$(document).ready(function(){
	$(".menu a").hover(
		function(){
			if(this.className == "active") return;			
			var newImg = $(this).find("img").attr("src").replace(/\_i.gif$/, '_a.gif');
			$(this).find("img").attr("src", newImg);
		},
		function(){
			if(this.className == "active") return;
			var newImg = $(this).find("img").attr("src").replace(/\_a.gif$/, '_i.gif');
			$(this).find("img").attr("src", newImg);
		}
	);
	
	$("a.openVideo").click(function(){
		if ($("#video").is(":visible") && $("#videoBg").is(":visible")) {
			$("#video").hide();
			$("#video").empty();
			$("#videoBg").fadeOut("slow");			
			$("body").css({overflow: "auto"});
		} else {
			$("#video").load("/video/load/" + $(this).attr("href"));
					
			$("#video").css({ top: (parseInt($("#video").offset().top) + 150) });
			$("#videoBg").css({top: $("#videoBg").offset().top});
			
			$("#videoBg").css({display: "block", opacity: 0}).fadeTo("slow", 0.50, function () {
				$("#video").show( 
					function () {					
						$("#video").css({ left: parseInt($('body').width()/2) - parseInt($("#video").width()/2) })
					}
				);
			});	
			$("body").css({overflow: "hidden"});
		}
		return false;
	});	
	
	$(".readMore").click(function(){
		currentExtended = $(this).parent().parent().children(".newsExtended");
		if (currentExtended.is(":visible")) {			
			$(this).html('Read more');
			$(this).removeClass('selected');
			currentExtended.slideUp("fast");
		} else {
			$(this).html('Close');
			$(this).addClass('selected');
			currentExtended.slideDown("fast");
		}
		return false;
	});

});
