﻿function hideDiv(divName) {
    if (document.getElementById) { // DOM3 = IE5, NS6 
        document.getElementById(divName).style.display = 'none';
    }
}

function showDiv(divName) {
    if (document.getElementById) { // DOM3 = IE5, NS6 
        document.getElementById(divName).style.display = 'inline';
    }
}

function PopupDialog(mylink, windowname, options) {
    if (!window.focus) return true;
    var href;
    if (typeof (mylink) == 'string') href = mylink; else href = mylink.href;
    hnd = window.open(href, windowname, options);
    hnd.focus();
}

function PopupDialogWithReturn(mylink, windowname, options) {
    if (!window.focus) return true;
    var href;
    if (typeof (mylink) == 'string') href = mylink; else href = mylink.href;
    hnd = window.open(href, windowname, options);
    hnd.focus();
    return false;
}

function clickButton(e, buttonid) {
    var evt = e ? e : window.event;
    var bt = document.getElementById(buttonid);
    if (bt) { if (evt.keyCode == 13) { bt.click(); return false; } }
}

function RedirectDropdownlist(loc) {
    window.location.href = loc;
    return false;
}

function encodeMyHtml(toEncode) {
    return toEncode.replace(/&/gi, '&amp;').replace(/\"/gi, '&quot;').replace(/</gi, '&lt;').replace(/>/gi, '&gt;');

}

function noHTML(toEncode) {
    return toEncode.replace(/<(?:.|\s)*?>/g, '');
}
