var storyOffsets={
	students:{pos:"0px 0px", color:"#E6ECF1"},
	alumni:{pos:"-746px 0px", color:"#EFE5E5"},
	faculty:{pos:"-1492px 0px", color:"#F7E8CD"}
}


$(function() {


	$("#storyLinks img").click(function(){
		
		var storyType=$(this).attr("id");
		$("#storyType").text(storyType);
		$("#loading").show();
		$("#storyPreviews").css("background-position",storyOffsets[storyType]["pos"]);
		$("#loadingArea").load("/stories/"+storyType+"?action=render #stories",{},function() {
			$("#loading").hide();
			$("#stories p.quote").css("background-color",storyOffsets[storyType]["color"]);
			$("#loadingArea .dossier").each(function() {
				var link=$(this).find("a").attr("href");
				$(this).find(".name").append(" <span class='stipulation'><a href='"+link+"'>read more...</a></span>");
				//var image=$(this).find("a").attr("href")+".jpg";
				$(this).css("background-image","url('"+link+".jpg')");
				//alert( $link.attr("href"));
				$.cookies.set("storyType",storyType);
				$(this).parent().attr("rel",link);
			});
			

			$(this).find(".person").hover(
				function() {
					//window.status=$(this).attr("rel");
					//$(this).css("cursor","hand");
					document.body.style.cursor = 'pointer';
				},
				function() {
					//$(this).css("cursor","pointer");
					document.body.style.cursor = 'default';
					//window.status="";
				}
			).click(function() {
				document.body.style.cursor = 'wait';
				window.location=$(this).attr("rel");
			});

			
			
		});
		return false;  // should defeat link in most browsers..
		
	});
	if(!$.cookies.get("storyType")) {
		$.cookies.set("storyType","students");
	}
	$("#"+$.cookies.get("storyType")).click();
	

	
});

