﻿function locationReplace(URL2Replace) {
    location.Replace(URL2Replace)
}
function locationHref(URL2Replace) {
    location.href(URL2Replace)
}

function showSubmenu(SubMenuID, HorizPos, MenuID, TextColor) {
    document.getElementById(SubMenuID).style.display = "block"
    document.getElementById(SubMenuID).style.left = HorizPos
    document.getElementById(MenuID).style.color = TextColor
}
function hideSubmenu(SubMenuID, MenuID, TextColor) {
    document.getElementById(SubMenuID).style.display = "none"
    document.getElementById(MenuID).style.color = TextColor
}
function hilite(SubMenuItemID, TextColor) {
    document.getElementById(SubMenuItemID).style.color = TextColor
}
function unhilite(SubMenuItemID, TextColor) {
    document.getElementById(SubMenuItemID).style.color = TextColor
}
function ShowItem(itemID) {
    document.getElementById(itemID).style.display = "block"
}
function HideItem(itemID) {
    document.getElementById(itemID).style.display = "none"
}


function Announce(TEXT) {
    alert(TEXT)
}
function WindowClose() {
    top.window.close
}

//Email Validator
function validate_email(field, alerttxt) {
    with (field) {
        apos = value.indexOf("@");
        dotpos = value.lastIndexOf(".");
        if (apos < 1 || dotpos - apos < 2)
        { alert(alerttxt); return false; }
        else { return true; }
    }
}

function validate_address(thisform) {
    with (thisform) {
        if (validate_email(email, "It does not appear that you have entered a valid e-mail address!") == false)
        { email.focus(); return false; }
    }
}

function show_redirect_confirm(Message, YesAddress, NoAddress) {
    var r = confirm(Message);
    if (r == true) {
        location.href(YesAddress) ;
    }
    else {
        //location.href(NoAddress);
    }
}

