
   function baseXMLHttpRequest() {
 		var req = false; 
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            req = new XMLHttpRequest();
            if (req.overrideMimeType) {
                req.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { // IE
            try {
                req = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
              try {
                 req = new ActiveXObject("Microsoft.XMLHTTP");
               }catch(e) {
                   alert("You need to enable active scripting and activeX controls");
              }
            }
        }
        if (!req) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        return req;
   }

   function openGetRequest(req,url,asynchronous) {
 	try {
	   req.open("GET", url, asynchronous);
		   req.setRequestHeader("MessageType","CALL")    
		   req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		   if (window.ActiveXObject) { // IE
		   	  req.send();
		   }else{
		      req.send(null);   // Mozilla, Safari, Opera etc...
		   }
	    } catch (e) {
	        alert(e);
	    }
   }
   function openPostRequest(req,url,parameter,asynchronous) {
 	try {
	   req.open("POST", url, asynchronous);
		   req.setRequestHeader("MessageType","CALL")    
		   req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		   req.send(parameter);
	    } catch (e) {
	        alert(e);
	    }
   }   

	/*
	  * Returns a function that waits for the specified XMLHttpRequest
	  * to complete, then passes it XML response to the given handler function.
	  * req - The XMLHttpRequest whose state is changing
	  * responseXmlHandler - Function to pass the XML response to
	  */
	 function getReadyStateLoadingHandler(req, controlId, loadingControlId, responseXmlHandler,loadingMessage) {
	   // Return an anonymous function that listens to the XMLHttpRequest instance
	   return function () {
	       //  0 (uninitialized)
	       //  1 (loading)
	       //   2 (loaded)
	       //   3 (interactive)
	       //  4 (complete) 
	      // alert(loadingControlId);
 	   document.getElementById(loadingControlId).style.display="block"; 
   	    // Since in NetScape 6.0+ , focus() is not working .So, to make AJAX work on NS6.0+ we are commenting it
   	  // document.getElementById(loadingControlId).focus(); 

   	   	
 	   if (req.readyState == 0) { 
          document.getElementById(loadingControlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Uninitialized! </center>';
       }       
       if (req.readyState == 1) { 
       		if((loadingMessage == "undefined")||(loadingMessage == null)||(loadingMessage == ""))loadingMessage = "Loading";
          document.getElementById(loadingControlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" />'+loadingMessage+'...</center>';
       }
       if (req.readyState == 2) { 
          document.getElementById(loadingControlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Loaded!</center>';
       }
       if (req.readyState == 3) { 
           document.getElementById(loadingControlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Interactive!</center>';
       }   
       if (req.readyState == 4) {
     	  // Check that we received a successful response from the server
      	 if (req.status == 200) {
        	 // Pass the XML payload of the response to the handler function.
        	 document.getElementById(loadingControlId).style.display="none"; 
        	 responseXmlHandler(req.responseXML,controlId);
     	  } else {
       	  // An HTTP problem has occurred
       	  alert("HTTP error "+req.status+": "+req.statusText);
       }
     }
   }
 }	
	/*
	  * Returns a function that waits for the specified XMLHttpRequest
	  * to complete, then passes it XML response to the given handler function.
	  * req - The XMLHttpRequest whose state is changing
	  * responseXmlHandler - Function to pass the XML response to
	  */
	 function getReadyStateHandler(req, controlId, responseXmlHandler) {
	   // Return an anonymous function that listens to the XMLHttpRequest instance
	   return function () {
	       //  0 (uninitialized)
	       //  1 (loading)
	       //   2 (loaded)
	       //   3 (interactive)
	       //  4 (complete) 
 	//   document.getElementById(controlId).style.display="block"; 
   	//   document.getElementById(controlId).focus(); 
   	   	
 	   if (req.readyState == 0) { 
         // document.getElementById(controlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Uninitialized! </center>';
       }       
       if (req.readyState == 1) { 
         // document.getElementById(controlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Loading...</center>';
       }
       if (req.readyState == 2) {  
       //   document.getElementById(controlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Loaded!</center>';
       }
       if (req.readyState == 3) { 
        //   document.getElementById(controlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Interactive!</center>';
       }   
       if (req.readyState == 4) {
     	  // Check that we received a successful response from the server
      	 if (req.status == 200) {
        	 // Pass the XML payload of the response to the handler function.
        	 responseXmlHandler(req.responseXML,controlId);
     	  } else {
       	  // An HTTP problem has occurred
       	  alert("HTTP error "+req.status+": "+req.statusText);
       }
     }
   }
 }
	
    function processStateChange(req,controlId) {
       return function () {
        //  0 (uninitialized)
       //  1 (loading)
       //   2 (loaded)
       //   3 (interactive)
       //  4 (complete) 
       document.getElementById(controlId).focus(); 
       if (req.readyState == 0) { 
           document.getElementById(controlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Uninitialized! </center>';
       }       
       if (req.readyState == 1) { 
           document.getElementById(controlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Loading...</center>';
       }
       if (req.readyState == 2) { 
           document.getElementById(controlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Loaded!</center>';
       }
       if (req.readyState == 3) {
           document.getElementById(controlId).innerHTML = '<center><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="center" /> Interactive!</center>';
       }       
        if (req.readyState == 4) { // Complete
            if (req.status == 200) { // OK response
                document.getElementById(controlId).innerHTML = "";
                document.getElementById(controlId).innerHTML = req.responseText;
            } else {
                alert("Problem: The system was unable to perform your request.");
            }
        }
        
        }
    }

/*
  function toggleLoading(currLoading){
    	 if (document.getElementById){
		   thisLoading=document.getElementById(currLoading).style;
	       if (thisLoading.display == "block"){
    	   		thisLoading.display = "none" ;
	       }else {
      	       	thisLoading.display = "block";
	       }
    	   return false
	     }else {
	     	return true;      
		 }
   }
*/


/* Added to display the loading icon aligned at left (TMB-WR-0070) */

	 function getReadyStateLoadingHandlerAtLeftAligned(req, controlId, loadingControlId, responseXmlHandler,loadingMessage) {
	   // Return an anonymous function that listens to the XMLHttpRequest instance
	   return function () {
	       //  0 (uninitialized)
	       //  1 (loading)
	       //   2 (loaded)
	       //   3 (interactive)
	       //  4 (complete) 
	      // alert(loadingControlId);
 	   document.getElementById(loadingControlId).style.display="block"; 
   	    // Since in NetScape 6.0+ , focus() is not working .So, to make AJAX work on NS6.0+ we are commenting it
   	  // document.getElementById(loadingControlId).focus(); 

   	   	
 	   if (req.readyState == 0) { 
          document.getElementById(loadingControlId).innerHTML = '<left><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="left" /> Uninitialized! </left>';
       }       
       if (req.readyState == 1) { 
       		if((loadingMessage == "undefined")||(loadingMessage == null)||(loadingMessage == ""))loadingMessage = "Loading";
          document.getElementById(loadingControlId).innerHTML = '<left><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="left" />'+loadingMessage+'...</left>';
       }
       if (req.readyState == 2) { 
          document.getElementById(loadingControlId).innerHTML = '<left><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="left" /> Loaded!</left>';
       }
       if (req.readyState == 3) { 
           document.getElementById(loadingControlId).innerHTML = '<left><img alt="Indicator" src="'+blurbeeImagesPath+'/loadingInt.gif" align="left" /> Interactive!</left>';
       }   
       if (req.readyState == 4) {
     	  // Check that we received a successful response from the server
      	 if (req.status == 200) {
        	 // Pass the XML payload of the response to the handler function.
        	 pause(500);
        	 document.getElementById(loadingControlId).style.display="none"; 
        	 responseXmlHandler(req.responseXML,controlId);
     	  } else {
       	  // An HTTP problem has occurred
       	  alert("HTTP error "+req.status+": "+req.statusText);
       }
     }
   }
 }