    //FUNCTION: ajax_send
    //performs an ajax call 
    //parameters:
    //      sMethod             (string) the http method with which to send the request
    //                                    { "HEAD", "OPTIONS", "GET", "POST" }
    //      sUrl                (string) the url to call
    //      elementid           (string) a string to return as the second parameter in the callback
    //                                    to use default callback supply an element id to be set to
    //                                    display block here
    //      callbackfunction    (string) the name of a custom callback function (see below)
    //                                    omit for default behaviour
    //      sPost               (string) the value to send in a http post call
    //
    //returns:
    //      True    if ajax is supported
    //      False   if ajax is not supported


// 2009.06.25 MEB hack to make ajax work in even ie 6.0 and 5.5 ... build into existing code instead
//if (!XMLHttpRequest) { window.XMLHttpRequest = function() { return new ActiveXObject('Microsoft.XMLHTTP'); } }
    
    
    
    function ajax_send(sMethod, sUrl, parameter, /*OPTIONAL*/callbackfunction, /*OPTIONAL*/ sPost)
    {
        var xmlreq = null;
        if(callbackfunction == null) callbackfunction = ajax_callback;
        if(window.XMLHttpRequest) xmlreq = new XMLHttpRequest();
        else if (window.ActiveXObject)
		{
			//try 
//			{
//        		xmlreq = new ActiveXObject("Msxml2.DOMDocument");
//			}
//			catch (e)
//			{
//				try
//				{
//					xmlreq = new ActiveXObject("Microsoft.XMLHTTP")
//
//				}
//				catch (e)
//				{}
//			}
//		
			xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
		}
        if(xmlreq==null) return false;
        xmlreq.open(sMethod, sUrl);
        xmlreq.onreadystatechange = function() {
			callbackfunction( xmlreq, parameter) ;
		}
		
		//new Function(callbackfunction + "(xmlreq, \""+parameter+"\");");
		if(sMethod.toUpperCase() == "POST")
		{
		    xmlreq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		    xmlreq.setRequestHeader("Content-length", sPost.length);
            xmlreq.setRequestHeader("Connection", "close");
		    
		}
		
        xmlreq.send(sPost);
        return true;
    };

    //default callback behaviour if no callback function name is specified
    // ***** will set the display type of the element supplied to "block" if
    // ***** the returned status is 200 (OK)
    function ajax_callback(xmlreq, sElement){
        if (xmlreq.readyState == 4) {
            if (xmlreq.status == 200 && sElement != "") {
                //document.getElementById(sElement).style.display = "block";
            }
        }
}


function ajaxGetSessionVar(key) {
    var AJAX;
    
    if (window.XMLHttpRequest) 
    { 
        AJAX = new XMLHttpRequest(); 
    } 
    else 
    { 
        AJAX = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    if (AJAX) 
    {
        AJAX.open("GET", encodeURI("/admin/public/PN1/SessionHandler.ashx?sKey=" + key), false);
        AJAX.send(null);
        if (AJAX.readyState == 4 && AJAX.status == 200 && AJAX.responseText != null) {
            return AJAX.responseText;
        }
        else {
            return false;
        }
    } 
    else 
    { 
        return false; 
    } 
        
}

function ajaxSetSessionVar(key, value) {

    var AJAX;
    
    if (window.XMLHttpRequest) 
    { 
        AJAX = new XMLHttpRequest(); 
    } 
    else 
    { 
        AJAX = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    if (AJAX) 
    {
        AJAX.open("GET", encodeURI("/admin/public/PN1/SessionHandler.ashx?sKey=" + key + "&sValue=" + value), false);
        AJAX.send(null);
        if (AJAX.readyState == 4 && AJAX.status == 200 && AJAX.responseText != null) {
            return AJAX.responseText;
        }
        else {
            return false;
        }
    }
    else {
        return false;
    } 

}
	
	
    
//    //To change default behaviour implement your own callback function and supply 
//    //  the name to the ajax_send method parameters
//    function My_callBack(objXMLHttpRequest, strElementID)
//    {
//        var objStateElement = document.getElementById(strElementID);
//        if(objXMLHttpRequest.readyState == 4)
//        {
//            //call completed do stuff!
//        }
//    }