﻿

/* ----------------------------------------------------------------*/
/* -- Used in  CreateLogin.aspx & LoginBox.ascs -------------------*/
function TextField_OnFocus(obj, labelText) {
    if (obj.value == labelText) {
        obj.value = "";
        obj.style.color = "#000000";
    }
}
function TextField_OnBlur(obj, labelText) {
    if (obj.value == "") {
        obj.value = labelText;
        obj.style.color = "#777777";
    }
} 
/* ----------------------------------------------------------------*/
function PasswordField_OnFocus() {
    var PasswordLabel = document.getElementById("LoginBox1_Txt_PasswordLabel");
    var Password = document.getElementById("LoginBox1_Txt_Password");
    if (PasswordLabel == null) {
        PasswordLabel = document.getElementById("StaticPageContent1_LoginBox1_Txt_PasswordLabel");
        Password = document.getElementById("StaticPageContent1_LoginBox1_Txt_Password");
    }
    PasswordLabel.style.display = "none";
    Password.style.display = "inline";
    Password.focus();
}
function PasswordField_OnBlur() {
    var PasswordLabel = document.getElementById("LoginBox1_Txt_PasswordLabel");
    var Password = document.getElementById("LoginBox1_Txt_Password");
    if (PasswordLabel == null) {
        PasswordLabel = document.getElementById("StaticPageContent1_LoginBox1_Txt_PasswordLabel");
        Password = document.getElementById("StaticPageContent1_LoginBox1_Txt_Password");
    }
    if (Password.value.length < 1) {
        PasswordLabel.style.display = "inline";
        Password.style.display = "none";        
    }
}
/* ----------------------------------------------------------------*/
function CreateLogin_BodyLoaded() {

    // Correctly display FirstName & LastName (only applies to Step 1 page).
    try {
        var obj = document.getElementById("Txt_FirstName");
        if (obj.value == "" || obj.value == "First Name") {
            obj.value = "First Name";
            obj.style.color = "#777777";
        } else {
            obj.style.color = "#000000";
        }
        obj = document.getElementById("Txt_LastName");
        if (obj.value == "" || obj.value == "Last Name") {
            obj.value = "Last Name";
            obj.style.color = "#777777";
        } else {
            obj.style.color = "#000000";
        }
    } catch (exc) { }
}


/* ----------------------------------------------------------------*/
function OnKeyUp_PhoneField(obj, skipToObj) {
    try {
        if (obj.value.length > 2) {
            obj.nextSibling.nextSibling.focus();
        }
    } catch (exc) { }
}

/* -----------------------------------------------------------------*/
/* Added by MTanner ... used in LoadingPleaseWait.ascx user control */
function HideSubmitButton(bttn, objPleaseWait) {
    bttn.style.display = "none";
    document.getElementById(objPleaseWait).style.display = "block";
}
function HideSubmitButtonInline(bttn, objPleaseWait) {
    bttn.style.display = "none";
    document.getElementById(objPleaseWait).style.display = "inline-block";
}

function GoToPage(Page, ElementToHide) {
    try {
        ElementToHide.style.display = "none";
    } catch (exc) { }
    window.location = Page;
}

function SelectCarrierInDropDown(CarrierLabelId, DropDownId) {
    try {
        var DropDownObj = document.getElementById(DropDownId);
        var carrierId = document.getElementById(CarrierLabelId).innerHTML;
        for (var i = 0; i < DropDownObj.options.length; i++) {
            var opt = DropDownObj.options.item(i);
            if (opt.value == carrierId) {
                opt.selected = true;
                i = DropDownObj.options.length + 1;
            }
        }
    } catch (exc) { }
}