// <!--

// cross navigator functions
	
var isIE =  ((navigator.userAgent.indexOf("MSIE") > -1) ? true : false);
var isMac =  ((navigator.userAgent.indexOf("Mac") > -1) ? true : false);
var isGecko = ((navigator.userAgent.indexOf("Gecko") > -1) ? true : false);

var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);

function getTag(id){
 if (isDOM) return document.getElementById(id);
 if (isIE4) return document.all[id];
 if (isNS4) return document.layers[id];
}

function getTagStyle(id){
 return (isNS4 ? getTag(id) : getTag(id).style);
} 


//*****************************************************************
// menu deroulant
//*****************************************************************
var smenu_actif = null;
var sitem_actif = null;

function swap(smenu, sitem) {
    if (sitem.display == "block") {
	    if (isGecko) {
	   		smenu.listStyle = "none";	
			smenu.block = "block";
			smenu.listStylePosition = "outside";			
		} else {
	   		smenu.listStyle = "none";
		}
	   sitem.display = "none";
	} else {
	   if (isIE && isMac) {
		   smenu.listStyle = "none";
	   } else if (isGecko) {
		   smenu.listStyle = "none";
		   smenu.block = "block";
		   smenu.listStylePosition = "outside";			
	   } else {
	   		smenu.listStyle = "none";
	   }
	   sitem.display = "block";
	   smenu_actif = smenu;
	   sitem_actif = sitem;
	}
}

function deroule(menu, item) {
	var smenu = getTagStyle(menu);
	if (smenu_actif && smenu_actif != smenu) {
		swap(smenu_actif, sitem_actif);
	}
	smenu_actif = null;
	sitem_actif = null;
	swap(smenu, getTagStyle(item));

}

//*****************************************************************
// pour afficher l'ascenseur et l'activer
//*****************************************************************
// parameters

var inc=10;
var speed=150;

var scroll_nb=2;
var scrollArray = new Array(scroll_nb);

var moveupvar = null;
var movedownvar = null;
var moveleftvar = null;
var moverightvar = null;

function scroll(sc,left,right,up,down,x,y,max_x,max_y) {
        this.sc = sc
        this.left = left
        this.right = right
        this.up = up
        this.down = down
        this.x = x
        this.y = y
        this.max_x = max_x
        this.max_y = max_y
}

function scrolling_setup (i, windowid, contentid, leftid, rightid, upid, downid, x, y) {

	var x_margin = -10;
	var y_margin = -10;

	var window_width = getTag(windowid).offsetWidth;
	var window_height = getTag(windowid).offsetHeight;
 	
	var sc = getTagStyle(contentid);
	var left = getTagStyle(leftid);
	var right = getTagStyle(rightid);
	var up = getTagStyle(upid);
	var down = getTagStyle(downid);

	if (getTag(contentid).offsetWidth > window_width) {
   	        /* we do horizontal scrolling */
		left.visibility = "visible";
		right.visibility = "visible";
		max_x = window_width - getTag(contentid).offsetWidth - x_margin;
	}
	
	if (getTag(contentid).offsetHeight > window_height) {
   	        /* we do vertical scrolling */
		up.visibility = "visible";
		down.visibility = "visible";
		max_y = window_height - getTag(contentid).offsetHeight - y_margin;
	}

	sc.left = -x + "px";
	sc.top = -y + "px";
	sc.padding = "0x 0px 0px 0px";

        scrollArray[i] = new scroll(sc,left,right,up,down,-x,-y,max_x,max_y);
}

// scrolling functions

function moveleft(i) {
        var s = scrollArray[i];
	if (moverightvar) clearTimeout(moverightvar);
	if (s.x < 0) {
		s.x = s.x + inc;
		s.sc.left = s.x + "px";
  		/* IE5 on mac has a bug, curious, it's working with this line */
		s.sc.padding = "0x 0px 0px 0px";
	}
	moveleftvar=setTimeout("moveleft("+i+")",speed);
}

function moveright(i) {
        var s = scrollArray[i];
	if (moveleftvar) clearTimeout(moveleftvar);
	if (s.x >= s.max_x) {
		s.x = s.x - inc;
		s.sc.left = s.x + "px";
  		/* IE5 on mac has a bug, curious, it's working with this line */
		s.sc.padding = "0x 0px 0px 0px";
	}
	moveleftvar=setTimeout("moveright("+i+")",speed);
}

