/* coding: Alessio 'selfishl0v3' Zappa @ www.alessiozappa.info */

$(window).load(function() {
	$('#slideNews').nivoSlider({
		effect: 'fade',
		animSpeed: 500,
		pauseTime: 5000,
		directionNav: false,
		controlNav: true,
		manualAdvance: false,
		pauseOnHover: false
	});
	var fRow = 0;
	var lRow = 0;
	if ($('#nextMatch').height() > $('#results').height())
		fRow=$('#nextMatch').height();
	else
		fRow=$('#results').height();
	$('#nextMatch,#results').css("height",fRow+"px");
	if ($('#lastPhotos').height() > $('#lastVideo').height())
		lRow=$('#lastPhotos').height();
	else
		lRow=$('#lastVideo').height();
	$('#lastPhotos,#lastVideo').css("height",lRow+"px");
});

$(function(){

	$('.lb').fancybox({
		'padding':0,
		'cyclic':true
	});
	
	/** 4 vimeo **/
	
	$(".lbVimeo").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type'			: 'swf'
		});

		return false;
	});
	
	$('#galleria h2').click(function(){
		$('.singleAlbum').slideUp('slow');
		if ($(this).next('.singleAlbum').css('display')=="block"){
			$(this).next('.singleAlbum').slideUp('slow');
		} else {
			$(this).next('.singleAlbum').slideDown('slow');
		}
	});
	
	
	var c = new String(document.location);
	if (c.indexOf('foto.html#video')>-1) 
	{
		$('.h2vid').click();
	}
	else
	{
		$('#galleria h2:first').click();
	}
	
	$('.sQuadra').hover(
		function(){
			$(this).children('img').fadeIn('slow');
		},
		function(){
			$(this).children('img').fadeOut(250);
		}
	);
	
});

function pagina(n) {
	window.location.replace("/news.html/" + n);
}
