function Message (type, message) {
	parent.document.getElementById('erreur').style.display = 'none';
	parent.document.getElementById('message').style.display = 'none';
	parent.document.getElementById('erreur').style.display = 'block';
	parent.document.getElementById(type).innerHTML = message;
}

function SpotImage (image, numero, type) {
	if (type==1) {
		//document.getElementById("icone-"+numero).src = "./modules/mod-"+image+"/"+image+"-2.gif";
		document.getElementById("titre-module-"+numero).style.color = "black";
	} else {
		//document.getElementById("icone-"+numero).src = "./modules/mod-"+image+"/"+image+".gif";
		document.getElementById("titre-module-"+numero).style.color = "gray";
	}
}

function Chargement (message) {
	//document.getElementById("erreur").style.display = "none";
	//document.getElementById("statut").style.display = "none";
	document.getElementById("message-traitement").innerHTML = message
	document.getElementById('chargement').style.left = ((document.documentElement.clientWidth/2)-150)+"px";
	if (navigator.appName=="Microsoft Internet Explorer") {
		var haut = document.body.scrollTop;
	} else {
		var haut = window.pageYOffset;
	}
	if (navigator.appName=="Microsoft Internet Explorer") {
		document.getElementById('fond-transparent').style.height = haut+document.body.offsetHeight+"px";
		document.getElementById('fond-transparent').style.width = document.body.offsetWidth+"px";
	} else {
		document.getElementById('fond-transparent').style.height = haut+window.innerHeight+"px";
	}
	if (navigator.appName=="Microsoft Internet Explorer") {
		haut = haut + ((document.documentElement.scrollTop)+(document.documentElement.clientHeight/2)-300);
	} else {
		haut = haut + ((document.documentElement.clientHeight/2)-300);
	}
	document.getElementById('chargement').style.top = haut+"px";
	$('#fond-transparent').fadeIn(500);
	$('#chargement').fadeIn(300);
}

function ArretChargement(type) {
	$('#chargement').fadeOut(500);
	if (type!=1) {
		$('#fond-transparent').fadeOut(300);
	}
}

function Statut (message) {
	document.getElementById("message-statut").innerHTML = message
	if (navigator.appName=="Microsoft Internet Explorer") {
		var haut = document.body.scrollTop;
	} else {
		var haut = window.pageYOffset;
	}
	if (navigator.appName=="Microsoft Internet Explorer") {
		document.getElementById('fond-transparent').style.height = haut+document.body.offsetHeight+"px";
		document.getElementById('fond-transparent').style.width = document.body.offsetWidth+"px";
	} else {
		document.getElementById('fond-transparent').style.height = haut+window.innerHeight+"px";
	}
	document.getElementById('statut').style.left = ((document.documentElement.clientWidth/2)-150)+"px";
	
	if (navigator.appName=="Microsoft Internet Explorer") {
		haut = haut + ((document.documentElement.scrollTop)+(document.documentElement.clientHeight/2)-300);
	} else {
		haut = haut + ((document.documentElement.clientHeight/2)-300);
	}
	document.getElementById('statut').style.top = haut+"px";
	if (document.getElementById('fond-transparent').style.display!="block") {
		$('#fond-transparent').fadeIn(500);
	}
	$('#statut').fadeIn(300);
}

function ArretStatut() {
	$('#statut').fadeOut(500);
	$('#fond-transparent').fadeOut(300);
}

function Erreur (message) {
	document.getElementById("message-erreur").innerHTML = message
	if (navigator.appName=="Microsoft Internet Explorer") {
		var haut = document.body.scrollTop;
	} else {
		var haut = window.pageYOffset;
	}
	if (navigator.appName=="Microsoft Internet Explorer") {
		document.getElementById('fond-transparent').style.height = haut+document.body.offsetHeight+"px";
		document.getElementById('fond-transparent').style.width = document.body.offsetWidth+"px";
	} else {
		document.getElementById('fond-transparent').style.height = haut+window.innerHeight+"px";
	}
	document.getElementById('erreur').style.left = ((document.documentElement.clientWidth/2)-150)+"px";
	
	if (navigator.appName=="Microsoft Internet Explorer") {
		haut = haut + ((document.documentElement.scrollTop)+(document.documentElement.clientHeight/2)-300);
	} else {
		haut = haut + ((document.documentElement.clientHeight/2)-300);
	}
	document.getElementById('erreur').style.top = haut+"px";
	if (document.getElementById('fond-transparent').style.display!="block") {
		$('#fond-transparent').fadeIn(500);
	}
	$('#erreur').fadeIn(300);
}

function ArretErreur() {
	$('#erreur').fadeOut(500);
	$('#fond-transparent').fadeOut(300);
}

function OuvertureChoixDate(champ, numero) {
	date = document.getElementById(champ).value;
  	window.open("./noyau/pages/choixdate.php?date="+date+"&champ="+champ, "choixdate", "width=250,height=250,status=yes");
}

function ErreurFonctionLocale (reponse) {
	if (confirm("Une erreur est survenue pendant l'exécution d'une commande sur le serveur. Voulez-vous afficher la description de l'erreur ?")) {
		window.open("../fichiers/erreur.php?erreur="+reponse, "Erreur IntelliWEB", "width=800,height=600,status=yes,toolbar=no");
		document.write(reponse);
	}
}

function AlerteDeconnexion (racine) {
	if (confirm("En vous déconnectant d'IntelliWEB, vos informations de connexion seront supprimées. Voulez-vous poursuivre ?")) {
		document.location = racine+"accueil/s-deconnexion.php";
	} else {
		window.refresh();
	}
}

function ChangerDomaine (that, local) {
	var choix = that.options[that.selectedIndex].value;

	switch (choix) {
		case "web":
			if (local==1) {
				document.location = "http://localhost/IntelliWEB/index.php";
			} else {
				document.location = "http://iwb.clementmultimedia.com/index.php";
			}
		break;
		case "mail":
			document.location = "http://iwb.clementmultimedia.com/email.php";
		break;
		case "support":
			document.location = "http://iwb.clementmultimedia.com/support.php";
		break;
		case "admin":
			document.location = "http://localhost/IntelliWEB/admin/index.php";
		break;
	}
}
