$(document).ready( function() {
	// set image swap events for all rollovers
	$('.rollover').hover(
		function() {
			this.src = this.src.replace( '-up', '-over' );
		},
		function() {
			this.src = this.src.replace( '-over', '-up' );
		}
	);
	
	// add class to support hover for li in ie
	if ( jQuery.browser.msie ) {
		$('div#top-navigation li').hover(
			function() {
				$(this).addClass( 'iehover' );
			},
			function() {
				$(this).removeClass( 'iehover' );
			}
		);
	}
});

// start preloading hover images after page is done
$(window).bind( 'load', function() {
	var imagePaths = new Array();
	var numPreloads = 0;
	$('.rollover').each( function() {
		s = $(this).attr("src").replace( '-up', '-over' );
		imagePaths.push( s );
		numPreloads++;
	});
	
	for ( var i = 0; i < numPreloads; i++ ){
		var img = document.createElement( 'img' );
		img.src = imagePaths[i];
	}
});