var http_request_post = false;
   function makePOSTRequest(url, parameters) {
      http_request_post = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request_post = new XMLHttpRequest();
         if (http_request_post.overrideMimeType) {
         	// set type accordingly to anticipated content type
            http_request_post.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request_post = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request_post = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request_post) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request_post.onreadystatechange = alertContents;
      http_request_post.open('POST', url, true);
      http_request_post.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request_post.setRequestHeader("Content-length", parameters.length);
      http_request_post.setRequestHeader("Connection", "close");
      http_request_post.send(parameters);
   }

   function alertContents() {
   
   		if (http_request_post.readyState < 4) {
		var processing_text = "<div class='process_msg'><img src=\"images/processing_green.gif \"> Please wait ...</div><br>";
		var ajaxDisplay = document.getElementById('contactinfomsg');
		ajaxDisplay.innerHTML = processing_text; 
		}			
		
   
      if (http_request_post.readyState == 4) {
         if (http_request_post.status == 200) {
            var result = http_request_post.responseText;			
            document.getElementById('contactinformation').innerHTML = result; 		 
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   
function get(theForm) {
document.contactform.btnsubmit.disabled = true;
document.contactform.btnreset.disabled = true;

 var formdata="";
 //url=action page for possted form

 //Set up the parameters of our AJAX call
 for (i=0; i < theForm.length; i++)
    {
         //Build Send String      
		
		 if(theForm.elements[i].type == "text"){ //Handle Textbox's
                  formdata = formdata + theForm.elements[i].name + "=" + escape(theForm.elements[i].value) + "&";                      
		 }
		 if(theForm.elements[i].type == "hidden"){ //Handle hiiden
                  formdata = formdata + theForm.elements[i].name + "=" + escape(theForm.elements[i].value) + "&";
         }
		 else if(theForm.elements[i].type == "textarea"){ //Handle textareas
                  formdata = formdata + theForm.elements[i].name + "=" + escape(theForm.elements[i].value) + "&";
         }
		 else if(theForm.elements[i].type == "checkbox"){ //Handle checkbox's
		 	if(theForm.elements[i].checked==true){
                 formdata = formdata + theForm.elements[i].name + "=" + theForm.elements[i].value + "&";
			}
         }
		 else if(theForm.elements[i].type == "radio"){ //Handle Radio buttons
          if(theForm.elements[i].checked==true){
                     formdata = formdata + theForm.elements[i].name + "=" + theForm.elements[i].value + "&";
                  }
         }
		 
		 else{
                  //finally, this should be select box.
                  formdata = formdata + theForm.elements[i].name + "=" + escape(theForm.elements[i].value) + "&";
         }

		 /*for text editor */ 

		  }	  

	  
      makePOSTRequest('contact_process.php', formdata);
	  
   }
