try { document.execCommand("BackgroundImageCache", false, true); } catch(e) { }

ViewRuleMenu = function() {
	this.initialize.apply(this, arguments);
};

ViewRuleMenu.prototype = {
	BT_FLAG_OPEN: 1,
	BT_FLAG_CLOSE: 2,
	bt_flag: 1,
	
	openImage: "",
	closeImage: "",
	
	menuElem: null,
	btnElm: null,
	
	initialize: function(resultViewRuleMenu, resultViewRuleBtn) {
		this.menuElem = $(resultViewRuleMenu);
		if(this.menuElem == null) {
			return;
		}
		
		//デフォルトで隠す
		this.menuElem.hide();
		this.bt_flag = this.BT_FLAG_CLOSE;
		
		//イベントハンドラをセット
		this.btnElm = $(resultViewRuleBtn);
		if(this.btnElm == null) {
			return;
		}
		Event.observe(this.btnElm, 'click', this.bind(this.click));
	},
	
	click: function(e){
		if(this.bt_flag == this.BT_FLAG_OPEN){
			this.menuElem.blindUp(
				{
					duration: 0.5,
					afterFinish: this.bind(this.onClose)
				}
			);
			this.bt_flag = this.BT_FLAG_CLOSE;
		} else if(this.bt_flag == this.BT_FLAG_CLOSE){
			this.menuElem.blindDown(
				{
					duration: 0.3,
					afterFinish: this.bind(this.onOpen)
				}
			);
			this.bt_flag = this.BT_FLAG_OPEN;
		}
		
		e.stop();
	},
	
	onClose: function(){
		this.btnElm.down().src = this.openImage;
	},
	
	onOpen: function(){
		this.btnElm.down().src = this.closeImage;
	},
	
	bind: function(func) {
		var self = this;
		var args = Array.prototype.slice.call(arguments, 1);
		return function(){
			return func.apply(
				self,
				args.concat(Array.prototype.slice.call(arguments, 0))
			);
		};
  	}
};

FacetSqueeze = function() {
	this.initialize.apply(this, arguments);
};

