var AJAX={	
    SEND_CONFIRM_EMAIL           : [1, "idg-sSendConfirmSubEmail.php"        ],
    CONFIRM_WEBSITE_REGISTRATION : [2, "idg-sUpdateWebSiteSubscription.php"]
};


function ajaxFunction( url,                        // number: operation no. will use numbered script file as listed above
		               params,                     // parameter string
		               refreshPage,                // boolean: will refresh screen if true (after sql operation)
                       showMessage,                // will show result of operation (assigned by global variable)
			           fn                          // callback function if provided
                      ){
	var ajaxRequest, msg, result, bn=0;
	if(fn===undefined) { fn=null; }
//--------------------------------------------------------------------------------------------------------------
    try{
		ajaxRequest = new XMLHttpRequest();bn=1;     // Opera 8.0+, Firefox, Safari
	   } catch (e) { 
	      try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");bn=2;     // Internet Explorer Browsers
		     } catch (f) {
			    try{
				   ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");bn=3;  // Internet Explorer Browsers
			       } catch (g){
				     alert("Your browser doesn't support this feature");
				   }
		    }
	  }
//--------------------------------------------------------------------------------------------------------------
    ajaxRequest.open( "POST", url[1], true );  // 
   
//Send the proper header information along with the request

    ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    ajaxRequest.setRequestHeader("Content-length", params.length);
    ajaxRequest.setRequestHeader("Connection", "close");
   
   
    ajaxRequest.onreadystatechange = function() {
       if ((ajaxRequest.readyState===4) && (ajaxRequest.status===200)) {
             result= ajaxRequest.responseText;
			 if(showMessage)  { alert("Result of this operation ("+url+"): "+result); }
			 if(refreshPage)  { window.location.reload();                             }
             if (fn!=null)    { fn(url[0],result);                                    }
       }
    };
	
    ajaxRequest.send(params);
    return;
}

