function createXmlHttp()
{
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (E) {
					xmlhttp = false;
				}
			}
	@end @*/

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
	{ 
		xmlhttp = new XMLHttpRequest(); 
	}
	return xmlhttp;
}





function writeXmlHttp ( sID, sURL ){


	var xh=createXmlHttp();
	
	if (xh==null)
	{
		/* browser doesnt seem to do xmlhttp, just do nothing */
	}else{
		xh.open('GET',sURL);
		xh.onreadystatechange = function() {
			if (xh.readyState==4)
			{	/* exec the response */

				document.getElementById(sID).innerHTML = xh.responseText;	
			}
		}
		xh.send(null);
	}//if
	
}//writeXmlHttp()








function makePOSTRequest(url, parameters) {
	
		/*
		Code originally from: http://www.captain.at/howto-ajax-form-post-request.php
		but some changes have been made
		
		Assumptions: that the page has a notifyUser() function.
		*/
		
		var xh = createXmlHttp();
		
	    xh.onreadystatechange=function() {
		
			if (xh.readyState==4) {
		
				notifyUser(xh.responseText)
		
			}//if
		
		}//function
		
		
		xh.open('POST', url, true);
		xh.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xh.setRequestHeader("Content-length", parameters.length);
		if (setConnectionHeader(xh)){
		    //skip, just to make sure it gets set before moving on.
		}//setConnHeader
		xh.send(parameters);
		//alert(parameters);
		
	}//makePOSTRequest()
	
	
	
	
	
	
	
	
	function createPostString ( frm ){
		//loop thru the form and return a string of all the fields and the values
		var frmLength = frm.length;
		var bFirstLoop = true;
		var i;
		var s = "";

		for (i=0; i<frmLength;i++){
			
			if( bFirstLoop == true){
				bFirstLoop = false;
			}else{
				
				s = s + "&"
			}//if
			
			s = s + frm[i].name + "=" + encodeURI( frm[i].value );
			
		}//for
		
		return s;


   }//createPostString()
   
   
    function setConnectionHeader( xh ){
        /*
        Description:	Problem with IE6 and win2k, the browser hangs if the connection is closed.  
                        So this function will check the browser version, and if it is not IE6 then 
                        it will add the close value for the http header connection type.
		Date:			22-Mar-07
		Author:		Cameron Priem
		Output:		None
		Input:		the XML Http Object
		
		*/
        if (is_ie6){
            //skip
        }else{
            xh.setRequestHeader("Connection", "close");
        }//if
        return true;
    }//setConnectionHeader()
   
   function callAjaxEval (url, parameters)
	{
		
		var xh = createXmlHttp();
		
	    xh.onreadystatechange=function() {
		
			if (xh.readyState==4) {
		
				eval(xh.responseText)
		
			}//if
		
		}//function
		
		
		xh.open('POST', url, true);
		xh.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xh.setRequestHeader("Content-length", parameters.length);
		if (setConnectionHeader(xh)){
		    //skip, just to make sure it gets set before moving on.
		}//setConnHeader
		
		xh.send(parameters);
			
	}//
	
	function callAjaxHTML (htmlItem, url, parameters)
	{
		
		var xh = createXmlHttp();
		
	    xh.onreadystatechange=function() {
		
			if (xh.readyState==4) {
		
				htmlItem.innerHTML = xh.responseText;
				
			}//if
		
		}//function
		
		
		xh.open('POST', url, true);
		xh.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xh.setRequestHeader("Content-length", parameters.length);
		if (setConnectionHeader(xh)){
		    //skip, just to make sure it gets set before moving on.
		}//setConnHeader
		xh.send(parameters);
			
	}//
   
   