
function loadHandlers() {
	$("#closeButton").hover(function() {
		$(this).css('cursor', 'pointer');
	});
	$("#closeButton").click(function() {
		hidePopup();
	});

	$("#seeMoreButton").hover(function() {
		$(this).css('cursor', 'pointer');
		$("#seeMoreButton").attr("src","images/seeMoreButtonOver.png");
	}, function() {
		$("#seeMoreButton").attr("src","images/seeMoreButton.png");
	});

	$("#favoriteButton").hover(function() {
		$(this).css('cursor', 'pointer');
	});
	$("#watchMoreButton").hover(function() {
			$(this).css('cursor', 'pointer');
	});

	$("#thumb1").hover(function() {
		$(this).css('cursor', 'pointer');
		$("#thumb1").attr("src","images/thumb1Over.png");
	}, function() {
		$("#thumb1").attr("src","images/thumb1.png");
	});
	$("#thumb2").hover(function() {
		$(this).css('cursor', 'pointer');
		$("#thumb2").attr("src","images/thumb2Over.png");
	}, function() {
		$("#thumb2").attr("src","images/thumb2.png");
	});
	$("#thumb3").hover(function() {
		$(this).css('cursor', 'pointer');
		$("#thumb3").attr("src","images/thumb3Over.png");
	}, function() {
		$("#thumb3").attr("src","images/thumb3.png");
	});
	$("#thumb5").hover(function() {
		$(this).css('cursor', 'pointer');
		$("#thumb5").attr("src","images/thumb5Over.png");
	}, function() {
		$("#thumb5").attr("src","images/thumb5.png");
	});
}

function finishedAgeCheck() {
	$("#runnerButton").hover(function() {
				$(this).css('cursor', 'pointer');
				$("#runnerButton").attr("src","images/runnerButtonOver.png");
		}, function() {
				$("#runnerButton").attr("src","images/runnerButton.png");
	});
	$("#runnerButton").click(function() {
		displayPopup();
	});
	displayPopup();
}

function setPopupPosition() {
	$("#popupWindow").css("left",($(window).width()-656)/2);
}

function displayPopup() {
	$("#greyFrame").css({"opacity" : "0.7"}).fadeIn("slow");
	$("#popupWindow").fadeIn("slow");
}
function hidePopup() {
	$("#greyFrame").css({"opacity" : "0.7"}).fadeOut(100);
	$("#popupWindow").fadeOut(100);
}

$(document).ready(function(){
	loadHandlers();
	$(window).resize(function() {
	   setPopupPosition();
	});
	setPopupPosition();
	//finishedAgeCheck();
});
