//-----------  For capcha ------------------------------------//
var chars = "0123456789ABCDEFGHIJKLMNPQRSTUVWXTZabcdefghikmnpqrstuvwxyz";
var string_length = 7;
var randomstring = '';
for (var i=0; i<string_length; i++) {
	var rnum = Math.floor(Math.random() * chars.length);
	randomstring += chars.substring(rnum,rnum+1);
}


//-----------  end For capcha ------------------------------------//

String.prototype.trim = function() {
a = this.replace(/^\s+/, '');
return a.replace(/\s+$/, '');
};

//----------------End of validation---------------------
function Inint_AJAX_Lead() 
{
   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;
}
//-------------------------------------------


//-------------------------------------------
function contactus_form_Validator(theForm)
{
  if (theForm.name.value=='')
  {
    alert("Please enter your name");
    theForm.name.focus();
    return (false);
  } 
  if (theForm.company.value=='')
  {
    alert("Please enter your company");
    theForm.company.focus();
    return (false);
  } 

 /*if (theForm.address.value =='')    
  {
    alert("Please enter your address");
    theForm.address.focus();
    return (false);
  }*/

 if (theForm.city.value =='')    
  {
    alert("Please enter your city");
    theForm.city.focus();
    return (false);
  }

 if (theForm.country.value =='')    
  {
    alert("Please select your country");
    theForm.country.focus();
    return (false);
  }
  
 if(theForm.email.value=='')
  {
	   alert("Please enter your email address")
	   theForm.email.focus()
	   return false;
  }
 else  
  if (theForm.email.value.indexOf("@")<0 || theForm.email.value.indexOf(".")<0)
  {
	 alert("Please enter a valid email address eg:info@bluentcad.com")
	 theForm.email.focus()
	 return false;
   }
   
 if (theForm.phone_mobile.value =='')    
  {
    alert("Please enter your mobile number");
    theForm.phone_mobile.focus();
    return (false);
  }

 if (theForm.requirements.value =='')    
  {
    alert("Please enter your requirements");
    theForm.requirements.focus();
    return (false);
  }
  

//new code for captcha
		 if (theForm.txtCaptcha.value=='' )
		  {
			alert("Please enter image verification code.");
			theForm.txtCaptcha.focus();
			return (false);
		  }
		  else
		  {
					if(theForm.txtCaptcha.value > randomstring || theForm.txtCaptcha.value < randomstring )
					{
						alert('Invalid Security code! Please enter again!');
						theForm.txtCaptcha.focus();
						return false;
					}
				
			 
		  }
		  
		
		//---------Asign value---------------------
	
	var email=theForm.email.value;
	var salutation=theForm.salutation.value;
	var name=theForm.name.value;
	var title=theForm.title.value;
	var find_us=theForm.find_us.value;
	var bl_relation=theForm.bl_relation.value;
	
	if(bl_relation=='')
	var bl_relation=theForm.other_relation.value;
	
	var phone_mobile=theForm.phone_mobile.value;
	var phone=theForm.phone.value;
	
	if(theForm.newsletter.checked==true)
	var newsletter=theForm.newsletter.value;
	else
	var newsletter='No';
	
	
	var address=theForm.address.value;
	var city=theForm.city.value;
	var country=theForm.country.value;
	var company=theForm.company.value;
	
	var message=theForm.requirements.value;
	var website=theForm.website.value;
	var send_to=theForm.send_to.value;
	var subject_email=theForm.subject_email.value;
	var website_url=theForm.website_url.value;
	var form_type=theForm.form_type.value;
	
	var topics='';
	
	var fnamestr=name.trim();
	
	if(fnamestr.lastIndexOf(' ')==-1)
	{
		theForm.first_name.value='';
		theForm.last_name.value=fnamestr;
	}
	else
	{
		var indexpos=fnamestr.lastIndexOf(' ');
		theForm.last_name.value=fnamestr.substr(indexpos,(fnamestr.length-indexpos));
		
		var fname_plus_middle=fnamestr.substr(0,indexpos);
		var fname_plus_middle_trim=fname_plus_middle.trim();
		
		if(fname_plus_middle_trim.indexOf(' ')==-1)
		{
			theForm.first_name.value=fname_plus_middle_trim;
			theForm.middle_name_c.value='';
		}
		else
		{
			var indexpos_f=fname_plus_middle_trim.indexOf(' ');
			theForm.first_name.value=fname_plus_middle_trim.substr(0,indexpos_f);
			theForm.middle_name_c.value=fnamestr.substr(indexpos_f,(fname_plus_middle_trim.length-indexpos_f));	
		}
	}
	//----------Trimming------------------
	theForm.first_name.value=theForm.first_name.value.trim();;
	theForm.middle_name_c.value=theForm.middle_name_c.value.trim();;
	theForm.last_name.value=theForm.last_name.value.trim();
	//------------End of Trimming----------------------
	theForm.email1.value=email;
	theForm.phone_work.value=phone;
	theForm.description.value=message;
	
	theForm.primary_address_street.value=address;
	theForm.primary_address_city.value=city;
	theForm.primary_address_country.value=country;
	theForm.account_name.value=company;
	
	
	if(theForm.project1.checked==true)
	topics+='- '+theForm.project1.value;
	if(theForm.project2.checked==true)
	topics+=' - '+theForm.project2.value;
	if(theForm.project3.checked==true)
	topics+=' - '+theForm.project3.value;
	if(theForm.project4.checked==true)
	topics+=' - '+theForm.project4.value;
	if(theForm.project5.checked==true)
	topics+=' - '+theForm.project5.value;
	if(theForm.project6.checked==true)
	topics+=' - '+theForm.project6.value;
	if(theForm.project7.checked==true)
	topics+=' - '+theForm.project7.value;
	
	topics+=' - '+form_type;
	
	theForm.topic_c.value=website_url+' '+topics;
	theForm.website_c.value=website;
	//-----------------Ajax code for sending email---------------------------
	
 	var  req_lead = Inint_AJAX_Lead();
	req_lead.onreadystatechange = function ()
	{ 
	          if (req_lead.readyState==4)
			  {
               if (req_lead.status==200)
			   {
				//document.getElementById("countrydivcontainer").innerHTML=req_lead.responseText;
				//alert(req_lead.responseText);
				return true;
               } 
            }
     };
     req_lead.open("GET", "http://www.bluentcad.com/contact_us.php?email="+email+"&name="+name+"&phone="+phone+"&message="+escape(message)+"&website="+website+"&subject_email="+subject_email+"&send_to="+send_to+"&address="+escape(address)+"&city="+city+"&country="+country+"&title="+title+"&find_us="+find_us+"&bl_relation="+bl_relation+"&phone_mobile="+phone_mobile+"&newsletter="+newsletter+"&topics="+topics+"&salutation="+salutation+"&company="+company,0); //make connection
     req_lead.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req_lead.send(null); //send value  
		  
		  
		  
}

  
 /* ========================================================================================= */



