/////////////////////////////////
// Import de fichiers js       //
/////////////////////////////////
function ImportJS() {
	var nbr_att = arguments.length;
	var js_effets=document.createElement("script");
	js_effets.setAttribute("type", "text/javascript");
	js_effets.setAttribute("src", arguments[0]);
	if(nbr_att>1){
		for (var i = 1; i<nbr_att; i++){
			js_effets.setAttribute(arguments[i][0], arguments[i][1]);
		}
	}
	document.getElementsByTagName("head")[0].appendChild(js_effets);
}

ImportJS("include/menu.js");
if (window.$&&(typeof window.$=="function")) {
	ImportJS("include/interface.js", Array("charset", "ISO-8859-1"));
	ImportJS("include/jquery.validate.js", Array("charset", "ISO-8859-1"));
	ImportJS("include/jquery.bgiframe.js", Array("charset", "ISO-8859-1"));
	ImportJS("include/jquery.dimensions.js", Array("charset", "ISO-8859-1"));
	ImportJS("include/chili-1.7.pack.js", Array("charset", "ISO-8859-1"));
	ImportJS("include/jquery.tooltip.js", Array("charset", "ISO-8859-1"));
}

/////////////////////////////////
// Affiche (ou cache) une div  //
// Paramètre: id de la div     //
/////////////////////////////////
function afficheId(baliseId, loaded){
	var ancre = document.location.hash;
	if (document.getElementById && document.getElementById('view_' + baliseId) != null){
		if(document.getElementById('view_' + baliseId).style.visibility != 'hidden'){
			if(!(loaded == 1 && '#' + baliseId == ancre)){
				document.getElementById('view_' + baliseId).style.visibility='hidden';
				document.getElementById('view_' + baliseId).style.display='none';
			}
		}
		else{
			if(loaded == 1 && baliseId == 'sub_' + ancre.substr(1)){
				document.getElementById('view_' + baliseId).style.visibility='hidden';
				document.getElementById('view_' + baliseId).style.display='none';
			}
			else{
				document.getElementById('view_' + baliseId).style.visibility='visible';
				document.getElementById('view_' + baliseId).style.display='block';
			}
		}
	}
}

function style(){
	if(document.styleSheets[0].cssRules)
		var rule =document.styleSheets[0].cssRules;
	else if(document.styleSheets[0].rules)
		var rule =document.styleSheets[0].rules;

	nbStyle = rule.length;
	for(i = 0; i < nbStyle; i++){
		if(rule[i].selectorText.toLowerCase() == "#menu ul#main_menu li.selected ul" || rule[i].selectorText.toLowerCase() == "#menu ul#main_menu li:hover > ul"){
			rule[i].style.left = (document.body.clientWidth - 960) / 2 + 'px';
			rule[i].style.display = 'block';
		}
	}
}

function table(){
	if (navigator.userAgent.indexOf("MSIE 6") != -1) {
		var TABLE = document.getElementsByTagName('table');
		var nbTABLE = TABLE.length;
		for(i = 0; i < nbTABLE; i++){
			if(TABLE[i].width == '100%')
				TABLE[i].width = '99%';
		}
		
		var DIV = document.getElementsByTagName('div');
		var nbDIV = DIV.length;
		for(i = 0; i < nbDIV; i++){
			if(DIV[i].style.width == '100%')
				DIV[i].style.width = '99%';
		}
	}
}

function verif_search(msg){
	if(document.search_engine.elements['words'].value == ''){
		alert(msg)
		 return false;
	}
	return true;
}

function swfobject(file, id, width, height, quality){
	var string = '<embed src="' + file + '"';
	if(id) string += ' id="' + id + '"';
	if(width) string += ' width="' + width + '"';
	if(height) string += ' height="' + height + '"';
	if(quality) string += ' quality="' + quality + '"';

	string += ' wmode="transparent"></embed>';
	document.write(string);
}

function menu_left(lien, over){
	if(typeof document.body.style.maxHeight == "undefined"){
		if(over == 1)
			lien.style.backgroundPositionY = 36;
		else
			lien.style.backgroundPositionY = 0;
	}
}