// Created by iWeb 2.0.4 local-build-20090828

setTransparentGifURL('Media/transparent.gif');function hostedOnDM()
{return false;}
function onPageLoad()
{loadMozillaCSS('Subscribe_files/SubscribeMoz.css')
adjustLineHeightIfTooBig('id1');adjustFontSizeIfTooBig('id1');detectBrowser();Widget.onload();fixAllIEPNGs('Media/transparent.gif');performPostEffectsFixups()}
function onPageUnload()
{Widget.onunload();}

function checkSubmit(){
	var focusSet=true;
	var errorOut="";
	if(document.forms[0]["name"].value==null ||
			isEmpty(document.forms[0]["name"].value)){
			errorOut="Please enter a name";
			document.getElementById("lName").style.fontWeight= "700";
			document.getElementById("lName").style.color= "#FFFFFF";
			if(focusSet){
				focusSet=false;
				document.forms[0]["name"].focus();
			}
	}
	if(document.forms[0]["email"].value!=null &&
			!isEmpty(document.forms[0]["email"].value)){
			if(!emailCheck(document.forms[0]["email"].value)){
					errorOut = (errorOut!="") ? errorOut + ", please enter a valid email address" :
						"Please enter a valid email address";
					document.getElementById("lEmail").style.fontWeight= "700";
					document.getElementById("lEmail").style.color= "#FFFFFF";
					if(focusSet){
						focusSet=false;
						document.forms[0]["email"].focus();
					}
			}
	}
	else{
		errorOut = (errorOut!="") ? errorOut + ", please enter a valid email address" :
						"Please enter a valid email address";
		document.getElementById("lEmail").style.fontWeight= "700";
		document.getElementById("lEmail").style.color= "#FFFFFF";
		if(focusSet){
			focusSet=false;
			document.forms[0]["email"].focus();
		}
	}
	if(document.forms[0]["street"].value==null ||
			isEmpty(document.forms[0]["street"].value)){
			errorOut = (errorOut!="") ? errorOut + ", please enter a street address": "Please enter a street address";
			document.getElementById("lStreet").style.fontWeight= "700";
			document.getElementById("lStreet").style.color= "#FFFFFF";
			if(focusSet){
				focusSet=false;
				document.forms[0]["street"].focus();
			}
	}
	if(document.forms[0]["city"].value==null ||
			isEmpty(document.forms[0]["city"].value)){
			errorOut = (errorOut!="") ? errorOut + ", please enter a city": "Please enter a city";
			document.getElementById("lCity").style.fontWeight= "700";
			document.getElementById("lCity").style.color= "#FFFFFF";
			if(focusSet){
				focusSet=false;
				document.forms[0]["city"].focus();
			}
	}
	if(document.forms[0]["state"].selectedIndex==0){
			errorOut = (errorOut!="") ? errorOut + ", please select a state": "Please select a state";
			document.getElementById("lState").style.fontWeight= "700";
			document.getElementById("lState").style.color= "#FFFFFF";
			if(focusSet){
				focusSet=false;
				document.forms[0]["state"].focus();
			}
	}
	if(document.forms[0]["zipcode"].value==null ||
			isEmpty(document.forms[0]["zipcode"].value)){
			errorOut = (errorOut!="") ? errorOut + ", please enter a zipcode": "Please enter a zipcode";
			document.getElementById("lZipcode").style.fontWeight= "700";
			document.getElementById("lZipcode").style.color= "#FFFFFF";
			if(focusSet){
				focusSet=false;
				document.forms[0]["zipcode"].focus();
			}
	}
	if(errorOut!=""){
		alert(errorOut);
		return false;
	}
	else 
		document.forms[0].submit();
}
function isEmpty(aTextField){
	var re = /\s/g; //Match any white space including space, tab, form-feed, etc.
	var str = aTextField.replace(re, "");
	if (str.length == 0) {
		return true;
	}
	else {
		return false;
	}
}
function emailCheck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    return false
	 }

	 if (str.indexOf(" ")!=-1){
	    return false
	 }
	 return true
}