function GetXmlHttpObjectall() {

	all=null;
	try {
	all=new XMLHttpRequest();}
	catch (e) {
	try {
	all=new ActiveXObject("Msxml2.XMLHTTP");}
	catch (e) {
	all=new ActiveXObject("Microsoft.XMLHTTP");}}
	return all;
	
}

function allreadystatchange(post,id) {

	id_change = id;	
	url="ajax.html";
	gid('waiting').innerHTML = "<img src='gfx/wait.gif' align='absmiddle' />";
	all=GetXmlHttpObjectall();	
	all.onreadystatechange=stateChangedall;
	all.open("POST",url,true);
	
	if (post != '') {
		
		all.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		all.send(post);
	
	}
	else all.send(null);
	

}

function stateChangedall(id) { 
	
	if (all.readyState==4 && all.status==200) {
		all=all.responseText;
		
		gid('waiting').innerHTML = "";
		if (id_change != null) {
			
			gid(id_change+"div").innerHTML=all;
			
			if (id_change == "gp") {				
				
				post = "y="+gid("year").value+"&t="+bb+"&s="+ee+"&p=1"+"&ms=1";;			
				
				allreadystatchange(post,'ss');			
			}
			else if (id_change == "ss") {				
				
				post = "y="+gid("year").value+"&t="+bb+"&s="+cc+"&p=1"+"&mp=1";;			
				
				allreadystatchange(post,'p1');			
			}
			else if (id_change == "p1") {
				
				post = "y="+gid("year").value+"&t="+bb+"&s="+dd+"&p=2"+"&mp=1";;	
					
				allreadystatchange(post,'p2');
	
			}
					
		}
		
	}	
}
function urlencode(ch) {
	ch = ch.replace(/[ ]/g,"+")
return escape(ch)
}

function send_msg_contact(nom,email,msg) {	
	
	url="contact.html";	
	post = "Nom="+urlencode(nom)+"&Email="+urlencode(email)+"&Message="+urlencode(msg);	
	all=GetXmlHttpObjectall();	
	all.onreadystatechange=return_contact;
	all.open("POST",url,true);		
	all.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	all.send(post);

}
function return_contact() {
	if (all.readyState==4 && all.status==200) {		
		alert(all.responseText);	
	}
}
