// 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 max_x = 0;
      var max_y = 0;
      var x_margin = -10;
      var y_margin = -10;
      var window_width = 0;
      var window_height = 0;

      if (!(getTag(windowid))) {alert(windowid+' n\'existe pas!')}
      if (!(getTag(contentid))) {alert(contentid+' n\'existe pas!')}

      var sc = getTagStyle(contentid);

      var up = null;
      var down = null;
      var left = null;
      var right = null;

      if (getTag(leftid) && getTag(rightid)) {
         left = getTagStyle(leftid);
         right = getTagStyle(rightid);
	 window_width = getTag(windowid).offsetWidth;
	 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(upid) && getTag(downid)) {
        up = getTagStyle(upid);
        down = getTagStyle(downid);
	window_height = getTag(windowid).offsetHeight;
	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 = "0px 24px 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 = "0px 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 = "0px 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 = "0px 24px 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 = "0px 24px 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);
}
//*****************************************************************

//*****************************************************************
// pour afficher l'intro en français ou en anglais
//*****************************************************************
var a_l_ecran_actuellement = 0;

function efface() {

    if (a_l_ecran_actuellement == 1) {
	getTagStyle("french").display = "none";
	}
	
    if (a_l_ecran_actuellement == 2) {
		getTagStyle("english").display = "none";
	}
	
    if (a_l_ecran_actuellement == 3) {
		getTagStyle("deutsch").display = "none";
	}
	
	a_l_ecran_actuellement == 0;

}

function affiche(langue) {

   if (langue == 1 && getTagStyle("french").display != "block") {
	    efface();
    	getTagStyle("french").display = "block";
    	a_l_ecran_actuellement = 1;
		return;
	}
  
  	if (langue == 2 && getTagStyle("english").display != "block") {
	    efface();
    	getTagStyle("english").display = "block";
    	a_l_ecran_actuellement = 2;
		return;
  	}
  
  	if (langue == 3 && getTagStyle("deutsch").display != "block") {
	    efface();
    	getTagStyle("deutsch").display = "block";
    	a_l_ecran_actuellement = 3;
		return;
  	}

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

//*****************************************************************
// préchargement des images pour roll-over page event
//*****************************************************************
im01off= new Image(240,240);
im01off.src="/pix/event/01.jpg";

im02off= new Image(240,240);
im02off.src="/pix/event/02.jpg";

im03off= new Image(240,240);
im03off.src="/pix/event/03.jpg";

im01= new Image(240,240);
im01.src="/pix/event/higher/01.jpg";

im02= new Image(240,240);
im02.src="/pix/event/higher/02.jpg";

im03= new Image(240,240);
im03.src="/pix/event/higher/03.jpg";

im04= new Image(240,240);
im04.src="/pix/event/poison/01.jpg";

im05= new Image(240,240);
im05.src="/pix/event/poison/02.jpg";

im06= new Image(240,240);
im06.src="/pix/event/poison/03.jpg";

im07= new Image(240,240);
im07.src="/pix/event/clarins/01.jpg";

im08= new Image(240,240);
im08.src="/pix/event/clarins/02.jpg";

im09= new Image(240,240);
im09.src="/pix/event/clarins/03.jpg";

im10= new Image(240,240);
im10.src="/pix/event/narciso/01.jpg";

im11= new Image(240,240);
im11.src="/pix/event/narciso/02.jpg";

im12= new Image(240,240);
im12.src="/pix/event/narciso/03.jpg";

im13= new Image(240,240);
im13.src="/pix/event/dior/01.jpg";

im14= new Image(240,240);
im14.src="/pix/event/dior/02.jpg";

im15= new Image(240,240);
im15.src="/pix/event/dior/03.jpg";

im16= new Image(240,240);
im16.src="/pix/event/duck/01.jpg";

im17= new Image(240,240);
im17.src="/pix/event/duck/02.jpg";

im18= new Image(240,240);
im18.src="/pix/event/duck/03.jpg";

im19= new Image(240,240);
im19.src="/pix/event/gdpalais/01.jpg";

im20= new Image(240,240);
im20.src="/pix/event/gdpalais/02.jpg";

im21= new Image(240,240);
im21.src="/pix/event/gdpalais/03.jpg";

im22= new Image(240,240);
im22.src="/pix/event/hallyday/01.jpg";

im23= new Image(240,240);
im23.src="/pix/event/hallyday/02.jpg";

im24= new Image(240,240);
im24.src="/pix/event/hallyday/03.jpg";

im25= new Image(240,240);
im25.src="/pix/event/hotel/01.jpg";

im26= new Image(240,240);
im26.src="/pix/event/hotel/02.jpg";

im27= new Image(240,240);
im27.src="/pix/event/hotel/03.jpg";

im28= new Image(240,240);
im28.src="/pix/event/champlatreux/01.jpg";

im29= new Image(240,240);
im29.src="/pix/event/champlatreux/02.jpg";

im30= new Image(240,240);
im30.src="/pix/event/champlatreux/03.jpg";

im31= new Image(240,240);
im31.src="/pix/event/veuvecliquot/01.jpg";

im32= new Image(240,240);
im32.src="/pix/event/veuvecliquot/02.jpg";

im33= new Image(240,240);
im33.src="/pix/event/veuvecliquot/03.jpg";

im34= new Image(240,240);
im34.src="/pix/event/lionel/01.jpg";

im35= new Image(240,240);
im35.src="/pix/event/lionel/02.jpg";

im36= new Image(240,240);
im36.src="/pix/event/lionel/03.jpg";

im37= new Image(240,240);
im37.src="/pix/event/versailles/01.jpg";

im38= new Image(240,240);
im38.src="/pix/event/versailles/02.jpg";

im39= new Image(240,240);
im39.src="/pix/event/versailles/03.jpg";

im40= new Image(240,240);
im40.src="/pix/event/leibovitz/01.jpg";

im41= new Image(240,240);
im41.src="/pix/event/leibovitz/02.jpg";

im42= new Image(240,240);
im42.src="/pix/event/leibovitz/03.jpg";

im43= new Image(240,240);
im43.src="/pix/event/iff/01.jpg";

im44= new Image(240,240);
im44.src="/pix/event/iff/02.jpg";

im45= new Image(240,240);
im45.src="/pix/event/iff/03.jpg";

im46= new Image(240,240);
im46.src="/pix/event/conde/01.jpg";

im47= new Image(240,240);
im47.src="/pix/event/conde/02.jpg";

im48= new Image(240,240);
im48.src="/pix/event/conde/03.jpg";

im49= new Image(240,240);
im49.src="/pix/event/tf1/01.jpg";

im50= new Image(240,240);
im50.src="/pix/event/tf1/02.jpg";

im51= new Image(240,240);
im51.src="/pix/event/tf1/03.jpg";

im52= new Image(240,240);
im52.src="/pix/event/palais-tokyo/01.jpg";

im53= new Image(240,240);
im53.src="/pix/event/palais-tokyo/02.jpg";

im54= new Image(240,240);
im54.src="/pix/event/palais-tokyo/03.jpg";


//*****************************************************************
// 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(/left/) == -1) {
		windowFeatures = windowFeatures + ",left=0";
	}
	if (windowFeatures.search(/top/) == -1) {
		windowFeatures = windowFeatures + ",top=0";
	}
	window.open(URLtoOpen, windowName, windowFeatures); 
}