//image preload
function imagePreload(){
//preload menu rollover images
$('#menu img').each(function(){
var src=$(this).attr('src');
//only those with 'off' state need preload
if (src.match('_off.')) {
//use a new image element which is not attached to the DOM to load images
$('<img>').attr('src', src.replace('_off', '_on'));
}//end if
});
}

//image rollover
function imageRollover(){
$('#menu img').hover(
function(){//over
var src=$(this).attr('src');
$(this).attr('src', src.replace('_off', '_on'));
},
function(){//out
//don't switch image if this is current item
if ($(this).parents('li:first').hasClass('current')) return;
var src=$(this).attr('src');
$(this).attr('src', src.replace('_on', '_off'));
}
);
}


$(document).ready(function(){
imagePreload();
imageRollover();
});
