//ROLLOVER

window.onload = function()
{
	new RollOverImages('rollover');
}


function preloadImg(src)
{
	if(document.images)
	{
		//alert(src);
		(new Image()).src = src;
	}
}

function preloadImgs(srcs)
{
	if(!document.images) return;
	for (i=0;i<srcs.length;i++)
	{
		preloadImg(srcs[i]);
	}
}

function RollOverImages( targetClass )
{
	this.targetClass = targetClass;
	this.ois = "_o";
	this.ais = "_a";
	this.define();
}

RollOverImages.pli = new Array();

RollOverImages.prototype.define = function()
{
	var pli = RollOverImages.pli;
	var ois = this.ois;
	var ais = this.ais;
	
	//-------
	var elements = [];
	var objs = new Array();

	elements = document.getElementsByTagName("IMG");
	var aObjsCnt = 0;
	
	for( var i = 0; i < elements.length; i++ )
	{
		if( elements[i].className == this.targetClass )
		{
			objs[ aObjsCnt ] = elements[i];
			aObjsCnt ++;
		}
 	}
	//---------

	var aPliCnt = 0;
	for( var i = 0; i < objs.length; i++ )
	{
		var tempimg = objs[i];
		
		var basesrc = tempimg.src;
		var imgtype = basesrc.substring(basesrc.lastIndexOf('.'));
		var basename = basesrc.substring(0,basesrc.length - imgtype.length);
		var temppli = new Object;
		tempimg.u = basesrc;
		
		if(ois)
		{
			tempimg.o = temppli.o = basename + ois + imgtype;
			
			var aTmpPli = pli.join(",");
			if(aTmpPli.indexOf(temppli.o) == -1)
			{
				pli[ aPliCnt ] = temppli.o;
				aPliCnt++;
			}
		}
		/*if(ais)
		{
			tempimg.a = temppli.a = basename + ais + imgtype;
			var aTmpPli = pli.join(",");
			if(aTmpPli.indexOf(temppli.a) == -1)
			{
				pli[ aPliCnt ] = temppli.a;
				aPliCnt ++;
			}
		}*/
		//alert(temppli.o);
		
		if(!tempimg.onmouseover) tempimg.onmouseover = function()
		{
			this._onfocus = this.onfocus;
			this.onfocus = '';
			this.src = this.o;
		};
		
		if(!tempimg.onmouseout) tempimg.onmouseout = function()
		{
			this.onfocus = this._onfocus
			this.src = this.u;
		};
		
		if(!tempimg.onmousedown) tempimg.onmousedown = function()
		{
		//	this._onfocus = this.onfocus;
		//	this.onfocus = '';
			this.src = this.o;
		};
		if(!tempimg.onmouseup) tempimg.onmouseup = function()
		{
		//	this._onfocus = this.onfocus;
		//	this.onfocus = '';
			this.src = this.o;
		};
		
		
		/*if(!tempimg.onfocus) tempimg.onfocus = function()
		{
			this.src = this.o;
		};
		
		if(!tempimg.onblur) tempimg.onblur = function()
		{
			this.src = this.u;
		};*/
	}
//alert(pli);
	preloadImgs(pli);
}




function Winopen(){

newWin=window.open('https://www2.hotwill.co.jp/wakabayashiseiki/','yoyaku','width=560,height=623,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');

}