function ValidPLogin() {
    if (document.frm.p_user.value == "") {
        alert("Please enter calendar username.")
        document.frm.p_user.focus()
        return false
    }
    if (document.frm.p_pass.value == "") {
        alert("Please enter calendar password.")
        document.frm.p_pass.focus()
        return false
    }
}

function ValidateSearchAdv() {
    if (document.frm.search.value == "") {
        alert("Please enter your search phrase.")
        document.frm.search.focus()
        return false
    }
}

function Toggle(obj, imgName) {
    var objId = document.getElementById(obj);
    var img = document.images[imgName];
    var plusSrc = "images/plus_tree.gif";
    var minusSrc = "images/minus_tree.gif";
    objId.style.display = (objId.style.display == "none") ? "" : "none";
    img.src = (img.alt == "Collapse") ? plusSrc : minusSrc;
    img.alt = (img.alt == "Expand") ? "Collapse" : "Expand";
}


function NewWindow(mypage, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=' + scroll
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0].toString().toLowerCase() == variable.toString().toLowerCase()) {
            return pair[1];
        }
    }
}

