var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayer = 0;

var visibleMenu = null;
var menuTimer = null;
var MENU_VISIBILITY_TIMEOUT = 5000;

if(document.getElementById) {
	isID = 1;
	isDHTML = 1;
} else {
	if(document.all) {
		isAll = 1;
		isDHTML = 1;
	} else {
		browserVersion = parseInt(navigator.appVersion);
		
		if((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {
			isLayer = 1;
			isDHTML = 1;
		}
	}
}

function translate() {
	if(window.location.href.match(/\/FR\//)) window.location.href = window.location.href.replace(/\/FR\//, "/EN/")
	else window.location.href = window.location.href.replace(/\/EN\//, "/FR/")
	
	return true;
}

function findDOM(objectID, withStyle) {
	var objectRef;
	
	if(isID) { objectRef = document.getElementById(objectID); }
	else {
		if(isAll) { 
			objectRef = document.all[objectID]; 
		} else {
			if(isLayer) { objectRef = document.layers[objectID]; }
		}
	}
	if(withStyle == 1) { return getStyleDOM(objectRef); }
	else { return objectRef; } 
}
function getStyleDOM(objectRef) {
	if(!objectRef) { return; }
	if(!objectRef.style) { return objectRef; }
	if(isID) { return (objectRef.style); }
	else {
		if(isAll) {
			return (objectRef.style);
		}
	}
	return objectRef;
}
function findLeft(objectRef) {
	var domStyle = getStyleDOM(objectRef);
	var result = null;
				
	if (objectRef.offsetParent) {
		while (objectRef.offsetParent) {
			result += objectRef.offsetLeft;
			objectRef = objectRef.offsetParent;
		}
	} else if(objectRef.x)
		result = objectRef.x;
	else if(domStyle.left)
		result = domStyle.left;
	else if(domStyle.pixelLeft)
		result = domStyle.pixelLeft;
		
	return result;
}
function findTop(objectRef) {
	var domStyle = getStyleDOM(objectRef);
	var result = 0;
	
	if (objectRef.offsetParent) {
		while (objectRef.offsetParent) {
			result += objectRef.offsetTop;
			objectRef = objectRef.offsetParent;
		}
	} else if(objectRef.y)
		result = objectRef.y;
	else if(domStyle.top)
		result = domStyle.top;
	else if(domStyle.pixelTop)
		result = domStyle.pixelTop;
	
	return result;
}
function findWidth(objectRef) {
	var result = 0;
	
	if(objectRef.offsetWidth)
		result = objectRef.offsetWidth;
	else if(dom.clip.width)
		result = objectRef.clip.width;
	
	return result;
}
function findHeight(objectRef) {
	var result = 0;
	
	if(objectRef.offsetHeight)
		result = objectRef.offsetHeight;
	else if(dom.clip.height)
		result = objectRef.clip.height;
	
	return result;
}
function findLivePageWidth() {
	if(window.innerWidth != null) { return window.innerWidth; }
	else {
		if(document.body.clientWidth != null) { return document.body.clientWidth; }
	}
	return 0;
}


function fadeText(obj, backR, backG, backB, frontR, frontG, frontB, current, direction, max, delay, quote_index, max_quotes) {
	if(findDOM((obj + quote_index), 0)) {
		if((direction > 0) && (current == max)) {
			objectRef = findDOM((obj + quote_index), 1);
			objectRef.display = "none";
			quote_index += 1;
			if(quote_index > max_quotes) { quote_index = 1; }
			objectRef = findDOM((obj + quote_index), 1);
			objectRef.display = "inline";
			direction = -1;
		}
		if((direction < 0) && (current == 0)) {
			setTimeout("fadeText('"+ obj + "'," + backR + "," + backG + "," + backB + "," + frontR + "," + frontG + "," + frontB + "," + current + ",1," + max + "," + delay + "," + quote_index + "," + max_quotes + ")", 12500);
			return;
		}
		
		current += direction;
		
		deltaR = Math.round(Math.abs(backR - frontR)/max);
		deltaG = Math.round(Math.abs(backG - frontG)/max);
		deltaB = Math.round(Math.abs(backB - frontB)/max);
		
		objectRef = findDOM((obj + quote_index), 1);
		if(objectRef) {
			currentR = (backR + (current * deltaR));
			currentG = (backG + (current * deltaG));
			currentB = (backB + (current * deltaB));
			objectRef.color = ("#" + NumToHex(currentR) + NumToHex(currentG) + NumToHex(currentB));
			setTimeout("fadeText('"+ obj + "'," + backR + "," + backG + "," + backB + "," + frontR + "," + frontG + "," + frontB + "," + current + "," + direction + "," + max + "," + delay + "," + quote_index + "," + max_quotes + ")", delay);
		}
	}
}
function NumToHex(numValue) {
	if(!(isNaN(numValue)) && (numValue <= 255) && (numValue >= 0)) {
		base = (numValue / 16);
		rem = (numValue % 16);
		base = (base - (rem / 16));
		return (MakeHex(base)) + (MakeHex(rem));
	}
	return "";
}
function MakeHex(x) {
	if((x >= 0) && (x <= 9)) return ("" + x);
	else {
		switch(x) {
			case 10: return "A";
			case 11: return "B";
			case 12: return "C";
			case 13: return "D";
			case 14: return "E";
			case 15: return "F";
		}
	}
}

