function mainmenu(menuid){
	$(menuid+" ul ul ").css({display: "none"}); // Opera Fix
	$(menuid+" li").hover(
		function(){
			$(this).find('ul:first').css({visibility: "visible",display: "none"}).show();
		},
		function(){
			$(this).find('ul:first').hide();
		}
	);

}


$(document).ready( function() {

	var h1=$('.accueil2 #bloc1').height();
	var h2=$('.accueil2 #bloc2').height();
	if(h1>h2){$('.accueil2 #bloc2 .bloc').height(h1-40);}
	if(h1<h2){$('.accueil2 #bloc1').height(h2);}
	
	$('.camping #bloc2').height($('#corps').height());
	//$('.accueil2 #bloc1 .bloc').height($('#bloc1').height());
	$('.region h3').click(
		function(){
			$('.open').slideUp();
			var p=$(this).parent().find('.pane');
			p.slideDown();
			p.addClass('open');
		}
	);
//	$("#actions .next").click(
//		function(){
//		var position = $("#scroll .items2").position();
//			if(position.top>($("#scroll").height()+20)*-1){
//			$("#scroll .items2").animate({
//			top: '-=50',
//		  }, 500, function() {
//			// Animation complete.
//		  });
//			}
//		}
//	);
//	$("#actions .prev").click(
//		function(){
//			var position = $("#scroll .items2").position();
//			if(position.top<0){
//			$("#scroll .items2").animate({
//			top: '+=50',
//		  }, 500, function() {
//			  //alert($("#scroll .items2").css('top'));
//			// Animation complete.
//		  });
//			}
//		}
//	);
	$("#scroll").scrollable({items:'items2',vertical:true});
	if($('body').attr('class')!='admin'){
	var api1=$('a[rel="#overlay"]').overlay({ 
        expose:'#000',opacity:0.88,top:55,api:true,
        onBeforeLoad: function() {
			$("#overlay iframe").attr('src',this.getTrigger().attr("href"));
		}
	});
	var api2=$('a[rel="#overlay2"]').overlay({ 
        expose:'#000',opacity:0.88,top:55,api:true,
        onBeforeLoad: function() {
			$("#overlay2 iframe").attr('src',this.getTrigger().attr("href"));
		}
	});
	
	$('a[rel="#camping"]').tooltip({tip:'#camping',effect:'fade',onBeforeShow:function(){this.getTrigger().click(function(){return false;});$('#camping .wrap').load(this.getTrigger().attr("href"));},position:'center right'});
	$(".tabs").tabs(".items > div",{effect: 'fade',fadeOutSpeed: "slow",rotate: true}).slideshow({autoplay:true,interval:5000});
	mainmenu('#navigation');
			
	$('#toolbar #tb_lists').parent().hover(function(){$(this).parent().find('.smenu').slideDown();},function(){$(this).parent().find('.smenu').slideUp();});
	$(".insert").hover(
		function(){
			$(this).find('.tool').css({display:"block"});
			$(this).find('.tool').attr('href',$(this).find('.tool').attr('href')+'&w='+$(this).width());
		},
		function(){
			$(this).find('.tool').css({display:"none"});
		}
	);
	}
});
