
function RegisterUnloadScript() {
    window.onbeforeunload = ShouldDoConfirm;
}

function UnRegisterUnloadScript() {
    window.onbeforeunload = "";
}


function ShouldDoConfirm() {
    var result = 'If you exit without clicking \'Update Account\' any changes you made won\'t be saved.';

    try
    {
        if (inRegistration == true) {
            result = 'If you exit without completing registration your information won\'t be saved.';
        }
    }
    catch(e) {
        // noop
    }

    return result;
}

function QuietConfirm() {
    UnRegisterUnloadScript();
    //alert('quiet');
    setTimeout('RegisterUnloadScript();', 1000);
    return true;
}

function openNoConfirmLink(link) {
    QuietConfirm();
    openLink('/feedpromo.aspx');
    return true;
}


function imgRollOver(name,over)
{
	if(window.document.images) 
	{
		if (over) {
			window.document.images[name].src = "Images/" + name + "_On.gif";
		}
		else {
			window.document.images[name].src =  "Images/" + name + ".gif";
		}
	}
}

function imgRollOverExternal(name, over) {
    if (window.document.images) {
        if (over) {
            window.document.images[name].src = "../Images/" + name + "_On.gif";
        }
        else {
            window.document.images[name].src = "../Images/" + name + ".gif";
        }
    }
}

function eraseBox()
{
	document.Form1.Header_dropUsername.value = "";
}

function openLinkDefault(linkAddress) {
    newWindow = window.open(linkAddress, "StatePointWindow", "scrollbars,resizable,toolbar=yes,location=yes,status=yes,menubar=yes");
    newWindow.focus();
    return false; 
}

function openLink(linkAddress) {	
	newWindow = window.open(linkAddress,"StatePointWindow","width=400,height=500,scrollbars,resizable,toolbar=yes,location=yes,status=yes,menubar=yes,left=100,top=250");
	newWindow.focus();
}

function openLink(linkAddress, width, height) {
    newWindow = window.open(linkAddress, "StatePointWindow", "width=" + width + ",height=" + height + ",scrollbars,resizable,toolbar=yes,location=yes,status=yes,menubar=yes,left=100,top=250");
    newWindow.focus();
}

function ToggleElement(targetElementId) {
    var targetElement = window.document.getElementById(targetElementId);

    if (targetElement.className == "hiddenPanel") {
        targetElement.className = "displayPanel";
    }
    else {
        targetElement.className = "hiddenPanel";
    }
}	