/*rollover script by two-ways*/
/*2006.12.12 ver2.0*/

startEvent('window','load','LoadEvent') ;
startEvent('window','resize','PageSize') ;

function LoadEvent(){//ページ読み込み時の挙動
prImg= new Array();
for (i=0; i<document.images.length; i++){
if(document.images[i].id){
//preload
baseIMG = document.images[i].src;
newIMG = baseIMG.replace(baseIMG.substr(baseIMG.length-4,4),("_o" + baseIMG.substr(baseIMG.length-4,4)));
prImg[i] = new Image();
prImg[i].src = newIMG;
startEvent(getLayOjStr(document.images[i].id),'mouseover','Over');
startEvent(getLayOjStr(document.images[i].id),'mouseout','Out');
}
}
}


function PageSize(){

if(navigator.appName=="Microsoft Internet Explorer"){
if(document.body.clientWidth < 650) {
element=document.getElementById("page");
element.style.width=650;
}else if(document.body.clientWidth > 1200) {
element=document.getElementById("page");
element.style.width=1200;
}
//else{
//element=document.getElementById("page");
//element.style.width=(document.body.clientWidth - 20);
//}
}
}


function startEvent(ojNameStr,eventTypeNameStr,funcNameStr){//関数呼び出しの設定
eval(ojNameStr+".on"+eventTypeNameStr+"="+ funcNameStr);
}

function getLayOjStr(idName){
if(document.getElementById){
return "document.getElementById('"+idName+"')"
}
}

function Over(){//mouseover
IMG = this.id;
baseIMG = document.images[IMG].src;
newIMG = baseIMG.replace(baseIMG.substr(baseIMG.length-4,4),("_o" + baseIMG.substr(baseIMG.length-4,4)));
document.images[IMG].src=newIMG;
 }

function Out(){//mouseout
IMG = this.id;
baseIMG = document.images[IMG].src;
newIMG = baseIMG.replace(baseIMG.substr(baseIMG.length-6,6),baseIMG.substr(baseIMG.length-4,4));
document.images[IMG].src=newIMG;
}



function closeWin(){
    document.write('<a href=\"#\" onclick=\"window.close();return false;\">このウィンドウを閉じる</a>');
}

function disp(url){
	if(!window.opener || window.opener.closed){
	    var newMainWin = window.open(url, "map", "location=1, toolbar=1, menubar=1, status=1, scrollbars=1, resizable=1, titlebar=1, directories=1");
	    newMainWin.focus();
	}
	else{
	    opener.window.focus();
	    opener.window.location = url;
	    opener.window.focus();
	}
}


