
//Begin script to check signup forms



/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/


function narrowcolumnformvalidation()
{

	function echeck(str) {

			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			if (str.indexOf(at)==-1){
			   alert("Please enter a Valid Email Address")
			   return false
			}

			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			   alert("Please enter a Valid Email Address")
			   return false
			}

			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
				alert("Please enter a Valid Email Address")
				return false
			}

			 if (str.indexOf(at,(lat+1))!=-1){
				alert("Please enter a Valid Email Address")
				return false
			 }

			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
				alert("Please enter a Valid Email Address")
				return false
			 }

			 if (str.indexOf(dot,(lat+2))==-1){
				alert("Please enter a Valid Email Address")
				return false
			 }
			
			 if (str.indexOf(" ")!=-1){
				alert("Please enter a Valid Email Address")
				return false
			 }

			 return true					
		}
		
		
	if (document.narrowcolumn.name.value=='')
	{
		alert("Please Enter Your Name");
		document.narrowcolumn.name.focus();
		return false;
	}

	if (document.narrowcolumn.phone.value=='')
	{
		alert("Please Enter Your Phone");
		document.narrowcolumn.phone.focus();
		return false;
	}


	if (document.narrowcolumn.email.value=='')
	{
		alert("Please Enter Your Email Address");
		document.narrowcolumn.email.focus();
		return false;
	}

	if (echeck(document.narrowcolumn.email.value)==false)
	{
		document.narrowcolumn.email.focus(); 
		return false;
	}

	
	if (document.narrowcolumn.suburb.value=='')
	{
		alert("Please Enter Your Suburb");
		document.narrowcolumn.suburb.focus();
		return false;
	}
	
	if (document.narrowcolumn.city.value=='')
	{
		alert("Please Enter Your City or Town");
		document.narrowcolumn.city.focus();
		return false;
	}


	
	if (document.narrowcolumn.securityword.value!='cat')
	{
		alert("In the Security Word Box, Please Type the letters like this: cat");
		document.narrowcolumn.securityword.focus();
		return false;
	}



}

// End script
// -->

/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/


function bottomformvalidation()
{

	function echeck(str) {

			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			if (str.indexOf(at)==-1){
			   alert("Please enter a Valid Email Address")
			   return false
			}

			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			   alert("Please enter a Valid Email Address")
			   return false
			}

			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
				alert("Please enter a Valid Email Address")
				return false
			}

			 if (str.indexOf(at,(lat+1))!=-1){
				alert("Please enter a Valid Email Address")
				return false
			 }

			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
				alert("Please enter a Valid Email Address")
				return false
			 }

			 if (str.indexOf(dot,(lat+2))==-1){
				alert("Please enter a Valid Email Address")
				return false
			 }
			
			 if (str.indexOf(" ")!=-1){
				alert("Please enter a Valid Email Address")
				return false
			 }

			 return true					
		}
		
		
	if (document.bottomform.name.value=='')
	{
		alert("Please Enter Your Name");
		document.bottomform.name.focus();
		return false;
	}

	if (document.bottomform.phone.value=='')
	{
		alert("Please Enter Your Phone");
		document.bottomform.phone.focus();
		return false;
	}


	if (document.bottomform.email.value=='')
	{
		alert("Please Enter Your Email Address");
		document.bottomform.email.focus();
		return false;
	}

	if (echeck(document.bottomform.email.value)==false)
	{
		document.bottomform.email.focus(); 
		return false;
	}

	
	if (document.bottomform.suburb.value=='')
	{
		alert("Please Enter Your Suburb");
		document.bottomform.suburb.focus();
		return false;
	}
	
	if (document.bottomform.city.value=='')
	{
		alert("Please Enter Your City or Town");
		document.bottomform.city.focus();
		return false;
	}


	
	if (document.bottomform.securityword.value!='cat')
	{
		alert("In the Security Word Box, Please Type the letters like this: cat");
		document.bottomform.securityword.focus();
		return false;
	}



}


/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/





