<!--
function popUp(URL) 
{
	window.open(URL, 'privacy', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500');
} 

function validateNY()
{
	if(window.document.form1.State.value=="New York")
	{
		alert("We're sorry, this program is not available to residents of New York.");
		document.form1.State.value="";	
		document.form1.State.focus();
	}
}

function ProductValidate()
{
	var groupId = window.document.form1.groupId.options[window.document.form1.groupId.selectedIndex].value;
	var retailPrice = window.document.form1.retailPrice.value;
	var affiliatePrice = window.document.form1.affiliatePrice.value;
	var immsCommission = window.document.form1.immsCommission.value;
	if (window.document.form1.productName.value.length == 0) 
	{
		alert ("Please enter a Product Name")
		document.form1.productName.focus();
		return false;
	}
	if (groupId == "0")
	{
		alert ("Please select a Group ID")
		document.form1.groupId.focus();
		return false;
	} 
	if (retailPrice == "")
	{
		alert ("Please enter a Retail Price")
		document.form1.retailPrice.focus();
		return false;
	} 
	if (!checknumbers(retailPrice))
	{
		alert ("Please enter a Retail Price with correct format. (ie: 24.99)")
		document.form1.retailPrice.focus();
		return false;
	} 
	if (affiliatePrice == "")
	{
		alert ("Please enter a Affiliate Price")
		document.form1.affiliatePrice.focus();
		return false;
	} 
	if (!checknumbers(affiliatePrice))
	{
		alert ("Please enter a Affiliate Price with correct format. (ie: 24.99)")
		document.form1.affiliatePrice.focus();
		return false;
	} 
	if (immsCommission == "")
	{
		alert ("Please enter a Imms Commission")
		document.form1.immsCommission.focus();
		return false;
	} 
	if (!checknumbers(immsCommission))
	{
		alert ("Please enter a Imms Commission with correct format. (ie: 24.99)")
		document.form1.immsCommission.focus();
		return false;
	} 
	return true;
	
}

function Corp_Validate()
{
	var State = window.document.form1.State.options[window.document.form1.State.selectedIndex].value;
	var Prefix = window.document.form1.Prefix.options[window.document.form1.Prefix.selectedIndex].value;
	
	var cnt = -1;
	for (var i=0; i < window.document.form1.levelOfService.length; i++) {
	   if (window.document.form1.levelOfService[i].checked) {cnt = i;}
	}
	
	if (cnt < 0) 
		{
			alert ("Please select the level of service");
			window.document.form1.levelOfService[0].focus();
			return false;
		}
	
	
	if (Prefix == "") 
		{
			alert ("Please select a Prefix")
			document.form1.Prefix.focus();	
			return false;
		}
	if (window.document.form1.FirstName.value.length == 0) 
	{
		alert ("Please enter a first name")
		document.form1.FirstName.focus();
		return false;
	}
		
	if (window.document.form1.LastName.value.length == 0) 
	{
		alert ("Please enter a last name")
		document.form1.LastName.focus();
		return false;
	}	
	
	if (window.document.form1.Company.value.length == 0) 
	{
		alert ("Please enter a company")
		document.form1.Company.focus();
		return false;
	}	
	
	if (window.document.form1.Address.value.length == 0) 
	{
		alert ("Please enter an address")
		document.form1.Address.focus();
		return false;
	}
		
	if (window.document.form1.City.value.length == 0) 
	{
		alert ("Please enter a city")
		document.form1.City.focus();
		return false;
	}
	if (State == "") 
	{
		alert ("Please select a state")
		document.form1.State.focus();
		return false;
	}
	if (window.document.form1.Zip.value.length == 0) 
	{
		alert ("Please enter a zip code")
		document.form1.Zip.focus();
		return false;
	}	
	if (window.document.form1.EmailAddress.value.length == 0) 
	{
		alert ("Please enter an email address")
		document.form1.EmailAddress.focus();
		return false;
	}
	if (window.document.form1.EmailAddress.value.length !=0)
	{
		if (!emailCheck(window.document.form1.EmailAddress.value)) 
		{
			alert("You have entered an invalid email address");
			document.form1.EmailAddress.focus();
			return false;
		}
	}	
	if (window.document.form1.EmailAddress.value != window.document.form1.EmailAddress2.value) 
	{
		alert ("Please re-confirm email address")
		document.form1.EmailAddress.focus();
		return false;
	}	
	
	var cnt2 = -1;
	for (var j=0; j < window.document.form1.Payment.length; j++) {
	   if (window.document.form1.Payment[j].checked) {cnt2 = j;}
	}
	
	if (cnt2 < 0) 
		{
			alert ("Please select a payment method");
			window.document.form1.Payment[0].focus();
			return false;
		}
	
}

function step1_Validate()
{
	var State = window.document.form1.State.options[window.document.form1.State.selectedIndex].value;
	var HearFrom = window.document.form1.HearFrom.options[window.document.form1.HearFrom.selectedIndex].value;
	/*var AgeGroup = window.document.form1.AgeGroup.options[window.document.form1.AgeGroup.selectedIndex].value; */
	var AgeGroup = "x";
	
	var Prefix = window.document.form1.Prefix.options[window.document.form1.Prefix.selectedIndex].value;
	
	var cnt = -1;
	for (var i=0; i < window.document.form1.ProductId.length; i++) {
	   if (window.document.form1.ProductId[i].checked) {cnt = i;}
	}
	
	if (cnt < 0) 
		{
			alert ("Please select a package to enroll");
			window.document.form1.ProductId[0].focus();
			return false;
		}
	
	
	if (Prefix == "") 
		{
			alert ("Please select a Prefix")
			document.form1.Prefix.focus();	
			return false;
		}
	if (window.document.form1.FirstName.value.length == 0) 
	{
		alert ("Please enter a first name")
		document.form1.FirstName.focus();
		return false;
	}
		
	if (window.document.form1.LastName.value.length == 0) 
	{
		alert ("Please enter a last name")
		document.form1.LastName.focus();
		return false;
	}	
	
	if (window.document.form1.Address.value.length == 0) 
	{
		alert ("Please enter an address")
		document.form1.Address.focus();
		return false;
	}
		
	if (window.document.form1.City.value.length == 0) 
	{
		alert ("Please enter a city")
		document.form1.City.focus();
		return false;
	}
	if (State == "") 
	{
		alert ("Please select a state")
		document.form1.State.focus();
		return false;
	}
	if (window.document.form1.Zip.value.length == 0) 
	{
		alert ("Please enter a zip code")
		document.form1.Zip.focus();
		return false;
	}	
	if (window.document.form1.EmailAddress.value.length == 0) 
	{
		alert ("Please enter an email address")
		document.form1.EmailAddress.focus();
		return false;
	}
	if (window.document.form1.EmailAddress.value.length !=0)
	{
		if (!emailCheck(window.document.form1.EmailAddress.value)) 
		{
			alert("You have entered an invalid email address");
			document.form1.EmailAddress.focus();
			return false;
		}
	}	
	if (window.document.form1.EmailAddress.value != window.document.form1.EmailAddress2.value) 
	{
		alert ("Please re-confirm email address")
		document.form1.EmailAddress.focus();
		return false;
	}	
	if (window.document.form1.SecEmailAddress.value.length == 0) 
	{
		alert ("Please enter an secondary email address")
		document.form1.SecEmailAddress.focus();
		return false;
	}
	if (window.document.form1.SecEmailAddress.value.length !=0)
	{
		if (!emailCheck(window.document.form1.SecEmailAddress.value)) 
		{
			alert("You have entered an invalid secondary email address");
			document.form1.SecEmailAddress.focus();
			return false;
		}
	}	
	if (HearFrom  == "") 
	{
		alert ("How did you hear about us?")
		document.form1.HearFrom.focus();
		return false;
	}	
	if (AgeGroup  == "") 
	{
		alert ("Please select your age group?")
		document.form1.AgeGroup.focus();
		return false;
	}	
	if (window.document.form1.Gender[0].checked == false && window.document.form1.Gender[1].checked == false)
	{
		alert ("Please select your gender?")
		return false;
	}	
}

function step2_Validate()
{
	var Relation = window.document.form1.Relation.options[window.document.form1.Relation.selectedIndex].value;
	
	if (Relation == "") 
		{
			alert ("Please select the Relationship")
			document.form1.Relation.focus();	
			return false;
		}
	if (window.document.form1.gFirstName.value.length == 0) 
	{
		alert ("Please enter a first name")
		document.form1.gFirstName.focus();
		return false;
	}
		
	if (window.document.form1.gLastName.value.length == 0) 
	{
		alert ("Please enter a last name")
		document.form1.gLastName.focus();
		return false;
	}	
		
	if (window.document.form1.gEmailAddress.value.length == 0) 
	{
		alert ("Please enter an email address")
		document.form1.gEmailAddress.focus();
		return false;
	}
	if (window.document.form1.gEmailAddress.value.length !=0)
	{
		if (!emailCheck(window.document.form1.gEmailAddress.value)) 
		{
			alert("You have entered an invalid email address");
			document.form1.gEmailAddress.focus();
			return false;
		}
	}	
}

function step3_Validate()
{	
		var Ctype = window.document.form1.cctype.options[window.document.form1.cctype.selectedIndex].value;
		var CMonth = window.document.form1.bill_ccexpmonth.options[window.document.form1.bill_ccexpmonth.selectedIndex].value;
		var CYear = window.document.form1.bill_ccexpyear.options[window.document.form1.bill_ccexpyear.selectedIndex].value;
		if (Ctype == "--") 
		{
			alert ("Please select the credit card type")
			document.form1.cctype.focus();
			
			return false;
		}

		if (window.document.form1.bill_ccname.value.length == 0) 
		{
			alert ("Please enter the name on the credit card")
			document.form1.bill_ccname.focus();
			
			return false;
		}
		if (window.document.form1.bill_ccnum.value.length == 0) 
		{
			alert ("Please enter the credit card number")
			document.form1.bill_ccnum.focus();
			
			return false;
		}
		if (Ctype == "VISA") 
		{
			var field = window.document.form1.bill_ccnum.value
			if (field.substring(0,1) != 4)
			{
				alert ("You have entered an invalid credit card number")
				document.form1.bill_ccnum.focus(); 
				
				return false;
			}

		}
		if (Ctype == "AMERICAN EXPRESS") 
		{
			field = window.document.form1.bill_ccnum.value
			if (field.substring(0,2) != 37)
			{
				alert ("You have entered an invalid credit card number")
				document.form1.bill_ccnum.focus(); 
				
				return false;
			}
		}
		if (Ctype == "MASTERCARD") 
		{
			field = window.document.form1.bill_ccnum.value
			if (field.substring(0,1) != 5)
			{
				alert ("You have entered an invalid credit card number")
				document.form1.bill_ccnum.focus(); 
				
				return false;
			}

		}
		if (window.document.form1.bill_ccnum.value.length <= 12) 
		{
			alert ("You have entered an invalid credit card number")
			document.form1.bill_ccnum.focus();
			
			return false;
		}
		if (!checknumbers(window.document.form1.bill_ccnum.value))
			{
				alert("Please enter the credit card number only, no spaces or dashes");
				document.form1.bill_ccnum.focus();
				
				return false;
			}	
		if (window.document.form1.bill_ccsecurity.value.length == 0) 
		{
			alert ("Please enter the credit card security number")
			document.form1.bill_ccsecurity.focus();
			
			return false;
		}
		if (!checknumbers(window.document.form1.bill_ccsecurity.value))
			{
				alert("Please enter the security number only, no spaces or dashes");
				document.form1.bill_ccsecurity.focus();
				
				return false;
			}	
		if (CMonth == "--") 
		{
			alert ("Please select the expiration month")
			document.form1.bill_ccexpmonth.focus();
			
			return false;
		}
		if (CYear == "--") 
		{
			alert ("Please select the expiration year")
			document.form1.bill_ccexpyear.focus();
			
			return false;
		}
		window.document.getElementById("submitbtn").style.display = "none";
		window.document.getElementById("processing").style.display = "";
		return true;
}

function renewal_Validate()
{
	if (window.document.form1.regId.value.length == 0) 
	{
		alert ("Please enter your certificate number")
		document.form1.regId.focus();
		return false;
	}
	if (!checknumbers(window.document.form1.regId.value))
	{
		alert ("Please enter a valid certificate number")
		document.form1.regId.focus();
		return false;
	}
	if (window.document.form1.zip.value.length == 0) 
	{
		alert ("Please enter your 5 digits zip code number")
		document.form1.zip.focus();
		return false;
	}
	
}

function retrieve_Validate()
{
	if (window.document.form1.FirstName.value.length == 0) 
	{
		alert ("Please enter your first name")
		document.form1.FirstName.focus();
		return false;
	}
	if (window.document.form1.LastName.value.length == 0) 
	{
		alert ("Please enter your last name")
		document.form1.LastName.focus();
		return false;
	}
	
	if (window.document.form1.EmailAddress.value.length == 0) 
	{
		alert ("Please enter an email address")
		document.form1.EmailAddress.focus();
		return false;
	}
	if (window.document.form1.EmailAddress.value.length !=0)
	{
		if (!emailCheck(window.document.form1.EmailAddress.value)) 
		{
			alert("You have entered an invalid email address");
			document.form1.EmailAddress.focus();
			return false;
		}
	}	
}

function validate()
{	
	var State = window.document.form1.State.options[window.document.form1.State.selectedIndex].value;
	var MemberOf = window.document.form1.MemberOf.options[window.document.form1.MemberOf.selectedIndex].value;		
	var Phone = window.document.form1.Phone.value + window.document.form1.Phone2.value + window.document.form1.Phone3.value;
	var HearFrom = window.document.form1.HearFrom.options[window.document.form1.HearFrom.selectedIndex].value;		
	
	if (window.document.form1.CompanyName.value.length == 0) 
	{
		alert ("Please enter a company name")
		document.form1.CompanyName.focus();
		return false;
	}
	/*
	if (window.document.form1.CompanyURL.value.length == 0) 
	{
		alert ("Please enter a company URL")
		document.form1.CompanyURL.focus();
		return false;
	}
	*/
	if (window.document.form1.Address1.value.length == 0) 
	{
		alert ("Please enter an address")
		document.form1.Address1.focus();
		return false;
	}
		
	if (window.document.form1.City.value.length == 0) 
	{
		alert ("Please enter a city")
		document.form1.City.focus();
		return false;
	}
	if (State == "") 
	{
		alert ("Please select a state")
		document.form1.State.focus();
		return false;
	}
	if (window.document.form1.Zip.value.length == 0) 
	{
		alert ("Please enter a zip code")
		document.form1.Zip.focus();
		return false;
	}		
		
	if (window.document.form1.FullName.value.length == 0) 
	{
		alert ("Please enter your name")
		document.form1.FullName.focus();
		return false;
	}
		
	if (window.document.form1.EmailAddress.value.length == 0) 
	{
		alert ("Please enter an email address")
		document.form1.EmailAddress.focus();
		return false;
	}
	if (window.document.form1.EmailAddress.value.length !=0)
	{
		if (!emailCheck(window.document.form1.EmailAddress.value)) 
		{
			alert("You have entered an invalid email address");
			document.form1.EmailAddress.focus();
			return false;
		}
	}	
	if (window.document.form1.EmailAddress.value != window.document.form1.EmailAddress2.value) 
	{
		alert ("Please re-confirm email address")
		document.form1.EmailAddress.focus();
		return false;
	}	
	
		
	if (window.document.form1.Password.value.length == 0) 
	{
		alert ("Please enter a password")
		document.form1.Password.focus();
		return false;
	}
	
	if (window.document.form1.Password.value.length < 4) 
	{
		alert ("Password must be at least 3 characters")
		document.form1.Password.focus();
		return false;
	}
		
	if (window.document.form1.Password.value != window.document.form1.Password2.value) 
	{
		alert ("Please re-confirm password")
		document.form1.Password2.focus();
		return false;
	}
		
	
	if (Phone.length < 1) 
	{
		alert ("Please enter a telephone number")
		document.form1.Phone.focus();
		return false;
	}	
	
	if (!checknumbers(Phone))
		{
			alert("You have entered an invalid telephone number");
			document.form1.Phone.focus();
			return false;
		}	
	if (Phone.length < 10)
		{
			alert("You have entered an invalid telephone number");
			document.form1.Phone.focus();
			return false;
		}
		
	if (window.document.form1.AffiliateTitle.value.length == 0) 
	{
		alert ("Please enter a name for your affiliate page")
		document.form1.AffiliateTitle.focus();
		return false;
	}				
	if (MemberOf == "") 
	{
		alert ("What company are you member of?")
		document.form1.MemberOf.focus();
		return false;
	}	
	if (HearFrom  == "") 
	{
		alert ("How did you hear about us?")
		document.form1.HearFrom.focus();
		return false;
	}		
	/*
	if (window.document.form1.IntroductoryCopy.value.length ==0) 
	{
		alert ("Please enter your company introductory")
		document.form1.IntroductoryCopy.focus();
		return false;
	}
	*/
}
	
function checknumbers(field)
{
	var field = field
	var valid = "0123456789"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.length; i++) 
		{
			temp = "" + field.substring(i, i+1);
			if (valid.indexOf(temp) == "-1") 
			ok = "no";
		}
	if (ok == "no") 
	{
		return false;
	}
	return true;
}