FacetSqueeze.prototype = {
	BT_FLAG_OPEN: 1,
	BT_FLAG_CLOSE: 2,
	bt_flag: 1,
	bt_flag_popup: 2,
//	bt_flag_pulldown: 2,
	
	titleElm: null,
	menuElm: null,
	moreElm: null,

	popup: null,
//	pulldown: null,

	COOKIE_VALUE_CLOSED: "1",
	COOKIE_VALUE_OPENED: "0",
	cookieName: null,

	initialize: function(menuName, moreBtn, fieldName) {
		var elm = $(menuName);
		this.menuElm = elm.down(".slideMenu");
		this.titleElm = elm.down(".squeezeTitle a");
		this.moreElm = $(moreBtn);
		this.cookieName = menuName;
		
		// デフォルトでポップアップは閉じる
		var popupElm = elm.down(".squeezePopupbox");
		popupElm.hide();
		this.bt_flag_popup = this.BT_FLAG_CLOSE;
		this.popup = new FacetPopup(popupElm, fieldName);
		this.popup.onOpen = this.bind(this.onPopupOpen);
		this.popup.onClose = this.bind(this.onPopupClose);
//		var pulldownElm = $(hiddenEntry);
//		if(pulldownElm != null) {
//			pulldownElm.hide();
//			this.bt_flag_pulldown = this.BT_FLAG_CLOSE;
//			this.pulldown = new FacetPulldown(pulldownElm);
//			this.pulldown.onOpen = this.bind(this.onPulldownOpen);
//			this.pulldown.onClose = this.bind(this.onPulldownClose);
//		}
		
		// クッキーを読んで閉じる
		var manager = new CookieManager();
		if( manager.getCookie(this.cookieName) == this.COOKIE_VALUE_CLOSED ){
			this.menuElm.hide();
			this.onMenuClose();
			this.bt_flag = this.BT_FLAG_CLOSE;
		} else {
			this.bt_flag = this.BT_FLAG_OPEN;
		}
		
		// イベントハンドラをセット（タイトルクリックでファセットを表示）
		Event.observe(this.titleElm, 'click', this.bind(this.toggleMenu));
		
		if(this.moreElm != null) {
			// イベントハンドラをセット（「すべて表示」でポップアップ表示）
			Event.observe(this.moreElm.down("a"), 'click', this.bind(this.togglePopup));
//			Event.observe(this.moreElm.down("a"), 'click', this.bind(this.togglePulldown));
		}
	},
	
	toggleMenu: function(e){
		if(this.bt_flag == this.BT_FLAG_OPEN){
			this.menuElm.blindUp(
				{
					duration: 0.5,
					afterFinish: this.bind(this.onMenuClose)
				}
			);
			this.bt_flag = this.BT_FLAG_CLOSE;
		} else if(this.bt_flag == this.BT_FLAG_CLOSE) {
			this.menuElm.blindDown(
				{
					duration: 0.3,
					afterFinish: this.bind(this.onMenuOpen)
				}
			);
			this.bt_flag = this.BT_FLAG_OPEN;
		}
		
		e.stop();
	},
	
	onMenuClose: function(){
		this.titleElm.addClassName("close");
		if(this.bt_flag_popup == this.BT_FLAG_OPEN) {
			// ポップアップが開いていたら、閉じる
			this.popup.fade();
		}
//		if(this.bt_flag_pulldown == this.BT_FLAG_OPEN) {
//			// ポップアップが開いていたら、閉じる
//			this.pulldown.fade();
//		}
		var manager = new CookieManager();
		manager.setCookie(this.cookieName, this.COOKIE_VALUE_CLOSED + ";path=/");
	},
	
	onMenuOpen: function(){
		this.titleElm.removeClassName("close");
		var manager = new CookieManager();
		manager.setCookie(this.cookieName, this.COOKIE_VALUE_OPENED + ";path=/");
	},

	togglePopup: function(e){
		if(this.bt_flag_popup == this.BT_FLAG_OPEN){
			this.popup.fade();
		} else if(this.bt_flag_popup == this.BT_FLAG_CLOSE) {
			this.popup.appear();
		}
		e.stop();
	},
	
	onPopupClose: function(){
		this.bt_flag_popup = this.BT_FLAG_CLOSE;
		this.moreElm.removeClassName("moreSqueezeLinkClose");
		this.moreElm.down("a").update("全てを見る");
	},
	
	onPopupOpen: function(){
		this.bt_flag_popup = this.BT_FLAG_OPEN;
		this.moreElm.addClassName("moreSqueezeLinkClose");
		this.moreElm.down("a").update("閉じる");
	},

//	togglePulldown: function(e){
//		if(this.bt_flag_pulldown == this.BT_FLAG_OPEN){
//			this.pulldown.fade();
//		} else if(this.bt_flag_pulldown == this.BT_FLAG_CLOSE) {
//			this.pulldown.appear();
//		}
//		e.stop();
//	},
	
//	onPulldownClose: function(){
//		this.bt_flag_pulldown = this.BT_FLAG_CLOSE;
//		this.moreElm.removeClassName("moreSqueezeLinkClose");
//		this.moreElm.down("a").update("全てを見る");
//	},
	
//	onPulldownOpen: function(){
//		this.bt_flag_pulldown = this.BT_FLAG_OPEN;
//		this.moreElm.addClassName("moreSqueezeLinkClose");
//		this.moreElm.down("a").update("閉じる");
//	},
	
	bind: function(func) {
		var self = this;
		var args = Array.prototype.slice.call(arguments, 1);
		return function(){
			return func.apply(
				self,
				args.concat(Array.prototype.slice.call(arguments, 0))
			);
		};
  	}
};

//FacetPulldown = function() {
//	this.initialize.apply(this, arguments);
//};

