///////////////////////////////////
//
//  画像ロールオーバー用
//
///////////////////////////////////


//スマートロールオーバー
//通常画像を「_off」、オーバー画像を「_on」で保存する。
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);
}



///////////////////////////////////
//
//  ポップアップ用
//
///////////////////////////////////
function openWin(win,w,h,iscroll,iresize){
	Nurl = window.location.href;
	wx = screen.width;
	wy = screen.height;
		if(document.all){
			if (typeof document.body.style.maxHeight != "undefined") {
			  // IE 7, mozilla, safari, opera 9
			  var h = h + 28;
			} else {
			  // IE6, older browsers
			  var h = h - 10;
			  window.location.href = Nurl;
			}
		}
		else if(document.layers || document.getElementById){
		// nn
		}
		else{
		//other
		}
	x = (wx - w) / 2;
	y = (wy - h) / 2;
	//alert("scrollbars="+intScroll+",resizable="+intResize);
    myWin = window.open(win,"newWin","width="+w+",height="+h+",scrollbars="+iscroll+",resizable="+iresize+",menubar=0");
	myWin.resizeTo(w,h);
	myWin.moveTo(x,y);
}




///////////////////////////////////
//
//  別ウィンドウ用
//
///////////////////////////////////
function winBlank(url){
	Nurl = window.location.href;
//	wName = window.name ;
//	alert(wName);
//	if(wName != ""){
		if(!window.opener.closed)	{
			//開いているときの処理
			//alert("閉じてない");
			window.opener.location.href = url;
			window.opener.focus();
			window.location.href = Nurl;
		} else {
			//alert("閉じてる");
			window.open(url,'main');
			window.location.href = Nurl;
		}
//	} else {
//		window.open(url,"main");
//		window.location.href = Nurl;
//	}
}





//////////////////////////////////////////
//
//  バックナンバー・現在地用
//
//////////////////////////////////////////
function highlight_active_links(active_url) {
  $("#sidecontents ul a").each(function(){
    var current_href = $(this).attr("href");
    current_href = active_url + current_href;
    if (document.location.href == current_href) {
      $(this).addClass("active");
    }
  });
}

