/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 Author : http://www.yomotsu.net
 created: 2008/03/04
 update : 2008/06/06
 Licensed under the GNU Lesser General Public License version 2.1
 
 image map 箇所の area 要素用ロールオーバー

//////////////////////////////////////////////////////////////////////////////////////////////////////
====================================================================================================*/

var yomotsuSwapImageMap = {

	main : function(){
		var area = document.getElementsByTagName("area");
		for(i=0;i<area.length;i++){
			area[i].onmouseover = yomotsuSwapImageMap.over;
			area[i].onmouseout = yomotsuSwapImageMap.out;
		}
	},
	
	over : function(){
		var i, j,
		img = document.images,
		area = this.parentNode.getElementsByTagName("area"),
		mapIdReg = new RegExp ("\\b"+this.parentNode.id+"\\b");
		
		for(i=0;i<area.length;i++){
			if(area[i]===this){
				for (j = 0; j <img.length; j++) {
					if (img[j].src.match(/_swap0\.(png|gif|jpg)\b/)&&img[j].getAttribute("usemap").match(mapIdReg)){
						img[j].src = img[j].src.replace('_swap0.', '_swap'+(i+1)+'.');
					}
					else if((img[j].style.filter)&&(img[j].style.filter.match(/_swap0\.png\b/))){//(IE5.5-6 && png)
						img[j].style.filter = img[j].style.filter.replace('_swap0.', '_swap'+(i+1)+'.');
					}
				}
			}
		}

	},
	
	out : function(){
		var i, j,
		img = document.images,
		area = this.parentNode.getElementsByTagName("area"),
		mapIdReg = new RegExp ("\\b"+this.parentNode.id+"\\b");
		
		for(i=0;i<area.length;i++){
			if(area[i]===this){
				for (j = 0; j <img.length; j++) {
					if (img[j].src.match(/_swap[0-9]{1,}\.(png|gif|jpg)\b/)&&img[j].getAttribute("usemap").match(mapIdReg)){
						img[j].src = img[j].src.replace('_swap'+(i+1)+'.', '_swap0.');
					}
					else if((img[j].style.filter)&&(img[j].style.filter.match(/_swap[0-9]{1,}\.png\b/))){//(IE5.5-6 && png)
						img[j].style.filter = img[j].style.filter.replace('_swap'+(i+1)+'.', '_swap0.');
					}
				}
			}
		}
	},
	
	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}

yomotsuSwapImageMap.addEvent();



/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

	トップマップの飛び指定

//////////////////////////////////////////////////////////////////////////////////////////////////////
====================================================================================================*/

////////////////////////////////////////////
//
// ■ ある(グローバルな)条件が満たされるまで一定間隔で監視を行い、
//    条件が満たされたら指定された処理を呼び出す関数
//
// ■ setViser( 監視する条件式(文字列) , 
//		条件が満たされとき呼び出す関数(文字列) , 
//		監視間隔)
//    ※条件式の中の変数、関数などはグローバルのものである必要があります。
//	必要に応じてグローバル変数に移しておきます。
//    ・何個も起動できます。
//
var g_IdViser = new Array(); // 監視タイマーのID
var g_NumViser = 0;      // 監視器のの数
var g_i = 0;        // グローバルカウンタ
function setViser( cond , funcCall1, val, funcCall2 , timeVise)
{
    // 条件が満たされれば、タイマーをクリアして関数を呼び出す
    strFunc = "" +
          "if(" + cond +"){ " + 
          "clearInterval(g_IdViser[" + g_NumViser + "]);" 
          + funcCall1 + val + funcCall2 + ";" + 
          "}";
    // 監視タイマーをセット ( setInterval)
    g_IdViser[g_NumViser] = setInterval( strFunc , timeVise);
    g_NumViser++;
}
//
//
////////////////////////////////////////////


var subwin="";
			
function js_area(hora){
	subwin=window.open('area.html','_blank');
	setViser( "subwin.document.getElementsByName('caster').length>0 ", "step1(", hora, ")" , 500 );
}

function step1(hora){
	
			for(a=1; a<12; a++){
				if(a!=hora){
				
				subwin.document.getElementById('areamap'+a).style.display="none";
				}else if(a==hora){
				
				subwin.document.getElementById('areamap'+a).style.display="block";
				
				}
			}
	
		window.close();
		return false;		
	
}