function emailCheck (emailStr) 
{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]\\*"
	var validChars="\[^\\s" + specialChars + "\]"
	var firstChars=validChars
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom="(" + firstChars + validChars + "*" + ")"
	var word="(" + atom + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) 
	{
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) 
	{
	return false
	}
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) 
	{
		  for (var i=1;i<=4;i++) 
		  {
			if (IPArray[i]>255) 
			{
				return false
			}
		   }
		return true
	}

	var domainArray=domain.match(domainPat)
	if (domainArray==null) 
	{
		return false
	}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) 
	{
	   return false
	}
	if (domArr[domArr.length-1].length==3 && len<2) {
	   var errStr="This address is missing a hostname!"
	   return false
	}
	return true;
}
	
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
	if(popUpWin)
	{
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=yes,menub ar=no,scrollbars=1,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function confirmSubmit()
{
	var agree=confirm("Are you sure you wish to continue?");
		
	if (agree)
		return true ;
	else
		return false ;
}

function ParsePhoneField(num) 
{
	num = new String( num );
	if( num.charAt(0) != "+" ) 
	{
		for( var i = 0; i < num.length; i++ ) 
		{
			if( isNaN(parseInt(num.charAt(i))) ) 
			{
				num = num.substring(0, i) + num.substring(i+1, num.length);
				i -= 1;
			} 
		}
		if( num == null ) num = "";
		if( num != "" ) num = num.substring(0, 3) + "-" + num.substring(3, 6) + "-" + num.substring(6, num.length);
		if( num.length != 12 ) alert("Please check your phone number!");
		return num.substring(0, 12);
	} 
	else 
	{
		return num;
	}
}

function ValidateEmail(email, msg, optional) 
{ 
	if (!email.value && optional) 
	{ 
		return true; 
	} 

	var EmailRegExpr = /^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/; 
	
	if (!EmailRegExpr(email.value)) 
	{ 
		alert(msg); 
		email.focus(); 
		email.select(); 
		return false; 
	} 
	else
	{
		alert("good");
		return true; 
	}
}

function getEmail(emailAddress)
{
	if (window.document.form1.SameAsInvitee.checked == true)
	{
		window.document.form1.gEmailAddress.value = emailAddress;
	}
	else
	{
		window.document.form1.gEmailAddress.value = "";
	}
}
//-->