function validateForm(theForm)
	{
		// Customize these calls for your form
		// Start ------->
		if (!validFirstName(theForm.FirstName))
			return false;
		if (!validLastName(theForm.LastName))
			return false;
		if (!validRequired(theForm.Email,"email"))
			return false;
		if (!validEmail(theForm.Email,"Email",true))
			return false;
		if (!validRequired(theForm.vEmailAddress,"email"))
			return false;
		if (!validEmail(theForm.vEmailAddress,"Email",true))
			return false;
		// <--------- End
		//validateCustomForm(theForm);
		return true;
}

function validateFormChange(theForm)
	{
		if (!validRequired(theForm.Email,"email"))
			return false;
		if (!validEmail(theForm.Email,"Email",true))
			return false;
		if (!validRequired(theForm.Emailnew,"email"))
			return false;
		if (!validEmail(theForm.Emailnew,"Email",true))
			return false;
		//validateCustomForm(theForm);
		return true;
	}
	
function validateFormUnsubscribe(theForm)
	{
		if (!validRequired(theForm.vEmailAddress,"email"))
			return false;
		if (!validEmail(theForm.vEmailAddress,"Email",true))
			return false;
		//validateCustomForm(theForm);
		return true;
	}



function show(object) {
    if (document.layers && document.layers[object] != null)
        document.layers[object].visibility = 'visible';
    else if (document.all)
        document.all[object].style.visibility = 'visible';
}
function hide(object) {
    if (document.layers && document.layers[object] != null)
        document.layers[object].visibility = 'hidden';
    else if (document.all)
        document.all[object].style.visibility = 'hidden';
}
function openWindow(url,name, width, height) {
var popupWin;
	// if a window already exists, destroy it.
	if (popupWin && !popupWin.closed) {
               popupWin.close();
	}
	var attr = 'scrollbars=no,status=yes,width=' + width + ',height= ' + height  +',left=1,top=1,resizable=1';
   	popupWin = window.open(url, name, attr);
	popupWin.focus();
}

var couponwidthdefault='358';
var couponheightdefault='480';
var couponiddefault='15';

function OpenCouponRestylane()
{
	var cgi = new Object();
      cgi.http_host = location.host;
      cgi.http_user_agent = navigator.userAgent;
      cgi.http_cookie = document.cookie;
      cgi.https = (location.protocol == 'https:\/\/') ? 'on' : 'off';
      cgi.path_info = (location.pathname.indexOf('?') != -1) ?
location.pathname.substring(0, location.pathname.indexOf('?')) :
location.pathname;
      cgi.query_string = (location.search) ?
((location.search.indexOf('#') != -1) ? location.search.substring(1,
location.search.indexOf('#')) : location.search.substring(1)) : '';
      cgi.script_name = cgi.path_info;
      cgi.http_referer = document.referrer;
	var LinkLocation =
"http://www.etnasystems.com/coupon/?COUPONID=47&OriginalReferer=" +
getCookie("JSREF") + "&OriginalPage=" + cgi['script_name'] + "&OriginalSite=" + cgi['http_host'];
//alert("link=" + LinkLocation);
	openWindow(LinkLocation, 'Coupon', '358', '515');
}


function checkMe(obj) {
	// declare errorstring
	var errorString ="";
	// email must have  and '@' and a '.' and cannot have any spaces
	if ((obj.Email.value.indexOf("@")==-1) || (obj.Email.value.indexOf(".")==-1) || (obj.Email.value.indexOf(" ")!=-1)) {
		errorString = errorString + "'" + obj.Email.value + "' is not a valid email address.\nPlease re-enter your email address.\n\n";
		}
	// if we've set the errorstring, lets yell at them and return false
	if (errorString != "") {
		alert(errorString);
		return false;
	}
	
	return true;
}
