function opacity(id,opc) {
	document.getElementById(id).style.filter = "alpha(Opacity="+opc+")";
	document.getElementById(id).style.opacity = opc/100;
}

function page(cat) {
	new Ajax.Updater('page', 'index.php', {parameters:'categorie=' + encodeURIComponent(cat), asynchronous:true, evalScripts:true});
}

function page_rub(rub) {
	new Ajax.Updater('page', 'index.php', {parameters:'rubrique=' + encodeURIComponent(rub), asynchronous:true, evalScripts:true});
}

function openrub(id,e,parent) {
	nom = 'info_rub'+id;
	
	if(parent != 0) {
		if(document.getElementById(e).style.backgroundImage == 'url(images/puce_menu_2.gif)') {
			document.getElementById(e).style.backgroundImage = 'url(images/puce_menu.gif)';
			self.setTimeout('invisible("'+nom+'")',900);
		}
		else {
			document.getElementById(e).style.backgroundImage = 'url(images/puce_menu_2.gif)';
		}
	}
	
	new Effect.toggle($(nom),'blind');
}

/****** Menu principal de gauche *******/

/* Fonction qui permet d'ouvrir et de fermer une catégorie */
function openmenu(id,e,parent) {
	nom = 'info'+id;
	
	if(parent != 0) {
		if(document.getElementById(e).style.backgroundImage == 'url(images/puce_menu_2.gif)') {
			document.getElementById(e).style.backgroundImage = 'url(images/puce_menu.gif)';
			self.setTimeout('invisible("'+nom+'")',900);
		}
		else {
			document.getElementById(e).style.backgroundImage = 'url(images/puce_menu_2.gif)';
		}
	}
	
	new Effect.toggle($(nom),'blind');
}



/* Rend invisible e */	
function invisible(e) {
	document.getElementById(e).style.display = "none";
}

/* rend visible e et change la puce à droite */
function visible1(e,toggle,parent) {
	document.getElementById(e).style.display = "block";
	
	if(parent != 0) {
		document.getElementById(toggle).style.backgroundImage = 'url(images/puce_menu_2.gif)';
	}
}

/* Au chargement de la page on regarde si un lien a été cliqué et on ouvre la catégorie ou le lien figure */
function ouvrir(idmenu,parent) {
	menuid = 'info'+idmenu;
	toggleinfo = 'toggleinfo'+idmenu;
	visible1(menuid,toggleinfo,parent);
}

function ouvrir_rub(idmenu,parent) {
	menuid = 'info_rub'+idmenu;
	toggleinfo = 'toggleinfo_rub'+idmenu;
	visible1(menuid,toggleinfo,parent);
}

/* permet de récupérer une variable passer en paramètre de l'URL */
function getURLParam(strParamName){
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 ){
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
			if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
	return strReturn;
}

function addToFavorites() {
	if (document.all) { window.external.AddFavorite(location.href, document.title); }
	else { alert('Vous pouvez faire CTRL + D pour ajouter cette page dans vos signets, ou favoris.') }
}

function afficheZoom(id){
	document.getElementById(id).style.display = "";
}

function close_window(id){
	document.getElementById(id).style.display = "none";
}
