/**/


$(document).ready(function(){

	/*******************/
	/*Aggiungi Link a mail*/
	$('span.eml').val(function(){
		var cd = $('span.emlcd').html();
		if(!cd) return;
		cd = Base64.decode(cd);				
		cd = 'mailto:' + cd;
		href = Base64.encode(cd);				
		$('span.emlvw').wrap("<a href=\""+href+"\" />");
		return;
	});
	/*Convert it*/
	$('span.eml a').click(function(){
		href = $(this).attr('href');
		if(href.search(/mailto:/i) === -1){//se non c'e' e' da decodificare
		 	href = Base64.decode(href);
			$(this).attr('href', href);
		}
		return;
	});
	
	/***********open in a new window ******/
	$('a[rel="external"]').click(function(){
		$(this).attr('target', '_blank');
		return true;
	});

		
	
	/*******************/
	// default axis ='y', if want to scroll both x and y:
	// $.localScroll.defaults.axis = 'xy';
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: 'body', // Could be a selector or a jQuery object too.
		queue:true,
		duration:1500,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
			/**Dettaglio -menu versioni **/
			//$("div.catalogoDetail ul.menuVs li.tratteggio span a.top").animate({opacity: 0});
		}
	});
	
	$.localScroll({
		target: 'body', // could be a selector or a jQuery object too.
		queue:true,
		duration:900,
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
			/**Dettaglio -menu versioni **/
			//$("div.catalogoDetail ul.menuVs li.tratteggio span a.top").animate({opacity: 0.25});
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
			//$("div.catalogoDetail ul.menuVs li.tratteggio span a.top").animate({opacity: 1});
		}
	});
		
	
	
	/**********************************/
	
	$('#slideshow ul.list').innerfade({ 
 	  animationtype: 'fade', //slide
   	  speed: '5000', //(slow, normal or fast) (Default: 'normal'), 
 	  timeout: '5500', 
 	  type: 'sequence', 
  	  containerheight: 'auto',
 	  runningclass: 'innerfade',
 	  children: null
   }); 

		
	/** SELEZIONE STAGIONE/GIORNATA **/
	$('div.selBox ul li').css('display', 'none');
	$('div.selBox ul li.first').css('display', 'block');
	
	$('div.selBox span.selTlt').click(function(){
	  $('div.selBox ul li:not(.first)').slideToggle('slow', function() {
	    	// Animation complete.
	 	 });
	});

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	
					
});//jquery
