/***********************************************************************
 * 初期設定用Javascript
 * Contents		: Basic Javascript
 * Programer	: T.Mizota
 * Create Date	: 2008/04/30
 * Update Date	: 2008/04/30
 * LICENCE		: http://creativecommons.org/licenses/LGPL/2.1/deed.ja
************************************************************************/

/***********************************************************
 * ロールオーバー
************************************************************/
function InitImageRollovers(){
	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.match('over')){
			var src=aImages[i].getAttribute('src');
			var ftype=src.substring(src.lastIndexOf('.'),src.length);
			var hsrc=src.replace(ftype,'_ovr'+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('_ovr'+ftype, ftype);
				}
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}
try{
	window.addEventListener("load",InitImageRollovers,false);
}catch(e){
	window.attachEvent("onload",InitImageRollovers);
}

/***********************************************************
 * ポップアップウィンドウ
************************************************************/
function InitPopupWindows(){
	var allLinks=document.getElementsByTagName('a');
	for(var i=0;i<allLinks.length;i++){
		if(allLinks[i].className.match('popup')){
			allLinks[i].onclick=function(){
				var optionName=eval("option"+(this.name.substring(6,5)));
				window.open(this.href,this.name,optionName);
				return false;
			}
		}
	}
}
try{
	window.addEventListener("load",InitPopupWindows,false);
}catch(e){
	window.attachEvent("onload",InitPopupWindows);
}