//FacetPulldown.prototype = {
//	pulldowmElm: null,
//	
//	initialize: function(elm) {
//		this.pulldowmElm = elm;
//	},
//	
//	onClose: null,
//	onClose_: function() {
//		if(this.onClose != null) {
//			this.onClose();
//		}
//	},
//	
//	onOpen: null,
//	onOpen_: function() {
//		if(this.onOpen != null) {
//			this.onOpen();
//		}
//	},
//	
//	fade: function() {
//		this.pulldowmElm.hide();
//		this.onClose_();
//	},
//	
//	appear: function() {
//		this.pulldowmElm.show();
//		this.onOpen_();
//	}
//};

FacetPopup = function() {
	this.initialize.apply(this, arguments);
};

FacetPopup.prototype = {
	popupElm: null,
	containerElm: null,
	loadingImageElm: null,
	
	url: null,
	params: null,
	fieldName: null,
	page: 1,
	
	onOpen: null,
	onClose: null,
	
	onOpen_: function() {
		if(this.onOpen != null) {
			this.onOpen();
		}
		this.page = 1;
	},
	
	onClose_: function() {
		if(this.onClose != null) {
			this.onClose();
		}
	},
	
	initialize: function(popupElm, fieldName) {
		this.fieldName = fieldName;
		this.popupElm = popupElm;
		this.containerElm = this.popupElm.down(".squeezePopupContainer");
		this.loadingImageElm = this.popupElm.down(".loadingImage");
		
		// イベントハンドラをセット（「閉じる」でポップアップ非表示）	
		Event.observe(this.popupElm.down(".closeBtn"), 'click', this.bind(this.close));
	},
	
	close: function(e) {
		this.fade();
		e.stop();
	},
	
	fade: function() {
		this.popupElm.fade(
			{
				duration: 0.3,
				afterFinish: this.bind(this.onClose_)
			}
		);
	},
	
	appear: function() {
		this.draw();
		this.popupElm.appear(
			{
				duration: 0.3,
				afterFinish: this.bind(this.onOpen_)
			}
		);
	},
	
	draw: function() {
		var currentParams = Object.clone(this.params);
		currentParams['facetPageNo'] = this.page;
		currentParams['facetFieldName'] = this.fieldName;
		
		this.containerElm.addClassName("hidden");
		this.loadingImageElm.removeClassName("hidden");
		new Ajax.Updater(
			this.containerElm,
			this.url,
			{
				parameters: currentParams,
				onComplete: this.bind(this.onLoaded)
			}
		);
	},
	
	onLoaded: function() {
		var nextLinkElm = this.containerElm.down(".nextLink").down("a");
		if(typeof(nextLinkElm) != 'undefined') {
			Event.observe(nextLinkElm, 'click', this.bind(this.clickNext));
		}
		var prevLinkElm = this.containerElm.down(".backLink").down("a");
		if(typeof(prevLinkElm) != 'undefined') {
			Event.observe(prevLinkElm, 'click', this.bind(this.clickPrev));
		}
		
		var pageListElm = this.containerElm.down(".pageList");
		var pageList = pageListElm.childElements();
		for(var i = 0; i < pageList.length; i++) {
			var elm = pageList[i].down("a");
			if(typeof(elm) != 'undefined') {
				var toPage = elm.readAttribute("href");
				Event.observe(elm, 'click', this.bind(this.scrollTo, toPage));
			}
		}
		
		this.loadingImageElm.addClassName("hidden");
		this.containerElm.removeClassName("hidden");
	},
	
	scrollTo: function(toPage, e){
		this.page = toPage;
		this.draw();
		e.stop();
	},
	
	clickNext: function(e){
		this.page++;
		this.draw();
		e.stop();
	},
	
	clickPrev: function(e){
		this.page--;
		this.draw();
		e.stop();
	},
	
	bind: function(func) {
		var self = this;
		var args = Array.prototype.slice.call(arguments, 1);
		return function(){
			return func.apply(
				self,
				args.concat(Array.prototype.slice.call(arguments, 0))
			);
		};
  	}
};SearchCondition = function() {
	this.initialize.apply(this, arguments);
};

