// JavaScript Document -- 4 EUROBOISSON -/// Developpement par Stéphane Dietkiewicz pour convergence communication

function onglet(action,id){
	
		
	if(action=="up"){ /// on monte le DIV
		
		var Y=document.getElementById(id).style.top;	
		posY = Y.substr(0,2);
		posY=posY-10;
		var Pos =posY+'px';
		document.getElementById(id).style.top=Pos;	
		eval('document.getElementById("'+id+'B")').style.visibility='visible';
		
		// document.getElementById('monFlash').GotoFrame='2';
		
		if(id=='prod'){ /// affichage du menu D
			document.getElementById('menuDLinkB').style.visibility='visible';
			document.getElementById('menuDLink').style.visibility='visible';
		}
		
		if(id!='prod'){ /// affichage du menu D
			document.getElementById('menuDLinkB').style.visibility='hidden';
			document.getElementById('menuDLink').style.visibility='hidden';
		}
		
	}
	
	if(action=="down" && id!="menuDLink"){ /// on monte le DIV
		
		var Y=document.getElementById(id).style.top;	
		posY = Y.substr(0,2);
		posY=(posY*1)+10;
		var Pos =posY+'px';
		document.getElementById(id).style.top=Pos;	
		eval('document.getElementById("'+id+'B")').style.visibility='hidden';
	}

	if(action=="down" && id=="menuDLink"){ /// on monte le DIV
		document.getElementById(id).style.visibility='hidden';	
		eval('document.getElementById("'+id+'B")').style.visibility='hidden';
	}
	

}


function plan(action){

	if(action=='open'){
		document.getElementById('blackOn').style.visibility='visible';
		document.getElementById('plan').style.visibility='visible';
	}
	
	if(action=='close'){
		document.getElementById('blackOn').style.visibility='hidden';
		document.getElementById('plan').style.visibility='hidden';
	}


}




function redefURL(url){
	
	window.statusbar = url;	
	window.locationbar = url;	

	}



function serviceFolio(){

	var img = document.getElementById('img');
	var imgArray = new Array();
	var imgName = new Array();
	var imgX = new Array();
	var imgY = new Array();
	imgArray['N']=imgName;
	imgArray['X']=imgX;
	imgArray['Y']=imgY;
	
	imgName[0] = "";
	imgX[0] = "";
	imgY[0] = "";
	imgName[1] = "images/produits/services/01.jpg";
	imgX[1] = "250";
	imgY[1] = "200";
	imgName[2] = "images/produits/services/02.jpg";
	imgX[2] = "250";
	imgY[2] = "200";
	imgName[3] = "images/produits/services/03.jpg";
	imgX[3] = "250";
	imgY[3] = "200";
	imgName[4] = "images/produits/services/04.jpg";
	imgX[4] = "250";
	imgY[4] = "200";
	var iMax = 4	
	
	/// rotation de l'image
	var I = document.getElementById('rot').value;
	I=(I*1)+1;
	if( I>iMax ){
		I = 1;
	}
	document.getElementById('rot').value = I;
	

	document.getElementById('img').src = imgArray['N'][I];
	document.getElementById('img').alt = imgArray['N'][I];
	
	///// RATIO
	var X =imgArray["X"][I];
	var Y =imgArray["Y"][I];
	var R = X/Y;
	
	/*
	if(R>0.775){
		
		img.width='155';
		H = Math.round((Y*155)/X);
		fromTop = Math.round((200-H)/2);
		img.height = H;
		img.style.marginTop=fromTop+'px';
		img.style.marginLeft='0px';
		
		alert ('Image '+imgArray['N'][I]+'('+I+')  => Large \n nouvelle Hauteur = '+H+'/'+X+' \n Repositionné à '+fromTop+'px du Top');
		
		
	}else{
		
		img.height='200';
		L = Math.round((X*200)/Y);
		fromLeft = Math.round((155-L)/2);
		img.width = L;
		img.style.marginLeft=fromLeft+'px';
		img.style.marginTop='0px';
		
		//alert ('Image '+imgArray['N'][I]+'('+I+')  => Haute \n nouvelle Largeur = '+L+'/'+Y+' \n Repositionné à '+fromLeft+'px du Left');
	}
	*/
	
	// setTimeout("Folio();",3000);


	/// FADDING
	
	// fadd();



}

function servicefadd(){


	var img = document.getElementById('img');
	/// INCREMENT
	var f=document.getElementById('fadd').value;
	f-=3;
	document.getElementById('fadd').value = f;
	/// FADDING
	
	if(f>250){
	
		var af = 350-f;
		if(af>=100){af=100;}
	
	img.style.filter='alpha(opacity="'+af+'")';
	img.style.opacity=(af/10);
	img.style.MozOpacity=(af/10);
	
	}
	
	
	if(f<100){
	
	img.style.filter='alpha(opacity="'+f+'")';
	img.style.opacity=(f/10);
	img.style.MozOpacity=(f/10);
	
	}
	/// SWITCH
	if(f<0){
		/* 
		img.style.filter='alpha(opacity="100")';
		img.style.opacity=1;
		img.style.MozOpacity=1;
		*/
		document.getElementById('fadd').value=350;
		serviceFolio();
	}
	
	setTimeout("servicefadd();",60);

}











