function ajax_send(method,url,data){
	var xmlhttp=ajax_object();
	if (!xmlhttp){
		return false;
	}
	if(method=="GET"){
		if(data == 'null'){
			xmlhttp.open("GET",url,true);
		}else{
			xmlhttp.open("GET",url+"?"+data,true);
		}
		xmlhttp.send(null);
	}else if(method == "POST"){
		xmlhttp.open("POST",url,true);
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttp.send(data);
	}
	return true;
}

function ajax_response(text){
	var data=new Array();
	var r=text.split('&');
	var p;
	for(var i in r){
		p=r[i].split('=');
		data[p[0]]=p[1];		
	}
	if(data['service']=='abo_participation'){
		if(data['redirect']=='1'){
			self.document.location.reload();
		}else{
			update_credit_participation(data['credit_participation']);
			if(data['resultat']==1){
				update_result_message("F&eacute;licitations, votre code kdo est gagnant.<br />Pensez &agrave; v&eacute;rifier vos informations personnelles sur le site afin que nous puissions vous envoyer facilement vos gains.");
			}else{
				update_result_message("D&eacute;sol&eacute;, votre code kdo n'est pas gagnant cette fois-ci.");
			}		
			abo_show_result(1);
		}
	}
}

function ajax_object(){
	var xmlhttp = false;
	
	/*@cc_on
	@if (@_jscript_version >= 5)
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	@else
	xmlhttp = false;
	@end @*/

	if(!xmlhttp && typeof XMLHttpRequest!='undefined'){
		try{
			xmlhttp=new XMLHttpRequest();
     	}catch(e){
			xmlhttp=false;
     	}
  	}

  	if(xmlhttp){
    	xmlhttp.onreadystatechange=function(){
        	if(xmlhttp.readyState==4){
				if(xmlhttp.status==200) {
           			ajax_response(xmlhttp.responseText);
				}
			}
		}
	}
	return xmlhttp;
}