SearchCondition.prototype = {
	elmContainer: null,
	elementHtml: null,
	
	onInitElement: null,
	onRemove: null,
	onChange: null,
	
	initialize: function(elmContainer) {
		this.elmContainer = elmContainer;
	},
	
	add: function() {
		var elmTemp = new Element('div');
		elmTemp.innerHTML = this.elementHtml;
		var elm = elmTemp.childElements()[0];
		
		elm.hide();
		this.elmContainer.appendChild(elm);
		elm.appear({
			duration: 0.3
		});
		
		if(this.onInitElement != null) {
			this.onInitElement(elm);
		}
		if(this.onChange != null) {
			this.onChange();
		}
	},
	
	remove: function(elm) {
		if(this.onRemove != null) {
			this.onRemove(elm);
		}
		elm.fade({
			duration: 0.3,
			afterFinish: function() {
				elm.remove();
				
				if(this.onChange != null) {
					this.onChange();
				}
			}.bind(this)
		});
	},
	
	childElements: function() {
		return this.elmContainer.childElements();
	}
};

SearchHelpPopup = function() {
	this.initialize.apply(this, arguments);
};

SearchHelpPopup.prototype = {
	elmPopup: null,
	
	STATUS_HIDDEN: 0,
	STATUS_SHOWN: 1,
	status: 0,
	
	initialize: function(elm) {
		this.elmPopup = elm;
		this.status = this.STATUS_HIDDEN;
	},
	
	toggle: function() {
		if(this.status == this.STATUS_HIDDEN) {
			this.show();
		} else if(this.status == this.STATUS_SHOWN) {
			this.hide();
		}
	},
	
	show: function() {
		this.elmPopup.appear({
			duration: 0.3,
			afterFinish: function() {
				this.status = this.STATUS_SHOWN;
			}.bind(this)
		});
	},
	
	hide: function() {
		this.elmPopup.fade({
			duration: 0.3,
			afterFinish: function() {
				this.status = this.STATUS_HIDDEN;
			}.bind(this)
		});
	}
};
<!--
// ナビゲーションプルダウン動作用
//----------------------------------------------------------


//ページをロード後に実行
Event.observe(window, "load", onpulldown, false);

var gcBtnTimmer1 = null;
var gcBtnTimmer2 = null;

function onpulldown() {
	
	var ctgryBtnset = $$("li.gnaviCtgry");
	for (var i = 0; i < ctgryBtnset.length; i ++) {
		ctgryBtnset[i].observe("mouseover", actionOver);
		ctgryBtnset[i].observe("mouseout", actionOut);
	}
	
};


//マウスオーバー動作
function actionOver(){
	var sBtn = $(this);//イベントを起こしたカテゴリ
	
	//focusChildAnchorElement(sBtn);
	//$("forcus4js").focus();
	window.focus();
	
	gcBtnTimmer1 = setTimeout( function(){
		
		var other_obj = $$("li.gnaviCtgry div.pulldownBox");
		for (var i = 0; i < other_obj.length; i ++) {
			other_obj[i].removeClassName("visivleBlock");
		}
		
		pulldown_obj = sBtn.getElementsByClassName("pulldownBox");
		pulldown_obj[0].addClassName("visivleBlock");
		
	},0);
	
	clearTimeout(gcBtnTimmer2);
	if(lastFocuseTimerFlag) clearTimeout(lastSelectTimer);
}

/*function focusChildAnchorElement(element){
	var ctgryBtn = element.getElementsByClassName("ctgryBtn")[0];
	var anchorElement = ctgryBtn.getElementsByTagName("a")[0];
	anchorElement.focus();
}*/


//マウスアウト動作
function actionOut(){
	
	clearTimeout(gcBtnTimmer1);
	
	focusOnLastFocusedElement();
	
	gcBtnTimmer2 = setTimeout( function(){
		
		var pulldown_obj2 = $$("li.gnaviCtgry div.pulldownBox");
		for (var i = 0; i < pulldown_obj2.length; i ++) {
			pulldown_obj2[i].removeClassName("visivleBlock");
		}
		
	},300);
	
}



// -->//=========================================================
//
//			ウィンドウロード完了の共通処理を入れる
//
//=========================================================
Event.observe(window, "load", windowLoad, false);


