   var http_request = false;
   var clicks	  = 0;

   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) 
		 {
            result = http_request.responseText;
						//alert(result)
			   if (result == 1)
				{
				window.location.href="contactsuccess.html";
				}

				else if (result == 2)
				{
					write_captcha();
					document.getElementById('capt').value		= '';
					document.getElementById('errormsg').innerHTML = "Please enter the correct security code ";
					
				}
         } 
		 else 
		 {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function get(obj) 
   {
	where_val = "";

  if (document.f.where1.checked == true )
  	where_val = where_val + document.f.where1.value;
  if (document.f.where2.checked == true )
    where_val = where_val + "," + document.f.where2.value;
  if (document.f.where3.checked == true) 
    where_val = where_val + "," + document.f.where3.value;
  if (document.f.where4.checked == true) 
    where_val = where_val + "," + document.f.where4.value;
	
	   //var poststr = "";
      var poststr = "Name=" + encodeURI( document.getElementById("Name").value ) +
	  "&Company_Name=" + encodeURI( document.getElementById("Company_Name").value ) +
	  "&Address=" + encodeURI( document.getElementById("Address").value ) +
	  "&Phone=" + encodeURI( document.getElementById("Phone").value ) +
	  "&Fax=" + encodeURI( document.getElementById("Fax").value ) +
	  "&Email=" + encodeURI( document.getElementById("Email").value ) +
  	  "&Subject=" + encodeURI( document.getElementById("Subject").value ) +
	  "&Interested_In=" + encodeURI( document.getElementById("Interested_In").value ) +
	"&Special_Requirements=" + encodeURI( document.getElementById("Special_Requirements").value ) +
	 "&where=" + encodeURI( where_val ) +
	"&where_others=" + encodeURI( document.getElementById("where_others").value ) +
	"&capt=" + encodeURI( document.getElementById("capt").value )+			  
	"&Submit=" + encodeURI( document.getElementById("Submit").value )+
	"&random="+Math.random();
//	alert(poststr)
      makePOSTRequest('contactformmaildotcom.php', poststr);
   }

   function write_captcha(){
   	clicks++;
	document.getElementById('errormsg').innerHTML = '';
   	document.getElementById('capt').value		= ''
	document.getElementById('captcha_id').innerHTML = '<img src="captcha_img.php?clicks=' + clicks + '" border="0" alt="SecurityCode" /> Refresh: <a style="cursor:pointer" onclick="write_captcha();"><img src="images/refresh.gif" border="0" alt="SecurityCode" /></a>';
   return false;
   }
   
