$(document).ready(function() {
	$('#navigation img').each(function() {
		var file = $(this).attr('src');
		if( basename(file) != 'logo.png' ) {
			
			//set on hover function and preload images
			var tmp_f = file.substring(0, file.lastIndexOf('.'));
			var tmp_e = file.substring(file.lastIndexOf('.'), file.length);
			var img = new Image();
			img.src = tmp_f + '-selected' + tmp_e;

			this.mouseoutimage = file;
			this.onhoverimage = img.src;
			$(this).hover(function() {
				$(this).attr('src', this.onhoverimage);
			}, function() {
				$(this).attr('src', this.mouseoutimage);
			});
			
		}
	});
	Cufon.replace('h1');
});

function basename(file) {
	return file.substring(file.lastIndexOf('/')+1, file.length);
}
