var dekigotoRollover = {
	
	main : function() {
		var img = document.images, ipt = document.getElementsByTagName('input'), i, preLoadImg = [];
		// img elements
		for (i = 0; i <img.length; i++) {
			if ((img[i].src.match(/.*_out\./))||(img[i].style.filter)){
				preLoadImg[preLoadImg.length] = new Image;
				preLoadImg[preLoadImg.length-1].src = img[i].src.replace('_out.', '_over.');

				img[i].onmouseover = dekigotoRollover.over;
				img[i].onmouseout  = dekigotoRollover.out;
				try {img[i].addEventListener('click', dekigotoRollover.click, false);}
				catch(e){img[i].attachEvent('onclick', (function(el){return function(){dekigotoRollover.click.call(el);};})(img[i]));}
			}
		}
		// input[image] elements
		for (i = 0; i <ipt.length; i++) {
			if ((ipt[i].src.match(/.*_out\./))&&(ipt[i].getAttribute('type')=='image')){
				preLoadImg[preLoadImg.length] = new Image;
				preLoadImg[preLoadImg.length-1].src = img[i].src.replace('_out.', '_over.');

				ipt[i].onmouseover = dekigotoRollover.over;
				ipt[i].onmouseout  = dekigotoRollover.out;
				try {ipt[i].addEventListener('click', dekigotoRollover.click, false);}
				catch(e){ipt[i].attachEvent('onclick', (function(el){return function(){dekigotoRollover.click.call(el);};})(ipt[i]));}
			}
		}
	}
	,
	
	over : function() {
		var imgSrc, preLoadImgSrc;
		if((this.style.filter)&&(this.style.filter.match(/_out\.gif/)))//(IE5.5-6 && gif)
			this.style.filter = this.style.filter.replace('_out.gif', '_over.gif');
		else
			this.src = this.src.replace('_out.', '_over.');
	},

	out : function(){
		if((this.style.filter)&&(this.style.filter.match(/_over\.gif/)))//(IE5.5-6 && gif)
			this.style.filter = this.style.filter.replace('_over.gif', '_out.gif');
		else
			this.src = this.src.replace('_over.', '_out.');
	},
	
	click : function(){
		if((this.style.filter)&&(this.style.filter.match(/_over\.gif/)))//(IE5.5-6 && gif)
			this.style.filter = this.style.filter.replace('_over.gif', '_out.gif');
		else
			this.src = this.src.replace('_over.', '_out.');
	},

	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}

dekigotoRollover.addEvent();
