// JavaScript Document

/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.dnolan.com/code/js/rollover/
	http://www.bleedingego.co.uk/webdev.php
*/
function initRollovers(el) {
	if (!document.getElementById) return

	var aPreLoad = new Array();
	var sTempSrc;
	if (el) var aImages = el.getElementsByTagName('img');
	else var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var regex = new RegExp(".*1" + ftype + "$");
			if (src.match(regex)) var hsrc = src.replace("1" + ftype, '2'+ftype);
			else var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}

			aImages[i].onmouseout = function() {
				if (!sTempSrc) {
					var regex = new RegExp(".*2" + ftype + "$");
					if (this.getAttribute("src").match(regex)) sTempSrc = this.getAttribute('src').replace('2'+ftype, '1' + ftype);
					else sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);

				}
				this.setAttribute('src', sTempSrc);
			}
		}


	}

	if (el) var inputs = el.getElementsByTagName('input');
	else var inputs = document.getElementsByTagName('input');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].type == 'image') {
			var src = inputs[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var regex = new RegExp(".*1" + ftype + "$");
			if (src.match(regex)) var hsrc = src.replace("1" + ftype, '2'+ftype);
			else var hsrc = src.replace(ftype, '_on'+ftype);

			inputs[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			inputs[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}

			inputs[i].onmouseout = function() {
				if (!sTempSrc) {
					var regex = new RegExp(".*2" + ftype + "$");
					if (this.getAttribute("src").match(regex)) sTempSrc = this.getAttribute('src').replace('2'+ftype, '1' + ftype);
					else sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);

				}
				this.setAttribute('src', sTempSrc);
			}
		}


	}
}




function display(variab,num)

{

	// if ( typeof( h) == "undefined" )
	// {
	// var h=0;
	// }



	var lis = document.getElementById("content-tabs").getElementsByTagName("li");

	for(var i=0; i< lis.length; i++){
		if(lis[i].className == "nav-on"){
			lis[i].className = "";
		}
	}


	//tgt.parentNode.id = "nav-on";
	try {
		lis[num-1].className="nav-on";
	} catch(err){}

	var tabl= new Array("layer1_id","layer2_id","layer3_id","layer4_id");
	var Obj;
	for( var i=0; i< tabl.length; i++)

	{


			if(document.getElementById( tabl[i])){

				Obj = document.getElementById( tabl[i]);
				if( variab==tabl[i])
				{
					Obj.style.display = "inline";

				//var tab= i+1;
				//document.getElementById(tab).style.backgroundImage = "url(../../../images/domestic-subpage/tab_leftcorner.gif)";



				}
				else
				{
					Obj.style.display = "none";
				//-- Ou autre mthode

				}

			}

		}

	return false;

}




function displayh(variab,num,h)

{

	// if ( typeof( h) == "undefined" )
	// {
	// var h=0;
	// }



	var lis = document.getElementById("content-tabs").getElementsByTagName("li");

	for(var i=0; i< lis.length; i++){
		if(lis[i].className == "nav-on"){
			lis[i].className = "";
		}
	}

	//tgt.parentNode.id = "nav-on";
	try {
		lis[num-1].className="nav-on";
	} catch(err){}

	var tabl= new Array("layer1","layer2","layer3","layer4");
	var Obj;
	for( var i=0; i< tabl.length; i++)

	{


			if(document.getElementById( tabl[i])){

				Obj = document.getElementById( tabl[i]);
				if( variab==tabl[i])
				{
					Obj.style.display = "inline";

				//var tab= i+1;
				//document.getElementById(tab).style.backgroundImage = "url(../../../images/domestic-subpage/tab_leftcorner.gif)";

				}
				else
				{
					Obj.style.display = "none";


				}

			}

		}
	h+="px";
//document.getElementById('content-tabs').style.height = h;
}

//Help and Questions functionality

openElement_a = new Array();
highlightElement_a = new Array();
currentElement = null;
currentElementLevel = 0;
currentLevel = 0;

currpath = "";
currlevel1 = "";
currlevel2 = "";
currlevel3 = "";

function _void()
{
}

function setDisplay (el, display)
{
	if (el)
	{
		el.style.display = display;
	}
}

function showElement (elId, level, currentEl)
{

	currentEl.hideFocus = "true";

	if (document.getElementById)
	{

		// style changes
		for (i=highlightElement_a.length-1;i>=level-1;i--)
		{
			hEl = highlightElement_a.pop();
			if (hEl && hEl.style){
				hEl.parentNode.style.backgroundColor = "#eef6e7";
				hEl.style.backgroundPosition = "5px 5px";
			}
		}
		if (currentEl && currentEl.style)
		{
			currentEl.parentNode.style.backgroundColor = "#D4F69F";
			currentEl.style.backgroundPosition = "5px 5px";
			highlightElement_a.push(currentEl);
		}
		// first hide any open layers
		for (i=openElement_a.length-1;i>=level-1;i--)
		{
			openEl = openElement_a.pop();
			if (openEl) setDisplay(openEl, "none");
		}
		el = document.getElementById(elId);
		setDisplay(el, "block");
		openElement_a.push(el);
		currentLevel = level;

		// hide the selectMsg if necessary
		el = document.getElementById("selectMsg");
		if (el && el.style)
		{
			if (level >= 1) el.style.display = "none";
			else el.style.display = "block";
		}
	}
}

