function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();
var zoneid;

function sndReqArg(action,arg,repl,id,call) {
    zoneid = id;
    http.open('post', 'http://www.isavaria-demo.com/gestion/index.php?do=clients&action='+action+'&arg='+encodeURIComponent(arg)+'&repl='+repl);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;

        document.getElementById(zoneid).innerHTML = response;
    }
}

function getRPC2HTML(action,arg,id) {
	var url = 'http://www.physigraph.net/index.php';
	var pars = 'do=rpc2&action='+action+'&arg='+encodeURIComponent(arg);
    var myAjax = new Ajax.Updater({success: id} , url, { method: 'post', postBody: pars, asynchronous : true, evalScripts:true, onFailure: reportError });

}
function getRPCGetHTML(action,arg,id) {
	
	var url = 'http://www.physigraph.net/index.php';
	var pars = 'do=rpc2&action='+action+'&arg='+encodeURIComponent(arg);
    var myAjax = new Ajax.Updater({success: id} , url, { method: 'get', parameters: pars, asynchronous : true, evalScripts:true, onFailure: reportError });

}
function getRPC3HTML(action,arg,id) {
	var url = 'http://www.physigraph.net/index.php';
	var pars = 'do=modal_clients&action='+action+'&arg='+encodeURIComponent(arg);
    var myAjax = new Ajax.Updater({success: id} , url, { method: 'post', postBody: pars, asynchronous : true, evalScripts:true, onFailure: reportError });

}



function reportError(request) {
	alert('Sorry. There was an error.  Try again / Une erreur est survenu.  Essayez encore');
}
/**
 *
 * @access public
 * @return void
 **/
function reportSuccess(request){
    alert('Successful request returned');
}

