
var isNav, isIE
var xPixel, yPixel
var closing, opening
var tere = "default"
var coll = ""
var styleObj = ""
var isMac, isPC
if (navigator.platform.indexOf('Mac') != -1) {
	isMac = true
} else {
	isPC = true
}
if (parseInt(navigator.appVersion) >= 4) {
	if (navigator.appName == "Netscape") {
		isNav = true
		origWidth = innerWidth;
        origHeight = innerHeight;
	} else {
		isIE = true;					 
		coll = "all.";
		styleObj = ".style";
	}
} else if (!isNav && !isIE) {
	top.location.href = "/suckapage.html"
}
function NetscapeSux() {
      if (innerWidth != origWidth || innerHeight != origHeight) {
		origWidth = innerWidth;
		origHeight = innerHeight;
		location.reload()
		return false
	}
}
if (isNav) {
	window.captureEvents(Event.RESIZE)
	window.onresize = NetscapeSux
}

//pour ouvrir les images dans une nouvelle fenetre
var win= null;

function NewWindow(mypage,myname,w,h,scroll)
{
var winl = 2*(screen.width-w)/3;
var wint = 2*(screen.height-h)/3;
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=yes,dependent=no'
win=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}



function fixLayer(lname) {
	var fixedLayer
	fixedLayer = eval("document." + coll + lname + styleObj);
	return fixedLayer;
}
function fixImg(imageTitle,lName) {
	if (isNav) {
		fixedImage = eval("document." + lName + ".document." + imageTitle);
	} else {
		fixedImage = eval("document." + imageTitle);
	}
	return fixedImage;
}


