var IE4 = (document.all) ? true : false;

/* Fonction basculant l'affichage vers la page d'accueil */
function goHome() {
	try {
		var domain = currentDomain(location.href);
		location.href = domain;
	}
	catch (e) {
		location.href='http://www.essec.edu';
	}
}

/* Fonction de bascule des langues */
function switchLangs() {
	var locationHref = location.href;
	try {
		var domain = currentDomain(locationHref);
		var locationToSwitch = domain + "/essec/switch" + locationHref.substring(domain.length, locationHref.length);
		location.href = locationToSwitch;
	}
	catch (e) {
		location.href='http://www.essec.edu';
	}
}

/* Récupération du domaine courant */
function currentDomain(locationHref) {
	var domain;

	try {
		var locationREF = locationHref.substring(7); // 7 = 'http://'.length
		locationREF = locationREF.substring(0, locationREF.indexOf('/'));

		return ('http://' + locationREF);
	}
	catch (e) {
		return 'http://www.essec.edu';
	}
}

/* Génération des adresses mails à la volée */
function ecleaf_mtlight_v1(arg1, arg2) {
	try {
		location.href="mailto:" + arg1 + "@" + arg2;
	}
	catch (e) {}
}

function Lobj(Lname) {
	if (IE4) {
		return document.all.tags('div')[Lname].style;
	}
	else {
		/* MF : 11/05/2004 - Modification pour compatibilité Netscape 6
		if (isNaN(Lname)) {
			for (var i=0; i<document.layers.length; i++) {
				if (document.layers[i].name == Lname) return document.layers[i];
			}
		}
		else return document.layers[Lname];
		*/
		return document.getElementById(Lname).style;
	}
}

function LsetVis(Lname,vis) {
	/*MF : 11/05/2004 - Modification pour compatibilité Netscape 6
	if (IE4) Lobj(Lname).visibility = (vis == 0) ? "hidden" : "visible";
	else Lobj(Lname).visibility = (vis == 0) ? 'hide' : 'show';
	*/
	Lobj(Lname).visibility = (vis == 0) ? 'hidden' : 'visible';
}
