/* Rollover */

function smartRollover() {
    if(document.getElementsByTagName) {
        var images = document.getElementsByTagName("img");
        for(var i=0; i < images.length; i++) {
            if(images[i].getAttribute("src").match("_off."))
            {
                images[i].onmouseover = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
                }
                images[i].onmouseout = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
                }
            }
        }
    }
}
if(window.addEventListener) {
    window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
    window.attachEvent("onload", smartRollover);
}


/* Rollover(image map) */
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/))&&img[j].getAttribute("usemap").match(mapIdReg)){//(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/))&&img[j].getAttribute("usemap").match(mapIdReg)){//(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();




/* OpenWindow */

	var Win=null;
	var url="";
	function OpenWin(url){
		Win=window.open(url,"dtl","width=600,height=400,toolbar=0,location=0,directories=0,status=yes,menubar=0,scrollbars=1,resizable=no");Win.focus();
		}


function Winopen(win,wi,he){
var newWin=window.open(win, 'Sub', "toolbar=no , menubar=no , scrollbars=yes , width=" +wi+" , height=" +he);
newWin.resizeTo(wi,he);
newWin.focus();
}
