function DoClick(navigateURL) {
    if (navigateURL != "") {
        top.location.href = navigateURL;
    }
}

function DoClickByID(id, newWindow) {
    var link = document.getElementById(id);

    if (newWindow == "true") {
        if (link != null) {
            link.click();
            return true;
        }
    }
    else {
        var navigateURL = link.getAttribute("href");
        if (navigateURL != "") {
            top.location.href = navigateURL;
        }
    }
}

function dropdown(mySel) {
    var myWin, myVal;
    myVal = mySel.options[mySel.selectedIndex].value;

    if (myVal == 'stay') return false;

    if (myVal) {
        var chopped = new Array();
        chopped = myVal.split('~|||~');

        if (!window) return true;

        if (chopped[1] == "_top") window.location = chopped[0];
            else if (chopped[1] == "_blank") window.open(chopped[0]);
    }

    return false;
}

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);

            if (c_end == -1) c_end = document.cookie.length;

            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}

function setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) +
    ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}

function HoldOpenNavItems(id) {
    return;

    var cookiename = "HoldOpenNavItems_" + id;
    var thiscookie = getCookie(cookiename);

    if (thiscookie == null || thiscookie == "") {
        setCookie(cookiename, "1");
    }
    else {
        setCookie(cookiename, "1", -1000);
    }
}

function doClose(id) {
    if (document.getElementById(id))
        document.getElementById(id).style.visibility = 'hidden';
    return false;
}

function imagePreview(fileName, width, height) {
    height += 80; //add some room , IE7 forces address bar showing plus footer for popup
    width += 15;

    var left = 100; //(screen.width  - width) * 0.7;
    var top = 100; //(screen.height - height) * 0.3;

    popup = window.open("", "Preview", "toolbar=0,resizable=1,status=0,menubar=0,scrollbars=0,titlebar=0,location=0,width=" + width + "px ,height=" + height + "px ,top=" + top + "px,left=" + left + "px", "false");
    popup.resizeTo(width, height);
    popup.document.open();
    popup.document.write("<html><title>Preview</title>");
    popup.document.write("<body style=\"margin: 0 0 0 0;\" onload = \"javascript: var timer = setTimeout('window.focus();',100); \">");
    popup.document.write("<img hspace=0 vspace=0 " + "src=\"" + fileName + "\" onclick=\"window.close();\" />");
    popup.document.write("</body></html>");
    popup.document.close();
}

/**
* HTML editor: adds a function to the window onload event
*/
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

/**
* HTML editor: adds a function to the window onunload event
*/
function addUnloadEvent(func) {
    var oldOnunload = window.onunload;
    if (typeof window.onunload != 'function') {
        window.onunload = func;
    }
    else {
        window.onunload = function() {
            oldOnunload();
            func();
        }
    }
}

/**
* Set language selection hidden field
*/
function setSiteLanguage(lval, cfield, csel) {
    if (cfield != "" && lval != "" && csel != "") {
        cform = document.getElementsByName(cfield)[0];
        if (cform != null) {
            cform.value = lval;
            setTimeout("__doPostBack('" + csel + "','')", 0);
        }
    }
}