function validate_form(theform)
{
	var name = theform.name.value;
	var name1= theform.name1.value;
	var emailid = theform.emailid.value;
	var phone=theform.phone.value;
	var enquiry = theform.enquiry.value;
	
	var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var namelRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var emailidRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	var enquiryRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	 
  if(name == "") {
  	alert('You must enter your First Name.');
  	theform.name.focus();
    return false;
  }
  if(!name.match(nameRegex)) {
    alert('You have entered an invalid First Name.');
    theform.name.value="";
    theform.name.focus();
    return false;
  }
  
  if(name1 == "") {
  	alert('You must enter your Last Name.');
  	theform.name1.focus();
    return false;
  }
  if(!name1.match(namelRegex)) {
    alert('You have entered an invalid Last Name.');
    theform.name1.value="";
    theform.name1.focus();
    return false;
  }
  
  if(emailid == "") {
    alert('You must enter your email.');
    theform.emailid.focus();
    return false;
  }
  if(!emailid.match(emailidRegex)) {
    alert('You have entered an invalid email.');
    theform.emailid.value="";
    theform.emailid.focus();
    return false;
  }
  if(phone == "")
  {
    alert('You must enter your Phone Number.');
    theform.phone.focus();
    return false;
  }
  else if(isNaN(phone))
  {
    alert('You must entered an Invalid Phone Number.');
    theform.phone.value="";
    theform.phone.focus();
    return false;
  }
  else if(!isInt(phone))
  {
	alert('You must entered an Invalid Phone Number.');
    theform.phone.value="";
    theform.phone.focus();
    return false;	
  }
  else if(phone.length < 10)
  {
    alert('Phone Number should have minimum 10 digits.');
    theform.phone.focus();
    return false;
  }
  if(enquiry == "") {
  	alert('Please Type Your Requirements.');
  	theform.enquiry.focus();
    return false;
  } 
 if(enquiry ==""){
 	alert('You have entered an invalid Requirements.');
 	theform.enquiry.value="";
 	theform.enquiry.focus();
  	return false;
  }
}


function isInt(x) {
   var y=parseInt(x);
   if (isNaN(y)) return false;
   return x==y && x.toString()==y.toString();
}
//Referral program Validate
function referralvalidate_form(theform)
{
	var yourname 		= theform.yourname.value;
	var yourcompany 	= theform.yourcompany.value;
	var youremail 		= theform.youremail.value;
	var yourphone 		= theform.yourphone.value;
	
	var refcompany  	= theform.refcompany.value;
	var refcontactname 	= theform.refcontactname.value;
	var refcontacttitle	= theform.refcontacttitle.value;
	var refcontactemail	= theform.refcontactemail.value;
	var refcontactphone	= theform.refcontactphone.value;
	var refaddinform	= theform.refaddinform.value;
	
	var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	//var lnameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	var compRegex  = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
 
  if(yourname == "") {
  	alert('Please your First Name.');
  	theform.yourname.focus();
    return false;
  }
  if(!yourname.match(nameRegex)) {
    alert('Please enter valid First Name.');
    theform.yourname.value="";
    theform.yourname.focus();
    return false;
  }
  if(yourcompany == "") {
  	alert('Please enter your Company Name.');
  	theform.yourcompany.focus();
    return false;
  }
  /*if(!lname.match(lnameRegex)) {
    alert('You have entered an invalid Last Name.');
    theform.lname.value="";
	theform.lname.focus();
    return false;
  }*/
  if(youremail == "") {
    alert('Please enter your email.');
    theform.youremail.focus();
    return false;
  }
  if(!youremail.match(emailRegex)) {
    alert('Please enter valid email.');
    theform.youremail.value="";
    theform.youremail.focus();
    return false;
  }
  if(yourphone == ""){
    alert('Please enter Phone Number.');
    theform.yourphone.focus();
    return false;
  }else if(isNaN(yourphone)){
    alert('Please enter valid Phone Number.');
    theform.yourphone.value="";
    theform.yourphone.focus();
    return false;
  }else if(yourphone.length < 10)
  {
    alert('Phone Number should have minimum 10 digits.');
    theform.yourphone.focus();
    return false;
  }
  
  if(refcompany == "") {
  	alert('You must enter your Company Name.');
  	theform.refcompany.focus();
    return false;
  }
  if(!refcompany.match(compRegex)) {
    alert('Please enter valid Company Name.');
    theform.refcompany.value="";
    theform.refcompany.focus();
    return false;
  }
  if(refcontactname == "") {
  	alert('Please enter Contact Name.');
  	theform.refcontactname.focus();
    return false;
  }
  if(refcontacttitle == "") {
  	alert('Please enter Contact Title.');
  	theform.refcontacttitle.focus();
    return false;
  }
  if(refcontactemail == "") {
    alert('Please enter contact email.');
    theform.refcontactemail.focus();
    return false;
  }
  if(!refcontactemail.match(emailRegex)) {
    alert('Please enter valid contact email.');
    theform.refcontactemail.value="";
    theform.refcontactemail.focus();
    return false;
  }
  if(refcontactphone == ""){
    alert('Please enter Contact Phone Number.');
    theform.refcontactphone.focus();
    return false;
  }else if(isNaN(refcontactphone)){
    alert('Please enter valid Contact Phone Number.');
    theform.refcontactphone.value="";
    theform.refcontactphone.focus();
    return false;
  }else if(refcontactphone.length < 10)
  {
    alert('Contact Phone Number should have minimum 10 digits.');
    theform.refcontactphone.focus();
    return false;
  }
  if(refaddinform == "") {
  	alert('Please enter Additional Information.');
  	theform.refaddinform.focus();
    return false;
  }
}

