// JavaScript Document
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 echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		var the_substring = str.substring(lat+1);
        var exp1="";
        if(the_substring==exp1)
        {
         alert("Invalid Email Id");
         return false;
        }
		  
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}
function fsubmitsmall()
{
	
/*	
	alert(document.formspider.regardingwhat[0].checked);
if(document.formspider.regardingwhat[0] && document.formspider.regardingwhat[1] && document.formspider.regardingwhat[2] && document.formspider.regardingwhat[3] )
{
	alert(document.formspider.regardingwhat[0]);
	
	if( (document.formspider.regardingwhat[0].checked==false) && (document.formspider.regardingwhat[1].checked==false) && (document.formspider.regardingwhat[2].checked==false) && (document.formspider.regardingwhat[3].checked==false) )
	{
		alert("Please Select a Radio Button Regarding What You Would Like to Contact us  ");
		document.formspider.localcitybox1.focus()
		return false;
	}

}
*/

if( document.formspider.name )
{
	if(isEmpty(document.formspider.name.value))
	{
		alert("Enter Name");
		document.formspider.name.value=''
		document.formspider.name.focus()
		return false;
	}
}


if( document.formspider.email )
{
	if(isEmpty(document.formspider.email.value))
	{
		document.formspider.email.value='';
		alert("Enter Email");
		document.formspider.email.focus()
		return false;
	}
	else
	{
		if(echeck(document.formspider.email.value))
		{
		
		}
		else
		{
		return false;
		}
	 
	}
}

if( document.formspider.tel )
{
	if(isEmpty(document.formspider.tel.value))
	{
		alert("Enter Telephone Number");
		document.formspider.tel.value=''
		document.formspider.tel.focus()
		return false;
	}
}

if( document.formspider.country )
{
	if(isEmpty(document.formspider.country.value))
	{
		alert("Enter Country");
		document.formspider.country.value=''
		document.formspider.country.focus()
		return false;
	}
}


if( document.formspider.website_seo )
{
	if(isEmpty(document.formspider.website_seo.value))
	{
		alert("Enter Your Website URL");
		document.formspider.website_seo.value=''
		document.formspider.website_seo.focus()
		return false;
	}
}



if(document.formspider.webdesignbox1 && document.formspider.webdevbox2 && document.formspider.seobox3 && document.formspider.maintenancebox4 && document.formspider.domainbox5 )
{

	if( (document.formspider.webdesignbox1.checked==false) && (document.formspider.webdevbox2.checked==false) && (document.formspider.seobox3.checked==false) && (document.formspider.maintenancebox4.checked==false) && (document.formspider.domainbox5.checked==false))
	{
		alert("Please Select One Service Atleast");
		document.formspider.webdesignbox1.focus()
		return false;
	}

}


if(document.formspider.localcitybox1 && document.formspider.localstatebox2 && document.formspider.singlecountrybox3 && document.formspider.alloverworldbox4 && document.formspider.otherbox5 )
{

	if( (document.formspider.localcitybox1.checked==false) && (document.formspider.localstatebox2.checked==false) && (document.formspider.singlecountrybox3.checked==false) && (document.formspider.alloverworldbox4.checked==false) && (document.formspider.otherbox5.checked==false))
	{
		alert("Please Select Your Target Market");
		document.formspider.localcitybox1.focus()
		return false;
	}

}

if(document.formspider.freeconsultationbox7 && document.formspider.onpageoptimizationbox1 && document.formspider.linkbuildingbox2 && document.formspider.directorysubmissionbox3 && document.formspider.contentwritingbox4 && document.formspider.blogsubmissionbox5 && document.formspider.pressreleasebox6  )
{

	if( (document.formspider.freeconsultationbox7.checked==false) && (document.formspider.onpageoptimizationbox1.checked==false) && (document.formspider.linkbuildingbox2.checked==false) && (document.formspider.directorysubmissionbox3.checked==false) && (document.formspider.contentwritingbox4.checked==false) && (document.formspider.blogsubmissionbox5.checked==false) && (document.formspider.pressreleasebox6.checked==false) )
	{
		alert("Please Select SEO Services/Information You Are Looking For");
		document.formspider.freeconsultationbox7.focus()
		return false;
	}

}



if(document.formspider.web_application_type)
{

	if( (document.formspider.web_application_type[0].checked==false) && (document.formspider.web_application_type[1].checked==false) && (document.formspider.web_application_type[2].checked==false))
	{
		alert("Please Select Type of application you are looking for ");
		document.formspider.web_application_type[0].focus()
		return false;
	}
}



if(document.formspider.yourbudget)
{
	if(isEmpty(document.formspider.yourbudget.value))
	{
		alert("Select Your Annual SEO Budget");
		document.formspider.yourbudget.value=''
		document.formspider.yourbudget.focus()
		return false;
	}

}
if(document.formspider.hearaboutus)
{
	if(isEmpty(document.formspider.hearaboutus.value))
	{
		alert("How Did You Hear About Spider Logics");
		document.formspider.hearaboutus.value=''
		document.formspider.hearaboutus.focus()
		return false;
	}

}




if(document.formspider.security_code)
{
	if(isEmpty(document.formspider.security_code.value))
	{
		alert("Enter Security Code");
		document.formspider.security_code.value=''
		document.formspider.security_code.focus()
		return false;
	}

}




document.formspider.submit();
}
			

