// JavaScript Document

/* -----------------------------------------------------------
	01 PageTop scroll = scrollsmoothly.js
	02 RollOver
	03 popup window
----------------------------------------------------------- */

/* -----------------------------------------------------------
 =02 RollOver
	ex. body onload="initRollovers();"
----------------------------------------------------------- */
/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

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, '_o'+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('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}


/* -----------------------------------------------------------
 =03 popup window  位置指定有 スクロール有 os,ブラウザ別windowサイズ補正　位置中央
	ex. onClick="openwin4(this.href,'name',700,950);return document.MM_returnValue"
----------------------------------------------------------- */
function openwin4(file,name,h,w) {//位置指定_センター
	
	sw=screen.availWidth/2-w/2;
	sh=screen.availHeight/2-h/2
 	//h=screen.height

	
	mac = (navigator.appVersion.indexOf("Mac") != -1) ?true:false;
	ie = (navigator.appName.charAt(0) == "M") ?true:false;
	nn = (navigator.appName.charAt(0) == "N") ?true:false;
	
	if (mac){
		if (ie){
		// mac IE
		w+=1;
		h-=0;
		}
		
		else{
		// mac NN etc.
		w+=16;
		h-=0;
		}
	}
	else{
		if (ie){
		// win IE
		w+=17;
		h-=0;
		}
		else{
		// win NN etc.
		w+=16;
		h-=0;
		}
	}

newWin4= window.open(file,name,"height="+h+",width="+w+",top="+sh+",screenY="+sh+",left="+sw+",screenX="+sw+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
document.MM_returnValue = false;
newWin4.focus()
}
