

function montre(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	if (d) { d.style.display='block'; }
}

function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement&& document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth=0;
	if (typeof(window.innerWidth)=='number') {
		windowWidth=window.innerWidth;
	} else {
		if (document.documentElement&& document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		} else {
			if (document.body&&document.body.clientWidth) {
				windowWidth=document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

function setFooter() {
	if (document.getElementById) {
		var windowHeight=getWindowHeight();
		if (windowHeight>0) {
			var contentHeight=document.getElementById('content').offsetHeight;
			var footerElement=document.getElementById('footer');
			var footerHeight=footerElement.offsetHeight;
			if (windowHeight-(contentHeight+footerHeight)>=0) {
				footerElement.style.position='relative';
				footerElement.style.top=(windowHeight-(contentHeight+footerHeight))+'px';
			} else {
				footerElement.style.position='static';
			}
		}
	}
}

var InitHmainPage ;
var EspaceMarge = 70;
function setMainHeight() {
	var HmainPage = document.getElementById("main-page").offsetHeight;
	var WindowHeight = getWindowHeight();
	var Htitre = document.getElementById("titre").offsetHeight;
	
	if ( HmainPage < (WindowHeight - Htitre - EspaceMarge) ) {
		document.getElementById("main-page").style.height =  WindowHeight - Htitre - EspaceMarge + 'px' ;
	}
}

function setMainHeightResize() {
	var WindowHeight = getWindowHeight();
	var Htitre = document.getElementById("titre").offsetHeight;
	if ( InitHmainPage < (WindowHeight - Htitre - EspaceMarge) ) {
		document.getElementById("main-page").style.height =  WindowHeight - Htitre - EspaceMarge + 'px' ;
	}
}

function verifForm(formulaire) {
	if(formulaire.nom.value == ""){
		alert('Veuillez entrer votre nom');
		return false;
	}
	if(formulaire.prenom.value == ""){
		alert('Veuillez entrer votre prénom');
		return false;
	}
	if(formulaire.adresse.value == ""){
		alert('Veuillez indiquer votre adresse');
		return false;
	}
	if(formulaire.telephone.value == ""){
		alert('Veuillez entrer votre numéro de téléphone');
		return false;
	}
	else {
	formulaire.submit();
	}
}

function clearStyle() {
	var radios = document.getElementsByTagName('radio');
//	alert (radios.length);
}

function openWindow (lien) {
	// Avec seulement un petit décalage en haut à gauche
	//window.open(lien, '_blank', 'resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,width=400,height=300,top=50,left=50')
	
	// Avec un centrage de la fenêtre si elle occupe toute la page
	//var top = (getWindowHeight() / 2) - (300 / 2) ;
	//var left = (getWindowWidth() / 2) - (400 / 2) ;
	//window.open(lien, '_blank', 'resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,width=400,height=300,top=' + top + ',left=' + left)
	
	// Avec une occupation de 1/2 de la taille de l'écran et avec un décalage léger à gauche
	var top = 50 ;
	var left = 50 ;
	var width = (getWindowWidth() / 2) ;
	var height = (getWindowHeight() / 2) ;
	window.open(lien, '_blank', 'resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left)
}

function openWindow2 (lien) {
	window.open(lien, '_blank', 'resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,width=355,height=290,top=50,left=50')
}

window.onload = function() {
	//clearStyle();
	//InitHmainPage = document.getElementById("main-page").offsetHeight;
	//setMainHeight();
}
window.onresize = function() {
	//setMainHeightResize();
}
