
/******************************************************************************
	関数名		ShowSearchLog
	機能		対象のログを表示する
	
	入力		sForm			フォーム名
				sKeyword		キーワード(YYYY/MM)
	出力		なし
	
	処理概要	1. 検索キーワードを入力フォームに格納する
				2. 月表示用FORMをsubmitする
******************************************************************************/
function ShowSearchLog(sForm, sKeyword){
	document.forms[sForm].elements['search_word'].value = sKeyword;
	document.forms[sForm].submit();
}



// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/
//
// nifty StyleSwitcher scripts modified by Aaron Jones 10/10/2002
// ----------------------------------------------

function setActiveStyleSheet(title, reset) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			a.disabled = true;
			if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
	if (reset == 1) {
		CreateCookie("petit", title, 365);
	}
}

function setStyle(){
	var style = ReadCookie("petit");
	if (style != null) {
		setActiveStyleSheet(style, 0);
	}
}

function popChild(url, width, height, winName){
	var features = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + width + ",height=" + height;
	if (winName == "") {
		winName = "childWin";
	}
	SmallWin = window.open(url,winName,features);
	if (window.focus) {
		SmallWin.focus();
	}
}

function loadParent(url) {
	var parentWin = window.opener;
	if (window.opener.closed) {
		window.open(url,"parentWin");
	} else {
		parentWin.location = url;
		
		if (window.focus) {
			parentWin.focus();
		}
	}
}

function CreateCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/; domain=petit.cc;";
	// ローカルでのチェック用
	//document.cookie = name+"="+value+expires+"; path=/;";
}

function ReadCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
	
}



/******************************************************************************
	サイドメニュー制御関連
******************************************************************************/
// サイドメニュー用オブジェクト格納配列
// ※ 関数呼び出しの際、「gSM[〜ID名〜].chgSideMenu()」と記述する
gSM = {};

function oSideMenu(idname){
	//メニューヘッダID名
	this.oHeader = idname + '_header';
	//メニューリストID名
	this.oContent = idname + '_content';
	//コンテンツ表示フラグ(0 : 非表示、1 : 表示)
	this.bFlg = 1;
}

/******************************************************************************
	関数名		chgSideMenu
	機能		サイドメニューを閉じたり開いたり
******************************************************************************/
oSideMenu.prototype.chgSideMenu = function(){
	//ヘッダの高さを変更(背景画像の高さに合わせるため)
	document.getElementById(this.oHeader).style.height = (this.bFlg)? '25px' : '23px';
	//ヘッダの背景画像を変更
	document.getElementById(this.oHeader).style.backgroundImage = (this.bFlg)? 'url(/0img/bkg_sm_close.gif)' : 'url(/0img/bkg_sm_open.gif)';
	//メニューリストの表示を変更
	document.getElementById(this.oContent).style.display = (this.bFlg)? 'none' : 'block';
	//フラグ変更
	this.bFlg = (this.bFlg)? 0 : 1;
}

/******************************************************************************
	サイドメニューオブジェクトを生成
******************************************************************************/
for(iCnt = 0; iCnt < 4; iCnt++){ gSM['sm' + iCnt] = new oSideMenu('sm' + iCnt); }


