$(document).ready(function(){

	$("#nav a").hover(
		// over
		function(){
			var image = $(this).children(":first-child");
			
			// store the original image src
			image.data( "originalsrc" , image.attr("src") );
			
			// add -over to the image unless it is already -over
			if (!image.attr("src").match(/-over/) ) {
				image.attr( "src", image.attr("src").replace(/\./, "-over.") );
			}
			
		},
		
		// out
		function(){
			var image = $(this).children(":first-child");
			
			// replace the original src
			image.attr("src", image.data("originalsrc"));
			image.data("originalsrc", null);
		}
	);
	
});


window.onload = function() {
	// preload
	$("#nav a img").each(
		function() {
			if (!$(this).attr("src").match(/-over/) ) {
				$("<img>").attr( "src", $(this).attr("src").replace(/\./, "-over.") );
			}
		}
	);
}


function popwindow(url) {
	newwindow=window.open(url,'name',"height=540,width=720,location=1,menubar=1,resizable=1,scrollbars=1,status=1,toolbar=1");
	if (window.focus) { newwindow.focus(); }
}