/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 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.keg.ac.jp/library/6121.gif');
		imgSrc2=new RegExp('http://www.keg.ac.jp/library/6122.gif');
		imgSrc3=new RegExp('http://www.keg.ac.jp/library/6123.gif');
		imgSrc4=new RegExp('http://www.keg.ac.jp/library/6124.gif');
		imgSrc5=new RegExp('http://www.keg.ac.jp/library/6125.gif');
		imgSrc6=new RegExp('http://www.keg.ac.jp/library/6126.gif');
		imgSrc7=new RegExp('http://www.keg.ac.jp/library/6127.gif');
		imgSrc8=new RegExp('http://www.keg.ac.jp/library/6128.gif');
		imgSrc9=new RegExp('http://www.keg.ac.jp/library/6129.gif');
		imgSrc10=new RegExp('http://www.keg.ac.jp/library/6130.gif');
		imgSrc11=new RegExp('http://www.keg.ac.jp/library/6131.gif');
		imgSrc12=new RegExp('http://www.keg.ac.jp/library/6132.gif');
		imgSrc13=new RegExp('http://www.keg.ac.jp/library/6133.gif');
		imgSrc14=new RegExp('http://www.keg.ac.jp/library/6134.gif');
		imgSrc15=new RegExp('http://www.keg.ac.jp/library/6135.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(/6121/)&&img[j].getAttribute("usemap").match(mapIdReg)){
						img[j].src = img[j].src.replace('6121', 6121+(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(/6122|6123|6124|6125|6126|6127|6128|6129|6130|6131|6132|6133|6134|6135/)&&img[j].getAttribute("usemap").match(mapIdReg)){
					
					
						img[j].src = img[j].src.replace(6121+(i+1), '6121');
						
						
					}
					
					
				}
			}
		}
	},
	
	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}

yomotsuSwapImageMap.addEvent();