var baseurl = "http://www.lib.adachi.tokyo.jp/";
var opacurl = "https://www.lib.adachi.tokyo.jp/licsxp-opac/";

setRootPos = function(url){
	if(url){	baseurl = url;}

	document.write('<link rel="shortcut icon" href="' + baseurl + 'favicon.ico" />');
}

setSeasonImage = function(){
	// 期間配列[開始,終了]
	var periods = [["1/1","1/15"], ["1/16","1/31"], ["2/1","2/15"],["2/16","2/29"], ["3/1","3/15"],["3/16","3/31"], ["4/1","4/15"], ["4/16","4/30"],["5/1","5/15"], ["5/16","5/31"],["6/1","6/15"], ["6/16","6/30"], ["7/1","7/15"],["7/16","7/31"], ["8/1","8/15"],["8/16","8/31"], ["9/1","9/15"], ["9/16","9/30"],["10/1","10/15"], ["10/16","10/31"], ["11/1","11/15"], ["11/16","11/30"],["12/1","12/15"],["12/16","12/31"]];
        // 画像配列
	var images = ["1gatu1.jpg","1gatu2.jpg","2gatu1.jpg","2gatu2.jpg","3gatu1.jpg","3gatu2.jpg","4gatu1.jpg","4gatu2.jpg","5gatu1.jpg","5gatu2.jpg","6gatu1.jpg","6gatu2.jpg","7gatu1.jpg","7gatu2.jpg","8gatu1.jpg","8gatu2.jpg","9gatu1.jpg","9gatu2.jpg","10gatu1.jpg","10gatu2.jpg","11gatu1.jpg","11gatu2.jpg","12gatu1.jpg","12gatu2.jpg"];

	var num = "";
        // 現時刻取得+時刻リセット
	today = new Date();
	today.setHours(0);
	today.setMinutes(0);
	today.setSeconds(0);
	today.setMilliseconds(0);
	thisYear = today.getFullYear();

	for(i=0 ; i<periods.length ; i++){
		day_s = new Date(periods[i][0] + "," + thisYear);
		day_e = new Date(periods[i][1] + "," + thisYear);
		if(day_s <= today && today <= day_e){
			if(obj = document.getElementById("head")){
				return("lbui/img/" + images[i]);
			}
		}
	}
}



// 検索窓実行
function search(schType) {
	document.SearchForm.action = opacurl + "WOpacMnuTopInitAction.do?WebLinkFlag=1&amp;moveToGamenId=tifschcmpdpre&SchType=" + schType;
    document.SearchForm.submit();
}

// オブジェクトのON/OFF
function showobj(obj){
	if(obj) obj.style.display = "block";
}
function hideobj(obj){
	if(obj) obj.style.display = "none";
}

// 文字サイズ変更
var defaultSize = 90;
var largeSize = 110;
var smallSize = 80;
var perOrder = 15;
var ckName = "musashinolib_fs_ck";
var ckDays = 2;
var ckPath = "/"
var fsCK = GetCookie(ckName);
if(fsCK == null){
	var currentSize = defaultSize;
}
else{
	var currentSize = eval(fsCK);
}
document.writeln('<style type="text/css">');
document.write('body{font-size:' + currentSize + '%' + '}');
switch(currentSize){
case smallSize:
	document.write('#fss{border-bottom:2px solid #f90;}');
	break;
case defaultSize:
	document.write('#fsm{border-bottom:2px solid #f90;}');
	break;
case largeSize:
	document.write('#fsl{border-bottom:2px solid #f90;}');
	break;
}
document.writeln('</style>');
function fontsize(size){
	if(size == "large"){
		var newSize = largeSize;
		SetCookie(ckName, newSize);
	}
	if(size == "small"){
		var newSize = smallSize;
		SetCookie(ckName, newSize);
	}
	if(size == "def"){
		DeleteCookie(ckName);
	}

	location.reload();
}
function SetCookie(name, value){
	var dobj = new Date();
	dobj.setTime(dobj.getTime() + 24 * 60 * 60 * ckDays * 1000);
	var expiryDate = dobj.toGMTString();
	document.cookie = name + '=' + escape(value) + ';expires=' + expiryDate + ';path=' + ckPath;
}
function GetCookie(name){
	var arg  = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while(i < clen){
		var j = i + alen;
		if(document.cookie.substring(i, j) == arg)
			return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if(i == 0) break;
	}
	return null;
}
function getCookieVal(offset){
	var endstr = document.cookie.indexOf(";", offset);
	if(endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset,endstr));
}
function DeleteCookie(name){
	if(GetCookie(name)){
		document.cookie = name + '=' +
		'; expires=Thu, 01-Jan-70 00:00:01 GMT;path='+ckPath;
	}
}





