var activeSub=0;
var SubNum=0;

//function reDo(){ document.location.reload() }	
//window.onResize = reDo();

    //Define global variables

	    var timerID = null;
		var timerOn = false;
		var timecount = 1000;
		var what = null;
		var newbrowser = true;
		var check = false;
		
		var x, y;
		var xLayer, yLayer;

    	function init(){
    	
    		//Mouse Position
    		//Mis en commentaire à cause que ça cause un bug JS dans Axis.
    		/*
    		if (window.Event) {
			document.captureEvents(Event.MOUSEMOVE);
			}
			
			document.onmousemove = getXY;
			*/
			//END MOUSE POSITION
			
    	
          if (document.layers) {
                        //alert ("Running Netscape 4");
                        layerRef="document.layers";
                        styleSwitch="";
                        visibleVar="show";
			screenSize = window.innerWidth;
			what ="ns4";


          }else if(document.all){
                        //alert ("Running IE");
                        layerRef="document.all";
                        styleSwitch=".style";
                        visibleVar="visible";
			screenSize = document.body.clientWidth + 18;
			what ="ie";

		  }else if(document.getElementById){
                        //alert ("Running Netscape 6");
                        layerRef="document.getElementByID";
                        styleSwitch=".style";
                        visibleVar="visible";
			what="moz";
		  
		  }else{
		  	//alert("Older than 4.0 browser.");
			what="none";
			newbrowser = false;
		  }
		  
 
		//window.status='status bar text to go here';
		check = true;
  	 	}

	// Turns the layers on and off
        function showLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			document.getElementById(layerName).style.top = yLayer+"px";
        			document.getElementById(layerName).style.left = xLayer+"px";
        			}
        		else{
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top='+yLayer);
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+xLayer);
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}
		
		function showLayerPage(layerName, anchorName){
			document.onmousemove = getXY_Anchor(anchorName);
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			document.getElementById(layerName).style.top = yLayer+"px";
        			document.getElementById(layerName).style.left = xLayer+"px";
        			}
        		else{
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top='+yLayer);
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+xLayer);
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}
		
		function showLayerPosition(layerName, anchorName){
			getXY_Anchor2(anchorName);
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
	        		document.getElementById(layerName).style.visibility="visible";
        			//document.getElementById(layerName).style.top = yLayer+"px";
        			//document.getElementById(layerName).style.left = xLayer+"px";
        			}
        		else{
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
        			//eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top='+yLayer);
        			//eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+xLayer);
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}
		
		function showLayerPositionLeft(layerName, anchorName){
			getXY_Anchor3(anchorName);
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			document.getElementById(layerName).style.top = yLayer+"px";
        			document.getElementById(layerName).style.left = xLayer+"px";
        			}
        		else{
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top='+yLayer);
        			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+xLayer);
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}
		

        function hideLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
        		else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="hidden";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
				}
        
        	}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
        }


		


		function startTime() {
	        if (timerOn == false) {
                timerID=setTimeout( "hideAll()" , timecount);
                timerOn = true;

	        }

		}


		function stopTime() {
	        if (timerOn) {
    	        clearTimeout(timerID);
                timerID = null;
                timerOn = false;
	        }
		}

		function onLoad(){
			init();
			
			}
			
		function getXY_Anchor(anchorName)
		{
		
			var coordinates=new Object();
			coordinates = getAnchorPosition("popupMenuPosition");

			//x = (window.Event) ? e.pageX : event.clientX;
			//y = (window.Event) ? e.pageY : event.clientY;

			//Endroit a changer pour modifier la distance du popup en X
			x = coordinates.x + 187;
			coordinates = getAnchorPosition(anchorName);
			y = coordinates.y;
			
			xLayer = x ;
			yLayer = y ;
		}
		
		function getXY_Anchor2(anchorName)
		{
		
			var coordinates=new Object();

			coordinates = getAnchorPosition(anchorName);
			y = coordinates.y-3;
			x = coordinates.x-3;
			
			xLayer = x ;
			yLayer = y ;
		}
		
		function getXY_Anchor3(anchorName)
		{
		
			var coordinates=new Object();

			coordinates = getAnchorPosition(anchorName);
			y = coordinates.y;
			x = coordinates.x-125;
			
			xLayer = x ;
			yLayer = y ;
		}
		
		

		
		

		function getXY(e) {
		x = (window.Event) ? e.pageX : event.clientX;
		y = (window.Event) ? e.pageY : event.clientY;
		
		xLayer = x + 50 ;
		yLayer = y ;
		
		//window.status = "xMousePos=" + xLayer + ", yLayer=" + yLayer ;
		}

/*

function getAnchorWindowPosition(anchorname) {
	
	var coordinates=getAnchorPosition(anchorname);
	
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

		

function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
	
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}
		
		
	*/	

			
		