function quotevalidate_form(theform)
{
	var fname = theform.fname.value;
	var lname = theform.lname.value;
	var email = theform.email.value;
	var phone = theform.phone.value;
	var comp  = theform.company.value;
	var web   = theform.web.value;
	//var city  = theform.city.value;
	var addr  = theform.address.value;
	//var state = theform.q5_State.value;
	//var country = theform.q6_Country.value;
	var server= theform.q14_TotalServer.value;
	var total = theform.total.value;
	var doc   = theform.file.value;
	
	var fnameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var lnameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	var compRegex  = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var webRegex   = /(\w+:\/\/[^\s]*)/g;
	//var cityRegex  = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	//var RegExp = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
	var RegExpweb = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
	var number		= theform.number.value;
	var captchcode	= $("#captchcode").html();
 
  if(fname == "") {
  	alert('You must enter your First Name.');
  	theform.fname.focus();
    return false;
  }
  if(!fname.match(fnameRegex)) {
    alert('You have entered an invalid First Name.');
    theform.fname.value="";
    theform.fname.focus();
    return false;
  }
  
   if(lname == "") {
  	alert('You must enter your Last Name.');
  	theform.lname.focus();
    return false;
  }
  if(!lname.match(lnameRegex)) {
    alert('You have entered an invalid Last Name.');
    theform.lname.value="";
	theform.lname.focus();
    return false;
  }
  if(email == "") {
    alert('You must enter your email.');
    theform.email.focus();
    return false;
  }
  if(!email.match(emailRegex)) {
    alert('You have entered an invalid email.');
    theform.email.value="";
    theform.email.focus();
    return false;
  }
  if(phone == ""){
    alert('You must enter your Phone Number.');
    theform.phone.focus();
    return false;
  }else if(isNaN(phone)){
    alert('You must entered a valid Phone Number.');
    theform.phone.value="";
    theform.phone.focus();
    return false;
  }else if(phone.length < 10)
  {
    alert('Phone Number should have minimum 10 digits.');
    theform.phone.focus();
    return false;
  }
  if(comp == "") {
  	alert('You must enter your Company Name.');
  	theform.company.focus();
    return false;
  }
  if(!comp.match(compRegex)) {
    alert('You have entered an invalid Company Name.');
    theform.company.value="";
    theform.company.focus();
    return false;
  }
  if(web == "") {
  	alert('You must enter your Website Url.');
  	theform.web.focus();
    return false;
  }
  if(RegExpweb.test(web) == false){
	alert('You have entered an invalid Website Url.');
    theform.web.value="";
    theform.web.focus();
    return false;
  }
  /*if(city == "") {
  	alert('You must enter your City Name.');
  	theform.city.focus();
    return false;
  }
  if(!city.match(cityRegex)) {
    alert('You have entered an invalid City name.');
    theform.city.value="";
    theform.city.focus();
    return false;
  }*/
  
  if(addr == "") {
  	alert('You must enter your Address');
  	theform.address.focus();
    return false;
  }
  
  /*if(state == "") {
  	alert('You must Select the State');
  	theform.q5_State.focus();
    return false;
  }
  
  if(country == "") {
  	alert('You must Select the Country');
  	theform.q6_Country.focus();
    return false;
  }*/
  
  if(server=="") {
	alert('You must Select Total Server');
  	theform.q14_TotalServer.focus();
    return false;
  }
  
  if(total=="") {
	alert('You must enter Total Desktop, Laptop and Users');
  	theform.total.focus();
    return false;
  }
  /*if(doc=="") {
	alert('You must upload the file for Network Documentation');
  	theform.file.focus();
    return false;
  }*/
  if(doc !="") {
	  dot=doc.lastIndexOf(".")+1;
	  ext=doc.substring(dot);
	  
	  if((ext!="pdf")&&(ext!="doc")&&(ext!="docx"))
	  {
		alert('You must upload the file as doc or pdf');
		theform.file.value="";
	  	theform.file.focus();
	    return false;
	}
  }
  if(number == ''){
	alert("Enter the Verification code");
	theform.number.focus();
	return false;
  }
  if(number != captchcode){
	alert("Enter the correct Verification code");
	theform.number.focus();
	return false;
  }
  
  //alert('Your Quote has been Received. We will contact you shortly');
}