function request_form_Validator(theForm)
{
  if (theForm.name.value=='')
  {
    alert("Please enter your name");
    theForm.name.focus();
    return (false);
  }  
 if(theForm.email.value=='')
      {
           alert("Please enter your email address")
           theForm.email.focus()
           return false;
      }
     else  
      if (theForm.email.value.indexOf("@")<0 || theForm.email.value.indexOf(".")<0)
          {
             alert("Please enter a valid email address eg:info@bluentcad.com")
             theForm.email.focus()
             return false;
           }
 if (theForm.address.value =='')    
  {
    alert("Please enter your address");
    theForm.address.focus();
    return (false);
  }

 if (theForm.city.value =='')    
  {
    alert("Please enter your city");
    theForm.city.focus();
    return (false);
  }

 if (theForm.state.value =='')    
  {
    alert("Please enter your state");
    theForm.state.focus();
    return (false);
  }

 if (theForm.country.value =='')    
  {
    alert("Please enter your country");
    theForm.country.focus();
    return (false);
  }

 if (theForm.phone.value =='')    
  {
    alert("Please enter your phone number");
    theForm.phone.focus();
    return (false);
  }

 if (theForm.subject.value =='')    
  {
    alert("Please enter your Query subject");
    theForm.subject.focus();
    return (false);
  }

 if (theForm.requirements.value =='')    
  {
    alert("Please enter your requirements");
    theForm.requirements.focus();
    return (false);
  }
  

//new code for captcha
		 if (theForm.txtCaptcha.value=='' )
		  {
			alert("Please enter image verification code.");
			theForm.txtCaptcha.focus();
			return (false);
		  }
		  else
		  {
					if(theForm.txtCaptcha.value > randomstring || theForm.txtCaptcha.value < randomstring )
					{
						alert('Invalid Security code! Please enter again!');
						theForm.txtCaptcha.focus();
						return false;
					}
				
			 
		  }
		  
		
		//---------Asign value---------------------
	
	var email=theForm.email.value;
	var name=theForm.name.value;
	var phone=theForm.phone.value;
	
	var address=theForm.address.value;
	var city=theForm.city.value;
	var state=theForm.state.value;
	var country=theForm.country.value;
	var company=theForm.company.value;
	var subject=theForm.subject.value;
	
	var message=theForm.requirements.value;
	var website=theForm.website.value;
	var send_to=theForm.send_to.value;
	var subject_email=theForm.subject_email.value;
	var website_url=theForm.website_url.value;
	var form_type=theForm.form_type.value;
	
	//var topics='';
	
	var fnamestr=name.trim();
	
	if(fnamestr.lastIndexOf(' ')==-1)
	{
		theForm.first_name.value='';
		theForm.last_name.value=fnamestr;
	}
	else
	{
		var indexpos=fnamestr.lastIndexOf(' ');
		theForm.last_name.value=fnamestr.substr(indexpos,(fnamestr.length-indexpos));
		
		var fname_plus_middle=fnamestr.substr(0,indexpos);
		var fname_plus_middle_trim=fname_plus_middle.trim();
		
		if(fname_plus_middle_trim.indexOf(' ')==-1)
		{
			theForm.first_name.value=fname_plus_middle_trim;
			theForm.middle_name_c.value='';
		}
		else
		{
			var indexpos_f=fname_plus_middle_trim.indexOf(' ');
			theForm.first_name.value=fname_plus_middle_trim.substr(0,indexpos_f);
			theForm.middle_name_c.value=fnamestr.substr(indexpos_f,(fname_plus_middle_trim.length-indexpos_f));	
		}
	}
	//----------Trimming------------------
	theForm.first_name.value=theForm.first_name.value.trim();;
	theForm.middle_name_c.value=theForm.middle_name_c.value.trim();;
	theForm.last_name.value=theForm.last_name.value.trim();
	//------------End of Trimming----------------------
	theForm.email1.value=email;
	theForm.phone_work.value=phone;
	theForm.description.value=message;
	
	theForm.primary_address_street.value=address;
	theForm.primary_address_city.value=city;
	theForm.primary_address_state.value=state;
	theForm.primary_address_country.value=country;
	theForm.account_name.value=company;
	
	/*
	
	if(theForm.project1.checked==true)
	topics+='- '+theForm.project1.value;
	if(theForm.project2.checked==true)
	topics+=' - '+theForm.project2.value;
	if(theForm.project3.checked==true)
	topics+=' - '+theForm.project3.value;
	
	topics+=' - '+form_type;*/
	
	theForm.topic_c.value=website_url+' -'+form_type;
	theForm.website_c.value=website;
	//-----------------Ajax code for sending email---------------------------
	
 	var  req_lead = Inint_AJAX_Lead();
	req_lead.onreadystatechange = function ()
	{ 
	          if (req_lead.readyState==4)
			  {
               if (req_lead.status==200)
			   {
				//document.getElementById("countrydivcontainer").innerHTML=req_lead.responseText;
				//alert(req_lead.responseText);
				return true;
               } 
            }
     };
     req_lead.open("GET", "http://www.bluentcad.com/request-form.php?email="+email+"&name="+name+"&phone="+phone+"&message="+escape(message)+"&website="+website+"&subject_email="+subject_email+"&send_to="+send_to+"&address="+escape(address)+"&city="+city+"&state="+state+"&country="+country+"&subject="+subject+"&company="+company,0); //make connection
     req_lead.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req_lead.send(null); //send value  
		  
		  
		  
}

  
 /* ========================================================================================= */



 /* ========================================================================================= */



 function campaign_bim_validate(theForm)
{
  if (theForm.name.value=='' || theForm.name.value=='Name')
  {
    alert("Please enter your name");
    theForm.name.focus();
    return (false);
  }  
 if(theForm.email.value=='' || theForm.email.value=='Email')
      {
           alert("Please enter your email address")
           theForm.email.focus()
           return false;
      }
     else  
      if (theForm.email.value.indexOf("@")<0 || theForm.email.value.indexOf(".")<0)
          {
             alert("Please enter a valid email address eg:info@bluentcad.com")
             theForm.email.focus()
             return false;
           }
 
  if (theForm.phone.value =='' || theForm.phone.value=='Phone')    
  {
    alert("Please enter your phone number");
    theForm.phone.focus();
    return (false);
  }
  
 
	//---------Asign value---------------------
	
	var email=theForm.email.value;
	var name=theForm.name.value;
	var phone=theForm.phone.value;
	var message=theForm.comments.value;
	var send_to=theForm.send_to.value;
	var subject_email=theForm.subject_email.value;
	var website=theForm.website.value;
	
	if(website=='Website' || website=='')
	website='';
	
	var website_url=theForm.website_url.value;
	var form_type=theForm.form_type.value;
	
	var topics='';
	
	var fnamestr=name.trim();
	
	if(fnamestr.lastIndexOf(' ')==-1)
	{
		theForm.first_name.value='';
		theForm.last_name.value=fnamestr;
	}
	else
	{
		var indexpos=fnamestr.lastIndexOf(' ');
		theForm.last_name.value=fnamestr.substr(indexpos,(fnamestr.length-indexpos));
		
		var fname_plus_middle=fnamestr.substr(0,indexpos);
		var fname_plus_middle_trim=fname_plus_middle.trim();
		
		if(fname_plus_middle_trim.indexOf(' ')==-1)
		{
			theForm.first_name.value=fname_plus_middle_trim;
			theForm.middle_name_c.value='';
		}
		else
		{
			var indexpos_f=fname_plus_middle_trim.indexOf(' ');
			theForm.first_name.value=fname_plus_middle_trim.substr(0,indexpos_f);
			theForm.middle_name_c.value=fnamestr.substr(indexpos_f,(fname_plus_middle_trim.length-indexpos_f));	
		}
	}
	/*alert(theForm.first_name.value)
	alert(theForm.middle_name_c.value)
	alert(theForm.last_name.value)*/
	
	//----------Trimming------------------
	theForm.first_name.value=theForm.first_name.value.trim();;
	theForm.middle_name_c.value=theForm.middle_name_c.value.trim();;
	theForm.last_name.value=theForm.last_name.value.trim();
	//------------End of Trimming----------------------
	
	theForm.email1.value=email;
	theForm.phone_work.value=phone;
	theForm.description.value=message;
	theForm.website_c.value=website;
	
	if(theForm.services1.checked==true)
	topics+='- '+theForm.services1.value;
	if(theForm.services2.checked==true)
	topics+=' - '+theForm.services2.value;
	if(theForm.services3.checked==true)
	topics+=' - '+theForm.services3.value;
	if(theForm.services4.checked==true)
	topics+=' - '+theForm.services4.value;	
	if(theForm.services5.checked==true)
	topics+=' - '+theForm.services5.value;	
	
	theForm.interest_in.value=topics;
	
	topics+=' - '+form_type;
	
	theForm.topic_c.value=website_url+' '+topics;
	//-----------------Ajax code for sending email---------------------------
	
 	var  req_lead = Inint_AJAX_Lead();
	req_lead.onreadystatechange = function ()
	{ 
	          if (req_lead.readyState==4)
			  {
               if (req_lead.status==200)
			   {
				//document.getElementById("countrydivcontainer").innerHTML=req_lead.responseText;
				//alert(req_lead.responseText);
				return true;
               } 
            }
     };
     req_lead.open("GET", "http://www.bluentcad.com/bim_consulting.php?email="+email+"&name="+name+"&phone="+phone+"&message="+escape(message)+"&subject_email="+subject_email+"&topics="+topics+"&website="+website+"&send_to="+send_to,0); //make connection
     req_lead.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req_lead.send(null); //send value  

}

