// Beat Fly JavaScript core document
/*jquery setting*/
$(document).ready(function(){
	
	//inizialize equalHeight Function
	equalHeight($(".box300"));
								
	//form focus
	$("#name").focus();
	
	//img effect
	$('#icons ul li, #rightside ul#foto li img, #thumbnail ul li img').hover(function() {
		$(this).stop().animate({
			opacity : 0.7
		}, 500);
		},
		function(){
		$(this).stop().animate({
			opacity : 1
		}, 500);
	});
	
	//bookmark
	$("a.jQueryBookmark").click(function(e){
		e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
		var bookmarkUrl = this.href;
		var bookmarkTitle = this.title;
		 
		if (window.sidebar) { // For Mozilla Firefox Bookmark
			window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
		} else if( window.external || document.all) { // For IE Favorite
			window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
		} else if(window.opera) { // For Opera Browsers
			$("a.jQueryBookmark").attr("href",bookmarkUrl);
			$("a.jQueryBookmark").attr("title",bookmarkTitle);
			$("a.jQueryBookmark").attr("rel","sidebar");
		} else { // for other browsers which does not support
			 alert('Spiacenti, il vostro Browser non supporta questa azione; aggiungere il Bookmark manualmente');
			 return false;
		}
	});
			
	//fancybox imgages
	$("a[href$=.jpg], a[href$=.JPG]").fancybox({
		'titlePosition'		:	'over',
		'overlayOpacity'	:	0.8,
		'overlayColor'		:	'#000'							
	});
	
	//fancybox external + map + meteo
	$("a.external").fancybox({
			'width'				: '90%',
			'height'			: '90%',
		    'autoScale'     	: true,
			'autoDimensions'	: true,
		    'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe'
	});
	
	//fancybox externalvideo
	$(".externalvideo").fancybox({
			'titlePosition'		: 'inside',
			'transitionIn'		: 'none',
			'transitionOut'		: 'none'
	});
	
	//fancybox getvideo
	$("a.getvideo").fancybox({
			'width'				: 430,
			'height'			: 370,
		    'autoScale'     	: true,
			'autoDimensions'	: true,
		    'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe'
	});

        //fancybox ilmeteo
	$("a.ilmeteo").fancybox({
			'width'				: 500,
			'height'			: 454,
		    'autoScale'     	: true,
			'autoDimensions'	: true,
		    'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe'
	});
		
});//end	

	//equalHeight Function
	function equalHeight(group) {
		tallest = 0;
		group.each(function() {
			thisHeight = $(this).height();
				if(thisHeight > tallest) {
					tallest = thisHeight;
				}
		});
		group.height(tallest);
	}
	
	//cufon
	Cufon.replace('h1, h2, h3, h4, h5', {
		textShadow: '0 1px 0 #ffffff'
	});
		
	Cufon.replace('.contentTab h2, .ui-tabs .ui-tabs-nav li a', {
		textShadow: '0 1px 0 #555'
	});

	Cufon.replace('#icons ul li#it a, #icons ul li#it_off, #icons ul li#en a, #icons ul li#en_off', {
		textShadow: '0 1px 0 #ffffff'
	});

	
