// JavaScript Document
function afficheExplication(id_calque,delai){
	
	calque_explication=document.getElementById("EX"+id_calque);
	calque_explication.style.display="block";
	
	setTimeout("masqueExplication()",delai);

}

function masqueExplication(){	
	calque_explication.style.display="none";
}

function changeTarif(selecteur){
	var pagination=selecteur.options[selecteur.selectedIndex].value;
	
	if(pagination == "")
	return;
	
	document.getElementById("t"+pagination).style.display="block";
	return;
}

function continueDemo(page){
	
		window.location=page;

}

function boucleTarif(){

		if(pagination_initiale==3)
			continueDemo("dmt2.php");
		
		var selecteur=document.form1.selecteur_tarif;
		selecteur.options[selecteur.selectedIndex].value=tbpag[pagination_initiale];
		selecteur.options[selecteur.selectedIndex].text=tbpag[pagination_initiale];
		
		if(pagination_initiale >0)
		document.getElementById("t"+tbpag[(pagination_initiale-1)]).style.display="none";
		document.getElementById("t"+tbpag[pagination_initiale]).style.display="block";
		
		
		pagination_initiale++;
		setTimeout("boucleTarif()",2000);		

}

function revelFrame(id_frame){

	document.getElementById(id_frame).style.display="block";
}

function anim(){

	var nb_anim=animation.length;
	
	for(i=0; i<nb_anim ;i++){		
		setTimeout(animation[i],timer[i]);
	}

}

/* Scripts dmt2*/
var winForm;
var image_select;

function CouleurBtn(){
	for (i=1; i<9; i++) {
		var image=document.getElementById("TYP"+i);
		image.style.backgroundColor=coul_page[i];
	}
}

function RollOverBtn(type_pages){
		var image=document.getElementById("TYP"+type_pages);
		image.style.backgroundColor=coul_page[9];
}

function RolloOutBtn(type_pages){
		var image=document.getElementById("TYP"+type_pages);
		if (type_pages==image_select) {
		image.style.backgroundColor=coul_page[0];
		} else {
		image.style.backgroundColor=coul_page[type_pages];
		}
}

function affichePages(type_pages){
	CouleurBtn();
	var image=document.getElementById("TYP"+type_pages);
	image_select=(type_pages);
	image.style.backgroundColor=coul_page[0];
	
	// recherche des images à afficher dans le container
	parent.leftFrame.window.location="affiche_pages.php?type="+type_pages;
	return;
}

function selectPage(num_image){
	
	//var champ_compteur_page=parent.leftFrame.document.getElementById("compteur_page");
	
	var image=document.getElementById("BT"+num_image);
	
	if(image.src.indexOf("off")!= -1){
		image.src="images/coche_on.gif";
		
	}else{
		image.src="images/coche_off.gif";
	}
	
	return;
}

function affichageGrand(page){
	
	if(winForm)
		winForm.close();
		
	var width=573;
	var height=563;
	winForm=window.open("preview.php?page="+page,"Page","width="+width+", height="+height+", left=200, top=100");
}

/*fenêtre preview*/

function fermeture3(){
	window.close();

}

/* scripts dmt3 */
function bougePage(sens,page){
	
	if(sens=="G" && page==2)
	return;
	
	if(sens=="D" && page==11)
	return;
	
	fleche=document.getElementById("F"+sens+page);
	var page_a_deplacer=document.getElementById("P"+page);
	
	if(sens=="G")
		var page_substitution=document.getElementById("P"+(page-1));
	else
		var page_substitution=document.getElementById("P"+(page+1));
		
		var tmp=page_substitution.src;
		
		page_substitution.src=page_a_deplacer.src;
		page_a_deplacer.src=tmp;
		
		return;
}

function toggleFleche(sens,cas,page){

	fleche=document.getElementById("F"+sens+page);
	fleche.src="images/accueil1/pt_fleche"+sens+cas+".gif"
	
	setTimeout("toggleFleche('"+sens+"','off',"+page+")",1500);	

}

/* scripts dmt4*/

function transform(){
	
	if(winForm)
		winForm.close();
		
	var width=573;
	var height=563;
	winForm=window.open("personnalisation.php","Personnalisation","width="+width+", height="+height+", left=200, top=100");
}


function changeValeur(){
	document.getElementById("perso1").innerHTML="Nature et Santé";
	document.getElementById("perso2").innerHTML="Une nouvelle vie avec le bio !";
	document.getElementById("perso3").innerHTML="35, rue de la gare<br>60400 NOYON";
	document.getElementById("perso4").innerHTML="tarif du 5 juin au 5 octobre 2006";
	document.getElementById("perso5").innerHTML="ouvert du lundi au samedi<br>de 9h à 12h et de 14h à 19h";
}

/*personnalisation (dmt4)*/
function saisie(champ,texte){

	var formulaire=document.form_perso;
	
	formulaire.elements["perso"+champ].value=texte;

}

function changeCouleurBouton(){
	var bouton=document.form_perso.bt_valid;
	bouton.style.backgroundColor="#666666";
	bouton.style.color="#FFFFFF";
	
}

function fermeture(){
	window.opener.changeValeur();
	window.close();

}

/* scripts dmt5*/
function changeOrdre(position,valeur){
	document.getElementById("prix"+position).innerHTML=valeur;
}

function appelProduitsRemplacement(){
	
	if(winForm)
		winForm.close();
		
	var width=563;
	var height=563;
	winForm=window.open("remplacement.php","Personnalisation","width="+width+", height="+height+", left=200, top=100");
}

function changeCouleurBouton2(){
	var bouton=document.form_perso.bt_valid;
	bouton.style.backgroundColor="#000099";
	bouton.style.color="#FFFFFF";
	
}
function validChangeProduit(position){
	document.getElementById("IM"+position).src="images/accueil1/p6.jpg";
	document.getElementById("TXT"+position).innerHTML="Yaourt Brebis ch&acirc;taigne<br>2 * 150 g.";
}

/* Page remplacement */
function selectProduit(position){
	var image=document.getElementById("B"+position);
	image.src="images/coche_on.gif";
}

function fermeture2(){
	window.opener.validChangeProduit(1);
	window.close();
}

/* gestion du navigateur*/
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
