// JavaScript Document


$(document).ready(rollover);

function rollover(){
	var preload = new Object();
	$(".rollover").each(function(){
		var orgsrc = this.src;
		var fext = orgsrc.substring(orgsrc.lastIndexOf('.'));
		var newsrc = orgsrc.replace(fext,"_on"+fext);

		preload[this.src] = new Image();
		preload[this.src].src = newsrc;
		$(this).hover(
			function (){
				this.src = newsrc;
			},
			function (){
				this.src = orgsrc;
			}
		);
	});

	$(".rollup").each(function(){
		var preload = new Object();
		var orgsrc;
		var target;
		$("#target-img").each(function(){	
			target=this;
		});
		orgsrc=target.src;				
		
		var basesrc = this.src;
		var fext = basesrc.substring(basesrc.lastIndexOf('.'));
		var newsrc = basesrc.replace(fext,"_on"+fext);

		preload[this.src] = new Image();
		preload[this.src].src = newsrc;

		$(this).hover(
			function (){
				target.src = newsrc;
			},
			function (){
				target.src = orgsrc;
			}
		);
	});
}

