//Déclaration des variables
var ie4         = (document.all) ? true : false;
var ff2        = (document.layers) ? true : false;
var ns6       = (document.getElementById && !document.all) ? true : false;

var Faq_Length = 10;
var Build_Length = 48;


var table_province = new Array("AB","BC","PE","MB","NB","NS","ON","QC","SK","TN")

// Example:
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}


// Utilisation : software_update.asp
// Description : affichage de la mise &agrave; jour Expert Estimateur sélectionnée
function EE_SearchBuild(Build)
{	
	var Build_Search = 'Build'+Build;
	var Build_Desc   = parseInt(Build) +1;
	var Desc_Length = Build_Length +1;
	
	if(ie4) //IE
	{	
		for(x=15;x<=Build_Length;x++){eval("document.all['Build"+x+"'].style.display = 'none'");}
		for(x=15;x<=Desc_Length;x++){eval("document.all['BuildDesc"+x+"'].style.display = 'none'");}
		
		if(Build!='null'){
			if(Build==Build_Length){Desc_Length++;}
			for(x=Build_Desc;x<Desc_Length;x++){eval("document.all['BuildDesc"+x+"'].style.display = 'block'");}
			document.all[Build_Search].style.display = "block";
		}
	}
	else //FF2, NETSCAPE 7
	{
		for(x=15;x<=Build_Length;x++){eval("document.getElementById(['Build"+x+"']).style.display = 'none'");}
		for(x=15;x<=Desc_Length;x++){eval("document.getElementById(['BuildDesc"+x+"']).style.display = 'none'");}
		
		if(Build!='null'){
			if(Build==Build_Length){Desc_Length++;}
			for(x=Build_Desc;x<Desc_Length;x++){eval("document.getElementById(['BuildDesc"+x+"']).style.display = 'block'");}
			document.getElementById([Build_Search]).style.display = "block";
		}
	}

}


// Utilisation : support.asp
// Description : affichage de la question sélectionnée de la foire aux questions
function EE_SearchFAQ(FAQ)
{	
	var Faq_Search = 'faq'+FAQ;
	if(ie4) //IE, OPERA
	{	
		for(x=0;x<=Faq_Length;x++){eval("document.all['faq"+x+"'].style.display = 'none'");}
		if(Faq_Search!='faqnull'){document.all[Faq_Search].style.display = "block";}
	}
	if(ff2) //FF2, NETSCAPE 7
	{
		for(x=0;x<=Faq_Length;x++){eval("document.getElementById(['faq"+x+"']).style.display = 'none'");}
		if(Faq_Search!='faqnull'){document.getElementById([Faq_Search]).style.display = "block";}
		
		//for(x=0;x<=Faq_Length;x++){eval("document.layers['faq"+x+"'].display = 'hide'");}
		//document.layers[Faq_Search].display = "Show";
	}
	if(ns6) //NETSCAPE 6
	{	
		for(x=0;x<=Faq_Length;x++){eval("document.getElementById(['faq"+x+"']).style.display = 'none'");}
		if(Faq_Search!='faqnull'){document.getElementById([Faq_Search]).style.display = "block";}
	}
}


// Utilisation : formulaire
// Description : affichage de l'infobulle décrivant le type de champs de formulaire
function EE_Info(oType, oDisplay)
{	
	var InfoType = 'info'+oType;
	var InfoDisplay;
	
	if(oDisplay==0){InfoDisplay='none';} else {InfoDisplay='block'}
	document.getElementById(InfoType).style.display = InfoDisplay;	
}


// Utilisation : i_header.asp
// Description : affichage du sous-menu
var intervalTimer;

function EE_SubMenu(pShowSub) {
	var SubMenu = 'div-submenu-0'+pShowSub;
	clearTimeout(intervalTimer);
	if(ie4) //IE, OPERA
	{	
		for(x=1;x<=4;x++){eval("document.all['div-submenu-0"+x+"'].style.display = 'none'");}
		if(pShowSub!='null'){document.all[SubMenu].style.display = "block"; intervalTimer = setTimeout("EE_SubMenu('null')",2000);}
	}
	if(ff2) //FF2, NETSCAPE 7
	{
		for(x=1;x<=4;x++){eval("document.getElementById(['div-submenu-0"+x+"']).style.display = 'none'");}
		if(pShowSub!='null'){document.getElementById([SubMenu]).style.display = "block";intervalTimer = setTimeout("EE_SubMenu('null')",2000);}
		
	}
	if(ns6) //NETSCAPE 6
	{	
		for(x=1;x<=4;x++){eval("document.getElementById(['div-submenu-0"+x+"']).style.display = 'none'");}
		if(pShowSub!='null'){document.getElementById([SubMenu]).style.display = "block";intervalTimer = setTimeout("EE_SubMenu('null')",2000);}
	}
}

// Utilisation : i_header.asp
// Description : ouverture et fermture de l'alerte latérale
var mTimer;
var alertStatus = 'hide';
var alertInMotion = 'false';
var x = 0;

function EE_AlertMenu(pLanguage) {
	if(alertInMotion=='false'){
		alertInMotion = 'true';
		if(pLanguage=='fr'){
			if(alertStatus=='show'){
				mTimer = setInterval ("EE_AlertMove('hide','fr')", 1 ); 
			} else {
				mTimer = setInterval ("EE_AlertMove('show','fr')", 1 ); 
			}
		} else {
			if(alertStatus=='show'){
				mTimer = setInterval ("EE_AlertMove('hide','en')", 1 ); 
			} else {
				mTimer = setInterval ("EE_AlertMove('show','en')", 1 ); 
			}
		}
	}
}

function EE_AlertMove(pStatus, pLanguage) {
	//alert(document.getElementById('div-alert').style.left)
	if(pStatus=='hide'){
		x = x - 10;
		document.getElementById('div-alert').style.left = x + "px";
	  	if (x < 5) {
			clearInterval(mTimer);
			eval("document.getElementById('div-alert-button-" + pLanguage + "').style.background='url(../images/" + pLanguage + "-CA/alert_btn_open.gif)'");
			alertStatus='hide';
			alertInMotion = 'false';
	  	}
	} 
	if(pStatus=='show'){
		x = x + 10;
		document.getElementById('div-alert').style.left = x + "px";
	  	if (x > 400) {
			clearInterval(mTimer);
			eval("document.getElementById('div-alert-button-" + pLanguage + "').style.background='url(../images/" + pLanguage + "-CA/alert_btn_close.gif)'");
			alertStatus='show';
			alertInMotion = 'false';
	  	}
	}
}

function openPopup(pPath,pTitle,pWidth,pHeight,pTop,pLeft) {
	eval("window.open('"+pPath+"','"+pTitle+"','height="+pHeight+",width="+pWidth+",scrollbars=no,resizable=no,status=no,left="+pLeft+",top="+pTop+",menubar=no,toolbar=no,location=no')");
	
	}

// Description : functions macromedia
	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_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_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_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);
	
	function EE_dropdownMenu(EE_form, EE_select){ //redirect to the page selected in the dropdown menu in the Header
	eval("var selection = parseInt(document." + EE_form + "." + EE_select + ".selectedIndex)");
	eval("var redirection = document." + EE_form + "." + EE_select + ".options[selection].value");
	if (redirection != "" && redirection != "null" && redirection != null) { window.location=redirection; }
	}