jQuery(document).ready( function() {

	//###############################################
	// On cache les images d'article qui n'ont pas de source
	//###############################################
	jQuery('.imgArticle').css("display","none");
	jQuery('.imgArticle[src*=assets]').css("display","block");

	
	//###############################################
	// Gestion du Menu
	//###############################################
	jQuery('.menu_h > li, .menu_v > li').hover(
		function() { jQuery(this).children('ul').fadeIn("fast"); } ,
		function() { jQuery(this).children('ul').fadeOut("fast"); }
	);

	
	//###############################################
	// CYCLE PLUGIN
	//###############################################
	jQuery(".cycle_fade1").cycle({ fx:'fade', timeout: 10000, speed:3000, pause:'0' });
	jQuery(".cycle_fade2").cycle({ fx:'fade', timeout: 4000, speed:2000, pause:'0' });
	jQuery(".cycle_fade3").cycle({ fx:'fade', timeout: 2000, speed:1000, pause:'0' });

	jQuery(".cycle_scrollDown1").cycle({ fx:'scrollDown', timeout: 10000, speed:3000, pause:'0' });
	jQuery(".cycle_scrollDown2").cycle({ fx:'scrollDown', timeout: 4000, speed:2000, pause:'0' });
	jQuery(".cycle_scrollDown3").cycle({ fx:'scrollDown', timeout: 2000, speed:1000, pause:'0' });
                                                                           
	jQuery(".cycle_scrollRight1").cycle({ fx:'scrollRight', timeout: 10000, speed:3000, pause:'0' });
	jQuery(".cycle_scrollRight2").cycle({ fx:'scrollRight', timeout: 4000, speed:2000, pause:'0' });
	jQuery(".cycle_scrollRight3").cycle({ fx:'scrollRight', timeout: 2000, speed:1000, pause:'0' });
                                                     
	
	//###############################################
	// TOOLTIP PLUGIN
	//###############################################
	/*
	jQuery("a").tooltip({ 
		bodyHandler: function() { 
			return jQuery(jQuery(this).attr("href")).html(); 
		}, 
		showURL: false 
	});
	*/
	
	//###############################################
	// LightBox sur les images
	//###############################################
	jQuery('a[rel*=lightbox], .thumbscontainer a').lightBox({
		overlayOpacity: 0.6,
		containerResizeSpeed: 350,
		txtImage: 'Image',
		txtOf: 'sur',
		imageLoading:	'assets/templates/aska/core/jquery-lightbox/images/lightbox-ico-loading.gif',
		imageBtnClose:	'assets/templates/aska/core/jquery-lightbox/images/lightbox-btn-close.gif',
		imageBtnPrev:	'assets/templates/aska/core/jquery-lightbox/images/lightbox-btn-prev.gif',
		imageBtnNext:	'assets/templates/aska/core/jquery-lightbox/images/lightbox-btn-next.gif',
		imageBlank:	'assets/templates/aska/core/jquery-lightbox/images/lightbox-blank.gif'
	});

	
	//###############################################
	// Bascule sur les CSS
	//###############################################
	var idLinkCSS	= "css-layout";
	var cssLayout = jQuery.cookie('cssLayout');
	if (cssLayout!=null) jQuery("#"+idLinkCSS).attr( {href: ""+cssLayout} );
	
	function mySwitchCSS(myCSS) {
		jQuery("#wrap")
			.fadeOut(
				1000 ,
				function(){jQuery("#"+idLinkCSS).attr( {href: ""+myCSS} );}
			);
		jQuery("#wrap").fadeOut(1000).fadeIn(1000);
		cssLayout = myCSS;
		jQuery.cookie('cssLayout', cssLayout);
	}
	
	jQuery("#switch_css li a").click(function(event) { mySwitchCSS(jQuery(this).attr("rel")); event.preventDefault(); });
	
} );