           var http_request = false;
		   function makePOSTRequest(url, parameters) {
			  http_request = false;
			  if (window.XMLHttpRequest) { // Mozilla, Safari,...
				 http_request = new XMLHttpRequest();
				 if (http_request.overrideMimeType) {
					// set type accordingly to anticipated content type
					//http_request.overrideMimeType('text/xml');
					http_request.overrideMimeType('text/html');
				 }
			  } else if (window.ActiveXObject) { // IE
				 try {
					http_request = new ActiveXObject("Msxml2.XMLHTTP");
				 } catch (e) {
					try {
					   http_request = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e) {}
				 }
			  }
			  if (!http_request) {
				 alert('Cannot create XMLHTTP instance');
				 return false;
			  }
			  
			  http_request.onreadystatechange = alertContents;
			  http_request.open('POST', url, true);
			  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			  http_request.setRequestHeader("Content-length", parameters.length);
			  http_request.setRequestHeader("Connection", "close");
			  http_request.send(parameters);
		   }
		
		   function alertContents() {
			  if (http_request.readyState == 4) {
				 if (http_request.status == 200) {
					//alert(http_request.responseText);
					result = http_request.responseText;
				 } else {
					alert('There was a problem with the request.');
				 }
			  }
		   }
		   
		   
		   function sendEnquiry(obj)
		   	   {
				 var isValid = true;
				 
				 if(document.getElementById("FirstName").value==""){
					alert("Please enter Name.");
					document.getElementById("FirstName").focus();
					isValid = false;
					return false;
					
				}else if(document.getElementById("EmailId").value==""){
					alert("Please enter EmailId.");
					document.getElementById("EmailId").focus();
					isValid = false;
					return false;
				}else if(document.getElementById("PhoneNo").value==""){
					alert("Please enter Phone Number.");
					document.getElementById("PhoneNo").focus();
					isValid = false;
					return false;
					   
				}else if(document.getElementById("RequestFor").value=="0"){
					alert("Please select the option 'Request For'.");
					document.getElementById("RequestFor").focus();
					isValid = false;
					return false;
					   
				} else if(document.getElementById("RequestFor").value=="1"){
						if(document.getElementById("visitorPrentStat").value==""){
							alert("Please enter site present status.");
							document.getElementById("visitorPrentStat").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("visitoraddress").value==""){
							alert("Please enter address.");
							document.getElementById("visitoraddress").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("visitorcontime").value==""){
							alert("Please enter Convenient Time.");
							document.getElementById("visitorcontime").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("visitorPurccontime").value=="Please Select"){
							alert("Please enter Estimated Time of Purchase.");
							document.getElementById("visitorPurccontime").focus();
							isValid = false;
							return false;
							   
						}
				}else if(document.getElementById("RequestFor").value=="2"){
						if(document.getElementById("demoproduct").value==""){
							alert("Please enter Product(s).");
							document.getElementById("demoproduct").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("demowhowill").value==""){
							alert("Please enter Profile of the Attendees .");
							document.getElementById("demowhowill").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("demovisitorcontime").value==""){
							alert("Please enter Convenient Time.");
							document.getElementById("demovisitorcontime").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("demovisitoraddress").value==""){
							alert("Please enter Address.");
							document.getElementById("demovisitoraddress").focus();
							isValid = false;
							return false;
						}else if(document.getElementById("Purchase").value=="Please Select"){
							alert("Please enter Estimated Time of Purchase.");
							document.getElementById("Purchase").focus();
							isValid = false;
							return false;
						}
				}else if(document.getElementById("RequestFor").value=="3"){
						if(document.getElementById("quoteproduct").value==""){
							alert("Please enter Product Name.");
							document.getElementById("quoteproduct").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("quotereq").value==""){
							alert("Please enter Description of Requirement.");
							document.getElementById("quotereq").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("quotebudget").value==""){
							alert("Please enter Estimated Budget.");
							document.getElementById("quotebudget").focus();
							isValid = false;
							return false;
							   
						}else if(document.getElementById("quotevalidate").value==""){
							alert("Please enter Validity of Quote.");
							document.getElementById("quotevalidate").focus();
							isValid = false;
							return false;
						}
				}
				
				
				
		   
		   
		  if(isValid == true){
			   var poststr = "FirstName=" +  document.getElementById("FirstName").value +
			   '&FirstName='+ document.getElementById("FirstName").value +
			   '&EmailId='+ document.getElementById("EmailId").value+
			   '&PhoneNo='+ document.getElementById("PhoneNo").value+
			   '&RequestFor='+ document.getElementById("RequestFor").value+
			   '&visitorPrentStat='+ document.getElementById("visitorPrentStat").value +
			   '&visitoraddress='+ document.getElementById("visitoraddress").value +
			   '&visitorcontime='+ document.getElementById("visitorcontime").value +
  			   '&visitorPurccontime='+ document.getElementById("visitorPurccontime").value +
			   '&demoproduct='+ document.getElementById("demoproduct").value +
			   '&demowhowill='+ document.getElementById("demowhowill").value +
			   '&demovisitorcontime='+ document.getElementById("demovisitorcontime").value +
			   '&demovisitoraddress='+ document.getElementById("demovisitoraddress").value +
			   '&Purchase='+ document.getElementById("Purchase").value +
			   '&quoteproduct='+ document.getElementById("quoteproduct").value +
			   '&quotereq='+ document.getElementById("quotereq").value +
			   '&quotebudget='+ document.getElementById("quotebudget").value +
			   '&quotevaldate='+ document.getElementById("quotevalidate").value;
			  
			  makePOSTRequest('?task=submit', poststr);
			  document.getElementById('FirstName').value = '';
			  document.getElementById('EmailId').value = '';
			  document.getElementById('PhoneNo').value = '';
			  document.getElementById('RequestFor').value = '0';
			     $("#slide_visit_div").hide();
				 $("#slide_quote_div").hide();
				 $("#slide_demo_div").hide();
			  document.getElementById('visitorPrentStat').value = '';
			  document.getElementById('visitoraddress').value = '';
			  document.getElementById('visitorcontime').value = '';
			  document.getElementById('visitorPurccontime').value = '';
			  document.getElementById('demoproduct').value = '';
			  document.getElementById('demowhowill').value = '';
			  document.getElementById('demovisitorcontime').value = '';
			  document.getElementById('demovisitoraddress').value = '';
			  document.getElementById('Purchase').value = 'Please Select';
			  document.getElementById('quoteproduct').value = '';
			  document.getElementById('quotereq').value = '';
			  document.getElementById('quotebudget').value = '';
			  document.getElementById('quotevalidate').value = '';
			  alert('Your Request has been submitted successfully, we will get back to you soon. Thank you!');
			  return false;
		   }
		    return true;
   }
   
   function emailvalidation()
{
        var myform = document.myform;
        var checkEmail = "@.";
        var checkStr = myform.EmailId.value;
        var EmailValid = false;
        var EmailAt = false;
        var EmailPeriod = false;
        for (i = 0;  i < checkStr.length;  i++)
        {
            ch = checkStr.charAt(i);
            for (j = 0;  j < checkEmail.length;  j++)
            {
                if (ch == checkEmail.charAt(j) && ch == "@") 
                EmailAt = true;
                if (ch == checkEmail.charAt(j) && ch == ".")
                EmailPeriod = true;
                if (EmailAt && EmailPeriod)
                break;
                if (j == checkEmail.length)
                break;
            }
// if both the @ and . were in the string
            if (EmailAt && EmailPeriod)
            {
                EmailValid = true
                break;
            }
        }
        if (!EmailValid)
        {
            alert("The \"email\" Field Must Contain an \"@\" and a \".\".");
            myform.EmailId.focus();
            myform.EmailId.value="";
            return (false);
        }
       
        var pos=checkStr.lastIndexOf(".");
            var extn=checkStr.substring(pos,checkStr.length).toLowerCase();
               
               
        if (! (extn==".com" || extn==".in" || extn==".org" || extn==".co.in"))
       
            {
                alert('Invalid Email Extention !!!');
                document.myform.EmailId.focus();
				yform.EmailId.value="";
                return false;
            }
       
}



