// MSF.js for Old contents

$(document).ready(function(){
	var re = new RegExp('.*\.cgi$');
	if(location.pathname.match(re) ) {
		$("#mainContentsLeft").load("/lib/htmlblock-banners.inc.php");
	}
});


// Popup Window Scroolbars NO

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

// Popup Window Scroolbars YES

var popUpWin2=0;
function popUpWindow2(URLStr, left, top, width, height)
{
  if(popUpWin2)
  {
    if(!popUpWin2.closed) popUpWin2.close();
  }
  popUpWin2 = open(URLStr, 'popUpWin2', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

// fontsize by kt

var fs = 11;
var lh = 0;
function fsc(type){
	if(type == "larger"){
		if(fs >= 21) return false;
		fs = fs + 3;
		lh = fs + 5;
	} else if(type == "smaller") {
		if(fs <= 11) return false;
		fs = fs - 3;
		lh = fs + 5;
	}
	obj = document.getElementsByTagName("body");
	obj = obj[0];
	setFontSize(obj);
}

function setFontSize(obj){
	obj.style.fontSize   = fs + "px";
	obj.style.lineHeight = lh + "px";
	
	if(obj.hasChildNodes()){
		var obj_c = obj.childNodes;

		for (var i=0;i<obj_c.length;i++) {
			if( obj_c[i].nodeType == 1){
				setFontSize(obj_c[i]);
			}
		}
	}
}

// fontsize end

// don't use. deprecated.
function openSubWin(file,name,width,height){
	window.open(file, name, "width=" + width + ",height=" + height + "resizable=no,menubar=no,location=no,scrollbars=yes");
}

// for photogallery
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// 印刷ページ用CSS適用
(function(){
	if(location.search != "") {
		var a = location.search.split("?");
		a = a[1].split("&");
		for(var i = 0; i < a.length; i++){
			var aa = a[i].split("=");
			if(aa[0] == "print"){
				document.write('<link href="/css/print.css" rel="stylesheet" type="text/css" media="all" />');
			}
		}
	}
})();