
   
   
   var http_request = false;

   var spanName = "";

   function setSpanName(spanID)
   {
      spanName =  spanID;
   }


  

   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 makePOSTRequestNew(url, parameters) {

      document.getElementById('box1').style.visibility = "hidden";
	 


	 
      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() {
      mySpan = spanName;
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById(mySpan).innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function get(obj,targetPost ) {

       if(targetPost == 'ISRPOST')
	   {
		  var poststr = "emailISR=" + encodeURI( document.getElementById("emailISR").value ) +
						"&passwordISR=" + encodeURI( document.getElementById("passwordISR").value );
		  makePOSTRequest('./post/postLoginInternalSalesRepresentative.php', poststr);
	   }

	   if(targetPost == 'SRPOST')
	   {
		  var poststr = "emailSR=" + encodeURI( document.getElementById("emailSR").value ) +
						"&passwordSR=" + encodeURI( document.getElementById("passwordSR").value );
		  makePOSTRequest('./post/postLoginSalesRepresentative.php', poststr);
	   }

	   if(targetPost == 'DPPOST')
	   {
		  var poststr = "emailDP=" + encodeURI( document.getElementById("emailDP").value ) +
						"&passwordDP=" + encodeURI( document.getElementById("passwordDP").value );
		  makePOSTRequest('./post/postLoginDataProcessors.php', poststr);
	   }
   
   }


    function getlogin(obj,targetPost ) {

       if(targetPost == 'BROKERPOST')
	   {
		
		  var poststr = "emailISR=" + encodeURI( document.getElementById("email").value ) +
						"&password=" + encodeURI( document.getElementById("password").value );
		  makePOSTRequestNew('./post/postLoginBroker.php', poststr);
	   }


       if(targetPost == 'CLIENTPOST')
	   {
		
		  var poststr = "emailISR=" + encodeURI( document.getElementById("email").value ) +
						"&password=" + encodeURI( document.getElementById("password").value );
		  makePOSTRequestNew('./post/postLoginClient.php', poststr);
	   }
	 
   }
