
$(document).ready(function() {
	
	// Preload all rollovers
	$("#navigation a img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"_on.gif");
		$("<img>").attr("src", rollON);
	});
	// Navigation rollovers
	$("#navigation a:has(img):not(:first)").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/_on.gif/);

		// don't do the rollover if state is already ON
		if (!matches) {
		imgsrcON = imgsrc.replace(/.gif$/ig,"_on.gif"); // strip off extension
		$(this).children("img").attr("src", imgsrcON);
		}
	});
	
	
	$("a").focus(function(){
		$(this).blur();
		return true;
	});
	
	
	$("#navigation a:has(img):not(:first)").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
	// if(document.location.href.indexOf("/work")!=-1){
	// 	$("#navigation a[href=/work/]").mouseover();
	// }
		if(category==""){
			base = document.location.href.substring(document.location.href.indexOf("/", 8)+1, document.location.href.length-1);
			$("#navigation a[href=/"+base+"/]").mouseover();
		}else{
			$("#navigation a."+category).mouseover();
		}
	
	
});


	// position = {{position}};
	// total = {{total}};
	// $(document).ready(function(){
	// 	$("#more").click(function(){
	// 		if(position!=total){
	// 			$("#number_holder").animate({"left": "-=18px"}, "fast");
	// 			position++;
	// 		}
	// 		
	// 	});
	// 	if(position>26){
	// 		$("#number_holder").css("left", parseInt($("#number_holder").css("left"))-(18*(position-26)));
	// 	}
	// });


		
