function submitLQForm()
{
	 var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	 
	 var name     = document.lightquotationfrm.name.value;
   var emailAdd = document.lightquotationfrm.emailAdd.value;
   var company  = document.lightquotationfrm.company.value;
   var address  = document.lightquotationfrm.address.value;
   var city     = document.lightquotationfrm.city.value;
   var country  = document.lightquotationfrm.country.value;
   var postcode = document.lightquotationfrm.postcode.value;
   var pnumber  = document.lightquotationfrm.pnumber.value;
   var description = document.lightquotationfrm.description.value;
   
		if(name=="" || name.substr(0,1)=="*" ){
			alert("Please enter Full Name.");
			}
		else if(emailAdd=="" || emailAdd.substr(0,1)=="*" ){
			alert("Please enter Email");
			}
		else if(reg.test(emailAdd) == false){
			alert('Invalid Email Address');
			}		
		else if(company=="" || company.substr(0,1)=="*" ){
			alert("Please enter Company Name.");
			}
		else if(address=="" || address.substr(0,1)=="*" ){
			alert("Please enter Address Line 1.");
			}
		else if(city=="" || city.substr(0,1)=="*" ){
			alert("Please enter City.");
			}	
		else if(country=="" || country.substr(0,1)=="*" ){
			alert("Please enter Country.");
			}			
		else if(postcode=="" || postcode.substr(0,1)=="*" ){
			alert("Please enter Postcode.");
			}				
		else if(pnumber=="" || pnumber.substr(0,1)=="*" ){
			alert("Please enter Phone Number.");
			}
		else if(ValidateLQ(pnumber,"[^0-9\\ ]") == true) {
			alert("Please enter valid Phone Number. Only numeric characters are allowed.");		
		 }					
		else if(description=="" || description.substr(0,1)=="*" ){
			alert("Please enter Project Description.");
		 }			
		else
		 {
				send_quation(name,emailAdd,company,address,city,country,postcode,pnumber,description);
		 }	
}
function clearText(field){
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
  }
function ValidateLQ(strToValidate,RegPattern)
{
	var expr = new RegExp(RegPattern);
	var result = expr.test(strToValidate);
	if(result==true){
		return true;
	}else{
		return false;
	}
}

function getXhttp( )
{
  var ajax_request;
  if(window.ActiveXObject)
   {
     var mSoftVersions = [
         'MSXML2.DOMDocument.5.0',
         'MSXML2.DOMDocument.4.0',
         'MSXML2.DOMDocument.3.0',
         'MSXML2.DOMDocument.2.0',
         'MSXML2.DOMDocument',
         'Microsoft.XmlDom',
         'Msxml2.XMLHTTP',
         'Microsoft.XMLHTTP'
       ];
	   for(i=0; i<mSoftVersions.length; i++)
	   {
       try{ajax_request = new ActiveXObject (  mSoftVersions[i]  );}catch(e){}
	   }
   }
  else if(  !ajax_request && typeof XMLHttpRequest != 'undefined'  ) 
   {
     try{ajax_request = new XMLHttpRequest;}  catch (  e  )  {    }
   }
  else if(!ajax_request && window.createRequest )
   {
    	try {ajax_request = window.createRequest;}  catch (  e  )  {    }
   }
  else
   {
     ajax_request = false;
   }
    return ajax_request;
}
function send_quation(name,emailAdd,company,address,city,country,postcode,pnumber,description)
{
   var xml=getXhttp();
   if(!xml)return false; //Usually you alert something but I don't :d
    xml.open('POST', 'send_quotation.php');
    xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
    if(document.lightquotationfrm.address2.vale!=""){address2=document.lightquotationfrm.address2.vale;}else{address2="";}
    if(document.lightquotationfrm.webdesign.checked==true){webdesign="Yes";}else{webdesign="";}
    if(document.lightquotationfrm.webdevelopemnt.checked==true){webdevelopemnt="Yes";}else{webdevelopemnt="";}
    if(document.lightquotationfrm.ecommerce.checked==true){ecommerce="Yes";}else{ecommerce="";}
    if(document.lightquotationfrm.wordpress.checked==true){wordpress="Yes";}else{wordpress="";}
    if(document.lightquotationfrm.joomla.checked==true){joomla="Yes";}else{joomla="";}
    if(document.lightquotationfrm.flash.checked==true){flash="Yes";}else{flash="";}
    if(document.lightquotationfrm.seo.checked==true){seo="Yes";}else{seo="";}
    if(document.lightquotationfrm.others.checked==true){others="Yes";}else{others="";}
    //CHECKS DONE HERE.
    xml.onreadystatechange = function() {ajaxDone("infoMSG",xml);};
    xml.send('name=' + name + '&emailAdd=' + emailAdd + '&company=' + company + '&address=' + address + '&address2=' + address2 + '&city=' + city + '&country=' + country + '&postcode=' + postcode + '&pnumber=' + pnumber + '&description=' + description + '&webdesign=' + webdesign + '&webdevelopemnt=' + webdevelopemnt + '&ecommerce=' + ecommerce + '&wordpress=' + wordpress + '&joomla=' + joomla + '&flash=' + flash + '&seo=' + seo + '&others=' + others);
    //ANYTHING EXTRA IS ADDED HERE.
}

