/**********************************************************************************************************/
function fixeHauteurPage() {

	if (window.innerHeight) {
		hautPage = (window.innerHeight);
	} else {
		hautPage = (document.body.offsetHeight);
	}
	
	
	ObjBody2 = document.getElementById('body2')
	
	if (ObjBody2) {
	
		hautBody2 = ObjBody2.clientHeight;
		if (hautBody2<hautPage) {
			hautBody2= hautPage;
			ObjBody2.style.height=hautPage+"px";
			
		
		}
		
		cadres = getElementsByClass("cadre",null, "div");
		for(i = 0; i<cadres.length; i++) {
			
			monCadre = cadres[i];
			if (monCadre) {
			
				hautMonCadre = monCadre.clientHeight;
	
				if (hautMonCadre<(hautBody2 - getTop(monCadre)-5)) {
					monCadre.style.height=(hautBody2 - getTop(monCadre)-5)+"px";
				
				} 
				
			}
		}
		
		
		
	}
	
	
	
	
	
}

/**********************************************************************************************************/
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

/**********************************************************************************************************/
function getTop(obj) {
	var ylocation = parseInt(obj.offsetTop);
	while (obj.parent)
	{
		obj = obj.parent;
		//xlocation = xlocation + parseInt(obj.offsetLeft);
		ylocation = ylocation + parseInt(obj.offsetTop);
	}
	
	return ylocation;
}

/**********************************************************************************************************/
function chargementPage() {
	fixeHauteurPage();
	menuMasquerSSMenus();
}


/**********************************************************************************************************/
/**
	* Affiche un sous menu 
	* Recois en paramètre soit l'objet DOM "menu père" soit "sous menu"
*/
function menuAfficherSSMenu(menu) {
   //menuMasquerSSMenus();

	if (menu) {
		//si menu est un sous menu
		if (menu.className=="ssmenu") {
			ssMenu = menu;
			//si menu est un menu père recherche son sous menu
		} else {
			ssMenu = menu.getElementsByTagName("UL")[0];
		}
		
		
		if (ssMenu) {
			ssMenu.style.display = "block";	
		}
	}
	
}

/**********************************************************************************************************/
/** Masque tous les sous menu*/
function menuMasquerSSMenus() {
	divMenu = document.getElementById("menu");
	if (divMenu) {
		listeMenus = divMenu.getElementsByTagName("UL");
		for(a=0;a<listeMenus.length;a++) {
			if (listeMenus[a].className == "ssMenu") {
				listeMenus[a].style.display = "none";
			}
		}
	}
}

/**********************************************************************************************************/
/** go to la page vers une adresse*/
function goToURL(url) {
	window.location = url;
}

