/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 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");
		
		imgSrc=new RegExp('http://www.gto.ac.jp/library/4588.gif');
		imgSrc2=new RegExp('http://www.gto.ac.jp/library/4589.gif');
		imgSrc3=new RegExp('http://www.gto.ac.jp/library/4590.gif');
		imgSrc4=new RegExp('http://www.gto.ac.jp/library/4591.gif');
		imgSrc5=new RegExp('http://www.gto.ac.jp/library/4592.gif');
		imgSrc6=new RegExp('http://www.gto.ac.jp/library/4593.gif');
		imgSrc7=new RegExp('http://www.gto.ac.jp/library/4594.gif');
		imgSrc8=new RegExp('http://www.gto.ac.jp/library/4595.gif');
		imgSrc9=new RegExp('http://www.gto.ac.jp/library/4596.gif');
		imgSrc10=new RegExp('http://www.gto.ac.jp/library/4597.gif');
		imgSrc11=new RegExp('http://www.gto.ac.jp/library/4598.gif');
		imgSrc12=new RegExp('http://www.gto.ac.jp/library/4599.gif');
		imgSrc13=new RegExp('http://www.gto.ac.jp/library/4560.gif');
		imgSrc14=new RegExp('http://www.gto.ac.jp/library/4601.gif');
		imgSrc15=new RegExp('http://www.gto.ac.jp/library/4602.gif');
		
		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(/4587/)&&img[j].getAttribute("usemap").match(mapIdReg)){
						img[j].src = img[j].src.replace('4587', 4588+(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(/4589|4590|4591|4592|4593|4594|4595|4596|4597|4598|4599|4600|4601|4602/)&&img[j].getAttribute("usemap").match(mapIdReg)){
					
					
						img[j].src = img[j].src.replace(4588+(i+1), '4587');
						
						
					}
					
					
				}
			}
		}
	},
	
	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}

yomotsuSwapImageMap.addEvent();