$(function(){
	var $menu_onglet=true;
	if($(location).attr('href').search("#")!=-1){
		$("h3").addClass("no");
		$menu_onglet=false;
	}		
 
	/* Accordeon */
	$( "#accordion" ).accordion({
		active: true,
		collapsible: true,
		navigation: true,
		autoHeight: false/*, change : yourFunction*/
	});
	$("#accordion h3 a").click(function(event){
		  window.location.hash=this.hash;
	 });
	 
	var Nav = navigator.appName;
	//anim
	if(Nav != 'Microsoft Internet Explorer'){
		$("h2").animate({marginLeft: "30px"}, 1500);
		$("#h3_1").animate({marginLeft: "0px"}, 500);
		$("#h3_2").animate({marginLeft: "0px"}, 1000);
		$("#h3_3").animate({marginLeft: "0px"}, 1500);
		$("#h3_4").animate({marginLeft: "0px"}, 2000);
		$("#h3_5").animate({marginLeft: "0px"}, 2500);
	}
	 
	if(Nav != 'Microsoft Internet Explorer'){
		var hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
		//Function to convert hex format to a rgb color
		function rgb2hex(rgb) {
		 rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
		 return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
		}
		function hex(x) {
		  return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];
		 } 		 
		$('h3').hover(function(e) {		
			var color = $(this).children('a').css("color");
			//console.log('a: '+rgb2hex(color));
			if(rgb2hex(color)!='#ff9001')
				
			$(this).children('a').hoverFlow(e.type, {color:'#ff9000'}, 200);
			$(this).hoverFlow(e.type,{top:-20,marginTop:20}, {duration:300,complete:function(){}});
			//$(this).hoverFlow(e.type,{bottom:20,marginBottom:-10,marginTop:10}, {duration:500,complete:function(){$toto=true}});
			//$(this).hoverFlow(e.type,{left:30}, 150);
	  }, function(e) {		
			var color = $(this).children('a').css("color");
			//console.log('a: '+rgb2hex(color));
			if(rgb2hex(color)!='#ff9001')
		 $(this).children('a').hoverFlow(e.type, { color:'#aaa',left: 0 }, 400);
		 $(this).hoverFlow(e.type,{top:0,marginTop:0}, {duration:300,complete:function(){$toto=true}});
		 //$(this).hoverFlow(e.type,{bottom:0,marginBottom:0,marginTop:0}, {duration:500,complete:function(){$toto=true}});
			//$(this).hoverFlow(e.type,{left:0}, 300);
	  });	  
	}
	 $(".ui-accordion-header").click(function(){
		var $this=$(this);		
		$(".ui-state-default").addClass('no');
		$("#accordion h3").addClass('no');
	});
  
	$("a#inline").fancybox({'hideOnContentClick': true});
});