function restore()
{
    var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages()
{
    var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

var howManyMenus=5;
var menuThreshold;
var goodToGo=false;
var headerImgsOn = new Array();
var headerImgsOff = new Array();
for (i=1;i<=howManyMenus;i++) {
	headerImgsOn[i] = new Image();
//	headerImgsOn[i].src = "/images/nav/main/hdr_mainnav" + i + "_on.gif";
	headerImgsOff[i] = new Image();
//	headerImgsOff[i].src = "/images/nav/main/hdr_mainnav" + i + "_off.gif";
}
function getMenuHeight(whichTime) {
	for (i=1; i<=howManyMenus; i++) {
		if (document.all) {
			var theLayer=eval("document.all.menu" + i);
			theLayer.style.pixelTop =menuThreshold - theLayer.clientHeight;
			var theBackLayer=eval("document.all.menu" + i + "Back");
			theBackLayer.style.pixelTop = menuThreshold - theLayer.clientHeight;
			theBackLayer.style.pixelHeight = theLayer.clientHeight +30;
			theLayer.style.visibility = "hidden";
			theBackLayer.style.visibility = "hidden";
		} else if (document.layers) {
			var theLayer = eval("document.menu" + i);
			theLayer.top = menuThreshold - theLayer.clip.bottom;
			theLayer.clip.top = 8;
			var theBackLayer = eval("document.menu" + i + "Back");
			theBackLayer.top=menuThreshold - theLayer.clip.bottom;
			theBackLayer.clip.bottom = theLayer.clip.bottom + 30;
			theBackLayer.clip.right = 180;
			theLayer.visibility = "hidden";
			theBackLayer.visibility = "hidden";
		} else if (document.getElementById) {
			var theLayer = eval("document.getElementById('menu" + i + "')");
			theLayer.style.top = menuThreshold - theLayer.offsetHeight;
			if (whichTime == "default") {
				theLayer.style.width = parseInt(theLayer.style.width) - 26;
			}
			var theBackLayer = eval("document.getElementById('menu" + i + "Back')");
			theBackLayer.style.top = menuThreshold + parseInt(theLayer.offsetHeight);
			theBackLayer.style.height = parseInt(theLayer.offsetHeight) + 30;
			theLayer.style.visibility = "hidden";
			theBackLayer.style.visibility = "hidden";
		}
	}
}

function stopMenus() {
	moveMenuDown('stop')
}
//use these variables for menu moving down
var downOne=0;
var tempMenuDown=0;
function moveMenuDown(whichMenu) {
	if(!goodToGo) {return}
	if(whichMenu==whichUpOne) {return}
	menuWhich=whichMenu;
	if (document.all) {
		if (whichMenu != "stop") {
			var downLayer=eval("document.all.menu" + whichMenu);
			var downLayerBack=eval("document.all.menu" + whichMenu + "Back");
			if (downLayer.style.pixelTop == menuThreshold - downLayer.clientHeight) {
				if (downOne != 0) {
					var upLayer = eval("document.all.menu" + downOne);
					upLayer.style.visibility = "hidden";
					upLayer.style.pixelTop = menuThreshold - upLayer.clientHeight;
					var upLayerBack = eval("document.all.menu" + downOne + "Back");
					upLayerBack.style.visibility = "hidden";
					upLayerBack.style.pixelTop = menuThreshold - upLayer.clientHeight;
				}
				downLayer.style.visibility = "visible";
				downLayerBack.style.visibility = "visible";
				downOne = whichMenu;
			}
			if (downLayer.style.pixelTop < menuThreshold) { 
				if (menuThreshold-downLayer.style.pixelTop > 9) {
					downLayer.style.pixelTop = downLayer.style.pixelTop + 10;
					downLayerBack.style.pixelTop = downLayer.style.pixelTop + 10;
				} else {
					downLayer.style.pixelTop = downLayer.style.pixelTop + (menuThreshold-downLayer.style.pixelTop);
					downLayerBack.style.pixelTop =  downLayerBack.style.pixelTop + (menuThreshold-downLayer.style.pixelTop);
				} 
				menuDown = setTimeout("moveMenuDown(menuWhich)", 10);
			}
		} else {
			getMenuHeight();
		}
	} else if (document.layers) {
		if (whichMenu != "stop") {
			var downLayer = eval("document.menu" + whichMenu);
			var downLayerBack = eval("document.menu" + whichMenu + "Back");
			if (downLayer.top == (menuThreshold - downLayer.clip.bottom)) {
				if (downOne != 0) {
					var upLayer = eval("document.menu" + downOne);
					upLayer.visibility = "hidden";
					upLayer.top = menuThreshold - upLayer.clip.bottom;
					var upLayerBack = eval("document.menu" + downOne + "Back");
					upLayerBack.visibility = "hidden";
					upLayerBack.top = menuThreshold - upLayer.clip.bottom;
				}
				downLayer.visibility = "visible";
				downLayerBack.visibility = "visible";
				downOne = whichMenu;
			}
			if (downLayer.top < menuThreshold) { 
				if (Math.abs(menuThreshold - downLayer.top) > 9) {
					downLayer.top = downLayer.top + 10;
					downLayerBack.top = downLayer.top + 10;
				} else {
					downLayer.top = downLayer.top + (menuThreshold - downLayer.top)+10;
					downLayerBack.top = downLayerBack.top + (menuThreshold - downLayer.top)+10;
				} 
				setTimeout("moveMenuDown(menuWhich)", 10);
			}
		} else {
			getMenuHeight();
		}
	} else if (document.getElementById) {
		if (whichMenu != "stop") {
			var downLayer = eval("document.getElementById('menu" + whichMenu + "')");
			var downLayerBack = eval("document.getElementById('menu" + whichMenu + "Back')");
			if (parseInt(downLayer.style.top) == (menuThreshold - downLayer.offsetHeight)) {
				if (downOne != 0) {
					var upLayer = eval("document.getElementById('menu" + downOne + "')");
					upLayer.style.visibility = "hidden";
					upLayer.style.top = menuThreshold - upLayer.offsetHeight;
					var upLayerBack = eval("document.getElementById('menu" + downOne + "Back')");
					upLayerBack.style.visibility = "hidden";
					upLayerBack.style.top = menuThreshold - upLayer.offsetHeight;
				}
				downLayer.style.visibility = "visible";
				downLayerBack.style.visibility = "visible";
				downOne = whichMenu;
			}
			if (parseInt(downLayer.style.top) < menuThreshold) { 
				if (Math.abs(menuThreshold - parseInt(downLayer.style.top)) > 9) {
					downLayer.style.top = parseInt(downLayer.style.top) + 10;
					downLayerBack.style.top = parseInt(downLayer.style.top) + 10;
				} else {
					downLayer.style.top = parseInt(downLayer.style.top) + (menuThreshold - parseInt(downLayer.style.top))+10;
					downLayerBack.style.top = parseInt(downLayerBack.style.top) + (menuThreshold - parseInt(downLayer.style.top))+10;
				} 
				setTimeout("moveMenuDown(menuWhich)", 10);
			}	
		} else {
			getMenuHeight();
		}
	}
}
var whichUpOne = 0;
var tempMenuUp=0;
function moveMenuUp(whichMenu) {
	if (tempMenuUp != 0 && whichMenu != whichUpOne) {
		return;
	} else {
		whichUpOne = whichMenu;
		if (document.all) {
			if (whichUpOne != 0) {
				var moveUpLayer=eval("document.all.menu" + whichUpOne);
				var moveUpLayerBack=eval("document.all.menu" + whichUpOne + "Back");
				if (moveUpLayer.style.pixelTop == menuThreshold) {
					steps = parseInt((moveUpLayer.style.pixelTop)/10);
					if ((moveUpLayer.style.pixelTop)%10 != 0) {
						steps++
						tempMenuDown = steps;
					}
				}
				if (moveUpLayer.style.pixelTop > menuThreshold-moveUpLayer.clientHeight) { 
					if (moveUpLayer.style.pixelTop > menuThreshold-moveUpLayer.clientHeight) {
						moveUpLayer.style.pixelTop = moveUpLayer.style.pixelTop - 10;
						moveUpLayerBack.style.pixelTop = moveUpLayer.style.pixelTop - 10;
					} else {
						UpLayer.style.pixelTop = UpLayer.style.pixelTop +((UpLayer.style.pixelTop + UpLayer.clientHeight) - menuThreshold);
						UpLayerBack.style.pixelTop = UpLayerBack.style.pixelTop+ ((UpLayerBack.style.pixelTop + UpLayerBack.clientHeight) - menuThreshold);
					}
					tempMenuDown--; 
					setTimeout("moveMenuUp(whichUpOne)", 10);
				} else {
				   // moveUpLayer.style.visibility="hidden";
			       // moveUpLayerBack.style.visibility="hidden";
					whichUpOne = 0;
					getMenuHeight();
					
				}
			}
		} else if (document.layers) {
			if (whichUpOne != 0) {
				var moveUpLayer=eval("document.menu" + whichUpOne);
				var moveUpLayerBack=eval("document.menu" + whichUpOne + "Back");
				if (moveUpLayer.top == menuThreshold) {
					steps = parseInt((moveUpLayer.top)/10);
					if ((moveUpLayer.top)%10 != 0) {
						steps++
						tempMenuDown = steps;
					}
				}
				if (moveUpLayer.top > menuThreshold - moveUpLayer.clip.bottom) { 
					if (moveUpLayer.top > menuThreshold - moveUpLayer.clip.bottom) {
						moveUpLayer.top = moveUpLayer.top - 10;
						moveUpLayerBack.top = moveUpLayer.top - 10;
					} else {
						moveUpLayer.top = moveUpLayer.top + ((moveUpLayer.top + moveUpLayer.clip.bottom) - menuThreshold);
						moveUpLayerBack.top = moveUpLayerBack.top + ((moveUpLayerBack.top + moveUpLayerBack.clip.bottom) - menuThreshold);
					}
					tempMenuDown--; 
					setTimeout("moveMenuUp(whichUpOne)", 10);
				} else {
					whichUpOne = 0;
					getMenuHeight();
				}
			}
		} else if (document.getElementById) {
			if (whichUpOne != 0) {
				var moveUpLayer = eval("document.getElementById('menu" + whichUpOne + "')");
				var moveUpLayerBack = eval("document.getElementById('menu" + whichUpOne + "Back')");
				if (parseInt(moveUpLayer.style.top) == menuThreshold) {
					steps = parseInt(parseInt(moveUpLayer.style.top)/10);
					if ((parseInt(moveUpLayer.style.top))%10 != 0) {
						steps++
						tempMenuDown = steps;
					}
				}
				if (parseInt(moveUpLayer.style.top) > (menuThreshold - parseInt(moveUpLayer.offsetHeight))) { 
					if (parseInt(moveUpLayer.style.top) > (menuThreshold - parseInt(moveUpLayer.offsetHeight))) {
						moveUpLayer.style.top = parseInt(moveUpLayer.style.top) - 10;
						moveUpLayerBack.style.top = parseInt(moveUpLayer.style.top) - 10;
					} else {
						moveUpLayer.style.top = parseInt(moveUpLayer.style.top) + ((parseInt(moveUpLayer.style.top) + parseInt(moveUpLayer.offsetHeight)) - menuThreshold);
						moveUpLayerBack.style.top = parseInt(moveUpLayerBack.style.top) + ((parseInt(moveUpLayerBack.style.top) + parseInt(moveUpLayerBack.offsetHeight)) - menuThreshold);
					}
					tempMenuDown--; 
					setTimeout("moveMenuUp(whichUpOne)", 10);
				} else {
					whichUpOne = 0;
					getMenuHeight();
				}
			}		
		}
	}
}
/*function rollOver(whichPic,onOff) {
	if (document.all || document.getElementById) {
		theImg = eval("document.hdrImg" + whichPic);
		theImg.src = "/images/nav/main/hdr_mainnav" + whichPic + "_" + onOff + ".gif";
	} else if (document.layers) {
		theImg = eval("document.Header.document.hdrImg" + whichPic);
		theImg.src = "/images/nav/main/hdr_mainnav" + whichPic + "_" + onOff + ".gif";
	}
}
*/

function popup(width,height){
	window.open("", "popUp", "resizable=yes,scrollbars=yes,toolbar=no,width="+width+",height="+height+"");
}


var menuThreshold;
if (isIE) {
	menuThreshold = 62;//134;	
} else if (isNav) {
	menuThreshold = 62;//121;
}
// you must include the number of parents for the rightNav
var parents = 6;

// this variable sets the height of the first rightNav option
var toolbarHeight = 235;
/*
l2TopImgsOn = new Array();
l2TopImgsOff = new Array();
for (i=1;i<=4;i++) {
	l2TopImgsOn[i] = new Image();
	l2TopImgsOn[i].src = "/images/nav/top/new/2nd_topnav" + i + "_on.gif";
	l2TopImgsOff[i] = new Image();
	l2TopImgsOff[i].src = "/images/nav/top/new/2nd_topnav" + i + "_off.gif";
}
function l2RollOver(whichPic,onOff) {
	if (isIE) {
		theImg = eval("document.topnav" + whichPic);
	} else if (isNav) {
		theImg = eval("document.Header.document.topnav" + whichPic);
	}
	theImg.src = "/images/nav/top/new/2nd_topnav" + whichPic + "_" + onOff + ".gif";
}

*/
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);