var xmlRequest = {
	'div_dest':null,
	'complete':null,

	'handleSuccess':function(o){

		if(o.responseText != "" && this.div_dest){

			var pattern = /<script (.*)>([\S\s]*?)<\/script>/igm;
			var tabJs = "";
			while((tabJs = pattern.exec(o.responseText)) != null)
				eval(tabJs[2]);

			this.div_dest.innerHTML = o.responseText;

			if(this.complete != null){
				eval(this.complete);
			}

		}
	},
	'handleFailure':function(o){
		alert( o.status + " " + o.statusText)
	},
	'get':function(objet) {

		url = objet.url;
		call = callback;
		flux = '';
		type = "POST";

		this.div_dest = document.getElementById(objet.id);
		if(!this.div_dest){
			this.div_dest = document.getElementsByTagName("body")[0];
		}
		if(objet.indicator != undefined){
			this.div_dest.innerHTML = "<img class='centrer' src='"+objet.indicator+"'>";
		}


		if(objet.callback != undefined){
			call = objet.callback;
		}
		if(objet.flux != undefined){
			flux = objet.flux;
		}
		if(objet.type != undefined){
			type = objet.type;
		}

		if(objet.complete != undefined){
			this.complete = objet.complete;
		}

		if(objet.start != undefined){
			eval(objet.start);
		}

		if(type == "POST"){
			YAHOO.util.Connect.asyncRequest('POST', objet.url , call, flux);
		}
		if(type == "FORM"){
			YAHOO.util.Connect.setForm(document.getElementById(objet.formId), false);
			YAHOO.util.Connect.asyncRequest('POST', objet.url, call);
		}
		if(type == "UPLOAD"){
			YAHOO.util.Connect.setForm(document.getElementById(objet.formId), true);
			YAHOO.util.Connect.asyncRequest('POST', objet.url, callbackUpload);
		}
	}
};

/**
*
*	Classic callback
*
**/
var callback ={
	success: xmlRequest.handleSuccess,
	failure: xmlRequest.handleFailure,
	scope:xmlRequest,
	argument: "ok"
};

/**
*
*	Upload callback
*
**/
var callbackUpload = {
	upload : xmlRequest.handleSuccess,
	failure: xmlRequest.handleFailure,
	scope:xmlRequest,
	argument: "ok"
}