$(function(){
	
	/********** Category chooser ************/
	function MOver(area) {
		area.hover(
			function() {
				$(this).find(".headerSubpage").addClass("Over");
			},
			function() {
				$(this).find(".headerSubpage").removeClass("Over");
			});
	}
	var category = $("#categoryName").text();
	switch(category) {
		case "web":
			first = "works_print.html";
			second = "works_ui.html";
			break;
		case "print":
			first = "works_web.html";
			second = "works_ui.html";
			break;
		case "ui":
			first = "works_web.html";
			second = "works_print.html";
			break;
	}

	$("#firstPopup").click(function() {
		window.location = first;
	});
	MOver($("#firstPopup"));
	$("#secondPopup").click(function() {
		window.location = second;
	});
	MOver($("#secondPopup"));
	$(".allWorksLink").toggle(
		function(){
			$("#firstPopup").show();
			$("#secondPopup").show();
			$("#firstPopup").animate({marginTop: "2px", opacity: 1.0},400);
			$("#secondPopup").animate({marginTop: "84px", opacity: 1.0},400);
		},
		function() {
			$("#firstPopup").animate({marginTop: "-8px", opacity: 0.0},400);
			$("#secondPopup").animate({marginTop: "64px", opacity: 0.0},400);
			$("#firstPopup").hide();
			$("#secondPopup").hide();
		})
	
})
