var layerList=new Array(); 
var mouseOverMenu=0; 
var thePause=80; 
var thePauseCrumb=80; 
var timerID=null; 
var timerrollID=null; 
var menuBuffer = 'SubNavBogus'; 
var navBuffer = null; 
if (document.layers) { 
  visible = 'show'; 
  hidden = 'hide'; 
} 
else if (document.all) { 
  visible = 'visible'; 
  hidden = 'hidden';
} 

function openWindow(url) { 
  popupWin = window.open(url, name, 'scrollbars,resizable,width=360,height=400,left=20,top=20'); 
} 

function hiLite(imgName,imgSwapName) {
  if (document.images) {
    document.images[imgName].src = eval(imgSwapName + ".src"); 
  } 
} 

function getLayer(name) { 
  if (document.layers)
    return(document.layers[name]); 
  else if (document.all) {
    layer=eval('document.all.'+name+'.style');
    return(layer);
  } 
  else return(null); 
} 

function showMenu(name){
  var myMenu=0; 
  myMenu= getLayer(name); 
  if (!myMenu) 
    return; 
  menuBuffer.visibility = hidden; 
  myMenu.visibility = visible; 
  menuBuffer = myMenu; 
} 

function hideMenu(name){ 
  var myMenu=0; 
  myMenu= getLayer(name); 
  if (!myMenu) 
    return;  
  myMenu.visibility = hidden; 
  menuBuffer = myMenu; 
} 

function mouseOverMen(name){ 
  var myRollover= name + "Roll"; 
  var myRollOn= name + "On"; 
  var myBufferover= navBuffer + "Roll"; 
  var myBufferOff= navBuffer + "Off"; 
  
  if ((!(enableProdNav) && name == "SubNavset1") || (!(enableCustCenterNav) && name == "SubNavcustomercenter") ||     (!(enableCustCenterNav) && name == "SubNavcustomercenterhigh") ) { 
      showMenu('SubNavBogus'); 
      return false ;
  } 
  clearTimeout(timerrollID); 
  if (navBuffer != null && navBuffer != myBreadCrumb) 
    hiLite(myBufferover,myBufferOff); 
    hiLite(myRollover,myRollOn); 
    navBuffer = name; 
    if (document.layers || document.all) { 
      clearTimeout(timerID); 
      mouseOverMenu=1; 
      showMenu(name); 
    } 
    return true; 
} 

function mouseOutMen(name){ 
  var myRollover= name + "Roll"; 
  var myRollOff= name + "Off"; 
  var myRollOut ="hiLite('" +myRollover+ "','" +myRollOff +"')"; 
  if (myBreadCrumb != name) { 
    timerrollID = setTimeout(myRollOut, thePauseCrumb); 
  } 
  if (document.layers || document.all) {  
    clearTimeout(timerID); 
    var myOut = "hideMenu('"+name+"')"; 
    mouseOverMenu=0; 
    timerID=setTimeout(myOut,thePause); 
  } 
} 

function mouseOverLayer(name){ 
  mouseOverMenu=1; 
  clearTimeout(timerID); 
  clearTimeout(timerrollID); 
} 

function mouseOutLayer(name){ 
  var myRollover= name + "Roll"; 
  var myRollOff= name + "Off"; 
  var myOut = "hideMenu('"+name+"')"; 
  var myRollOut ="hiLite('" +myRollover+ "','" +myRollOff +"')"; 
  timeOutMenu(); 
  mouseOverMenu=0; 
  timerID=setTimeout(myOut,thePause); 
  if (myBreadCrumb != name) { 
    timerrollID = setTimeout(myRollOut, thePauseCrumb); 
  } 
} 

function timeOutMenu(){
  clearTimeout(timerID);
  timerID=setTimeout("if(!mouseOverMenu)showMenu('SubNavBogus');",thePause);
}

function createLayer(name, left, top, width, height, visible, content){ 
  var zindex=layerList.length + 100; 
  var layer;
  layerList[zindex]=name; 
  if (document.layers){ 
    document.writeln('<layer name="'+name+'" left='+left+' top='+top+' width='+width+' height='+height+ '       visibility='+(visible ? '"show"' : '"hide"')+' z-index='+ zindex + ' onMouseOver="mouseOverLayer(\''+name+'\');"     onMouseOut="mouseOutLayer(\''+name+'\');" layer-background-color=white>'); 
    document.writeln(content); 
    document.writeln('</layer>'); 
    layer=getLayer(name); 
    layer.width=width; 
    layer.height=height; 
  } 
  else if (document.all){ 
    document.writeln('<div id="'+name+'"style="position:absolute;overflow:none;left:'+left+'px; top:'+top+'px; width:'+width+'px; height:'+height+'px;'+' visibility:'+(visible ? 'visible;' :       'hidden;')+' z-index:' + zindex + '" onMouseOver="mouseOverLayer(\''+name+'\');"     onMouseOut="mouseOutLayer(\''+name+'\');" background-color=white>'); 
    document.writeln(content); 
    document.writeln('</div>'); 
  } 
  clipLayer(name, 0, 0, width, height); 
} 

function clipLayer(name, clipleft, cliptop, clipright, clipbottom) { 
  var layer = getLayer(name); 
  if (document.layers) { 
    layer.clip.left = clipleft; 
    layer.clip.top = cliptop; 
    layer.clip.right = clipright; 
    layer.clip.bottom = clipbottom; 
  } 
  if (document.all) 
    layer.clip = 'rect(' + cliptop + ' ' + clipright + ' ' + clipbottom + ' ' + clipleft +')'; 
} 

function defineHomePage(){
	this.setHomePage('http://www.sante-abitibi-temiscamingue.gouv.qc.ca/');
}

// SCRIPT POPUP MENU EMPLOI

	//PLF- http://www.jejavascript.net/
	
	var colorbg = "#FFFFFF"; //couleur de fond
	var colorlien = "#000000"; //couleur du texte
	var colorsel = "#FFFFFF"; //couleur selection
	var taillebg = 145 //largeur du menu
	
	
	var Screenwidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		Screenwidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth ) ) {
		//IE 6+ in 'standards compliant mode'
		Screenwidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth ) ) {
		//IE 4 compatible
		Screenwidth = document.body.clientWidth;
	} else
	{
		Screenwidth = screen.width
	}
	
	
	//Largeur bordure gauche + position par rapport à la largeur de la page en px (popup toujours à p pixels du contenu maximal gauche)
	var position_x = ((Screenwidth - 760) / 2) + 615 - 11
	var position_y = 89

	// MENU
	menutexte = new Array;
	menulien = new Array;
	menutarget = new Array;
	
	menutexte[0]= "Emplois à l'Agence"
	menulien[0]= "emploi.html"
	menutarget[0]="_self"
	
	menutexte[1]= "Emplois dans le réseau"
	menulien[1]= "http://www.jaidupanache.com"
	menutarget[1]="_blank"

function ouvrir_menu()
{
	document.getElementById("menu_context").style.top = position_y;
	document.getElementById("menu_context").style.left = position_x;
	document.getElementById("menu_context").style.visibility = "visible";
	return(false);
}

function fermer_menu()
{
	if (document.getElementById)
	{
		document.getElementById("menu_context").style.top = 0;
		document.getElementById("menu_context").style.left = 0;
		document.getElementById("menu_context").style.visibility = "hidden";
	}
}

function menu_sel(selec, lienmenu)
{
	if(selec == 1)
	{
		lienmenu.style.background = colorsel;
		lienmenu.style.color = colorbg;
	}
	else
	{
		lienmenu.style.background =colorbg;
		lienmenu.style.color = colorlien;
	}
}