/* ====================================================================================== */

 function campaign_bim_validate_online(theForm)
{
  if (theForm.name.value=='' || theForm.name.value=='Name')
  {
    alert("Please enter your full name");
    theForm.name.focus();
    return (false);
  } 
   
 if(theForm.email.value=='' || theForm.email.value=='Email')
      {
           alert("Please enter your email address")
           theForm.email.focus()
           return false;
      }
     else  
      if (theForm.email.value.indexOf("@")<0 || theForm.email.value.indexOf(".")<0)
          {
             alert("Please enter a valid email address eg:info@bluentcad.com")
             theForm.email.focus()
             return false;
           }
 
  if (theForm.phone.value =='' || theForm.phone.value=='Phone')    
  {
    alert("Please enter your phone number");
    theForm.phone.focus();
    return (false);
  }
  
 
  //----------------- code for captcha -------------------------
  
 /* if (theForm.txtCaptcha.value=='' )
  {
	alert("Please enter image verification code.");
	theForm.txtCaptcha.focus();
	return (false);
  }
  else
  {
			if(theForm.txtCaptcha.value > randomstring || theForm.txtCaptcha.value < randomstring )
			{
				alert('Invalid Security code! Please enter again!');
				theForm.txtCaptcha.focus();
				return false;
			}
		
	 
  }*/
  //----------End of captcha--------------------------
  
 

	//---------Asign value---------------------
	
	var email=theForm.email.value;
	var name=theForm.name.value;
	var phone=theForm.phone.value;
	var message=theForm.comments.value;
	var send_to=theForm.send_to.value;
	var subject_email=theForm.subject_email.value;
	
	var website=theForm.website.value;
	
	if(website=='Website' || website=='')
	website='';
	
	var website_url=theForm.website_url.value;
	var form_type=theForm.form_type.value;
	
	var topics='';
	
	var fnamestr=name.trim();
	
	if(fnamestr.lastIndexOf(' ')==-1)
	{
		theForm.first_name.value='';
		theForm.last_name.value=fnamestr;
	}
	else
	{
		var indexpos=fnamestr.lastIndexOf(' ');
		theForm.last_name.value=fnamestr.substr(indexpos,(fnamestr.length-indexpos));
		
		var fname_plus_middle=fnamestr.substr(0,indexpos);
		var fname_plus_middle_trim=fname_plus_middle.trim();
		
		if(fname_plus_middle_trim.indexOf(' ')==-1)
		{
			theForm.first_name.value=fname_plus_middle_trim;
			theForm.middle_name_c.value='';
		}
		else
		{
			var indexpos_f=fname_plus_middle_trim.indexOf(' ');
			theForm.first_name.value=fname_plus_middle_trim.substr(0,indexpos_f);
			theForm.middle_name_c.value=fnamestr.substr(indexpos_f,(fname_plus_middle_trim.length-indexpos_f));	
		}
	}
	/*alert(theForm.first_name.value)
	alert(theForm.middle_name_c.value)
	alert(theForm.last_name.value)*/
	
	//----------Trimming------------------
	theForm.first_name.value=theForm.first_name.value.trim();;
	theForm.middle_name_c.value=theForm.middle_name_c.value.trim();;
	theForm.last_name.value=theForm.last_name.value.trim();
	//------------End of Trimming----------------------
	
	theForm.email1.value=email;
	theForm.phone_work.value=phone;
	theForm.description.value=message;
	//theForm.website_c.value=website;
	
	if(theForm.services1.checked==true)
	topics+='- '+theForm.services1.value;
	if(theForm.services2.checked==true)
	topics+=' - '+theForm.services2.value;
	if(theForm.services3.checked==true)
	topics+=' - '+theForm.services3.value;
	if(theForm.services4.checked==true)
	topics+=' - '+theForm.services4.value;	
	if(theForm.services5.checked==true)
	topics+=' - '+theForm.services5.value;	
	if(theForm.services6.checked==true)
	topics+=' - '+theForm.services6.value;	
	if(theForm.services7.checked==true)
	topics+=' - '+theForm.services7.value;	
	if(theForm.services8.checked==true)
	topics+=' - '+theForm.services8.value;
	
	theForm.interest_in.value=topics;
	
	topics+=' - '+form_type;
	
	theForm.topic_c.value=website_url+' '+topics;
	//-----------------Ajax code for sending email---------------------------
	
 	var  req_lead = Inint_AJAX_Lead();
	req_lead.onreadystatechange = function ()
	{ 
	          if (req_lead.readyState==4)
			  {
               if (req_lead.status==200)
			   {
				//document.getElementById("countrydivcontainer").innerHTML=req_lead.responseText;
				//alert(req_lead.responseText);
				return true;
               } 
            }
     };
     req_lead.open("GET", "http://www.bluentcad.com/bim_consulting_online.php?email="+email+"&name="+name+"&phone="+phone+"&message="+escape(message)+"&subject_email="+subject_email+"&topics="+topics+"&website="+website+"&send_to="+send_to,0); //make connection
     req_lead.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req_lead.send(null); //send value  

}

