var event_height;
var first_loaded = false;
$(document).ready(function () {
	if (!first_loaded){
		first_loaded = true;
		reload_animations();

		$("#start").fadeIn(3000);
	
		if ($(".event .caption").length)
			event_height = $(".event .caption").height();
	}
});

function show_more_videos(){
	var h = $("#video_list").height();
	var v_top = $("#video_list").position().top;
	
	if (Math.abs(v_top-3*257) >= h){
		$("#video_list").animate({
			top:"0px"
			}, 1500, "easeOutSine"
		);
	}
	else {
		$("#video_list").animate({
			position:"absolute",
			top: "-=257px"
		}, 1500, "easeInSine");
	}
	
	//return false;
}

function reload_animations(){
	if ($(".event .caption").length)
		event_height = $(".event .caption").height()+31;

	$('.event').hover(
		
		function(){//185
			$('.caption', this).stop().animate({top:(370-event_height) + 'px'}, {queue:false, duration:500});
		},
		function(){
			$('.caption', this).stop().animate({top:'294px'}, {queue:false, duration:500});
		}
	);

}

function loade(link){
	$("#loading_img").show();

	$.get(link, {'ajax': true }, function(response){
		$("#main_inner").html(response);
		reload_animations();
		$("#loading_img").hide();
		$("#main_inner").fadeIn("slow", function(){
		});
	});

	top.location = "#" + link;
	return false;
}

