//global variables
  var req ;
  var which;

 function getAjax(){ 
        var xmlhttp=false; 
        try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } 
        catch(e){ 
            try    {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } 
            catch(E) { xmlhttp=false; } 
        } 
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
        return xmlhttp; 
 }  


  
  function retrieveAllURL(url,nameOfFormToPost) {
    
    //get the (form based) params to push up as part of the get request
    url=url+getFormAsString(nameOfFormToPost);
    retrieveURL(url);
  }
  
  
  function retrieveURL(url) {
  
    
    //Do the Ajax call
    if (window.XMLHttpRequest) { // Non-IE browsers
        req = getAjax();
      req.onreadystatechange = processStateChange;
      try {
      	req.open("GET", url, true); //was get
      } catch (e) {
        alert("Problem Communicating with Server\n"+e);
      }
      req.send(null);
    } else  { // IE
      
      req = getAjax();
      if (req) {
        req.onreadystatechange = processStateChange;
        req.open("GET", url, true);
        req.send();
      }
    }
  }
  
    function retrieveURLImgContent(url) {
  
    
    //Do the Ajax call
    if (window.XMLHttpRequest) { // Non-IE browsers
        req = getAjax();
      req.onreadystatechange = processStateChangeImg;
      try {
      	req.open("GET", url, true); //was get
      } catch (e) {
        alert("Problem Communicating with Server\n"+e);
      }
      req.send(null);
    } else  { // IE
      
      req = getAjax();
      if (req) {
        req.onreadystatechange = processStateChangeImg;
        req.open("GET", url, true);
        req.send();
      }
    }
  }
  
   function processStateChangeImg() {
       
  	  if (req.readyState == 4) { // Complete
      if (req.status == 200) { // OK response
      
        //alert("Ajax response: "+req.responseText);
              
        //Use these span elements to update the page
         
        ajaxResponseImgContent(req.responseText);

      } else {
        alert("Problem with server response:\n " + req.statusText);
      }
    }
  }
  
   function retrieveURLProdContent(url) {
  
    
    //Do the Ajax call
    if (window.XMLHttpRequest) { // Non-IE browsers
        req = getAjax();
      req.onreadystatechange = processStateChangeProd;
      try {
      	req.open("GET", url, true); //was get
      } catch (e) {
        alert("Problem Communicating with Server\n"+e);
      }
      req.send(null);
    } else  { // IE
      
      req = getAjax();
      if (req) {
        req.onreadystatechange = processStateChangeProd;
        req.open("GET", url, true);
        req.send();
      }
    }
  }
  
   function processStateChangeProd() {
       
  	  if (req.readyState == 4) { // Complete
      if (req.status == 200) { // OK response
      
        //alert("Ajax response: "+req.responseText);
              
        //Use these span elements to update the page
         
        ajaxResponseProdContent(req.responseText);

      } else {
        alert("Problem with server response:\n " + req.statusText);
      }
    }
  }
  
     function retrieveURLLoginContent(url) {
  
    
    //Do the Ajax call
    if (window.XMLHttpRequest) { // Non-IE browsers
        req = getAjax();
      req.onreadystatechange = processStateChangeLogin;
      try {
      	req.open("GET", url, true); //was get
      } catch (e) {
        alert("Problem Communicating with Server\n"+e);
      }
      req.send(null);
    } else  { // IE
      
      req = getAjax();
      if (req) {
        req.onreadystatechange = processStateChangeLogin;
        req.open("GET", url, true);
        req.send();
      }
    }
  }
  
   function processStateChangeLogin() {
       
  	  if (req.readyState == 4) { // Complete
      if (req.status == 200) { // OK response
      
        //alert("Ajax response: "+req.responseText);
              
        //Use these span elements to update the page
         
        ajaxResponseLoginContent(req.responseText);

      } else {
        alert("Problem with server response:\n " + req.statusText);
      }
    }
  }
  
    function processStateChange() {
       
  	  if (req.readyState == 4) { // Complete
      if (req.status == 200) { // OK response
      
        //alert("Ajax response: "+req.responseText);
              
        //Use these span elements to update the page
         
        ajaxResponse(req.responseText);

      } else {
        alert("Problem with server response:\n " + req.statusText);
      }
    }
  }
  
  
  
   function getFormAsString(formName){
 	
 	//Setup the return String
 	returnString ="";
 	
  	//Get the form values
 	formElements=document.forms[formName].elements;
 	
 	//loop through the array , building up the url
 	//in the form /strutsaction.do&name=value
 	
 	for ( var i=formElements.length-1; i>=0; --i ){
 		//we escape (encode) each value
 		returnString=returnString+"&"+escape(formElements[i].name)+"="+escape(formElements[i].value);
 	}
 	
 	//return the values
 	return returnString; 
 }
 
 
 