window.onAjaxLoad = function() {};

(function($){
  $(function(){	
			 
						   
	 $('a.spip_out, a.out').click(function(){	
		this.target = "_blank";	
	});
	 
	//ridimensionamento
	
	var wh = $(window).height();
	var dim = wh - 824;
	var cont = $('#container_center').height();
	
	
	if (wh>824){
		var newheight = cont + dim;
		$('#container_center').css('height', newheight +'px');
	};
	
	$(window).resize(function(){
		var wh = $(window).height();
		var dim = wh - 824;
		if (wh>824){
			var newheight = cont + dim;
			$('#container_center').css('height', newheight +'px');
		}
		else {
			$('#container_center').css('height', cont +'px');
		};
	});	
		
	 
	//visualizza articoli e lancio dell'easySlider
	$("a[name^=art]").click(function(){
	  $(this).parent().parent().find('a').removeClass("on");
	  $(this).addClass("on");							 
	  var a = $(this).attr("name");
	  $(this).parent().parent().next().children().hide();
	  $("#view_"+a).show();	 
	  
	  /*if(a=="art_11" || a=="art_30"){
		$("#scrollruoli").easySlider({
			orientation:'vertical',
			prevId:'prevGR',
			nextId:'nextGR'
	  	});
	  }
	  if(a=="art_12" || a=="art_31"){
		$("#scrollposiz").easySlider({
			orientation:'vertical',
			prevId:'prevGposiz',
			nextId:'nextGposiz'
	 	});	  
	  }
	  if(a!="art_12" && a!="art_11" && a!="art_30" && a!="art_31"){
		   $("#scroll_"+a).jScrollPane({showArrows:true});
		 
	  }*/	
	  $("#scroll_"+a).jScrollPane({showArrows:true});
	  return false;
    });
	
	if($.fn.jScrollPane) {
    //$('#scrollnews').jScrollPane({showArrows:true});	
  	$('#scrollitem').jScrollPane({showArrows:true});
	$('#scrollnews').jScrollPane({showArrows:true});
	//$('#scrollruoli').jScrollPane({showArrows:true});
  	$('div:visible>div.scrollart').jScrollPane({showArrows:true});
	}
	
	
	$("li.ruolili").wrapAll("<ul></ul>");
	
	
	
	$("li.posizioneli").wrapAll("<ul></ul>");
	//$("#scrollruoli").after("<span id='prevGR'><a href='javascript:void(0);'><span>&lt;</span></a></span><span id='nextGR'><a href='javascript:void(0);'><span>&gt;</span></a></span>");	
	//$("#scrollposiz").append("<span id='prevGposiz'><a href='javascript:void(0);'><span>&lt;</span></a></span><span id='nextGposiz'><a href='javascript:void(0);'><span>&gt;</span></a></span>");
	 /*$("#scrollnews").easySlider({
			orientation:'vertical',
			prevId:'prevGnews',
			nextId:'nextGnews'
	 	});*/	 
	  $("#scrollvideo").easySlider2({
			orientation2:'orizzontal',
			prevId2:'prevGallery',
			nextId2:'nextGallery'
	 	});	 
	
   $("#menu a").each(function(i){
      if(!$(this).is(".on")) {
        $(this).css({backgroundImage:"none",overflow:"hidden",position:"relative"});
        $("<img>").addClass("normal").css({display:"none",margin:"auto",border:"none"}).attr("src",menu_img[i].normal).prependTo(this);
        $("<img>").addClass("hover").css({display:"block",height:"35px",position:"absolute",right:0,margin:"auto",border:"none"}).attr("src",menu_img[i].hover).prependTo(this);
      }
   })	
  	
   $("#menu a:not(.on)").hover(function(){
    $(this).stop().animate({height:"66px"},200);
    $("img.normal",this).hide();
    $("img.hover",this).css({height:"35px",display:"block"}).stop().animate({height:"66px"},200);
   },
   function(){
    $(this).stop().animate({height:"35px"},200);
    $("img.hover",this).stop().animate({height:"35px"},200);
   });
	 });
})(jQuery);		




