function returnObjById(id) {
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function showPopup(disp, section) {
    var popup_div = returnObjById(section + '-popup');
    var dimbox_div = returnObjById('dimbox');
    var overlay_div = returnObjById(section + '-overlay');
    var header_div = returnObjById('header');
    if (disp == 'show') {
        popup_div.style.display = 'block';
        dimbox_div.style.display = 'block';
        overlay_div.style.display = 'block';
        header_div.style.backgroundImage = "url('images/header_back_dim.jpg')";
    }
    else {
        popup_div.style.display = 'none';
        dimbox_div.style.display = 'none';
        overlay_div.style.display = 'none';
        header_div.style.backgroundImage = "url('images/header_back.jpg')";
    }
}

function validateForgotPW() {
    var my_email_reg = /[_a-zA-Z0-9.-]+@[_a-zA-Z0-9.-]+[.][_a-zA-Z0-9.-][_a-zA-Z0-9.-]+/;
    var my_email = document.forgot_password_form.email.value;
    var res = my_email_reg.test(my_email);
    if (!res) {
        alert("The emailL address entered for Email " + my_email + " is not valid.");
        document.forgot_password_form.your_email.focus();
        return false;
    }
    submitForgotPW();
}

function submitForgotPW() {
    var url = 'test.html';
    var post_string = 'email=' + encodeURI(document.forgot_password_form.email.value);
    var location = 'login-popupcontents';
    var xObj = false;
    xObj = getHTTPObject();
    xObj.open('POST', url, true);
    xObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xObj.onreadystatechange = function() {
        if (xObj.readyState == 4) {
            document.getElementById(location).innerHTML = xObj.responseText;
        }
    }
    xObj.send(post_string);
}

function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
            xmlhttp = false;
        }
    }
    @else
  xmlhttp = false;
  @end
    @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}