//
// Note - Since this file is called by files that generate PDF, it can't have any blank lines
//
    var value = 0;
    var mask = [];
    mask["REQUIRED"] = Math.pow(2, value++);
    mask["EMAIL"] = Math.pow(2, value++);
    mask["DATE"] = Math.pow(2, value++);
    mask["TIME"] = Math.pow(2, value++);
    mask["CURRENCY"] = Math.pow(2, value++);
    mask["NUMERIC"] = Math.pow(2, value++);
    mask["DECIMAL"] = Math.pow(2, value++);
    mask["ALPHANUMERIC"] = Math.pow(2, value++);
    mask["ALPHA"] = Math.pow(2, value++);
    mask["PHONE"] = Math.pow(2, value++);
    mask["STATE"] = Math.pow(2, value++);
    mask["ZIPCODE"] = Math.pow(2, value++);
    mask["URLENTRY"] = Math.pow(2, value++);
    mask["SAVE_REQUIRED"] = Math.pow(2, value++);
//
function pop(theURL) { 
    win = window.open(theURL,"","scrollbars=1,resizable,height=600,width=600");
}
// for email all popup
var myWindow;
function refreshWindow() {
    myWindow.document.open(); 
    myWindow.document.writeln('<h1 align="center">Email Preview</h1><hr>');
    myWindow.document.writeln('<div align="center"><img SRC="http://www.rscds-sf.org/globalImages/rscdslogo.gif" ALT="RSCDS logo" WIDTH="199" HEIGHT="144"></div>');
    myWindow.document.writeln('<h2>'+document.emailform.subject.value+'</h2>');
    myWindow.document.writeln(document.emailform.messageEdit.value);
    document.emailform.message.value = escape(document.emailform.messageEdit.value);
    myWindow.document.close(); 
}
function createWindow() {
    var windowName = 'EmailPreviewWindow';
    myWindow = window.open('',windowName);
    refreshWindow();
}
function closeChildWindow() {
    myWindow.close();
}
//
function isValidEmail(str) {
    setCookieTime();
    if (str.length) {
        if (str == 'root') {
            return true;
        }
        if (str.lastIndexOf(".") > 2) {
            if (str.indexOf("@") > 0) {
                if (str.lastIndexOf(".") > str.indexOf("@")) {
                    return true;
                }
            }
        }
    }
    alert ("You must specify a valid email address");
    return false;
}
//
function validEMailPop(str, URL) {
    if (isValidEmail(str)) {
        return pop(URL+'?email='+str);
    }
}
//
function pwCheck(str1, str2, str3) {
    setCookieTime();
    if (str1 == str2) {
        alert ("New Password must be differrent then the old password");
        return false;
    }
    if (str2 != str3) {
        alert ("New Password and Retyped New Password don't match");
        return false;
    }
    return true;
}
//
function setCookieTime() {
    var currentTime = new Date();
    var month   = currentTime.getMonth() + 1;
    var day     = currentTime.getDate();
    var year    = currentTime.getFullYear();
    var hours   = currentTime.getHours();
    var minutes = currentTime.getMinutes();
    var seconds = currentTime.getSeconds();
    if (minutes < 10) minutes = "0" + minutes;
    if (seconds < 10) seconds = "0" + seconds;
    if (day     < 10) day     = "0" + day;
    if (month   < 10) month   = "0" + month;
    var cookietime = (hours + "," + minutes + "," + seconds + "," + month + "," + day + "," + year);
    document.cookie = "timeis="+cookietime+"; path=/";
}
//
function closeWindow() {
    var close = confirm("Closing this window will delete any changes you have made\r\nDo You want to close this window?");
    if (close)
        window.close();
}
//