//--- ◆ スマートロールオーバー ◆ ---------------------------------

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.", "_ov."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_ov.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}

//--- ◆ ポップアップWindow ◆ ---------------------------------

function f_openWindow(v_page, v_name, v_width, v_height){
	
  v_posX = 10;//(screen.width - v_width) / 2;
  v_posY = (screen.height - v_height) / 2;
	
  v_detail = 'height=' + v_height + ',width=' + v_width + ',top=' + v_posY + ',left=' + v_posX + ',scrollbars=1' + ',resizable=0';
  
	newWindow = window.open(v_page, v_name, v_detail);
	newWindow.focus();

}

//--- ◆ ポップアップWindow2 ◆ ---------------------------------


function openPopup() {
	if (!document.getElementsByTagName) return false;
	var links = document.getElementsByTagName("a");
	
	for (i=0; i<links.length; i++) {
		
		if (links[i].className.match("popup")) {
			links[i].onclick=(function(obj, num){
			return function(){
				var newWindow =window.open(obj.href, num, "width=590,height=700,scrollbars=1,resizable=0");
				newWindow.focus();
				return false;
			};})(links[i],i);
		}
	}
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}else {
		window.onload = function() {
		oldonload();
		func();
		}
	}
}


addLoadEvent(openPopup);