//Conatct form
function convalidate_form(theform)
{
	var name 	= theform.name.value;
	var comp 	= theform.company.value;
	var phone	=	theform.phone.value;
	var email 	= theform.email.value;
	var add_req	=	theform.add_req.value;
	var number		= theform.number.value;
	var captchcode	= $("#captchcode").html();
	
	var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var compRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	 
  if(name == "") {
  	alert('You must enter your Name.');
  	theform.name.focus();
    return false;
  }
  if(!name.match(nameRegex)) {
    alert('You have entered an invalid Name.');
    theform.name.value="";
    theform.name.focus();
    return false;
  }
  
  if(comp == "") {
  	alert('You must enter your Company Name.');
  	theform.company.focus();
    return false;
  }
  if(!comp.match(compRegex)) {
    alert('You have entered an invalid Company Name.');
    theform.company.value="";
    theform.company.focus();
    return false;
  }
  
  if(phone == ""){
    alert('You must enter your Phone Number.');
    theform.phone.focus();
    return false;
  }else if(isNaN(phone)){
    alert('You must entered a valid Phone Number.');
    theform.phone.value="";
    theform.phone.focus();
    return false;
  }else if(phone.length < 10)
  {
    alert('Phone Number should have minimum 10 digits.');
    theform.phone.focus();
    return false;
  }
  
  if(email == "") {
    alert('You must enter your email.');
    theform.email.focus();
    return false;
  }
  if(!email.match(emailRegex)) {
    alert('You have entered an invalid email.');
    theform.email.value="";
    theform.email.focus();
    return false;
  }
 /* var len=theform.interest[].length;
  c=0;
  for(i=0;i<len;i++)
  	if(theform.interest[i].checked)
  		c+=1;
 if(c==0)
 {alert('Please Select Atleast One Interest Value'); return false;}
 */
 if (!theform.urgent[0].checked && !theform.urgent[1].checked && !theform.urgent[2].checked){
 	
	alert('Please Select Atleast One Urgency Request Value');
	theform.urgent[0].focus();
 	return false;
  }

 if(add_req==""){
 	alert('Please Type Your Requirements');
 	theform.add_req.focus();
  	return false;
 }
 if(number == ''){
	alert("Please enter Verification code");
	theform.number.focus();
	return false;
 }
 if(number != captchcode){
	alert("Please enter correct Verification code");
	theform.number.focus();
	return false;
 }
}