/* ====================================================================================== */


/* ====================================================================================== */

 function campaign_bim_partner_validate(theForm)
{
  if (theForm.name.value=='' || theForm.name.value=='Name')
  {
    alert("Please enter your full name");
    theForm.name.focus();
    return (false);
  } 
   
 if(theForm.email.value=='' || theForm.email.value=='Email')
      {
           alert("Please enter your email address")
           theForm.email.focus()
           return false;
      }
     else  
      if (theForm.email.value.indexOf("@")<0 || theForm.email.value.indexOf(".")<0)
          {
             alert("Please enter a valid email address eg:info@bluentcad.com")
             theForm.email.focus()
             return false;
           }
 
  if (theForm.phone.value =='' || theForm.phone.value=='Phone')    
  {
    alert("Please enter your phone number");
    theForm.phone.focus();
    return (false);
  }
  
 
  
 

	//---------Asign value---------------------
	
	var email=theForm.email.value;
	var name=theForm.name.value;
	var phone=theForm.phone.value;
	var message=theForm.comments.value;
	var send_to=theForm.send_to.value;
	var subject_email=theForm.subject_email.value;
	
	var extension=theForm.extension.value;
	
	if(extension=='Extn.' || extension=='')
	extension='';
	
	var website_url=theForm.website_url.value;
	var form_type=theForm.form_type.value;
	
	var topics='';
	
	var fnamestr=name.trim();
	
	if(fnamestr.lastIndexOf(' ')==-1)
	{
		theForm.first_name.value='';
		theForm.last_name.value=fnamestr;
	}
	else
	{
		var indexpos=fnamestr.lastIndexOf(' ');
		theForm.last_name.value=fnamestr.substr(indexpos,(fnamestr.length-indexpos));
		
		var fname_plus_middle=fnamestr.substr(0,indexpos);
		var fname_plus_middle_trim=fname_plus_middle.trim();
		
		if(fname_plus_middle_trim.indexOf(' ')==-1)
		{
			theForm.first_name.value=fname_plus_middle_trim;
			theForm.middle_name_c.value='';
		}
		else
		{
			var indexpos_f=fname_plus_middle_trim.indexOf(' ');
			theForm.first_name.value=fname_plus_middle_trim.substr(0,indexpos_f);
			theForm.middle_name_c.value=fnamestr.substr(indexpos_f,(fname_plus_middle_trim.length-indexpos_f));	
		}
	}
	
	
	//----------Trimming------------------
	theForm.first_name.value=theForm.first_name.value.trim();;
	theForm.middle_name_c.value=theForm.middle_name_c.value.trim();;
	theForm.last_name.value=theForm.last_name.value.trim();
	//------------End of Trimming----------------------
	
	theForm.email1.value=email;
	theForm.phone_work.value=phone;
	theForm.description.value=message;
	
	//-----------------Ajax code for sending email---------------------------
	
 	var  req_lead = Inint_AJAX_Lead();
	req_lead.onreadystatechange = function ()
	{ 
	          if (req_lead.readyState==4)
			  {
               if (req_lead.status==200)
			   {
				//document.getElementById("countrydivcontainer").innerHTML=req_lead.responseText;
				//alert(req_lead.responseText);
				return true;
               } 
            }
     };
     req_lead.open("GET", "http://www.bluentcad.com/bim_consulting_partner.php?email="+email+"&name="+name+"&phone="+phone+"&extension="+extension+"&message="+escape(message)+"&subject_email="+subject_email+"&send_to="+send_to,0); //make connection
     req_lead.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req_lead.send(null); //send value  

}

