//Create a boolean variable to check for a valid Internet Explorer in
    
var xmlhttp2 = false;

    //Check if we are using IE.
    try {
        //If the Javascript version is greater than 5.
        xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
            //If not, then use the older active x object.
            try {
                //If we are using Internet Explorer.
                xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                //Else we must be using a non-IE browser.
                xmlhttp2 = false;
            }
    }
//If we are using a non-IE browser, create a javascript instance of t
if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
   		  xmlhttp2 = new XMLHttpRequest();
}
				
				
function makerequest2(serverPage, objID) {
				 var obj = document.getElementById(objID);
				 xmlhttp2.open("GET", serverPage);
				 xmlhttp2.onreadystatechange = function() {
				       if (xmlhttp2.readyState == 4) {
					    if (xmlhttp2.status == 200) {
				  		 obj.innerHTML = xmlhttp2.responseText;
					    } else {
						 obj.innerHTML = xmlhttp2.status + xmlhttp2.statusText;
					    }
					 }
				 }

xmlhttp2.send(null);
}

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 xmlhttp2 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;
            document.getElementById('post').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function get(obj) {
	 
	 									// This is used to get the checked boxes from the array
										// of options available to the user
	 									boxes = document.getElementById("demo").chk1.length;
										txt = "";
										for (i = 0; i < boxes; i++) {
  										if (document.getElementById("demo").chk1[i].checked) {
  											 txt = txt + document.getElementById("demo").chk1[i].value + "<br />";
  										}
									  }	
										
										// This creates a string to post to the salesman email
										// and show the user what he requested.  
      var poststr = "contactName=" + encodeURI( document.getElementById("contactName").value ) +
                    "&company=" + encodeURI( document.getElementById("company").value ) +
										"&address1=" + encodeURI( document.getElementById("address1").value ) +
										"&address2=" + encodeURI( document.getElementById("address2").value ) +
										"&city=" + encodeURI( document.getElementById("city").value ) +
										"&state=" + encodeURI( document.getElementById("state").value ) +
										"&zip=" + encodeURI( document.getElementById("zip").value ) +
										"&phone=" + encodeURI( document.getElementById("phone").value ) +
										"&email=" + encodeURI( document.getElementById("email").value ) +
										"&txtHelp=" + encodeURI( document.getElementById("txtHelp").value ) +
										"&chk1=" + encodeURI( txt ) +
										"&chk2=" + encodeURI( document.getElementById("chk2").checked );
										
										

		
      makePOSTRequest('demo.php', poststr);
   }