function charvalid(field_id)
			{
				var Alphabet;
				//Alphabet = "^[a-zA-Z]+$";
				Alphabet =/^[A-Za-z]+$/;
				//A-Z or a-z Alphabets only allowed

				var name = document.getElementById(field_id).value;
				if (name.search(Alphabet) == -1) 
				//	Or
				//if (!name.match(Alphabet))
				{
					alert ("please enter characters only");
					document.getElementById(field_id).focus();
					document.getElementById(field_id).value="";
				}
				
			}





function dodacheck(val)
    {   
	   var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\!\|]/; 
		var strPass = val.value;
		var strLength = strPass.length;
		var lchar = val.value.charAt((strLength) - 1);
		if(lchar.search(mikExp) != -1)
		  {
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
		   }
    }
	
function charvalidation(val)
    {   
	   var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\!\~\=\|]/;
	   var C_NUM = /[0-9][0-9]*/;
		var strPass = val.value;
		var strLength = strPass.length;
		var lchar = val.value.charAt((strLength) - 1);
		if(lchar.search(mikExp) != -1)
		  {
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
		   }
		   else if(lchar.search(C_NUM) != -1) {
	var tst = val.value.substring(0, (strLength) - 1);
	val.value = tst;
   	   }
    }

function numbervalidation(val)
    {   
	   var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\a-z\A-Z\!\|]/;
		var strPass = val.value;
		var strLength = strPass.length;
		var lchar = val.value.charAt((strLength) - 1);
		if(lchar.search(mikExp) != -1)
		  {
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
		   }
    }

			
function PhoneValidate(num_id)
{
   if(document.getElementById(num_id).value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
      alert("The phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
	  document.getElementById(num_id).focus();
      document.getElementById(num_id).value="";
      
   }
 }			
			

