// RollOver

var preLoadImg = new Object();

function initRollOvers(){
	$("img.rollover,input.rollover").each(function(){
		var imgSrc = this.src;
		var sep = imgSrc.lastIndexOf('.');
		var onSrc = imgSrc.substr(0, sep) + '_on' + imgSrc.substr(sep, 4);
		preLoadImg[imgSrc] = new Image();
		preLoadImg[imgSrc].src = onSrc;
		
		if (navigator.userAgent.indexOf("MSIE 6")>=0) {	// IE6
			var onImg = new Image();
			onImg.src = onSrc;
			onImg.width = this.width;
			
			this.style.position = "absolute";
			this.style.left = "0px";
			this.style.top = "0px";
			
			$(this.parentNode)
				.css({
					"position": "relative",
					"font-size": "0",
					"line-height": "0"
				})
				.append($(onImg).css({
					"position": "absolute",
					"left": "0px",
					"top": "0px"
				}).hide())
				.hover(
					function() {
						$(this).find("span").eq(0).hide();
						$(this).find("span").eq(1).show();
					},
					function() {
						$(this).find("span").eq(0).show();
						$(this).find("span").eq(1).hide();
					}
				);
		}
		else {
			$(this).hover(
				function() { this.src = onSrc; },
				function() { this.src = imgSrc; }
			);
		}
	});
}
$(function(){
	initRollOvers();
});

