
$(document).ready(function()
	{
	$(function () {
	
	
	
	
	$.preloadCssImages();
	
/*
Slides the element with class "menu_body" 
when paragraph with class "menu_head" is clicked 
*/

/*
if ($.browser.msie && $.browser.version.substr(0,1)<7) {
  // search for selectors you want to add hover behavior to

};
*/
	$("#firstpane p.menu_head").click(function()
    {
		$(this).css({backgroundImage:""}).next("div.menu_body").slideToggle(400).siblings("div.menu_body").slideUp("slow");
       	$(this).siblings().css({backgroundImage:""});
	});
	
	// Depending the name ofthe folder founded on the url, it calls witch menu to show;
	
	var url = location.href;

	if (url.indexOf("alcooldrogue")!=-1) {
		//alert("alcooldrogue")
		$('.menu_body:eq(0)').show();
		$('a[id="alcooldrogue"]').children('img').attr('src', '../images/btn-alcooldrogue-over.jpg');
	}
	
	else if (url.indexOf("its")!=-1)
	{
		//alert("ITS")
		$('.menu_body:eq(1)').show();
		$('a[id="its"]').children('img').attr('src', '../images/btn-its-over.jpg');
	}
	else if (url.indexOf("jeu")!=-1)
	{
		//alert("Jeu")
		$('.menu_body:eq(2)').show();
		$('a[id="jeu"]').children('img').attr('src', '../images/btn-jeu-over.jpg');
	}
	if (url.indexOf("alcoholdrug")!=-1) {
		//alert("alcooldrogue")
		$('.menu_body:eq(0)').show();
		$('a[id="alcoholdrug"]').children('img').attr('src', '../images/btn-alcooldrogue-over.jpg');
	}
	
	else if (url.indexOf("sti")!=-1)
	{
		//alert("ITS")
		$('.menu_body:eq(1)').show();
		$('a[id="sti"]').children('img').attr('src', '../images/btn-its-over.jpg');
	}
	else if (url.indexOf("gambling")!=-1)
	{
		//alert("Jeu")
		$('.menu_body:eq(2)').show();
		$('a[id="gambling"]').children('img').attr('src', '../images/btn-jeu-over.jpg');
	}
	else
	{
		//nothing
	}	
	
	
	
	

/*
Swap images on rollover
js file needed: jQuery.js
*/
		$('img[hover]').hover(function() {
			var currentImg = $(this).attr('src');
			$(this).attr('src', $(this).attr('hover'));
			$(this).attr('hover', currentImg);
		}, function() {
			var currentImg = $(this).attr('src');
			$(this).attr('src', $(this).attr('hover'));
			$(this).attr('hover', currentImg);
		});
			
/*
Sliding panel
js file needed: jQuery.js, slidebox.js
Original script from http://www.hotajax.org/demo/jquery/SlideBox/SlideBox/index.html or http://www.samuelgarneau.com/lab/slidebox/
*/

			
			


			$("#dock").slideBox({width: "100%", height: "550px", position: "bottom", closingTo: "50px"});
			
			
			
			
			$(body).onResize();
			
			//$(body).resize();
			
			
			
			
			
			
		
	});	
});



