var xhr;

function getXhr(){
     
    if(window.XMLHttpRequest) // Firefox et autres
       xhr =  new XMLHttpRequest(); 
    else if(window.ActiveXObject){ // Internet Explorer 
       try {
                xhr = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                xhr = new ActiveXObject("Microsoft.XMLHTTP");
            }
    }
    else { // XMLHttpRequest non supporté par le navigateur 
       alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
       xhr = false; 
    }
    return xhr;
}
function changemonth(month,year,path,template){

    getXhr();

    xhr.onreadystatechange = function(){
//alert(xhr.readyState+' => '+xhr.status);
        if(xhr.readyState == 4 && xhr.status == 200){ 
					                                                                 
             divHtml = xhr.responseText;                                                                   
			 //alert(divHtml);								
			document.getElementById('divbottomcal').innerHTML=divHtml;

		}
                        
    }                  
                
                
    xhr.open("POST",path+"calendar.php?month="+month+"&year="+year+"&path="+path+"&template="+template,true);
  	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                
    xhr.send("");            
}
function changebabillard(today,nobabillard,path){

    getXhr();

    xhr.onreadystatechange = function(){
//alert(xhr.readyState+' => '+xhr.status);
        if(xhr.readyState == 4 && xhr.status == 200){ 
					                                                                 
             divHtml = xhr.responseText;                                                                   
			 //alert(divHtml);								
			document.getElementById('divbottombabillard').innerHTML=divHtml;

		}
                        
    }                  
                
                
    xhr.open("POST",path+"babillard.php?today="+today+"&nobabillard="+nobabillard+"&path="+path,true);
  	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                
    xhr.send("");            
}
function CreatUserVanilla(Email,Name,NewPassword,path){

		 PostBackAction = "Apply";
		 ReadTerms = "0";		 
		 ConfirmPassword = NewPassword; 
		 AgreeToTerms="1";

				getXhr();

				xhr.onreadystatechange = function(){
		 
					if(xhr.readyState == 4 && xhr.status == 200){					
						html = xhr.responseText;
	          
					}
				}


				xhr.open("POST",path+"forum/people.php",true);

				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');								
				xhr.send("PostBackAction="+PostBackAction+"&ReadTerms="+ReadTerms+"&Email="+Email+"&Name="+Name+"&NewPassword="+NewPassword+"&ConfirmPassword="+ConfirmPassword+"&AgreeToTerms="+AgreeToTerms);
				
}
function LogUserVanilla(Username,Password,path){

			PostBackAction = "SignIn";		
			ReturnUrl = "";
					 
				getXhr();

				xhr.onreadystatechange = function(){

					if(xhr.readyState == 4 && xhr.status == 200){					
						html = xhr.responseText;						 	
					   
					}
				}

				xhr.open("POST",path+"forum/people.php",true);

				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				xhr.send("PostBackAction="+PostBackAction+"&ReturnUrl="+ReturnUrl+"&Username="+Username+"&Password="+Password);
				
}
function LogOutUserVanilla(path){

			PostBackAction = "SignIn";		
			ReturnUrl = "";
					 
				getXhr();

				xhr.onreadystatechange = function(){

					if(xhr.readyState == 4 && xhr.status == 200){					
						html = xhr.responseText;						 	
	
	                       //document.write(html);

					}
				}

				xhr.open("GET",path+"forum/people.php?PostBackAction=SignOutNow",true);

				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				xhr.send("");
				
}