function windowLoad(e){
	// イベントリスナーの削除
	Event.stopObserving(window, "load", windowLoad, false);

	// Cookieを見てログイン状態を判断する
	loginUserManager_checkLogin();
	
	// twitthisの実装
	var twitThisUri = "http://twitter.com/home/?status=";
	var twitThisLocation = window.location;
	var twitThisTitle = document.title;
	var twitThisParam = twitThisTitle + "\n" + twitThisLocation;
	twitThisParam = data = encodeURIComponent(twitThisParam);
	twitThisUri = twitThisUri + twitThisParam;
	$("twitthis").href = twitThisUri;
}/**
 *  open genre menu
 */
function ___global_navi_subgenre_list_open___(){
	var global_navi_sub_genres = $A($("global_navi_pulldownBox_genre").getElementsByClassName("___global_navi_subgenre_list___"));
	global_navi_sub_genres.each(function(elm){Element.setStyle(elm,{display:"block"});});

	Element.setStyle($("genreListOpenBtn"),{display:"none"});
	Element.setStyle($("genreListCloseBtn"),{display:"block"});
}

/**
 *  close genre menu
 */
function ___global_navi_subgenre_list_close___(){
	var global_navi_sub_genres = $A($("global_navi_pulldownBox_genre").getElementsByClassName("___global_navi_subgenre_list___"));
	global_navi_sub_genres.each(function(elm){Element.setStyle(elm,{display:"none"});});
	Element.setStyle($("genreListOpenBtn"),{display:"block"});
	Element.setStyle($("genreListCloseBtn"),{display:"none"});
}


/**
 *  close genre menu and setEventListeners where window loaded
 */
Event.observe(window, "load", function(e){
	Event.observe($("treeMenuSwitchOpen"), "click",___global_navi_subgenre_list_open___ , false);
	Event.observe($("treeMenuSwitchClose"), "click",___global_navi_subgenre_list_close___, false);
	___global_navi_subgenre_list_close___();
}, false);var lastFocusedInputElement;
var lastFocusedFlag = false;
var lastSelectTimer;
Event.observe(window, "load", function(e){
	//console.log("input");
	var inputElements = document.getElementsByTagName("input");
	var inputLength = inputElements.length;
	for(var inputCount = 0; inputCount < inputLength; inputCount++){
		var currentInputObject = inputElements[inputCount];
		//console.log( currentInputObject );
		
		Event.observe(currentInputObject, "focus", function(e){
			lastFocusedFlag = true;
			if(lastFocuseTimerFlag) clearTimeout(lastSelectTimer);
			var selectElement = Event.element(e);
			//console.log(selectElement);
			lastFocusedInputElement = selectElement;
		},false);
	}
}, false);

var lastFocuseTimerFlag = false;
function focusOnLastFocusedElement(){
	if(lastFocuseTimerFlag) clearTimeout(lastSelectTimer);
	lastSelectTimer = setTimeout( function(){
		lastFocuseTimerFlag = true;
		if(lastFocusedFlag){
			lastFocusedInputElement.focus();
			clearTimeout(lastSelectTimer);
		}
	},500);
}/**
*	make banner tags
*/

// for rectangle banners
var BANNER_TYPE_RECTANGLE = {
	"impAtag" 	: "/SITE=ET.TOWER.DAC/AREA=RECTANGLE/AAMSZ=300X250/CL=REC",
	"width" 	: 300,
	"height"	: 250
}

// for square banners
var BANNER_TYPE_PAGE = {
	"impAtag"	: "/SITE=ET.TOWER.DAC/AREA=PAGE/AAMSZ=728X90/CL=SB",
	"width" 	: 728,
	"height" 	: 90
};

// set default banner type
var DEFAULT_BANNER_TYPE = BANNER_TYPE_RECTANGLE;

