	(function($){
$(document).ready(function(){
	/* ***********************************************************************
	 * MANAGECONTENT
	 *********************************************************************** */
	 var zoom = 100;
	 var $body = $(".mainframe");
	 var zoomStep = 10;
	 var zoomMax = 150;
	 var zoomMin = 70;
	 $("#manageContent")
	 	.find("a.fontMore")
			.bind("click", function(event){
				event.preventDefault();
				/* augmenter la taille du texte */
				//console.log($("body").css("font-size"));
				if (zoom < zoomMax) {
					zoom += zoomStep;;
					$body
						.removeClass("zoom" + (zoom - 10))
						.addClass("zoom" + zoom)
					;
				}
			})
		.end()
		.find("a.fontLess")
			.bind("click", function(event){
				event.preventDefault();
				/* diminuer la taille du texte */
				if (zoom > zoomMin) {
					zoom -= zoomStep;;
					$body
						.removeClass("zoom" + (zoom + 10))
						.addClass("zoom" + zoom)
					;
				}
			})
		.end()
		.find("a.print")
			.bind("click", function(event){
				event.preventDefault();
				print();
			})
		.end()
	;

	/***************************************************************************
	 * TAPERICI
	 **************************************************************************/
	$("label.taperici").taperici();

	/***************************************************************************
	 * ZEBRA
	 **************************************************************************/
	$("table tbody tr, div.blockActualite")
		.filter(":odd")
			.addClass("odd")
		.end()
		.filter(":even")
			.addClass("even")
		.end()
	;

	/***************************************************************************
	 * MENU
	 **************************************************************************/
	$("#mainNavigation li")
		.hover(
			function(){
				var $this = $(this);
				$this.addClass("hover");
				if ( $("ul", this).length > 0){
					$this.addClass("hoverSub");
				}
			},
			function(){
				$(this)
					.removeClass("hover")
					.removeClass("hoverSub")
				;
			}
		)
	;
	/***************************************************************************
	 * LIGHTBOX
	 **************************************************************************/
	if($('#gallery').get(0)){
	    $('#gallery a').lightBox({
	    	imageLoading: '/jsp/jahia/templates/ifma_web/ifmaweb_templates/img/lightbox/lightbox-ico-loading.gif',
	    	imageBtnClose:'/jsp/jahia/templates/ifma_web/ifmaweb_templates/img/lightbox/lightbox-btn-close.png'
	    	//txtImage: ''
	    	});
	}
	/***************************************************************************
	 * ACCORDION
	 **************************************************************************/
    if (jQuery.browser.msie && parseInt(jQuery.browser.version)=='6') {

    	$("div.blockSurLeSite div.container").accordion({ animated: false});

    	}

    	else {

    	$("div.blockSurLeSite div.container").accordion();

    	}


	/***************************************************************************
	 * BORDER
	 **************************************************************************/
	$("div.blockPhototheque, div.blockPhototheque div.items, div.blockZoom h3, #homeSecondaryInfo, div.blockActualites, div.blockSurLeSite, div.container, div.blockSurLeSite h3, div.blockActualites div.newslistContainer")
		.corner("8px")
	;

	$("#blockVousetes")
		.corner("5px")
	;
	
	$(".blockaccordion")
			.accordion()
	;

	$(".blockDocCat h2")
		.corner("8px")
		.each(function (){
			if($(this).hasClass('closed')) {
				$($(this).parent().children('div')[0]).toggle();
			}
			
		})
		.click(function (){
			$($(this).parent().children('div')[0]).toggle();			
			var nclass = $(this).hasClass('closed') ?  "open" : "closed";
			$(this).removeClass("closed").removeClass("open")
			$(this).addClass(nclass);
		})
	;
	$('#demandedocumentationform input.submit')
		.corner("8px")
	;
	
	/***************************************************************************
	 * DISPLAY
	 **************************************************************************/
	
	$('.blockDocCat .blockDoc:not(.noalternate)').alternate({odd:'odd', even:'even'});
	
	var lists = $('.sitemap .list');
	var modulo = 0;
	lists.each(function (){
		if (modulo%2!=0){
			$(this).after('<hr class="grey"/>');
		}
		modulo++;
	})
	
	
		
	/***************************************************************************
	 * JCAROUSEL
	 **************************************************************************/

	$("div.blockActualites div.newslistContainer")
		.parent()
			.prepend("<div class='jcarousel-next' />")
			.prepend("<div class='jcarousel-prev disabled' />")
		.end()
		.jCarouselLite({
			btnNext: "div.blockActualites div.jcarousel-next",
			btnPrev: "div.blockActualites div.jcarousel-prev",
			visible: 1,
			circular: false
		})
	;
	$("div.jcarousel-next")
		.hover(
			function(){
				$(this).addClass("jcarousel-next-hover");
			},
			function(){
				$(this).removeClass("jcarousel-next-hover");
			}
		)
	;
	$("div.jcarousel-prev")
		.hover(
			function(){
				$(this).addClass("jcarousel-prev-hover");
			},
			function(){
				$(this).removeClass("jcarousel-prev-hover");
			}
		)
	;
	$("div.blockNosPartenaires div.content")
	.jCarouselLite({
		visible: 1,
		auto: 2000,
		speed: 600
	})
	;
	
	
	/***************************************************************************
	 * SLIDESHOW
	 **************************************************************************/
	if($('#slideshow').get(0)){
		slideshow.auto=false;
		slideshow.speed=5;
		slideshow.link="linkhover";
		slideshow.info="information";
		slideshow.thumbs="slider";
		slideshow.left="slideleft";
		slideshow.right="slideright";
		slideshow.scrollSpeed=4;
		slideshow.spacing=5;
		slideshow.active="#fff";
		slideshow.init("slideshow","image","imgprev","imgnext","image");
		
		if(window.location.hash!='')
		{
			$('#slider img[alt='+window.location.hash.substring(1)+']').click();
		}
		$('#slider img').bind('click', function(){window.location.hash='#'+$(this).attr('alt')});
		$('#imgprev').click(function(){window.location.hash='#'+$($("#slider img.active").get(0)).attr('alt')});
		$('#imgnext').click(function(){window.location.hash='#'+$($("#slider img.active").get(0)).attr('alt')});
		/*console.debug($('#image img'));
		alert($('#image img').offset());
		if(parseInt($('#image img').width())>500){
			$('#image img').width('500	px');
		}*/
	}	
	
	
});
})(jQuery);

