$(document).ready(function(){
	
	
	$("#left a.nav").html("&nbsp;").each(function(){
		im = new Image();
		im.src = $(this).css("backgroundImage").replace(".gif","M.gif").replace("url(","").replace(")","")
	})
	$("#thumbContainer").css("overflow","hidden").children().each(function(){
		$(this).addClass("thumb")
	})
	$(".thumb div").hide()
	
	$(".thumb img").css({cursor:"pointer"}).click(function(){
		if ($(this).parent().attr("id")!="back" && $(this).parent().attr("id")!="next"){
			h=$(document).height()
			h2=$(window).height()
			if(h2>h) h=h2
			//h = (document.height || document.body.offsetHeight);
			//h +="px"
			$("#mask").css({display:"block",opacity:"0"}).fadeTo("slow",0.85).css({height:h+50})
			$("#mask div").css({display:"block"})
			//$("#imageBox span").html($(this).attr("title"));
			$("#imageBox span").html($(this).next().html());
			$("#imageBox img").load(function(){
				$("#imageBox").fadeIn("slow")
				//$("#mask").css({height:$("body").height()})
			})
			.attr("src",$(this).attr("src").replace("thumbs/thumb-",""));
		}
		
		
	})
	.each(function(){
		im = new Image();
		im.src = $(this).attr("src").replace("/thumbs","")
	})
	$("#imageBox").css({cursor:"pointer"}).click(function(){
		$("#mask").fadeTo("fast",0,function(){
			$(this).css({display:"none"})
		})
		$("#imageBox").fadeOut("slow")
	});
})