document.onselectstart=new Function ("return false");

var precharge=new Array();
var banner=new Array();

// on lit les images
function CreationImg() {
	for (var i=0;i<pixarray.length;i++) {
		if (pixarray[i].indexOf("banner",0)>0) {
			banner[i]=new Image(); // création de l'image
			banner[i].src=pixarray[i]; // on charge sa source
		} else {	
			//alert(i);
			precharge[i]=new Image(); // création de l'image
			precharge[i].src=pixarray[i]; // on charge sa source
		}
	}
	Verification(); // on lance la procedure de verification
}

// cette fonction verifie a interval régulier si toutes les images sont chargées
// et redirige vers un page HTM le cas échéant
function Verification() {
	// on verifie pour chaque img si le chargement est fini
	var nb_charge=0;	
	for (var i=0;i<pixarray.length;i++) {
		if (pixarray[i].indexOf("banner",0)>0) {
			if (banner[i].complete) {
				nb_charge+=1;
			}
		} else {
			if (precharge[i]) {
				nb_charge+=1;
				//alert(i);
			}
		}
		//alert(nb_charge);
	}
	// on affiche le pourcentage complété dans la barre d'etat
	var pourcents=parseInt((nb_charge/pixarray.length)*100)+"% chargés...";
	// fini?
	if (nb_charge==pixarray.length/*&&document.images.dia_1&&document.images.dia_2&&document.images.dia_3*/) {
		hideloading();
		//window.defaultStatus="© 2007 Les Cuisines Robert Zink";			
	} else {
		alert(nb_charge+"/"+pixarray.length);
	  setTimeout("Verification();",500); // sinon on relance la verif dans 1/10eme de seconde
	}
}

function hideloading()	{
	loading.style.visibility="hidden";
}

function pic(itm)	{
	if(itm=="plan"){
		actualpic=parent.document.images.centrale.src;
		newpic="./images/plan.gif";
		if (document.all){
			parent.document.images.centrale.filters.blendTrans.Apply();
			parent.document.images.centrale.src = newpic;/*banner[banvar1].src*/;
			parent.document.images.centrale.filters.blendTrans.Play();
		}
	}else{
		actualpic=document.images.centrale.src;
		newpic="./images/plan.gif";
		if (document.all){
			document.images.centrale.filters.blendTrans.Apply();
			document.images.centrale.src = newpic;/*banner[banvar1].src*/;
			document.images.centrale.filters.blendTrans.Play();
		}
	}		
}

function pic_out(itm)	{
	if(itm=="plan"){
		if (document.all){
			parent.document.images.centrale.filters.blendTrans.Apply();
			parent.document.images.centrale.src = actualpic;/*banner[banvar1].src*/;
			parent.document.images.centrale.filters.blendTrans.Play();
		}
	}else{
		if (document.all){
			document.images.centrale.filters.blendTrans.Apply();
			document.images.centrale.src = actualpic;/*banner[banvar1].src*/;
			document.images.centrale.filters.blendTrans.Play();
		}
	}		
}

var baseopacity=30

function slowhigh(which2){
	imgobj=which2
	browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
	instantset(baseopacity)
	highlighting=setInterval("gradualfade(imgobj)",50)
}

function slowlow(which2){
	cleartimer()
	instantset(baseopacity)
}

function instantset(degree){
	if (browserdetect=="mozilla")
	imgobj.style.MozOpacity=degree/100
	else if (browserdetect=="ie")
	imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
	if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
	if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
	cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
	else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
	cur2.filters.alpha.opacity+=10
	else if (window.highlighting)
	clearInterval(highlighting)
}
function position(){
	marge_ver=((parent.document.body.clientWidth-514)/2);
	marge_hor=((parent.document.body.clientHeight-388)/2);
	parent.document.getElementById("photo").style.left=0;
	parent.document.getElementById("photo").style.top=0;
	parent.document.getElementById("photo2").style.left=marge_ver;
	parent.document.getElementById("photo2").style.top=marge_hor;
}
function montre(pic) {
	marge_ver=((parent.document.body.clientWidth-514)/2);
	marge_hor=((parent.document.body.clientHeight-388)/2);
	parent.document.getElementById("photo").style.left=0;
	parent.document.getElementById("photo").style.top=0;
	parent.document.getElementById("photo2").style.left=marge_ver;
	parent.document.getElementById("photo2").style.top=marge_hor;
	
	if(pic==16){
		prevpic=11;		
		newpic=1;
	}else if(pic==1){
		prevpic=12;
		newpic=2;		
	}else{
		newpic=pic+1;
		prevpic=pic-1;		
	}
	
	picnum=pic;
	
	if(pic!="plan"){
		pic="images/sr_"+pic+".jpg";
		var photo='<img src="'+pic+'">'+"<br><a href='#' onClick='montre("+prevpic+")'><img src='images/trileft.gif' border='0'></a>&nbsp;<a href='#' onClick='montre("+newpic+")'><img src='images/triright.gif' border='0'></a>&nbsp;&nbsp;"+picnum+"/16&nbsp;&nbsp;(Cliquez sur la photo pour fermer la fen&ecirc;tre)";		
	}else{
		pic="images/plan.jpg";
		var photo='<img src="'+pic+'">'+"<br>&nbsp;(Cliquez sur la photo pour fermer la fen&ecirc;tre)";		
	}
	
	parent.document.getElementById("photo2").innerHTML=photo;
	parent.document.getElementById("photo2").style.visibility="visible";
	parent.document.getElementById("photo").style.visibility="visible";
}
function montre_cc(pic) {
	marge_ver=((parent.document.body.clientWidth-514)/2);
	marge_hor=((parent.document.body.clientHeight-388)/2);
	parent.document.getElementById("photo").style.left=0;
	parent.document.getElementById("photo").style.top=0;
	parent.document.getElementById("photo2").style.left=marge_ver;
	parent.document.getElementById("photo2").style.top=marge_hor;
	
	if(pic==7){
		prevpic=11;		
		newpic=1;
	}else if(pic==1){
		prevpic=7;
		newpic=2;		
	}else{
		newpic=pic+1;
		prevpic=pic-1;		
	}
	
	picnum=pic;
	
	if(pic!="plan"){
		pic="images/cc_"+pic+".jpg";
		var photo='<img src="'+pic+'">'+"<br><a href='#' onClick='montre("+prevpic+")'><img src='images/trileft.gif' border='0'></a>&nbsp;<a href='#' onClick='montre_cc("+newpic+")'><img src='images/triright.gif' border='0'></a>&nbsp;&nbsp;"+picnum+"/7&nbsp;&nbsp;(Cliquez sur la photo pour fermer la fen&ecirc;tre)";		
	}else{
		pic="images/plan.jpg";
		var photo='<img src="'+pic+'">'+"<br>&nbsp;(Cliquez sur la photo pour fermer la fen&ecirc;tre)";		
	}
	
	parent.document.getElementById("photo2").innerHTML=photo;
	parent.document.getElementById("photo2").style.visibility="visible";
	parent.document.getElementById("photo").style.visibility="visible";
}
function cache() {
	parent.document.getElementById("photo").style.visibility="hidden";
	parent.document.getElementById("photo2").style.visibility="hidden";
}