function moveup(i) {
        var s = scrollArray[i];
	if (movedownvar) clearTimeout(movedownvar);
	if (s.y < 0) {
		s.y = s.y + inc;
		s.sc.top = s.y + "px";
		/* IE5 on mac has a bug, curious, it's working with this line */
		s.sc.padding = "0x 0px 0px 0px";
 	}	
	moveupvar=setTimeout("moveup("+i+")",speed)
}

function movedown(i) {
        var s = scrollArray[i];
	if (moveupvar) clearTimeout(moveupvar);
	if (s.y >= s.max_y) {
		s.y = s.y - inc;
		s.sc.top = s.y + "px";
  		/* IE5 on mac has a bug, curious, it's working with this line */
		s.sc.padding = "0x 0px 0px 0px";
	}
	movedownvar=setTimeout("movedown("+i+")",speed);
}

function movestop() {
	if (moveleftvar) clearTimeout(moveleftvar);
	if (moverightvar) clearTimeout(moverightvar);
	if (moveupvar) clearTimeout(moveupvar);
	if (movedownvar) clearTimeout(movedownvar);
}
//*****************************************************************

//*****************************************************************
// préchargement des images
//*****************************************************************
beton01= new Image(70,50);
beton01.src="/pix/beton/mini/01off.jpg";

beton02= new Image(70,50);
beton02.src="/pix/beton/mini/02off.jpg";

beton03= new Image(70,50);
beton03.src="/pix/beton/mini/03off.jpg";

beton04= new Image(70,50);
beton04.src="/pix/beton/mini/04off.jpg";

beton05= new Image(70,50);
beton05.src="/pix/beton/mini/05off.jpg";

beton06= new Image(70,50);
beton06.src="/pix/beton/mini/06off.jpg";

beton07= new Image(70,50);
beton07.src="/pix/beton/mini/07off.jpg";

beton08= new Image(70,50);
beton08.src="/pix/beton/mini/08off.jpg";

beton09= new Image(70,50);
beton09.src="/pix/beton/mini/09off.jpg";

citerne01= new Image(50,70);
citerne01.src="/pix/flottaison/citerne/mini/01off.jpg";

citerne02= new Image(50,70);
citerne02.src="/pix/flottaison/citerne/mini/02off.jpg";

citerne03= new Image(50,70);
citerne03.src="/pix/flottaison/citerne/mini/03off.jpg";

citerne04= new Image(50,70);
citerne04.src="/pix/flottaison/citerne/mini/04off.jpg";

citerne05= new Image(50,70);
citerne05.src="/pix/flottaison/citerne/mini/05off.jpg";

citerne06= new Image(50,70);
citerne06.src="/pix/flottaison/citerne/mini/06off.jpg";

citerne07= new Image(50,70);
citerne07.src="/pix/flottaison/citerne/mini/07off.jpg";

citerne08= new Image(50,70);
citerne08.src="/pix/flottaison/citerne/mini/08off.jpg";

citerne09= new Image(50,70);
citerne09.src="/pix/flottaison/citerne/mini/09off.jpg";

globe01= new Image(50,70);
globe01.src="/pix/flottaison/globe/mini/01off.jpg";

globe02= new Image(50,70);
globe02.src="/pix/flottaison/globe/mini/02off.jpg";

globe03= new Image(50,70);
globe03.src="/pix/flottaison/globe/mini/03off.jpg";

globe04= new Image(50,70);
globe04.src="/pix/flottaison/globe/mini/04off.jpg";

globe05= new Image(50,70);
globe05.src="/pix/flottaison/globe/mini/05off.jpg";

globe06= new Image(50,70);
globe06.src="/pix/flottaison/globe/mini/06off.jpg";

globe07= new Image(50,70);
globe07.src="/pix/flottaison/globe/mini/07off.jpg";

globe08= new Image(50,70);
globe08.src="/pix/flottaison/globe/mini/08off.jpg";

vrac0101= new Image(50,70);
vrac0101.src="/pix/flottaison/vrac01/mini/01off.jpg";

vrac0102= new Image(50,70);
vrac0102.src="/pix/flottaison/vrac01/mini/02off.jpg";

