/* 
	E-CLOPE-FR.COM 2010
	BY MR.PING
*/


//
//  PANIER GESTION
//

function panierAjout(ID) {
	
	// ajax
	$.ajax({
		type: "GET",
		url: "../ajax/boutique.ajax.php",
		data: "option=1&arId="+ID,
		success: function(msg){
			
			var tab = msg.split('<¤>');
			
			// maj nbr element
			//$("#panierNbrArticle").fadeOut("fast", function () {
				$("#panierNbrArticle").text(tab[2]);
			//	$("#panierNbrArticle").fadeIn("fast");
			//});
			
			// maj cout total
			//$("#panierCout").fadeOut("fast", function () {
				$("#panierCout").text(tab[1]+' €');
			//	$("#panierCout").fadeIn("fast");
			//});
			
			// maj quantite total
			//$("#panierQuantiteT").fadeOut("fast", function () {
				$("#panierQuantiteT").text(tab[0]);
			//	$("#panierQuantiteT").fadeIn("fast");
			//});	
		}
	});
}


function panierVider() {	
	
	// ajax
	$.ajax({
		type: "GET",
		url: "../ajax/boutique.ajax.php",
		data: "option=2",
		success: function(msg){
			
			if(msg=="6d45f65d4fg6d4f65") {
				
				// maj nbr element
				$("#panierNbrArticle").fadeOut("fast", function () {
					$("#panierNbrArticle").text(0);
					$("#panierNbrArticle").fadeIn("fast");
				});
				
				// maj cout total
				$("#panierCout").fadeOut("fast", function () {
					$("#panierCout").text(0+' €');
					$("#panierCout").fadeIn("fast");
				});
				
				// maj quantite total
				$("#panierQuantiteT").fadeOut("fast", function () {
					$("#panierQuantiteT").text(0);
					$("#panierQuantiteT").fadeIn("fast");
				});		
			}
		}
	});
}


//
//  ANNONCE ANIMATION
//

var tabAnnonce = new Array('<img id="annonce" src="img/annonces/annonce1.png" width="600" height="100" />', '<img id="annonce" src="img/annonces/annonce2.png" width="600" height="100" />', '<img id="annonce" src="img/annonces/annonce3.png" width="600" height="100" />', '<img id="annonce" src="img/annonces/annonce4.png" width="600" height="100" />');
var annoncesSideId = Math.floor(Math.random() * 3);

function changeAnnonce () {
	$("#header_annonce").fadeTo(500, 0, function () { 
			document.getElementById("header_annonce").innerHTML = tabAnnonce[annoncesSideId];
			$("#header_annonce").fadeTo(800, 1);
			annoncesSideId++;
			if(annoncesSideId == 4) annoncesSideId=0;
		}
	);
	setTimeout(changeAnnonce, 5000);
}

setTimeout(changeAnnonce, 2000);



//
//  ALERT BOX
//

function alertClose(idDiv) {
	
	document.getElementById(idDiv).style.display = 'none';
}



//
//  QUESTION ANIMATION PAGE
//

function changePage() {
	
	$("#a_div1").fadeOut("fast", function () {
		$("#a_div2").fadeIn("fast");
	});
}


//
//  ECLOPE ? ANIMATION PAGE
//

var e_page = 'presentation';

function e_changePage(idPage) {
		
	$("#"+e_page).fadeOut("fast", function () {
		//$("#panierQuantiteT").text(0);
		$("#"+idPage).fadeIn("fast");
	});
	
	$("img[src='img/eclope_boutons/"+e_page+".png']").fadeTo("slow", 1);
	e_page = idPage;
}

function e_changePageBouton() {
		$("img[src='img/eclope_boutons/"+e_page+".png']").fadeTo("slow", 0.50);
		
		setTimeout("e_changePageBouton();", 2000);
}

setTimeout("e_changePageBouton();", 2000);