/* ====================================================================================== */


 function partner(theForm)
{
  if (theForm.name.value=='')
  {
    alert("Please enter your name");
    theForm.name.focus();
    return (false);
  }  
 if(theForm.email.value=='')
      {
           alert("Please enter your email address")
           theForm.email.focus()
           return false;
      }
     else  
      if (theForm.email.value.indexOf("@")<0 || theForm.email.value.indexOf(".")<0)
          {
             alert("Please enter a valid email address eg:info@bluentcad.com")
             theForm.email.focus()
             return false;
           }
 
  if (theForm.phone.value =='')    
  {
    alert("Please enter your phone number");
    theForm.phone.focus();
    return (false);
  }
  //----------------- code for captcha -------------------------
  
  if (theForm.txtCaptcha.value=='' )
  {
	alert("Please enter image verification code.");
	theForm.txtCaptcha.focus();
	return (false);
  }
  else
  {
			if(theForm.txtCaptcha.value > randomstring || theForm.txtCaptcha.value < randomstring )
			{
				alert('Invalid Security code! Please enter again!');
				theForm.txtCaptcha.focus();
				return false;
			}
		
	 
  }
  //----------End of captcha--------------------------
  
  if(theForm.form_type.value=='Tour BluEnt CAD')
  {
		  if (theForm.services.checked ==false && theForm.services_2.checked ==false && theForm.services_3.checked ==false &&  theForm.services_4.checked ==false)    
		  {
			alert("Please select any one.");
			theForm.services.focus();
			return (false);
		  }
  }
  else
  {
	  if (theForm.services.checked ==false && theForm.services_2.checked ==false && theForm.services_3.checked ==false)    
	  {
		alert("Please select any one.");
		theForm.services.focus();
		return (false);
	  }
  }

	//---------Asign value---------------------
	
	var email=theForm.email.value;
	var name=theForm.name.value;
	var phone=theForm.phone.value;
	
	var address=theForm.address.value;
	var company=theForm.company.value;
	
	var message=theForm.comments.value;
	var send_to=theForm.send_to.value;
	var subject_email=theForm.subject_email.value;
	var website_url=theForm.website_url.value;
	var form_type=theForm.form_type.value;
	
	var topics='';
	
	var fnamestr=name.trim();
	
	if(fnamestr.lastIndexOf(' ')==-1)
	{
		theForm.first_name.value='';
		theForm.last_name.value=fnamestr;
	}
	else
	{
		var indexpos=fnamestr.lastIndexOf(' ');
		theForm.last_name.value=fnamestr.substr(indexpos,(fnamestr.length-indexpos));
		
		var fname_plus_middle=fnamestr.substr(0,indexpos);
		var fname_plus_middle_trim=fname_plus_middle.trim();
		
		if(fname_plus_middle_trim.indexOf(' ')==-1)
		{
			theForm.first_name.value=fname_plus_middle_trim;
			theForm.middle_name_c.value='';
		}
		else
		{
			var indexpos_f=fname_plus_middle_trim.indexOf(' ');
			theForm.first_name.value=fname_plus_middle_trim.substr(0,indexpos_f);
			theForm.middle_name_c.value=fnamestr.substr(indexpos_f,(fname_plus_middle_trim.length-indexpos_f));	
		}
	}
	/*alert(theForm.first_name.value)
	alert(theForm.middle_name_c.value)
	alert(theForm.last_name.value)*/
	
	//----------Trimming------------------
	theForm.first_name.value=theForm.first_name.value.trim();;
	theForm.middle_name_c.value=theForm.middle_name_c.value.trim();;
	theForm.last_name.value=theForm.last_name.value.trim();
	//------------End of Trimming----------------------
	
	theForm.email1.value=email;
	theForm.phone_work.value=phone;
	theForm.description.value=message;
	
	theForm.primary_address_street.value=address;
	theForm.account_name.value=company;
	
	
	
	if(theForm.services.checked==true)
	topics+='- '+theForm.services.value;
	if(theForm.services_2.checked==true)
	topics+=' - '+theForm.services_2.value;
	if(theForm.services_3.checked==true)
	topics+=' - '+theForm.services_3.value;
	
	if(form_type=='Tour BluEnt CAD')
	{
		if(theForm.services_4.checked==true)
		topics+=' - '+theForm.services_4.value;	
	}
	
	topics+=' - '+form_type;
	
	theForm.topic_c.value=website_url+' '+topics;
	//-----------------Ajax code for sending email---------------------------
	
 	var  req_lead = Inint_AJAX_Lead();
	req_lead.onreadystatechange = function ()
	{ 
	          if (req_lead.readyState==4)
			  {
               if (req_lead.status==200)
			   {
				//document.getElementById("countrydivcontainer").innerHTML=req_lead.responseText;
				//alert(req_lead.responseText);
				return true;
               } 
            }
     };
     req_lead.open("GET", "http://www.bluentcad.com/partners-form.php?email="+email+"&name="+name+"&phone="+phone+"&message="+escape(message)+"&subject_email="+subject_email+"&topics="+topics+"&send_to="+send_to+"&address="+escape(address)+"&company="+company,0); //make connection
     req_lead.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req_lead.send(null); //send value  

}