function bannerTag(type){
	if(type == undefined){
		type = DEFAULT_BANNER_TYPE;
	}
	
	var impAcn = "IMPASEG";
	var impAco = document.cookie;
	var impApos = impAco.indexOf(impAcn+"=");
	var impAseg = (impApos!=-1)?impAco.substring(impApos+impAcn.length+1,(impAco.indexOf("; ",impApos)!=-1)?impAco.indexOf("; ",impApos):impAco.length):null;
	var width = type["width"];
	var height = type["height"]
	var impAtag = type["impAtag"];
	
	impAseg = (impAseg)?unescape(impAseg):null;

	impAserver = "http://as.dc.impact-ad.jp";
	
	impAtarget = (impAseg)?impAtag+"/"+impAseg:impAtag;

	impArnd = Math.round(Math.random() * 100000000);
	if (!impApid) var impApid = Math.round(Math.random() * 100000000);
	document.write('<iframe src="'+impAserver+'/hserver/acc_random='+impArnd + impAtarget + '"');
	document.write(' noresize scrolling="no" hspace="0" vspace="0" frameborder="0" marginheight="0" marginwidth="0" width="' + width + '" height="' + height + '" allowTransparency="true">');
	if (navigator.userAgent.indexOf("Gecko")==-1 && navigator.userAgent.indexOf("MSIE")==-1){
		document.write('<scr');
		document.write('ipt src="' + impAserver + '/jnserver/acc_random=' + impArnd + impAtarget + '/pageid=' + impApid + '">');
		document.write('</scr');
		document.write('ipt>');
	}
	document.write('</iframe>');
}/**
 *  div functions
 */
function resizeMap(minSize, maxSize, minText, maxText, thisObj){
	var target = document.getElementById('mapDetail');
	var height = target.style.height;
	
	if(height == minSize){
		target.style.height = maxSize;
		thisObj.innerHTML = maxText;
	}else{
		target.style.height = minSize;
		thisObj.innerHTML = minText;
	}
	
	return false;
}/**************************************************************
*						popup window utils
***************************************************************/
/**
 *  open review window
 *  @arg link		review link
 */
function popupReviewWindow(link){
	popupSimpleWindow(link, 'review', 600, 680);
	
	return false;
}


//-------------------------------------------------------------------
//
//							functions
//
//-------------------------------------------------------------------
/**
 *  make popup simple window design size only
 *  @arg link			href
 *  @arg windowName		window name
 *  @arg width			width
 *  @arg height			height
 */
function popupSimpleWindow(link, windowName, width, height){
	windowPopupSource(link,windowName,width,height,false, false, true, true, false);
	
	return false;
}


/**
 *  change boolean to yes or no
 *  @arg flag
 */
function boolean2yn(flag){
	if(flag){
		return "yes";
	}else{
		return "no";
	}
}

/**
 *  make popup window
 *  @arg link			href
 *  @arg windowName		window name
 *  @arg width			width
 *  @arg height			hegiht
 *  @arg menubar		menubar true or false
 *  @arg toolbar		toolbar true or false
 *  @arg scrollbars		scrollbars true or false
 */
function windowPopupSource(link, windowName, width, height, menubar, toolbar, scrollbars, resizable, location){
	menubar = boolean2yn(menubar);
	toolbar = boolean2yn(toolbar);
	scrollbars = boolean2yn(scrollbars);
	resizable = boolean2yn(resizable);
	location = boolean2yn(location);
	window.open(link, windowName, 'width=' + width + ',height=' + height + ', menubar=' + menubar + ', toolbar=' + toolbar + ', scrollbars=' + scrollbars + ', resizable=' + resizable + ",location=" + location);
}/**
 * 広告のHTMLを出力する
 */
function adv_getSimpleAd(contextPath, advId, elementId){
	// キャッシュ防止パラメータ
	var noCache = (new Date()).getTime();
	
	// URLの作成
	var url = contextPath + "/advertisement/" + advId + "/";
	
	
	// リクエスト
	new Ajax.Request(url,{
		method: "get",
		parameters: "t=" + noCache,
		
		// リクエスト成功
		onSuccess:function(httpObj){
			var splited = httpObj.responseText.split("	");
//			alert(splited);
			var mode = splited[0];
			var body = adv_getBody(splited);
			
//			alert(mode + ":----:" + body);
			
			if(mode == "script")
				eval(body);
			else if(mode == "image")
				Insertion.Top($(elementId), body);
		},
		
		// リクエスト失敗時
		onFailure:function(httpObj){
			console.log("adv load error.");
		}
	});
}

