// JavaScript Document
$(document).ready(function() {
	//
	//
	//
	var alphaBase = 0.5
	var alphaMax = 1.0
	//
	//
	//
	// index page
				var loc = window.location.toString()
				var lastchar = loc.substr(-1)
				windowlocation_2 = ''
				if (lastchar == "/"){
					windowlocation_2 = window.location+'index.php';
				} else  if (lastchar == "m") {
					windowlocation_2 = window.location+'/index.php';
				} else {
					windowlocation_2 = window.location
				}
				//alert(windowlocation_2);
				//
				//
				//
		$("#menu_top a").each(function() {
				//
				//
			 if(this.href == windowlocation_2 || trouve_pareil(this.href, windowlocation_2)){
				 //
				 //
				 //
				 // page exacte
				$(this).addClass("active");
			 } else {
				 //
				 //
				 // aspect de bae
				$(this).fadeTo(0, alphaBase)
				//
				var itemColorBase = $(this).css("background-color")
				//
				$(this).mouseover(function(){
					$(this).fadeTo(100,alphaMax)
				});
				$(this).mouseout(function(){
					$(this).fadeTo(300,alphaBase)
				});
			}
		});
	$("#menu_bottom a").each(function() {
		 if(this.href == windowlocation_2 ||  trouve_pareil(this.href)){
		 	$(this).addClass("active");
		 }
	});
	function trouve_pareil(href, location){
			var currentpage = jQuery.url.setUrl(location).attr("file");
			var currentlink = jQuery.url.setUrl(href).attr("file");
			//alert(currentpage);
			if (currentpage!==null){
			return (currentpage.substr(0,9) == currentlink.substr(0,9))?true:false;
			}
	}
	/*$("#menu_bottom a").each(function() {
		 if(this.href == window.location){ 
		 	$(this).addClass("active");
		 }
	});*/
	//
	//
	//
	});