vrac0103= new Image(50,70);
vrac0103.src="/pix/flottaison/vrac01/mini/03off.jpg";

vrac0104= new Image(50,70);
vrac0104.src="/pix/flottaison/vrac01/mini/04off.jpg";

vrac0105= new Image(50,70);
vrac0105.src="/pix/flottaison/vrac01/mini/05off.jpg";

vrac0106= new Image(50,70);
vrac0106.src="/pix/flottaison/vrac01/mini/06off.jpg";

vrac0107= new Image(50,70);
vrac0107.src="/pix/flottaison/vrac01/mini/07off.jpg";

//*****************************************************************


//*****************************************************************
// pour afficher les photos
//*****************************************************************
var a_l_ecran_actuellement = 0;

function efface() {

    if (a_l_ecran_actuellement == 1) {
		getTagStyle("beton1").display = "none";
	}
	
    if (a_l_ecran_actuellement == 2) {
		getTagStyle("beton2").display = "none";
	}

    if (a_l_ecran_actuellement == 3) {
		getTagStyle("beton3").display = "none";
	}
	
    if (a_l_ecran_actuellement == 4) {
		getTagStyle("beton4").display = "none";
	}

    if (a_l_ecran_actuellement == 5) {
		getTagStyle("beton5").display = "none";
	}
	
    if (a_l_ecran_actuellement == 6) {
		getTagStyle("beton6").display = "none";
	}

    if (a_l_ecran_actuellement == 7) {
		getTagStyle("beton7").display = "none";
	}
	
    if (a_l_ecran_actuellement == 8) {
		getTagStyle("beton8").display = "none";
	}
	
    if (a_l_ecran_actuellement == 9) {
		getTagStyle("beton9").display = "none";
	}

    if (a_l_ecran_actuellement == 11) {
		getTagStyle("vue1").display = "none";
	}
	
    if (a_l_ecran_actuellement == 12) {
		getTagStyle("vue2").display = "none";
	}

    if (a_l_ecran_actuellement == 13) {
		getTagStyle("vue3").display = "none";
	}
	
    if (a_l_ecran_actuellement == 14) {
		getTagStyle("vue4").display = "none";
	}

    if (a_l_ecran_actuellement == 15) {
		getTagStyle("vue5").display = "none";
	}
	
    if (a_l_ecran_actuellement == 16) {
		getTagStyle("vue6").display = "none";
	}

    if (a_l_ecran_actuellement == 17) {
		getTagStyle("vue7").display = "none";
	}
	
    if (a_l_ecran_actuellement == 18) {
		getTagStyle("vue8").display = "none";
	}
	
    if (a_l_ecran_actuellement == 19) {
		getTagStyle("vue9").display = "none";
	}
	
	
	a_l_ecran_actuellement == 0;

}