//Career
function careervalidate_form(theform)
{
	var name = theform.fname.value;
	var email = theform.email.value;
	var phone = theform.phone.value;
	var addr  = theform.address.value;
	var posi  = theform.position.value;
	var start = theform.txt_start.value;
	var cover = theform.cover.value;
	var resume = theform.file.value;
	
	var number		= theform.number.value;
	var captchcode	= $("#captchcode").html();
	
	var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var lnameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
//	var posiRegex  = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	 
  if(name == "") {
  	alert('You must enter your Name.');
  	theform.fname.focus();
    return false;
  }
  if(!name.match(nameRegex)) {
    alert('You have entered an invalid Name.');
    theform.fname.value="";
    theform.fname.focus();
    return false;
  }
  
  if(email == "") {
    alert('You must enter your email.');
    theform.email.focus();
    return false;
  }
  if(!email.match(emailRegex)) {
    alert('You have entered an invalid email.');
    theform.email.value="";
    theform.email.focus();
    return false;
  }
  if(phone == ""){
    alert('You must enter your Phone Number.');
    theform.phone.focus();
    return false;
  }else if(isNaN(phone)){
    alert('You must entered a valid Phone Number.');
    theform.phone.value="";
    theform.phone.focus();
    return false;
  }else if(phone.length < 10){
    alert('Phone Number should have minimum 10 digits.');
    theform.phone.focus();
    return false;
  }
  
  if(addr == "") {
  	alert('You must enter your Address');
  	theform.address.focus();
    return false;
  }
  
  if(posi == "") {
  	alert('You must enter for which position are you applying.');
  	theform.position.focus();
    return false;
  }
 /* if(!posi.match(posiRegex)) {
    alert('You have entered an invalid Position Name.');
    theform.position.value="";
    theform.position.focus();
    return false;
  }*/
  
  
  if(start == "") {
  	alert('You must enter When can you start?.');
  	theform.txt_start.focus();
    return false;
  }
  

  if(cover == "") {
  	alert('You must insert Your Cover Letter.');
  	theform.cover.focus();
    return false;
  }
  if(number == ''){
	alert("Please enter Verification code");
	theform.number.focus();
	return false;
 }
 if(number != captchcode){
	alert("Please enter correct Verification code");
	theform.number.focus();
	return false;
 }
  
  if(resume=="") {
	alert('You must upload your resume to send.');
  	theform.file.focus();
    return false;
  }
  dot=resume.lastIndexOf(".")+1;
  ext=resume.substring(dot);
  
  if((ext!="pdf")&&(ext!="doc")&&(ext!="docx"))
  {
	alert('You must upload the file as doc or pdf');
	theform.file.value="";
  	theform.file.focus();
    return false;
}
  //alert('Your Quote has been Received. We will contact you shortly');
  
}

