function popUpWindow()
{
	var sFeatures, h, w, myThanks, i
	h = window.screen.availHeight 
	w = window.screen.availWidth 
	//sFeatures = "height=" + h*.25 + ",width=" + h*.50 + ",screenY=" + (h*.30) + ",screenX=" + (w*.33) + ",top=" + (h*.30) + ",left=" + (w*.33) + ",resizable=no,scrollbars=no"
	sFeatures ="width=430,height=225,menubar=no,resizable=no";
    //sFeatures = "height=" + h*.25 + ",width=" + h*.50 + ",screenY=" + (h*.30) + ",screenX=" + (w*.33) + ",resizable=no,scrollbars=no"

	myThanks = window.open("Enews.aspx","",sFeatures)
}

function ExpirationDateMessage()
{
	    var  msg, upperLine, lowerLine
	    msg = "The form was not submited due to the following error(s).\n";
		upperLine = "\n_________________________________________________________\n\n";
		lowerLine = "_________________________________________________________\n";		
		msg += upperLine;
		msg += "Expiration Month is not valid.\n";
		msg += lowerLine;		
		alert(msg);
		return false;
}
function PostalcodeMessage()
{
	    var  msg, upperLine, lowerLine
	    msg = "The form was not submited due to the following error(s).\n";
		upperLine = "\n_________________________________________________________\n\n";
		lowerLine = "_________________________________________________________\n";		
		msg += upperLine;
		msg += "We need to have: State , Postal Code.\n";
		msg += lowerLine;		
		alert(msg);
		return false;
}

function isNumeric(sText)
{
    var ValidChars = "0123456789";
    var IsNumber=true;
    var Char;
 
    for (i = 0; i < sText.length && IsNumber == true; i++) { 
        Char = sText.charAt(i); 
        if (ValidChars.indexOf(Char) == -1) {
            IsNumber = false;
            break;
        }
    }
    return IsNumber;
}

function get_cookie(cookie_name) {
    var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');

    if (results)
        return (unescape(results[2]));
    else
        return null;
}

function delete_cookie(cookie_name) {
    var cookie_date = new Date();  // current date & time
    cookie_date.setTime(cookie_date.getTime() - 1);
    document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

addLoadEvent(function() {
    var oldcid = get_cookie("CID");
    if (oldcid != null && !isNumeric(oldcid)) {
        alert(oldcid);
        delete_cookie("CID");
    }
})
