/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 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.teg.ac.jp/library/2045.gif');
		imgSrc2=new RegExp('http://www.teg.ac.jp/library/2046.gif');
		imgSrc3=new RegExp('http://www.teg.ac.jp/library/2047.gif');
		imgSrc4=new RegExp('http://www.teg.ac.jp/library/2048.gif');
		imgSrc5=new RegExp('http://www.teg.ac.jp/library/2049.gif');
		imgSrc6=new RegExp('http://www.teg.ac.jp/library/2050.gif');
		imgSrc7=new RegExp('http://www.teg.ac.jp/library/2051.gif');
		imgSrc8=new RegExp('http://www.teg.ac.jp/library/2052.gif');
		imgSrc9=new RegExp('http://www.teg.ac.jp/library/2053.gif');
		imgSrc10=new RegExp('http://www.teg.ac.jp/library/2054.gif');
		imgSrc11=new RegExp('http://www.teg.ac.jp/library/2055.gif');
		imgSrc12=new RegExp('http://www.teg.ac.jp/library/2056.gif');
		imgSrc13=new RegExp('http://www.teg.ac.jp/library/2057.gif');
		imgSrc14=new RegExp('http://www.teg.ac.jp/library/2058.gif');
		imgSrc15=new RegExp('http://www.teg.ac.jp/library/2059.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(/2045/)&&img[j].getAttribute("usemap").match(mapIdReg)){
						img[j].src = img[j].src.replace('2045', 2045+(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(/2046|2047|2048|2049|2050|2051|2052|2053|2054|2055|2056|2057|2058|2059/)&&img[j].getAttribute("usemap").match(mapIdReg)){
					
					
						img[j].src = img[j].src.replace(2045+(i+1), '2045');
						
						
					}
					
					
				}
			}
		}
	},
	
	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}

yomotsuSwapImageMap.addEvent();