//mousover handler

$(document).ready(function() {
	
	$("a.link").hover(
	  function () {
		$(this).fadeTo(300,.7)
	  },
	  function () {
		$(this).fadeTo(300,1)
	  }
	);
	
	
	$("#menu > a").hover(
	  function () {
		$(this).fadeTo(300,.7)
	  },
	  function () {
		$(this).fadeTo(300,1)
	  }
	);
	
	$("#content")
		.fadeTo(0,.5)
		.fadeTo(300,1);
		
	$("#sponsors a img").hover(
		function(){
			$(this).fadeTo(300,.7);
		},
		function(){
			$(this).fadeTo(300,1);
		}
	);
	
	$(".castHolder .label")
		.css("top","14px")
		.css("z-index",99999)
		.css("display","none")
		.parent()
		.css("background", "none")
		.find("img")
		.hover(
		function(){
			var imgWidth = $(this).width();
			var imgHeight = $(this).height();
			var left= parseInt($(this).parent().css("left"));
			if(imgWidth < 200){
				if(left < 1500){
					$(this)
						.parent()
						.css("background", "#FFF")
						.find(".label")
						.css("padding",0)
						.css("left",imgWidth-10)
						.css("width",$(this).width())
						.css("opacity", 0)
						.css("display","block")
						.animate({
							"left":imgWidth+4,
							"opacity":1
						})
				}else{
					$(this)
						.parent()
						.css("background", "#FFF")
						.find(".label")
						.css("padding",0)
						.css("left",-($(this).width()-10))
						.css("width",$(this).width())
						.css("opacity", 0)
						.css("display","block")
						.animate({
							"left":-($(this).width()-4),
							"opacity":1
						})
				}
			}else{
				$(this)
					.parent()
					.css("background", "#FFF")
					.find(".label")
					.css("opacity", 0)
					.css("top",imgHeight)
					.css("display","block")
					.animate({
						"top":imgHeight+4,
						"opacity":1
					})
			}
		},
		function(){
			var imgWidth = $(this).width();
			var imgHeight = $(this).height();
			var left= parseInt($(this).parent().css("left"));
			
			
			if(imgWidth < 200){
				if(left < 1500){
					$(this)
						.parent()
						.css("background", "none")
						.find(".label")
						.animate({
							"left":imgWidth-10,
							"opacity":0
						})
				}else{
					$(this)
						.parent()
						.css("background", "none")
						.find(".label")
						.animate({
							"left":-($(this).width()-18),
							"opacity":0
						})
				}
			}else{
				$(this)
					.parent()
					.css("background", "none")
					.find(".label")
					.animate({
						"top":imgHeight-10,
						"opacity":0
					})
			}
		})
	
	crewScroll();
	
});

function crewScroll(){
	var height = $("#crewScroller").outerHeight();
	
	$("#crewScroller")
		.css("top", 450)
		.animate({
			top:-(height-40)
			}, (height*50), "linear");
	
}
