var previous_show = null;
function montre(id){
	document.getElementById(id).style.display='block';
	if(id !='detail_crackers' && id !='detail_mv' && id !='detail_medias'){
		previous_show = id;
	}
	return false;
}
function cache(id){
	document.getElementById(id).style.display='none';
	return false;
}
function appel_montre(id){
	if(document.getElementById(id).style.display=='none'){
		if(previous_show != null){
			cache('detail_medias');
			cache('detail_mv');
			cache('detail_crackers');
			cache(previous_show);
		}
		return montre(id);
	}else if(document.getElementById(id).style.display=='block'){
		return cache(id);
	}
}
function appel_montre_interne(id){
	if(document.getElementById(id).style.display=='none'){
		return montre(id);
	}else if(document.getElementById(id).style.display=='block'){
		return cache(id);
	}
}
function appel_montre_admin(id){
	if(document.getElementById(id).style.display=='none'){
		if(previous_show != null){
			cache(previous_show);
		}
		document.getElementById('tab0').style.display = 'none';
		return montre(id);
	}else if(document.getElementById(id).style.display=='block'){
		document.getElementById('tab0').style.display = 'block';
		return cache(id);
	}
}
function verifMail(mail){
	var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]­{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
	if(reg.test(mail))	{
		return(true);
	}else{
		return(false);
	}
}
function checkForm(){
	var ret = true;
	if(!verifMail(document.getElementById("email").value)){
		document.getElementById("emailLb").style.color="red";
		document.getElementById('email').style.backgroundColor='red';
		ret = false;
	}else{
		document.getElementById("emailLb").style.color="black";
		document.getElementById('email').style.backgroundColor='white';
	}
	if(document.getElementById("nom").value == ""){
		document.getElementById("nomLb").style.color="red";
	document.getElementById('nom').style.backgroundColor='red';
		ret = false;
	}else{
		document.getElementById("nomLb").style.color="black";
		document.getElementById('nom').style.backgroundColor='white';
	}
	if(document.getElementById("sujet").value == ""){
	document.getElementById('sujet').style.backgroundColor='red';
		document.getElementById("sujetLb").style.color="red";
		ret = false;
	}else{
		document.getElementById('sujet').style.backgroundColor='white';
		document.getElementById("sujetLb").style.color="black";
	}
	if(document.getElementById("message").value == ""){
		document.getElementById('message').style.backgroundColor='red';
		document.getElementById("messageLb").style.color="red";
		ret = false;
	}else{
		document.getElementById('message').style.backgroundColor='white';
		document.getElementById("messageLb").style.color="black";
	}
	return ret;
}
function isMailSent(result){
	if(result){
		document.getElementById('result_mail').innerHTML = "E-mail envoy&eacute; avec succ&egrave;s.";
		document.getElementById('result_mail').style.display = "block";
	}else{
		document.getElementById('result_mail').innerHTML = "Erreur lors de l'envoi de l'e-mail.";
		document.getElementById('result_mail').style.display = "block";
	}
	return false;
}
function adapte_design(){
	var largeur = (document.body.clientWidth);
	var hauteur = (document.body.clientHeight);
	
	var object = document.getElementById('cadre_centre');
	object.style.minHeight = hauteur + 'px'; 
}

