$(document).ready(function(){
	$('#scroller ul li a').click(function(){
		var $tmp = $(this).attr('href');
		$tmp = $tmp.replace('#','');
		var $credits = $(this).find('span.credits').html();		
		var $title = $(this).find('strong').html();
		$('#viemo iframe').attr('src','http://player.vimeo.com/video/'+$tmp);
		//$('#scroller ul li').css('display','block');
		//$(this).parent('li').css('display','none');
		$('h2').html($title);
		$('#credits').html($credits);
		return false;
	});

	$("#slider").slider({ 
		orientation: "vertical",
		min: -100,
		max: 0,		
		change: handleChange,
		slide: handleSlide,
		animate: true
	});

	$('#menu li a').mouseover(function(){
		$(this).parents('li').css('marginTop','-5px');
	}).mouseleave(function() {
		$(this).parents('li').css('marginTop','0');
	});

	$('#menu li a').click(function(){
		$(this).parents('li').css('marginTop','5px');
	});

	$('#lang strong.pl a').mouseover(function(){
		$(this).parent('strong').addClass('pl-hover');
	}).mouseleave(function() {
		$(this).parent('strong').removeClass('pl-hover');
	});	
	$('#lang strong.en a').mouseover(function(){
		$(this).parent('strong').addClass('en-hover');
	}).mouseleave(function() {
		$(this).parent('strong').removeClass('en-hover');
	});		
	

function handleChange(e, ui) {
	var maxScroll = $("#scroller").attr("scrollHeight") - $("#scroller").height();
	$("#scroller").animate({ scrollTop: -ui.value * (maxScroll / 100)}, 100);
}

function handleSlide(e, ui) {
	var maxScroll = $("#scroller").attr("scrollHeight") - $("#scroller").height();
	$("#scroller").attr({ scrollTop: -ui.value * (maxScroll / 100)});
}				
		

});

