// remap jQuery to $
(function($){})(window.jQuery);


/* trigger when page is ready */
$(document).ready(function (){

	// your functions go here
	
	Shadowbox.init({
		language: 'it',
		players: ['swf', 'flv'],
		flashParams: {allowfullscreen:'true'}
	});

//	document.getElementById('video').addEventListener('ended',function(){document.getElementById('video').webkitExitFullScreen();},false);
	
	$('.video_th a').bind("mouseover", function (event) {
		event.preventDefault();
		$(this).css('background','transparent');
		$(this).next('video').get(0).play();
	});
	$('.video_th a').bind("click", function (event) {
//		event.preventDefault();
	});
	
	$('nav a').bind("click", function (event) {
		event.preventDefault();
		var tab_name = $(this).attr('href');
		tab_name_no_hash = tab_name.replace('#', '');
		if($('#top_content .open').attr('id')!=tab_name_no_hash){
			$('#top_content .open').hide().removeClass('open');
			$(tab_name).show().addClass('open');
		}
	});
	
	if (!$.browser.webkit) {
//	if (!Modernizr.video) {
		$('.video_th').each(function(index) {
			$(this).children('.inner').remove();
			var id = $(this).attr('id');
			$(this).flash(
			{ src: 'video/'+id+'.swf',
			  width: 300,
			  height: 169 },
			{ version: 8 }
		    );
	
		});
	}
    
});

function openShadowbox(content, player, width, height){
    Shadowbox.open({
        content:    content,
        player:     player,
        width:		width,
        height:		height
    });
}

/* optional triggers

$(window).load(function() {
	
});

$(window).resize(function() {
	
});

*/
