$(document).ready(function(){
	function setPic(id){
		id.css("color","#000000");
		$("#sp2 img").hide().attr({"src": id.attr("title")});
	}
	function pageload(hash) {
		if(hash) {			
			$("#sp3 li a").each(function(){
				var ahash = this.href;
				ahash = ahash.replace(/^.*#/, '');				
				if(ahash==hash){
					setPic($(this));				
				}else{
					$(this).css("color","#999999");
				}
			});					
		}else{
			$("#sp3 li a").each(function(intIndex){
				if(intIndex==0){
					setPic($(this));
				}
			});
		}
	}
	
	$("#sp2>img").load(function(){$("#sp2>img:hidden").fadeIn("slow")});
	
	$("#sp3 li a").click(function(){
		var hash = this.href;
		hash = hash.replace(/^.*#/, '');
		$.historyLoad(hash);
		return false;
	});	
	$.historyInit(pageload);	
});