

/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

// Rollover のimgタグ用
function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

// Rollover のinputタグ用
function initRolloversInput() {
	if (!document.getElementById) return
	
	var aPreLoadInput = new Array();
	var sTempSrcInput;
	var aImagesInput = document.getElementsByTagName('input');

	for (var i = 0; i < aImagesInput.length; i++) {		
		if (aImagesInput[i].className == 'imgover') {
			var src = aImagesInput[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImagesInput[i].setAttribute('hsrc', hsrc);
			
			aPreLoadInput[i] = new Image();
			aPreLoadInput[i].src = hsrc;
			
			aImagesInput[i].onmouseover = function() {
				sTempSrcInput = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImagesInput[i].onmouseout = function() {
				if (!sTempSrcInput) sTempSrcInput = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrcInput);
			}
		}
	}
}


/*------------------------------------------------------------
 * stripedtable.js Version 1.0
 * Author : Kyosuke Nakamura
 * http://kyosuke.jp/
 *------------------------------------------------------------
 * 特定classのtable要素内、tr要素に対して交互にクラスをつけます。

 * className : 対象となるテーブルに設定するためのクラス名

 * oddlineClassName : 奇数ラインに付くクラス名

 * evenlineClassName : 偶数ラインに付くクラス名

/*------------------------------------------------------------*/
conf = {
	className : "stripedtable",
	oddlineClassName : "oddline",
	evenlineClassName : "evenline"
}

function setStripedTable(){
	var tables = getElementsByClassName(conf.className);
	for (var i=0, len=tables.length; i<len; i++){
		var table = tables[i];
		var lines = table.getElementsByTagName("tr");

		for (var j=0, llen=lines.length; j<llen; j++){
			tr = lines[j];
			if(j%2==0) {
				tr.className = conf.oddlineClassName;
			} else {
				tr.className = conf.evenlineClassName;
			}
		}
	}
}

function getElementsByClassName(name){
	var elements = new Array();
	var allElements = document.getElementsByTagName('*');
	for (var i=0, len=allElements.length; i<len; i++){
		if (allElements[i].className == name){
			elements.push(allElements[i]);
		}
	}
	return elements;
}


try{
	window.addEventListener("load",initRollovers,false);
}catch(e){
	window.attachEvent("onload",initRollovers);
}

try{
	window.addEventListener("load",initRolloversInput,false);
}catch(e){
	window.attachEvent("onload",initRolloversInput);
}


try{
	window.addEventListener("load",setStripedTable,false);
}catch(e){
	window.attachEvent("onload",setStripedTable);
}



//popup window用
function NewWindow(mypage, myname, w, h, scroll, myform) {
	var winl = (screen.width - w) / 2;
	var wint = 10;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,menubar=no,location=no,resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

/* らくらく検索 */
function sub_detail(strPath, strMode) {
	var ds = document.simple;
	ds.target = "blank";
	ds.action = strPath + "buy/detail.asp?mode=" + strMode + "&bkn_cd=" + ds.bkn_cd.value;
}
 

