
/**
 * We use the initCallback callback
 * to assign functionality to the controls
 */

// Ride the carousel...
jQuery(document).ready(function() {

	/*gestion des widgets */
	$(".widget  ul").hide();
	$(".widget  div").hide();
	$(".widgettitle").click(function() {
		var idWidget = 	$(this).parent().attr('id');
		//$(this).parent().find('ul') function(){alert("toto");}
		$("#"+idWidget+" ul").slideToggle();
		$("#"+idWidget+" div").slideToggle();
		$("#"+idWidget+" h2").toggleClass("deployed");
	});
	/*gestion de la navigation */	
	$("#header ul.nav div.navsubmenu").hide();
	$("#header ul.nav li").find("ul");
    $("#header ul.nav > li").hover( function () {
				$(this).addClass("selected");
		        $(this).find(".navsubmenu").slideDown(200);
		       // $("#header ul.nav li li:last-child").addClass("LastLi");
		    },
		    function () {
		    	$(this).removeClass("selected");
		        $(this).find(".navsubmenu").slideUp(200);
		    }
    )
    .end();
    
    		$("ul.thumb li").hover(function() {
			$(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
			$(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
				.animate({
					marginTop: '-61px', /* The next 4 lines will vertically align this image */ 
					marginLeft: '-61px',
					top: '50%',
					left: '50%',
					width: '121px', /* Set new width */
					height: '121px', /* Set new height */
					padding: '0'
				}, 100, 'linear'); /* this value of "200" is the speed of how fast/slow this hover animates */
		
			} , function() {
			$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
			$(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
				.animate({
					marginTop: '0', /* Set alignment back to default */
					marginLeft: '0',
					top: '0',
					left: '0',
					width: '72px', /* Set width back to default */
					height: '72px', /* Set height back to default */
					padding: '5px'
				}, 500, 'linear');
		});
    
    
});




function hideHover(index) {
		$("#mycarousel li.jcarousel-item-"+index+" a").animate({ opacity: "0.9"}, 100 );
		$("#mycarousel li.jcarousel-item-"+index+" a").children('span').animate({  width:"0", height:"0", marginLeft:"0"}, 100 );

}
function showHover(index)
{
	$("#mycarousel li.jcarousel-item-"+index+" a").animate({
        opacity: "1"}, 500 );
    $("#mycarousel li.jcarousel-item-"+index+" a").children('span').animate({
                width:"268px", height:"161px", marginLeft:"-40px"},
         500 );
}
