var xhrObj = null;
var mstrCallee = null;

//##########################		
//callback function : Process the status of the query
//ENTRY : none
//EXIT : none
//##########################
function getResponse_callBack()
{
	var arrData;
	
	if(xhrObj.readyState == 4) {     
						
		switch (mstrCallee) {
			
			case "ExempleClientCalledFromJS":											
				//alert(xhrObj.responseText);
				//you can use xhrObj.responseText instead of  xhrObj.responseXML if the result data is not a recordset like a status for example (or to debug when processData.asp returns an error)
				fExempleClientJS_callback(xhrObj.responseXML);
				break;
				
			case "checkFileSize":															
				fcheckFileSize_callback(xhrObj.responseXML);
				break;
			
			case "sSubmitData":
				sSubmitData_Callback(xhrObj.responseText);
				break;
			
			default:				
				alert("Erreur data : " + xhrObj.responseText );				
				break;
		}
		
		mstrCallee = null;

	}
}

//##########################
//Save data into the DB
//ENTRY : string of all parameters (param1=value1&parma2=value2...&paramN=valueN)
//EXIT : none
//##########################
function processData(pstrData) {

	if(window.XMLHttpRequest) // Mozilla/Firefox 
		xhrObj = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
		xhrObj = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest doesn't supported by the browser
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		return; 
	}
			
	xhrObj.open("POST", "./utilities/processData.asp", true);
			
	xhrObj.onreadystatechange = getResponse_callBack;
		
	xhrObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	xhrObj.send(pstrData);
	
}
