﻿function startEditingTextBox(textBox)
{
    if (textBox.style.color != "#000000")
    {
        textBox.style.color = "#000000";
        textBox.value = "";
        textBox.select();
    }
}

function endEditingTextBox(textBox, defaultText)
{
    if (textBox.value.trim() == "")
    {
        textBox.style.color = "#777777";
        textBox.value = defaultText;
    }
}

function fakePasswordFocus(realId, fakeId)
{
    var realPassword = document.getElementById(realId);
    var fakePassword = document.getElementById(fakeId);
    fakePassword.style.display = "none";
    realPassword.style.display = "inline";
    realPassword.value = "";
    realPassword.select();
    
//    if (textBox.style.color != "#000000")
//    {
//        // Hasn't been edited
//        textBox.style.color = "#000000";
//        textBox.value = "";
//        textBox.select();
//    }
}

function realPasswordBlur(realId, fakeId)
{
    var realPassword = document.getElementById(realId);
    var fakePassword = document.getElementById(fakeId);

    if (realPassword.value.trim() == "")
    {
        // No password has been entered so put back to original state
        fakePassword.style.display = "inline";
        realPassword.style.display = "none";
    }

//    if (textBox.value.trim() == "")
//    {
//        textBox.setAttribute("type", "text");
//        textBox.style.color = "#777777";
//        textBox.value = defaultText;
//    }
}

function enableOnlyIfChecked(checkboxObj, targetId)
{
    if (checkboxObj.checked)
    {
        $(targetId).removeAttr("disabled");
    }
    else
    {
        $(targetId).attr("disabled", "disabled");
    }
}