function adv_getBody(splited){
	var splitedLength = splited.length;
	var ret = "";
	for(var splitedCount = 1; splitedCount < splitedLength; splitedCount++){
		ret += splited[splitedCount];
	}
	return ret;
}//=========================================================
//
//								ユーザのログイン状態を判定する
//
//=========================================================
/**
 * ログインしてる場合は「ログアウト」を表示してログインしてないときは「ログイン」を表示するようにする
 */
function loginUserManager_switchLoginLogoutText(flag){
	var yes = "inline";
	var no = "none";

	// ログインしてる場合
	if(flag){
		$("nowLogin4js").style.display = yes;
		$("nowLogout4js").style.display = no;
	}
	
	// ログインしていない場合
	else{
		$("nowLogin4js").style.display = no;
		$("nowLogout4js").style.display = yes;
	}
}

/**
 *  ajaxでログイン状態を調べる
 */
function loginUserManager_checkLogin(){
	var url = contextPath + "/ajax/checkLogin/?t=" + new Date().getTime();
	
	var ajax = new Ajax.Request(
		url,
		{
			method: 'get',
			onComplete: function(req){
				var value = req.responseText;
				var flag = false;
				
				if(value == "1")
					flag = true;
				
				loginUserManager_switchLoginLogoutText(flag);
			}
		}
	);
	
}


/**
 *  クッキーがあるか判定する
 */
function loginUserManager_hasCookie(cookieName){
	var cookieList = document.cookie.split(" ");
	
	var cookieLength = cookieList.length;
	
	for(var cookieCount = 0; cookieCount < cookieLength; cookieCount++){
		var cookieFormula = cookieList[cookieCount].split("=");
		
		if(cookieFormula[0] == cookieName){
			return true;
		}
	}
	
	return false;
}var DS = "/";
var pageNo = 1;
var page= 1;

function encodeSearchStr(str) {
	str = str.replace('/', '%2F');
	str = str.replace('?', '%3F');
	str = str.replace('.', '%2E');
	str = encodeURIComponent(str);
	return str;
}

function form_submit(obj) {
	var valueObj = obj.elements['searchStr'];
	
	if(!valueObj.value) {
		alert('検索ワードを指定してください。');
		return 0;
	}
	
	var action = getActionPath(valueObj);
	self.document.submit_form.action = action;

	self.document.submit_form.submit();
}

function getActionPath(obj) {
	var searchStr = encodeSearchStr(obj.value);
	var action = contextPath + DS + currentTab + DS + searchStr + DS + page;
	return action;
}

function switchSearchMode(mode){

	var action = contextPath+DS;
	
	if(!$('headerSearchTextBox').value) {
		currentTab = mode;
		Element.removeClassName($('headerSearchSelecterArea').getElementsByClassName('select')[0],'select');
		Element.addClassName($('headerSearchSelecterArea').getElementsByClassName(mode.replace('search/',''))[0], 'select');
		return;
	}

	var searchStr = encodeSearchStr($('headerSearchTextBox').value);
	action += mode+DS;
	action += searchStr+DS+page;

	resetSearchRule();
	self.document.submit_form.action = action;
	self.document.submit_form.submit();
}
function resetSearchRule(){
	self.document.submit_form.limit.value = 20;
	self.document.submit_form.sort.value = "";
	self.document.submit_form.direction.value = false;
	self.document.submit_form.highlight.value = false;
}ProtoCalendar.LangFile['en'].WEEKDAY_ABBRS = ['S','M','T','W','T','F','S'];

ProtoCalendarRender.prototype.renderHeader = function(calendar) {
    var html = '';
    // required 'href'
    html += '<div class="#{headerTopClass}"></div><div class="#{headerClass}">' +
      '<a href="javascript:void(0);" id="#{prevBtnId}" class="#{prevButtonClass}"><img width="9" height="9" alt="前月" src="'+
      contextPath + '/images/d_calendar-btn-prev.gif"/></a>' +
      this.createSelect(calendar.getYear(), calendar.getMonth()) + 
		//'<span id="' + this.getIdPrefix() + '-test">'+ calendar.getYear() + '</span>/<span id="' + this.getIdPrefix() + '-test2">' + calendar.getMonth() + '</span>' +
		'<a href="javascript:void(0);" id="#{nextBtnId}" class="#{nextButtonClass}"><img width="9" height="9" alt="次月" src="'+
      contextPath + '/images/d_calendar-btn-next.gif"/></a>' +
      '</div><div class="#{headerBottomClass}"></div>';
    return html;
};

