// JavaScript Document

(function($){

	$(document).ready(function(){

		// rollover.
		$('img[class=rollover]').each(function(){
			// preload image.
			var img = new Image();
			img.src = this.src.replace(/^(.+)(\.[a-z]+)$/, '$1on$2');
			$(this)
				// store the image sources.
				.data('image', {
					defaultSrc: this.src,
					hoverSrc: img.src
				})
				.hover(
					function(){
						this.src = $(this).data('image').hoverSrc;
					},
					function(){
						this.src = $(this).data('image').defaultSrc;
					}
				);
		});

		// rolloveron
		$('img[class=rolloveron]').each(function(){
			this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, '$1on$2');
		});

	});

})(jQuery);
