function openwin(url) {
    openwindow('', url, 50, 50, 950, 1050, 0, 0, 0, 1, 1, '')
};

function openwindow(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable, promptbox) {

    toolbar_str = toolbar ? 'yes' : 'no';
    menubar_str = menubar ? 'yes' : 'no';
    statusbar_str = statusbar ? 'yes' : 'no';
    scrollbar_str = scrollbar ? 'yes' : 'no';
    resizable_str = resizable ? 'yes' : 'no';

    if (promptbox == '') {
        window.open(url, name, 'left=' + left + ',top=' + top + ',width=' + width + ',height=' + height + ',toolbar=' + toolbar_str + ',menubar=' + menubar_str + ',status=' + statusbar_str + ',scrollbars=' + scrollbar_str + ',resizable=' + resizable_str);

    } else {
        if (confirm(promptbox)) {
            window.open(url, name, 'left=' + left + ',top=' + top + ',width=' + width + ',height=' + height + ',toolbar=' + toolbar_str + ',menubar=' + menubar_str + ',status=' + statusbar_str + ',scrollbars=' + scrollbar_str + ',resizable=' + resizable_str);
        };
    };
};



function isValidFolderName(val) {
    var isValid = true;
    if (val == '') {
        return false;
    }
    var chr1 = val.charAt(0);
    if (!isAlphaNumeric(chr1)) {
        return false;
    }
    for (var j = 0; j < val.length; j++) {
        var ch = val.charAt(j);
        if (!isFolderSafe(ch)) {
            isValid = false;
        }
    }
    return isValid;

}

function isValidPageName(val) {
    var isValid = true;
    if (val == '') {
        return false;
    }
    var chr1 = val.charAt(0);
    if (!isAlphaNumeric(chr1)) {
        return false;
    }
    for (var j = 0; j < val.length; j++) {
        var ch = val.charAt(j);
        if (!isPageSafe(ch)) {
            isValid = false;
        }
    }
    return isValid;

}

function isAlphaNumeric(chr) {
    var hh = chr.charCodeAt(0);
    if ((hh > 47 && hh < 58) || (hh > 64 && hh < 91) || (hh > 96 && hh < 123))
    { return true; } else { return false; }
}
function isFolderSafe(c) {
    var hh = c.charCodeAt(0);
    if (isAlphaNumeric(c) || (hh == 32) || (hh == 95))
    { return true; } else { return false; }
}

function isPageSafe(c) {
    var hh = c.charCodeAt(0);
    if (isAlphaNumeric(c) || (hh == 45) || (hh == 95))
    { return true; } else { return false; }
}




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.toUTCString());
}

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 Delete_Cookie(name) {
    document.cookie = name +
  '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}
