var _TimerCompteClient = null;
var _TimerPanierRapide = null;
var _Timer = null;
var overdiv=0; //variable si div login ouvert
var ValidationForm = 0; // variable si clic sur validation formulaire de log

function $_(element){
	return document.getElementById(element);
}

function AffichePanierRapide(){
	CacheFormCompteClient();
	$('#PanierRapide').fadeIn('normal');
	KillTimerPanier();
	$_('FlechAccesPanier').innerHTML = "<img src='images/flech_login_haut.png' />";
}
function CachePanierRapide(){
	$('#PanierRapide').fadeOut('normal');
	$('#PanierRapide').slideUp('normal');
	$_('FlechAccesPanier').innerHTML = "<img src='images/flech_login_bas.png' />";
}

function AfficheFormCompteClient(){
		CachePanierRapide();
		$('#FormCompteClient').fadeIn('normal');
		$('#FormCompteClient').slideDown('normal');
		KillTimerMenuCompteClient();
		$_('FlechAccesCompteClient').innerHTML = "<img src='images/flech_login_haut.png' />";
}
function CacheFormCompteClient(){
	$('#FormCompteClient').fadeOut('normal');
	$('#FormCompteClient').slideUp('normal');
	$_('FlechAccesCompteClient').innerHTML = "<img src='images/flech_login_bas.png' />";
}

function KillTimerPanier(){
	if (_Timer){clearTimeout(_Timer)} 
}
function TimerPanier(){
	if (Number(overdiv) == '0'){
		
		_Timer = setTimeout ("CachePanierRapide()", 600);
		}
	else {
		KillTimerPanier();
		return false;	
	}
}


function KillTimerMenuCompteClient(){
	if (_TimerCompteClient){clearTimeout(_TimerCompteClient)} 
}

function TimerMenuCompteClient(){

	if (overdiv == 0 && ValidationForm == 0){
		_TimerCompteClient = setTimeout ("CacheFormCompteClient()", 600);
		}
	else {
		if (ValidationForm == 1 && overdiv == 0 ){
			_TimerCompteClient = setTimeout ("CacheFormCompteClient()", 2600);
		}
		else {
			KillTimerMenuCompteClient();
			return false;
		}
			
	}
	
	

}

function Affichage(retourajax,elementid){
	document.getElementById(elementid).innerHTML = retourajax;
}
function Affichage1(retourajax,elementid){
	document.getElementById(elementid).value = retourajax;
}
function Affichage3(retourajax,elementid){
	if (retourajax === '1'){window.location = './CaddieAffichage.html';}
}

function Affichage6(retourajax,elementid){
if (retourajax === "1"){
	alert ("Votre email à bien été inséré dans notre base! \n Vous recevrez prochainement les nouveautés du site ");
	}
}

function Modal_port(){
	tb_show('Frais de port', './calculport.php?width=515&height=365', null);
}
function Modal_image(image){
	tb_show('Esprit Discount | Photo', image, null);
}

function vide_champ(champ){
	$_(champ).value = "";
}

function ChangeInputToPassword(champ){
	$_(champ).type = "password";
	$_(champ).value = "";
}
function fn_recherche(){
	var data = $_('_recherche').value;
	window.location = "./index.php?page=_Recherche&q="+data;
}