// JavaScript Document

// JavaScript Document

var winfenetre = null;
var contentWin;
function inscription(){
if(winfenetre!=null)winfenetre.close();
winfenetre = new Window({className: "alphacube", title: "Inscription", 
                      top:70, left:100, width:500, height:470, 
                      url: "/index.php?rq=users_display_inscription", showEffectOptions: {duration:1.5}})
winfenetre.showCenter();
winfenetre.show();                                            
	}

function rechercher(){
if(winfenetre!=null)winfenetre.close();
winfenetre = new Window({className: "alphacube", title: "Rechercher", 
                      top:70, left:100, width:400, height:200, 
                      url: "/html/site/recherche.html", showEffectOptions: {duration:1.5}})
winfenetre.showCenter();
winfenetre.show();                                            
}	
/*
function contact(){
if(winfenetre!=null)winfenetre.close();
winfenetre = new Window({className: "alphacube", title: "Contact", 
                      top:70, left:100, width:500, height:200, 
                      url: "html/site/site_contact.html", showEffectOptions: {duration:1.5}})
winfenetre.showCenter();
winfenetre.show();                                            
	}
*/	
function identification(){
if(winfenetre!=null)winfenetre.close();
winfenetre = new Window({className: "alphacube", title: "Session", 
                      top:70, left:100, width:500, height:250, 
                      url: "/index.php?rq=users_display_session", showEffectOptions: {duration:1.5}})
winfenetre.showCenter();
winfenetre.show();                                            
	}
	
function mdp_oublie(){
if(winfenetre!=null)winfenetre.close();
winfenetre = new Window({className: "alphacube", title: "Mot de passe oublié", 
                      top:70, left:100, width:500, height:220, 
                      url: "/index.php?rq=users_mdp_oublie_display", showEffectOptions: {duration:1.5}})
winfenetre.showCenter();
winfenetre.show();                                            
	}	

	
	
	
function compte(rq){
	if(rq==null)rq="users_comptexml";
	display_div("compteloading",true);
	 ajax = new Ajax.Request("/index.php",{
     method: "GET",
     parameters: "rq="+rq,
     onSuccess: function(transport, json) {
			if (200 == transport.status){
			//	alert(transport.responseText);
				if(!json){
					alert("Erreur transmition de données");
					alert(transport.responseText);
					return;
				}
				if(json.error!=""){
					display_div("compteloading",false);
				}
				
				if(json.message=="session_detroy" && document.location.href.indexOf("rq=adminsite_")!=-1){
					document.location.href="index.php";
				}
			  	else loadcompte(json);
			}
			 else 
				alert("Une erreur s'est produite");
		    }
     } );
}
