function chk(email1)
{	
invalid = "";

if (!email1)
invalid = "No email address found!  Try reloading the page then use the 'email a script' feature again.";

else {

if ( (email1.indexOf("@") == -1) || (email1.indexOf(".") == -1) )
invalid += "\n\nInvalid email address.  Your email address is missing an '@' sign and a '.' in the domain name (like '.com').  Please check your address then submit again.";

if (email1.indexOf("youremailhere") > -1)
invalid += "\n\nInvalid email address.  Make sure your email address included your username, the '@' sign, and the domain name (like '.com').";

if (email1.indexOf("\\") > -1)
invalid += "\n\nEmail address contains an invalid back-slash (\\) character.  Remove the character and submit again.";

if (email1.indexOf("/") > -1)
invalid += "\n\nEmail address contains an invalid forward-slash (/) character.  Remove the character and submit again.";

if (email1.indexOf("'") > -1)
invalid += "\n\nEmail address contains an invalid apostrophe (') character.  Remove the character and submit again.";

if (email1.indexOf("zaz.com.br") > -1)
invalid += "\n\nPlease do not use an email address that has an autoresponder set up for it.  Thanks.";

if (email1.indexOf("!") > -1)
invalid += "\n\nEmail address contains an invalid exclamation point (!) character.  Remove the character or correct the email address then submit again.";

if ( (email1.indexOf(",") > -1) || (email1.indexOf(";") > -1) )
invalid += "\n\nPlease only enter one email address in the box at a time.  Remove the extra addresses and submit again.";

if (email1.indexOf("?subject") > -1)
invalid += "\n\nPlease do not add '?subject=...' to your email address.  Scriptbot will send you the script with a pre-defined subject already.  Please remove the '?subject=...' from your email address and submit again.";
}
return invalid;
}
function chkemail(email1)
{	
invalid = "";

if (!email1)
invalid = "No email address found!  Try reloading the page then use the 'email a script' feature again.";

else {

if ( (email1.indexOf("@") == -1) || (email1.indexOf(".") == -1) )
invalid += "\n\nInvalid email address.  Your email address is missing an '@' sign and a '.' in the domain name (like '.com').  Please check your address then submit again.";

if (email1.indexOf("youremailhere") > -1)
invalid += "\n\nInvalid email address.  Make sure your email address included your username, the '@' sign, and the domain name (like '.com').";

if (email1.indexOf("\\") > -1)
invalid += "\n\nEmail address contains an invalid back-slash (\\) character.  Remove the character and submit again.";

if (email1.indexOf("/") > -1)
invalid += "\n\nEmail address contains an invalid forward-slash (/) character.  Remove the character and submit again.";

if (email1.indexOf("'") > -1)
invalid += "\n\nEmail address contains an invalid apostrophe (') character.  Remove the character and submit again.";

if (email1.indexOf("zaz.com.br") > -1)
invalid += "\n\nPlease do not use an email address that has an autoresponder set up for it.  Thanks.";

if (email1.indexOf("!") > -1)
invalid += "\n\nEmail address contains an invalid exclamation point (!) character.  Remove the character or correct the email address then submit again.";

if ( (email1.indexOf(",") > -1) || (email1.indexOf(";") > -1) )
invalid += "\n\nPlease only enter one email address in the box at a time.  Remove the extra addresses and submit again.";

if (email1.indexOf("?subject") > -1)
invalid += "\n\nPlease do not add '?subject=...' to your email address.  Scriptbot will send you the script with a pre-defined subject already.  Please remove the '?subject=...' from your email address and submit again.";
}
if(invalid!="")
{
	alert(invalid);
	return false;	
}
else
{
	return true;	
}
}
function validation()
{
	if (trimString (frmreg.txtfname.value)=="" || frmreg.txtfname.value=="First")
	{
		alert("Enter your Name.");
		frmreg.txtfname.focus();
		return (false);
	}
	if(trimString (frmreg.txtaddress.value)=="")
	{
		alert("Enter your full address.");
		frmreg.txtaddress.focus();
		return (false);
	}
	if(trimString (frmreg.txtcity.value)=="")
	{
		alert("Enter your city name.");
		frmreg.txtcity.focus();
		return (false);
	}
	if(trimString (frmreg.txtstate.value)=="" && trimString(frmreg.state.value)=="")
	{
		alert("Enter your State.");
		frmreg.txtstate.focus();
		return (false);
	}
	if(trimString (frmreg.txtzip.value)=="")
	{
		alert("Enter your Zip Code.");
		frmreg.txtzip.focus();
		return (false);
	}
	if(trimString (frmreg.txtcountry.value)=="")
	{
		alert("Enter your Country Name.");
		frmreg.txtcountry.focus();
		return (false);
	}
	if(trimString(frmreg.state.value)=="" && trimString(frmreg.txtcountry.value)=="USA")
	{
		alert("Please Select State");
		frmreg.state.focus();
		return (false);
	}
	if(trimString (frmreg.txtstate.value)=="" && trimString(frmreg.txtcountry.value)!="USA")
	{
		alert("Enter your State");
		frmreg.txtstate.focus();
		return (false);
	}
	if(trimString (frmreg.txtemail.value)=="")
	{
		alert("Enter your valid email address.");
		frmreg.txtemail.focus();
		return (false);
	}
	else
	{
		kk_invalid=chk(frmreg.txtemail.value);
		if (kk_invalid!="")
		{
			alert(kk_invalid);
			frmreg.txtemail.focus();
			return(false);
		}	
	}
	
	if (trimString(frmreg.txtdob.value)=="")
	{
		alert("Enter Date Of Birth ");
		frmreg.txtdob.focus();
		return (false);
	}
	
	if (trimString(frmreg.txtid.value)=="")
	{
		alert("Enter your User I.D. ");
		frmreg.txtid.focus();
		return (false);
	}
	if (trimString (frmreg.txtid.value)=="admin")
	{
		alert("UserID already exist");
		frmreg.txtid.focus();
		return (false);
	}
	if (trimString(frmreg.txtid.value).length<6)
	{
		alert("Enter your User I.D. Minimum 6 characters ( without space ).");
		frmreg.txtid.focus();
		return(false);
	}
	if(trimString(frmreg.txtpassword.value)=="")
	{
		alert("Please Enter passwords");
		frmreg.txtpassword.focus();
		return (false);
	}
	if (trimString(frmreg.txtpassword.value).length<6)
	{
		alert("Enter your Password Minimum 6 characters ( without space ).");
		frmreg.txtpassword.focus();
		return(false);
	}
	if(frmreg.txtpassword.value!=frmreg.txtpassword1.value)
	{
		alert("password and confirm password must be equal");
		frmreg.txtpassword1.focus();
		return (false);
	}
	/*if(trimString(frmreg.email1.value)!="")
	{
		kk_invalid=chk(frmreg.email1.value);
		if (kk_invalid!="")
		{
			alert(kk_invalid);
			frmreg.email1.focus();
			return(false);
		}	
	}
	if(trimString(frmreg.email2.value)!="")
	{
		kk_invalid=chk(frmreg.email2.value);
		if (kk_invalid!="")
		{
			alert(kk_invalid);
			frmreg.email2.focus();
			return(false);
		}	
	}
	if(trimString(frmreg.email3.value)!="")
	{
		kk_invalid=chk(frmreg.email3.value);
		if (kk_invalid!="")
		{
			alert(kk_invalid);
			frmreg.email3.focus();
			return(false);
		}	
	}
	if(trimString(frmreg.email4.value)!="")
	{
		kk_invalid=chk(frmreg.email4.value);
		if (kk_invalid!="")
		{
			alert(kk_invalid);
			frmreg.email4.focus();
			return(false);
		}	
	}
	if(trimString(frmreg.email5.value)!="")
	{
		kk_invalid=chk(frmreg.email5.value);
		if (kk_invalid!="")
		{
			alert(kk_invalid);
			frmreg.email5.focus();
			return(false);
		}	
	}
	if(dup_email(frmreg.txtemail.value,frmreg.email1.value,frmreg.email2.value,frmreg.email3.value,frmreg.email4.value,frmreg.email5.value)==false)
	{
		return false;
	}*/
	return (true);
}
function dup_email(e,e1,e2,e3,e4,e5)
{
	var e_arr= new Array(e,e1,e2,e3,e4,e5);
	for(i=0;i<5;i++)
	{
		for(j=i+1;j<5;j++)
		{
			if(e_arr[i]!="")
				if(e_arr[i]==e_arr[j])
				{
					alert("You Enter Duplicate Email Address");
					return false;
				}
		}
	}
	return true;
}
function check1_onclick() {
if (frmreg.check1.status==true)
	frmreg.submit1.disabled =false;
else
	frmreg.submit1.disabled =true;
}

function trimString (str) 
{
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function onlynumbers1(){

	if (!(((window.event.keyCode>47)&&(window.event.keyCode<58))||(window.event.keyCode==32)))
	window.event.keyCode=0;
}
function onlynumbers(){

	if (!((window.event.keyCode>47)&&(window.event.keyCode<58)))
	window.event.keyCode=0;
}
function hidenumbers(){

	if ((window.event.keyCode>47)&&(window.event.keyCode<58))
	window.event.keyCode=0;
}
function sel_con()
{
	if(frmreg.txtcountry.value=="USA")
	{
		frmreg.txtstate.value="";	
		frmreg.txtstate.disabled=true;
		frmreg.state.disabled=false;
	}
	else
	{
		frmreg.state.value="";	
		frmreg.state.disabled=true;
		frmreg.txtstate.disabled=false;
	}
}
function sel_state()
{
	if(frmreg.state.value!="")
	{
		frmreg.txtstate.value="";	
		frmreg.txtstate.disabled=true;
		frmreg.txtcountry.value="USA";
	}
	else
	{
		frmreg.txtstate.disabled=false;
	}
}