ProtoCalendarRender.prototype.renderFooter = function(calendar) {
    return '<div class="#{footerTopClass}"></div><div class="#{footerClass}" id="#{footerId}"></div>'+
    '<div class="#{footerBottomClass}"><img width="5" height="3" src="'+
	contextPath + '/images/d_calendar-top_arrow.gif"/></div>';
};

function setAlignment(alignTo, element) {
  var elmDim = element.getDimensions();
  var algDim = alignTo.getDimensions();
  var offsets = Position.cumulativeOffset(alignTo);
  var uName = navigator.userAgent;
  var sfpx = 0; 
  if (uName.indexOf("Safari") > -1){ sfpx = 235; }
  
  element.setStyle(
  	{
  		left: (offsets[0] - elmDim.width / 2 + algDim.width / 2 - sfpx) + "px",
  		top: (offsets[1] + 23) + "px"
  	}
  );
}
var blogID;

function getCalendar(blogURL, id, path) {
    blogID = id;
    var cookie = readCookie("AjaxCal" + id);
    if(cookie != null) {
        if(blogURL.lastIndexOf("/") != blogURL.length - 1) {
            path = blogURL + "/calendar/" + cookie + "/";
        } else {
            path = blogURL + "calendar/" + cookie + "/";
        }
    }
    changeMonth(path);
}

function changeMonth(url) {
    new Ajax.Updater({success: 'calendar'},
                     url, {
                         method: 'get',
                         onComplete: endProcess,
                         onFailure: errorProcess
                     });
    return false;
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0, len = ca.length; i < len; 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;
}

function endProcess() {
    var value = $('calendar').getElementsByTagName('table')[0].getAttribute('summary');
    setWeekendAndHoliday(value.split("/")[0], value.split("/")[1]);
    document.cookie = "AjaxCal" + blogID + "=" + value + "; path=/";
}

function errorProcess() {
    $('calendar').innerHTML = 'File Not Found';
}

function setWeekendAndHoliday(y,m) {
    setCurrentDate();
    var elements = $('calendar').getElementsByTagName("table");
    for (var j = 0, len = elements.length; j < len; j++) {
        var element = elements[j].getAttribute("summary");
        if(element == null){
            return;
        }
        var year = element.split("/")[0];
        var month = element.split("/")[1];
        if(!(year == y && month == m)){
            return;
        }
        var spans = elements[j].getElementsByTagName("span");
        var day;
        for (i = 0; i < spans.length; i++) {
            if (spans[i].parentNode.nodeName == "TD") {
                if(spans[i].innerHTML.indexOf("href") != -1){
                    day = spans[i].getElementsByTagName("a")[0].innerHTML;
                } else {
                    day = spans[i].innerHTML;
                }
                if (isHoliday(year, month, day)) {
                    spans[i].setAttribute('class', 'holiday');
                    spans[i].setAttribute('className', 'holiday');
                } else if(isSaturday(year, month, day)) {
                    spans[i].setAttribute('class', 'saturday');
                   spans[i].setAttribute('className', 'saturday');
                }
                if (isToday(year, month, day)) {
                    spans[i].parentNode.setAttribute('class', 'today');
                    spans[i].parentNode.setAttribute('className', 'today');
                }
            }
        }
    }
}
function topFlashDisp(){
	if($('mboxFlashCell')){
		var flashurl="flashtest/trcarousel.swf";
		var tag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="645" height="117"><param name="movie" value="'+ flashurl + '" /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="' + flashurl + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="645" height="117" wmode="transparent"></embed></object>';
		$('mboxFlashCell').innerHTML = tag;
	}
}