//=======================================================================
// ROLLOVER EFFECT AND PRELOAD IMAGES
//=======================================================================



//var lng = new String(window.location).toLowerCase().indexOf("/en/") >= 0 ? "en" : "fr";
var preloadFlag = false;

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


function changeImages(id) {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			//document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			document.getElementById(id).src = changeImages.arguments[i+1];
		}
	}
}


function preloadImages() {
	if (document.images) {

		// Images used for the roll over on the left menu
		img01 = newImage(imgPath+lang+"/nov_left-01-over.gif");
		img02 = newImage(imgPath+lang+"/nov_left-02-over.gif");
		img03 = newImage(imgPath+lang+"/nov_left-03-over.gif");
		img04 = newImage(imgPath+lang+"/nov_left-04-over.gif");
		img05 = newImage(imgPath+lang+"/nov_left-05-over.gif");
		img06 = newImage(imgPath+lang+"/nov_left-06-over.gif");
/*		img01 = newImage(lng + "images/nov_left-01-over.gif");
		img02 = newImage(lng + "images/nov_left-02-over.gif");
		img03 = newImage(lng + "images/nov_left-03-over.gif");
		img04 = newImage(lng + "images/nov_left-04-over.gif");
		img05 = newImage(lng + "images/nov_left-05-over.gif");
		img06 = newImage(lng + "images/nov_left-06-over.gif");*/

		preloadFlag = true
	}
}


//=======================================================================
// SUBMENU EFFECT
//=======================================================================



var currentId = null;
var timer = null;



function styleCalque(idCalque) {
	if(document.all) calqueStyle = document.all[idCalque].style;
	else if(document.layers) calqueStyle = document.layers[idCalque];
	else calqueStyle = document.getElementById(idCalque).style;
	
	return calqueStyle;
}



function cacheMenu(idCalque) {
	styleCalque(idCalque).visibility = "hidden";
	currentId = null;
}



function affMenu(idCalque) {
	clearTimeout(timer);
	
	if(idCalque != currentId && currentId != null) {
		cacheMenu(currentId);
	}
	
	styleCalque(idCalque).visibility = "visible";
	currentId = idCalque;
}



function closemenu(idCalque) {
	timer = setTimeout("cacheMenu('" + idCalque + "');", 30);
}



//=======================================================================
// SEARCH BOX FUNCTION
//=======================================================================

function cleardata(id, txt)
{
	if (document.getElementById(id).value == txt)
	{
	document.getElementById(id).value = "";
	document.getElementById(id).style.fontWeight = "normal";
	document.getElementById(id).style.textAlign = "left";
	}
}

function restoredata(id, txt)
{
	if (document.getElementById(id).value == "")
	{
	document.getElementById(id).value = txt;
	document.getElementById(id).style.fontWeight = "bold";
	document.getElementById(id).style.textAlign = "center";
	}
}