// ロールオーバーイメージ

var preloadImgs = new Array();
var changedImgs = new Array();
var changedIndex = 0;
var filenameReg = /(.+)_o[nf]\.([^.]{3})/;

function newImg(src) {
	img = new Image();
	img.src = src;
	return img;
}

function loadImgs() {
	if (!document.images) return;
	for( i=0; i<preloadImgFiles.length; i++ ) {
		id = preloadImgFiles[i];
		document[id].src.match( filenameReg );
		img = newImg( RegExp.$1+"_ov."+RegExp.$2 );
		preloadImgs[i] = img;
	}
}

function changeImgs(id) {
	if (!document.images) return;
	changedImgs[changedIndex++] = id;
	changedImgs[changedIndex++] = document[id].src;
	document[id].src.match( filenameReg );
	document[id].src = RegExp.$1+"_ov."+RegExp.$2;
}

function restoreImgs() {
	if (!document.images) return;
	while( changedIndex >0 ) {
		src = changedImgs[--changedIndex];
		id = changedImgs[--changedIndex];
		document[id].src = src;
	}
}


// オープンサブウィンドウ1

var popupWins = new Array();
function subWin(url,wname,w,h,o){
	top.window.name = "subWin";
	win = popupWins[wname];
	if ( win && !win.closed ) win.close();
	if( w >screen.availWidth ) w = screen.availWidth-20;
	if( h >screen.availHeight ) h = screen.availHeight-50;
	o = "width="+w+",height="+h+","+o;
	win = window.open(url,"",o);
	win.focus();
	popupWins[wname] = win;
}