function affiche(photo) {

   if (photo == 1 && getTagStyle("beton1").display != "block") {
	    efface();
    	getTagStyle("beton1").display = "block";
    	a_l_ecran_actuellement = 1;
		return;
	}
  
  	if (photo == 2 && getTagStyle("beton2").display != "block") {
	    efface();
    	getTagStyle("beton2").display = "block";
    	a_l_ecran_actuellement = 2;
		return;
  	}

   if (photo == 3 && getTagStyle("beton3").display != "block") {
	    efface();
    	getTagStyle("beton3").display = "block";
    	a_l_ecran_actuellement = 3;
		return;
	}
  
  	if (photo == 4 && getTagStyle("beton4").display != "block") {
	    efface();
    	getTagStyle("beton4").display = "block";
    	a_l_ecran_actuellement = 4;
		return;
  	}

   if (photo == 5 && getTagStyle("beton5").display != "block") {
	    efface();
    	getTagStyle("beton5").display = "block";
    	a_l_ecran_actuellement = 5;
		return;
	}
  
  	if (photo == 6 && getTagStyle("beton6").display != "block") {
	    efface();
    	getTagStyle("beton6").display = "block";
    	a_l_ecran_actuellement = 6;
		return;
  	}

   if (photo == 7 && getTagStyle("beton7").display != "block") {
	    efface();
    	getTagStyle("beton7").display = "block";
    	a_l_ecran_actuellement = 7;
		return;
	}
  
  	if (photo == 8 && getTagStyle("beton8").display != "block") {
	    efface();
    	getTagStyle("beton8").display = "block";
    	a_l_ecran_actuellement = 8;
		return;
  	}
  
  	if (photo == 9 && getTagStyle("beton9").display != "block") {
	    efface();
    	getTagStyle("beton9").display = "block";
    	a_l_ecran_actuellement = 9;
		return;
  	}

   if (photo == 11 && getTagStyle("vue1").display != "block") {
	    efface();
    	getTagStyle("vue1").display = "block";
    	a_l_ecran_actuellement = 11;
		return;
	}
  
  	if (photo == 12 && getTagStyle("vue2").display != "block") {
	    efface();
    	getTagStyle("vue2").display = "block";
    	a_l_ecran_actuellement = 12;
		return;
  	}

   if (photo == 13 && getTagStyle("vue3").display != "block") {
	    efface();
    	getTagStyle("vue3").display = "block";
    	a_l_ecran_actuellement = 13;
		return;
	}
  
  	if (photo == 14 && getTagStyle("vue4").display != "block") {
	    efface();
    	getTagStyle("vue4").display = "block";
    	a_l_ecran_actuellement = 14;
		return;
  	}

   if (photo == 15 && getTagStyle("vue5").display != "block") {
	    efface();
    	getTagStyle("vue5").display = "block";
    	a_l_ecran_actuellement = 15;
		return;
	}
  
  	if (photo == 16 && getTagStyle("vue6").display != "block") {
	    efface();
    	getTagStyle("vue6").display = "block";
    	a_l_ecran_actuellement = 16;
		return;
  	}

   if (photo == 17 && getTagStyle("vue7").display != "block") {
	    efface();
    	getTagStyle("vue7").display = "block";
    	a_l_ecran_actuellement = 17;
		return;
	}
  
  	if (photo == 18 && getTagStyle("vue8").display != "block") {
	    efface();
    	getTagStyle("vue8").display = "block";
    	a_l_ecran_actuellement = 18;
		return;
  	}
  
  	if (photo == 19 && getTagStyle("vue9").display != "block") {
	    efface();
    	getTagStyle("vue9").display = "block";
    	a_l_ecran_actuellement = 19;
		return;
  	}

   if (photo == 20 && getTagStyle("vue10").display != "block") {
	    efface();
    	getTagStyle("vue10").display = "block";
    	a_l_ecran_actuellement = 20;
		return;
	}
  
  	if (photo == 21 && getTagStyle("vue11").display != "block") {
	    efface();
    	getTagStyle("vue11").display = "block";
    	a_l_ecran_actuellement = 21;
		return;
  	}
  
  	if (photo == 22 && getTagStyle("vue12").display != "block") {
	    efface();
    	getTagStyle("vue12").display = "block";
    	a_l_ecran_actuellement = 22;
		return;
  	}

  return;
}
//*************************************************************


//*****************************************************************
// ouverture pop up
//*****************************************************************

function openNewWindow(URLtoOpen, windowName, windowFeatures) {
	if (windowFeatures.search(/scrollbars/) == -1) {
		windowFeatures = windowFeatures + ",scrollbars=0";
	}
	if (windowFeatures.search(/toolbar/) == -1) {
		windowFeatures = windowFeatures + ",toolbar=0";
	}
	if (windowFeatures.search(/titlebar/) == -1) {
		windowFeatures = windowFeatures + ",titlebar=0";
	}
	if (windowFeatures.search(/status/) == -1) {
		windowFeatures = windowFeatures + ",status=0";
	}
	if (windowFeatures.search(/resizable/) == -1) {
		windowFeatures = windowFeatures + ",resizable=0";
	}
	if (windowFeatures.search(/location/) == -1) {
		windowFeatures = windowFeatures + ",location=0";
	}
	if (windowFeatures.search(/width/) == -1) {
		windowFeatures = windowFeatures + ",width=630";
	}
	if (windowFeatures.search(/height/) == -1) {
		windowFeatures = windowFeatures + ",height=390";
	}
	if (windowFeatures.search(/left/) == -1) {
		windowFeatures = windowFeatures + ",left=350";
	}
	if (windowFeatures.search(/top/) == -1) {
		windowFeatures = windowFeatures + ",top=210";
	}
	window.open(URLtoOpen, windowName, windowFeatures); 
}

// -->