//Web Development  - Validate
function webdevelop_quotevalidate(theform)
{
	var firstname 			= theform.firstname.value;
	var lastname 			= theform.lastname.value;
	var companyname 		= theform.companyname.value;
	var companytype 		= theform.companytype.value;
	var contactno 			= theform.contactno.value;
	var time_to_contact 	= theform.time_to_contact.value;
	var emailid 			= theform.emailid.value;
	var currentlocation 	= theform.currentlocation.value;
	var country 			= theform.country.value;
	
	var siteurl 			= theform.siteurl.value;
	//var category 			= theform.category.value;
	var typeofwebsite 		= theform.typeofwebsite.value;
	var sitecolors 			= theform.sitecolors.value;
	//var logodesign 			= theform.logodesign.value;
	var project_description	= theform.project_description.value;
	var desiredtimeframe 	= theform.desiredtimeframe.value;
	var estimatedbudget 	= theform.estimatedbudget.value;
	
	var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
 
  if(firstname == "") {
  	alert('Please your First Name.');
  	theform.firstname.focus();
    return false;
  }
  if(!firstname.match(nameRegex)) {
    alert('Please enter valid First Name.');
    theform.firstname.value="";
    theform.firstname.focus();
    return false;
  }
  if(lastname == "") {
  	alert('Please your Last Name.');
  	theform.lastname.focus();
    return false;
  }
  if(!lastname.match(nameRegex)) {
    alert('Please enter valid Last Name.');
    theform.lastname.value="";
    theform.lastname.focus();
    return false;
  }
  if(companyname == "") {
  	alert('Please enter your Company Name.');
  	theform.companyname.focus();
    return false;
  }
  if(companytype == "") {
  	alert('Please enter your Company Type.');
  	theform.companytype.focus();
    return false;
  }
  if(contactno == ""){
    alert('Please enter Contact Number.');
    theform.contactno.focus();
    return false;
  }else if(isNaN(contactno)){
    alert('Please enter valid Contact Number.');
    theform.contactno.value="";
    theform.contactno.focus();
    return false;
  }else if(contactno.length < 10)
  {
    alert('Contact Number should have minimum 10 digits.');
    theform.contactno.focus();
    return false;
  }
  if(time_to_contact == "") {
  	alert('Please enter Best Time to contact you.');
  	theform.time_to_contact.focus();
    return false;
  }
  if(emailid == "") {
    alert('Please enter your email.');
    theform.emailid.focus();
    return false;
  }
  if(!emailid.match(emailRegex)) {
    alert('Please enter valid email.');
    theform.emailid.value="";
    theform.emailid.focus();
    return false;
  }
  if(time_to_contact == "") {
  	alert('Please enter Best Time to contact you.');
  	theform.time_to_contact.focus();
    return false;
  }
  if(currentlocation == "") {
  	alert('Please enter your Current Location.');
  	theform.currentlocation.focus();
    return false;
  }
  if(country == "") {
  	alert('You must enter your Country.');
  	theform.country.focus();
    return false;
  }
  
  
  //Project Info
  if(!theform.project_type[0].checked && !theform.project_type[1].checked) {
    alert('Please select Project Type.');
    theform.project_type[0].focus();
    return false;
  }
  if(!theform.category[0].checked && !theform.category[1].checked) {
    alert('Please select Category.');
    theform.category[0].focus();
    return false;
  }
  if(typeofwebsite == "") {
    alert('Please select your Type of website.');
    theform.typeofwebsite.focus();
    return false;
  }
  if(sitecolors == "") {
  	alert('Please enter Colors.');
  	theform.sitecolors.focus();
    return false;
  }
  if(!theform.logodesign[0].checked && !theform.logodesign[1].checked) {
    alert('Please select Logo Design.');
    theform.logodesign[0].focus();
    return false;
  }
  if(project_description == "") {
  	alert('Please enter Project Information.');
  	theform.project_description.focus();
    return false;
  }
  if(desiredtimeframe == "") {
    alert('Please enter Desired Timeframe.');
    theform.desiredtimeframe.focus();
    return false;
  }
  if(estimatedbudget == ""){
    alert('Please enter Estimated Budget.');
    theform.estimatedbudget.focus();
    return false;
  }
}

//Search Validate
function SearchValidate(){
	
		var keyword=document.getElementById("keyword");
		if(keyword.value==''){
			alert("Enter the Keyword");
			keyword.focus();
			return false;
		}
}