/* ====================================================================================== */

function validate_news_form(theForm)
{ 
	if(theForm.name.value=='')
	{
		alert("Please enter your name")
		theForm.name.focus()
		 return false;
	}
	if(theForm.email.value=='' || theForm.email.value=='email here')
	{
		theForm.email.value='';
		alert("Please enter a email address.")
		theForm.email.focus()
		 return false;
	}
	else  
  	if (theForm.email.value.indexOf("@")<0 || theForm.email.value.indexOf(".")<0)
	{
		 alert("Please enter a valid email address eg:info@abc.com")
		 theForm.email.focus()
		 return false;
	}
	
	//new code for captcha
		 if (theForm.txtCaptcha.value=='' )
		  {
			alert("Please enter image verification code.");
			theForm.txtCaptcha.focus();
			return (false);
		  }
		  else
		  {
					if(theForm.txtCaptcha.value > randomstring || theForm.txtCaptcha.value < randomstring )
					{
						alert('Invalid Security code! Please enter again!');
						theForm.txtCaptcha.focus();
						return false;
					}
				
			 
		  }
	
	 //---------Asign value---------------------
	 
	var Email=theForm.email.value;
	var website_url=theForm.website_url.value;
	var form_type=theForm.form_type.value;
	var Name=theForm.name.value;
	var company=theForm.company.value;
	var message=theForm.comments.value;
	
	
	theForm.email1.value=Email;
	theForm.account_name.value=company;
	theForm.description.value=message;
	var fnamestr=Name.trim();
	
	if(fnamestr.lastIndexOf(' ')==-1)
	{
		theForm.first_name.value='';
		theForm.last_name.value=fnamestr;
	}
	else
	{
		var indexpos=fnamestr.lastIndexOf(' ');
		theForm.last_name.value=fnamestr.substr(indexpos,(fnamestr.length-indexpos));
		
		var fname_plus_middle=fnamestr.substr(0,indexpos);
		var fname_plus_middle_trim=fname_plus_middle.trim();
		
		if(fname_plus_middle_trim.indexOf(' ')==-1)
		{
			theForm.first_name.value=fname_plus_middle_trim;
			theForm.middle_name_c.value='';
		}
		else
		{
			var indexpos_f=fname_plus_middle_trim.indexOf(' ');
			theForm.first_name.value=fname_plus_middle_trim.substr(0,indexpos_f);
			theForm.middle_name_c.value=fnamestr.substr(indexpos_f,(fname_plus_middle_trim.length-indexpos_f));	
		}
	}
	
	//----------Trimming------------------
	theForm.first_name.value=theForm.first_name.value.trim();;
	theForm.middle_name_c.value=theForm.middle_name_c.value.trim();;
	theForm.last_name.value=theForm.last_name.value.trim();
	//------------End of Trimming----------------------
	theForm.topic_c.value=website_url+' -'+form_type;
	return true;
}