function ajaxDone(target,xml) 
{
			// only if req is "loaded"
	if(xml.readyState == 4) 
	{ 
		// only if "OK"
		if (xml.status == 200 || xml.status == 304) 
		{
			results = xml.responseText;
			document.getElementById(target).innerHTML = results;
			document.lightquotationfrm.reset();
		} 
		else 
		{
			document.getElementById(target).innerHTML="ajax error:\n" +
			xml.statusText;
		}
	}
}

/*
function send_quation(name,emailAdd,company,address,city,country,postcode,pnumber,description)
{
	send_quation_ajax("../send_quotation.php","infoMSG",name,emailAdd,company,address,city,country,postcode,pnumber,description);
}
function send_quation_ajax(url,target,name,emailAdd,company,address,city,country,postcode,pnumber,description)
{
	   // native XMLHttpRequest object
   document.getElementById(target).innerHTML = 'Requesting...';
   if (window.XMLHttpRequest) {
       req = new XMLHttpRequest();
     	 url	=	url+"?name=" + name + "&emailAdd=" + emailAdd + "&company=" + company + "&address=" + address + "&address2=" + address2 + "&city=" + city + "&country=" + country + "&postcode=" + postcode + "&pnumber=" + pnumber + "&description=" + description + "&webdesign=" + webdesign + "&webdevelopemnt=" + webdevelopemnt + "&ecommerce=" + ecommerce + "&wordpress=" + wordpress + "&joomla=" + joomla + "&flash=" + flash + "&seo=" + seo + "&others=" + others;
       req.onreadystatechange = function() {ajaxDone_free(target);};
       req.open("POST", url, true);
       req.send(null);
   // IE/Windows ActiveX version
   } else if (window.ActiveXObject) {
       req = new ActiveXObject("Microsoft.XMLHTTP");
       if (req) {
       	 	 url	=	url+"?name=" + name + "&emailAdd=" + emailAdd + "&company=" + company + "&address=" + address + "&address2=" + address2 + "&city=" + city + "&country=" + country + "&postcode=" + postcode + "&pnumber=" + pnumber + "&description=" + description + "&webdesign=" + webdesign + "&webdevelopemnt=" + webdevelopemnt + "&ecommerce=" + ecommerce + "&wordpress=" + wordpress + "&joomla=" + joomla + "&flash=" + flash + "&seo=" + seo + "&others=" + others;
           req.onreadystatechange = function() {ajaxDone_free(target);};
           req.open("POST",url, true);
           req.send();
       }
   }
}
function ajaxDone_free(target) 
{
			// only if req is "loaded"
	if(req.readyState == 4) 
	{ 
		// only if "OK"
		if (req.status == 200 || req.status == 304) 
		{
			results = req.responseText;
			document.getElementById(target).innerHTML = results;
		} 
		else 
		{
			document.getElementById(target).innerHTML="ajax error:\n" +
			req.statusText;
		}
	}
}
*/