
/*
============================================================
□ createXMLHttpRequest 
□ getJSONData	JSONデータを読み込み、jsで使える変数に格納して値を返す
□ onMouseOverBgchange
□ onMouseOutBgchange
□ navisecondChange
□ building_id
□ threadtabChange
□ contacttabChange
□ openBox_01
□ closeBox_01
□ openBox_02
□ closeBox_02
□ openBox_03
□ closeBox_03
□ openBox_04
□ closeBox_04
□ CookieClass
□ changeLetterSize
□ together_build_inquiry10	一括資料請求10物件用
□ together_build_inquiry4	一括資料請求4物件用（index,group,threadの10レス下などに表示されるオリジナルの方）
□ together_build_inquiry4Body	一括資料請求4物件用（thread.tt のスレ本文下に表示される4物件用）
□ together_build_inquiry_ranking	一括資料請求物件ランキング用
□ checkInquiry10AllOn		全物件にチェックを入れるボタン10物件用
□ checkInquiry10AllOff	全物件のチェックを外すボタン10物件用
□ checkInquiry4AllOn		全物件にチェックを入れるボタン4物件用
□ checkInquiry4AllOff	全物件のチェックを外すボタン4物件用
□ checkRankingAllOn		全物件にチェックを入れるボタン物件ランキング用
□ checkRankingAllOff	全物件のチェックを外すボタン物件ランキング用
□ getCookie			投稿した時のハンドルネームをcookieに保存する
□ setCookie			前回投稿した時のハンドルネームをフォームに入れる
□ selectTokumei		匿名リストで選択した名前をフォームに入れる
□ submitRes			レス投稿時の確認画面
□ confirmThread		新規スレ立て確認
□ submitThread			新規スレ立て実行
□ backThread			新規スレ立て確認画面から投稿フォームへ戻る
□ loadMap				スレページの地図表示
□ createMarker			地図表示のloadMapに利用
□ checkValue			携帯電話にモバイル版URLを送る時のエラーメッセージ
□ showHiddenForm		レス投稿フォームをPOPUPで出してドラッグで動かす
□ hideHiddenForm		レス投稿フォームをhiddenする
□ stopPropagation		レス投稿フォームのStopPropagation
□ openBlock			idを取得しdivを表示・非表示する
□ foldThreadText		スレッド本文を折りたたむ機能
□ expandThreadText	スレ本文を折りたたんだ後、スレ全文を見るリンク
□ operationAdBlock		スレ下４物件、adsense枠の表示非表示切り替え
□ searchEstate			スレと物件が関連付いていない時に出す、関連付けフォーム
□ linkEstate			関連付けのアラート文
□ jquery.corner.js		角丸のjQuery
□ estatenavisecondChange       estatesearchのナビゲーションを表示非表示にする
□ openBlock			問い合わせフォームの説明文開閉用

============================================================
*/

/* ---------------------------------------------------------
□ createXMLHttpRequest
--------------------------------------------------------- */

function createXMLHttpRequest() {
   return this.XMLHttpRequest ? 
      new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
}


/* ---------------------------------------------------------
□ getJSONData
--------------------------------------------------------- */
function getJSONData(filename) {
  var xmlhttp = createXMLHttpRequest();
  var jsondata = "";
  if (xmlhttp) {
    xmlhttp.open("GET", filename, false);
    xmlhttp.send(null);
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      jsondata = eval("(" + xmlhttp.responseText + ")");
    }
  }
  return jsondata;
}


/* ---------------------------------------------------------
□ onMouseOverBgchange
--------------------------------------------------------- */
function onMouseOverBgchange(target) {
	target.style.backgroundColor = "#FFF7DE";
	if(target.getElementsByTagName("th")[0])
	target.getElementsByTagName("th")[0].style.backgroundColor = "#FFF7DE";
}

/* ---------------------------------------------------------
□ onMouseOutBgchange
--------------------------------------------------------- */
function onMouseOutBgchange(target) {
	var target_name = target.className;
	if (target_name =="time_01"){
		target.style.backgroundColor = "#F7EFE7";
	} else if(target_name =="time_02") {
		target.style.backgroundColor = "#FFFFEF";
	} else if(target_name =="time_03") {
		target.style.backgroundColor = "#F9F9F9";
	} else {
		target.style.backgroundColor = "#FFFFFF";
	}
	if(target.getElementsByTagName("th")[0])
	target.getElementsByTagName("th")[0].style.backgroundColor = "#D3CEB1";
}

/* ---------------------------------------------------------
□ navisecondChange
--------------------------------------------------------- */
function navisecondChange(no) {
	for(var i=1;i<11;i++){
		document.getElementById("navi_second_" + i).style.display = "none" ;
		document.getElementById("navi_li_" + i).className = "" ;
	}
	document.getElementById("navi_second_" + no).style.display = "block" ;
	document.getElementById("navi_li_" + no).className = "nv_selected" ;
}

/* ---------------------------------------------------------
□  building_id　
--------------------------------------------------------- */
// 物件IDはテンプレートに直書きに変更したため、一部コメントアウト 20110928
function building_id(obj){
	if(obj.className == "form_checkbox"){
//		obj.getElementsByTagName("input")[0].value = b_id;
		obj.className ="form_checkbox_on";
	} else {
//		obj.getElementsByTagName("input")[0].value = "";
		obj.className ="form_checkbox";
	}
}


/* ---------------------------------------------------------
□ threadtabChange
--------------------------------------------------------- */
//スレッドのソースの順序を変更したため、関数をカスタマイズ　20110918
//var threadobj_no =1;
//function threadtabChange(no) {
//	document.getElementById("tab_area_" + threadobj_no).style.display = "none" ;
//	document.getElementById("tab_area_bt_" + threadobj_no).className = "sprite-fr_01_thread_tab_0" + threadobj_no ;
//	threadobj_no = no;
//	document.getElementById("tab_area_" + threadobj_no).style.display = "block" ;
//	document.getElementById("tab_area_b").className = "sprite-fr_01_thread_t_0" + threadobj_no ;
//	document.getElementById("tab_area_bt_" + threadobj_no).className = "sprite-fr_01_thread_tab_0" + threadobj_no + "_on" ;
//}

var threadobj_no =1;
function threadtabChange(no,num){
	document.getElementById("tab_area_bt_" + threadobj_no).className = "sprite-fr_01_thread_tab_0" + threadobj_no ;
	threadobj_no = no;
	document.getElementById("tab_area_b").className = "sprite-fr_01_thread_t_0" + threadobj_no ;
	document.getElementById("tab_area_bt_" + threadobj_no).className = "sprite-fr_01_thread_tab_0" + threadobj_no + "_on" ;
	if(no==1){
		document.getElementById("tab_area_1").style.display = "block";
		document.getElementById("content_bottom").style.display = "block";
		document.getElementById("tab_loadarea").style.display = "none";
	} else {
		document.getElementById("tab_area_1").style.display = "none";
		document.getElementById("content_bottom").style.display = "none";
		document.getElementById("tab_loadarea").style.display = "block";
		document.getElementById("tab_loadarea").innerHTML = document.getElementById("tab_area_"+no).innerHTML;
	}

// map2回目の切り替え時に地図が表示されるようにするために本関数について、以下のように修正が必要。
//var threadobj_no =1;
//function threadtabChange(no,num){
//	document.getElementById("tab_area_bt_" + threadobj_no).className = "sprite-fr_01_thread_tab_0" + threadobj_no ;
//	threadobj_no = no;
//	document.getElementById("tab_area_b").className = "sprite-fr_01_thread_t_0" + threadobj_no ;
//	document.getElementById("tab_area_bt_" + threadobj_no).className = "sprite-fr_01_thread_tab_0" + threadobj_no + "_on" ;
//	if(no==1){
//		document.getElementById("tab_area_1").style.display = "block";
//		document.getElementById("content_bottom").style.display = "block";
//		document.getElementById("tab_area_2").style.display = "none";
//		document.getElementById("tab_area_3").style.display = "none";
//	} else if(no==2) {
//		document.getElementById("tab_area_1").style.display = "none";
//		document.getElementById("content_bottom").style.display = "none";
//		document.getElementById("tab_area_2").style.display = "block";
//		document.getElementById("tab_area_3").style.display = "none";
//	} else if(no==3) {
//		document.getElementById("tab_area_1").style.display = "none";
//		document.getElementById("content_bottom").style.display = "none";
//		document.getElementById("tab_area_2").style.display = "none";
//		document.getElementById("tab_area_3").style.display = "block";
//	}

  if(!map){
   loadMap(num);
  } else if(num == 0){
   openInfoWindow(0);
  } else if(num){
   openInfoWindow(num);
  }
}


/* ---------------------------------------------------------
□ contacttabChange
--------------------------------------------------------- */
var contactobj_no =1;
function contacttabChange(no) {
	document.getElementById("contacttab_area_" + contactobj_no).style.display = "none" ;
	document.getElementById("contacttab_area_bt_" + contactobj_no).className = "sprite-fr_contact_tab_0" + contactobj_no ;
	contactobj_no = no;
	document.getElementById("contacttab_area_" + contactobj_no).style.display = "block" ;
	document.getElementById("contacttab_area_b").className = "sprite-fr_contact_t_0" + contactobj_no ;
	document.getElementById("contacttab_area_bt_" + contactobj_no).className = "sprite-fr_contact_tab_0" + contactobj_no + "_on" ;
}

/* ---------------------------------------------------------
□ openBox_01
--------------------------------------------------------- */
function openBox_01() {
	document.getElementById("openbox_01_01").style.display = "none" ;
	document.getElementById("openbox_01_02").style.display = "block";
	document.getElementById("openbox_01_03").style.display = "none" ;
	document.getElementById("openbox_01_04").style.display = "block";
}

/* ---------------------------------------------------------
□ closeBox_01
--------------------------------------------------------- */
function closeBox_01() {
	document.getElementById("openbox_01_01").style.display = "block" ;
	document.getElementById("openbox_01_02").style.display = "none";
	document.getElementById("openbox_01_03").style.display = "block" ;
	document.getElementById("openbox_01_04").style.display = "none";
}

/* ---------------------------------------------------------
□ openBox_02
--------------------------------------------------------- */
function openBox_02() {
	document.getElementById("openbox_02_01").style.display = "none" ;
	document.getElementById("openbox_02_02").style.display = "block";
	document.getElementById("openbox_02_03").style.display = "block" ;
}

/* ---------------------------------------------------------
□ closeBox_02
--------------------------------------------------------- */
function closeBox_02() {
	document.getElementById("openbox_02_01").style.display = "block" ;
	document.getElementById("openbox_02_02").style.display = "none";
	document.getElementById("openbox_02_03").style.display = "none" ;
}

/* ---------------------------------------------------------
□ openBox_03
--------------------------------------------------------- */
function openBox_03() {
	document.getElementById("openbox_03_01").style.display = "none" ;
	document.getElementById("openbox_03_02").style.display = "block";
	document.getElementById("openbox_03_03").style.display = "block" ;
}

/* ---------------------------------------------------------
□ closeBox_03
--------------------------------------------------------- */
function closeBox_03() {
	document.getElementById("openbox_03_01").style.display = "block" ;
	document.getElementById("openbox_03_02").style.display = "none";
	document.getElementById("openbox_03_03").style.display = "none" ;
}

/* ---------------------------------------------------------
□ openBox_04
--------------------------------------------------------- */
function openBox_04(target) {
	document.getElementById("openbox_04_" + target + "_01").style.display = "none" ;
	document.getElementById("openbox_04_" + target + "_02").style.display = "block";
	document.getElementById("openbox_04_" + target + "_03").style.display = "block" ;
}

/* ---------------------------------------------------------
□ closeBox_04
--------------------------------------------------------- */
function closeBox_04(target) {
	document.getElementById("openbox_04_" + target + "_01").style.display = "block" ;
	document.getElementById("openbox_04_" + target + "_02").style.display = "none";
	document.getElementById("openbox_04_" + target + "_03").style.display = "none" ;
}

/* ---------------------------------------------------------
□ openBox_05
--------------------------------------------------------- */
function openBox_05() {
	document.getElementById("openbox_05_01").style.display = "none" ;
	document.getElementById("openbox_05_02").style.display = "block";
}

/* ---------------------------------------------------------
□ closeBox_05
--------------------------------------------------------- */
function closeBox_05() {
	document.getElementById("openbox_05_01").style.display = "block" ;
	document.getElementById("openbox_05_02").style.display = "none";
}


/* ---------------------------------------------------------
□ CookieClass
--------------------------------------------------------- */
/**
 * Cookie()コンストラクタ
 * 指定したcookie情報を設定する
 * @param cname cookie名
 */
function Cookie(cname) {
	//cookieの名前を記憶する
	this.$name = cname ;
	
	//このドキュメントに付随するcookieをすべて読み込む
	var cookieObj = document.cookie ;
	//cookieが存在しない場合は処理を終了
	if ( cookieObj == "" ) return ;
	
	var cookies = cookieObj.split(';') ;
	var cookie = null ;
	for ( var i = 0 ; i < cookies.length ; i++ ) {
		//引数で指定されたcookie名の場合
		cookies[i] = cookies[i].replace(/(^\s+)|(\s+$)/g, "") ;
		if (cookies[i].substring(0, cname.length+1) == (cname + "=")) {
			cookie = cookies[i] ;
			break ;
		}
	}
	//指定したcookieが存在しない場合は処理を終了
	if ( cookie == null ) return ;
	
	//cookieに格納されている値を取得する
	var cval = cookie.substring(cname.length+1) ;
	var wk = cval.split('&') ;
	for ( var i = 0 ; i < wk.length ; i++ ) {
		wk[i] = wk[i].split(':') ;
	}
	for ( var i = 0 ; i < wk.length ; i++ ) {
		//デコードした値を格納する
		this[wk[i][0]] = decodeURIComponent(wk[i][1]);
	}
}

/**
 * cookieの発行処理
 * @param cduration cookieの有効期限（0:Cookie削除、null:セッションクッキー（ブラウザ終了時削除））
 * @param cpath cookieのパス
 * @param cdomain cookieのドメイン
 * @param csecure cookieのsecure属性 （true:secureを設定する、false:secureを設定しない）
 */
Cookie.prototype.publish = function ( cduration , cpath , cdomain , csecure ) {
	var cval = "" ;
	for ( var prop in this ) {
		//$で始まるプロパティ、メソッドを除く
		if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function'))
			continue ;
		if (cval != "") cval += '&' ;
		cval += prop + ':' + encodeURIComponent(this[prop]) ;
	}
	
	//cookieに保存する文字列を編集する
	var cookie = this.$name + '=' + cval ;
	if ( cduration || cduration == 0 ) {
		var expi = new Date();
		expi.setTime(expi.getTime() + cduration*24*60*60*1000);
		
		cookie += "; expires=" + expi.toGMTString() ;
		//cookie += "; max-age=" + (cduration*24*60*60) ;
	}
	if ( cpath ) cookie += "; path=" + cpath ;
	if ( cdomain ) cookie += "; domain=" + cdomain ;
	if ( csecure ) cookie += "; secure" ;

	document.cookie = cookie ;
}

/**
 * cookieの削除処理
 * @param cpath cookieのパス
 * @param cdomain cookieのドメイン
 * @param csecure cookieのsecure属性 （true:secureを設定する、false:secureを設定しない）
 */
Cookie.prototype.remove = function( cpath , cdomain , csecure ) {
	//取得しているcookie情報を削除する
	for(var prop in this) {
		if (prop.charAt(0) != '$' && typeof this[prop] != 'function') 
			delete this[prop] ;
	}
	//有効期限0でcookieを発行する
	this.publish( 0, cpath , cdomain , csecure ) ;
}

/**
 * cookieの有効判定
 * 有効な場合はtrue、無効な場合はfalseを返す
 * @return （true:有効、false:無効）
 */
Cookie.enabled = function() {
	//使用中のブラウザが、navigator.cookieEnabledが使用できる場合には、
	//navigator.cookieEnabledにて判定を行う
	if ( navigator.cookieEnabled != undefined ) return navigator.cookieEnabled ;
	
	//すでに判定済みであれば、判定結果をキャッシュから返す
	if ( Cookie.enabled.cache != undefined ) return Cookie.enabled.cache ;
	
	//とりあえずcookieを発行してみる
	document.cookie = "checkcookie=test; max-age=10000" ;
	var cookies = document.cookie ;
	if ( cookies.indexOf("checkcookie=test") == -1 ) {
		//発行できなかったので、結果をキャッシュに保存してfalseを返す
		return Cookie.enabled.cache = false ;
	} else {
		//発行したcookieを削除し、
		document.cookie = "checkcookie=test; max-age=0" ;
		//結果をキャッシュに保存してtrueを返す
		return Cookie.enabled.cache = true ;
	}
}

/* ---------------------------------------------------------
□  changeLetterSize
--------------------------------------------------------- */
var cname = "ab_hr_sel_f" ;//Cookie名
var cterm = 3000 ;//Cookieの保存日数
var cpath = "/" ;//Cookieのパス

//文字サイズ変更関数
function changeLetterSize(letterSize) {
	if(letterSize=="big") {
		document.getElementsByTagName("body")[0].style.fontSize = "14px";
	} else if(letterSize=="small") {
		document.getElementsByTagName("body")[0].style.fontSize = "12px";
	} else {
		document.getElementsByTagName("body")[0].style.fontSize = "13px";
	}
	var cookie = new Cookie(cname) ;
	cookie.fsize = letterSize ;
	cookie.publish(cterm , cpath) ;
}

//文字サイズCookie判定
var cookie = new Cookie(cname) ;
if (cookie.fsize) {
	if(cookie.fsize=="big") {
		document.write('<style type="text/css">body{ font-size: 14px;}</style>');
	} else if (cookie.fsize=="small") {
		document.write('<style type="text/css">body{ font-size: 12px;}</style>');
	} else {
		document.write('<style type="text/css">body{ font-size: 13px;}</style>');
	} 
}

/* ---------------------------------------------------------
□  together_build_inquiry10
--------------------------------------------------------- */
// 物件IDはチェックの有無に関わらず、最初からテンプレートに直書きに変更したため、一部修正。20110928

//10物件用一括資料請求 紐づけ無し用
function together_build_inquiry10(yj_id,cnt) {
	var yj_ad_id = yj_id;
	var inquiry_build_list ="";
	for (i = 0; i < cnt; i++ ) {
	// id「checkAllKey + i」が、form_checkbox_on　の場合のみ、物件idを取得する
  	//if(document.inquiry_build10.getElementsByTagName("input")[i].value !== "") {
  	if(document.getElementById("checkInquiry10AllKey" + i).className == "form_checkbox_on") {
    	inquiry_build_list += document.inquiry_build10.getElementsByTagName("input")[i].value + ',%20';
		}
	}
	if(inquiry_build_list){
 	// 複数の物件IDをURLに接続する
	window.open("https://new.realestate.yahoo.co.jp/mansion/request/?cbid="
+ inquiry_build_list.replace(/,%20$/,"")  +  yj_ad_id );
	//チェックされていない場合
	} else {
	// alert を表示
	alert('資料請求を希望する物件にチェックを入れてください');
	}
return false;
}

/* ---------------------------------------------------------
□  together_build_inquiry4
--------------------------------------------------------- */
// 物件IDはチェックの有無に関わらず、最初からテンプレートに直書きに変更したため、一部修正。20110928

//4物件用一括資料請求 紐づけ無し用（index,group,threadの10レス下などに表示されるオリジナルの方）
function together_build_inquiry4(yj_id,cnt) {
	var yj_ad_id = yj_id;
	var inquiry_build_list ="";
	for (i = 0; i < cnt; i++ ) {
		
	// id「checkAllKey + i」が、form_checkbox_on　の場合のみ、物件idを取得する
//  	if(document.inquiry_build4.getElementsByTagName("input")[i].value !== "") {
  	if(document.getElementById("checkInquiry4AllKey" + i).className == "form_checkbox_on") {
    	inquiry_build_list += document.inquiry_build4.getElementsByTagName("input")[i].value + ',%20';
	  	}  
	}

	if(inquiry_build_list){
 	// 複数の物件IDをURLに接続する
	window.open("https://new.realestate.yahoo.co.jp/mansion/request/?cbid="
+ inquiry_build_list.replace(/,%20$/,"")  +  yj_ad_id );
	//チェックされていない場合
	} else {
	// alert を表示
	alert('資料請求を希望する物件にチェックを入れてください');
	}
return false;
}

/* ---------------------------------------------------------
□  together_build_inquiry4Body
--------------------------------------------------------- */
//4物件用一括資料請求 紐づけ無し用（thread.tt のスレ本文下に表示される4物件用）
function together_build_inquiry4Body(yj_id,cnt) {
	var yj_ad_id = yj_id;
	var inquiry_build_list ="";
	for (i = 0; i < cnt; i++ ) {
		
  	if(document.getElementById("checkInquiry4AllKeyBody" + i).className == "form_checkbox_on") {
    	inquiry_build_list += document.inquiry_build4Body.getElementsByTagName("input")[i].value + ',%20';
	  	}  
	}

	if(inquiry_build_list){
 	// 複数の物件IDをURLに接続する
	window.open("https://new.realestate.yahoo.co.jp/mansion/request/?cbid="
+ inquiry_build_list.replace(/,%20$/,"")  +  yj_ad_id );
	//チェックされていない場合
	} else {
	// alert を表示
	alert('資料請求を希望する物件にチェックを入れてください');
	}
return false;
}
/* ---------------------------------------------------------
□  together_build_inquiry_ranking
--------------------------------------------------------- */
// 物件IDはチェックの有無に関わらず、最初からテンプレートに直書きに変更したため、一部修正。20110928

//ランキング用一括資料請求
function together_build_inquiry_ranking(yj_id) {
	var yj_ad_id = yj_id;
	var inquiry_build_list ="";
	for (i = 0; i < 10; i++ ) {
		
	// id「checkAllKey + i」が、form_checkbox_on　の場合のみ、物件idを取得する
//  	if(document.inquiry_build_ranking.getElementsByTagName("input")[i].value !== "") {
  	if(document.getElementById("checkRankingAllKey" + i).className == "form_checkbox_on") {

	var inquiry_build_id_index = document.inquiry_build_ranking.building_id_01[i].value.search("dtl/") + 4;
	var inquiry_build_id = document.inquiry_build_ranking.building_id_01[i].value.substr(inquiry_build_id_index, 8);

	inquiry_build_list += inquiry_build_id + ',%20';
	  	}  
	}

	if(inquiry_build_list){
 	// 複数の物件IDをURLに接続する

	window.open("https://new.realestate.yahoo.co.jp/mansion/request/?cbid="
+ inquiry_build_list.replace(/,%20$/,"")  +  yj_ad_id );

	//チェックされていない場合
	} else {
	// alert を表示
	alert('資料請求を希望する物件にチェックを入れてください');
	}
return false;
}

/* ---------------------------------------------------------
□  function checkInquiry10AllOn
--------------------------------------------------------- */

function checkInquiry10AllOn() {
	for (i = 0; i < 10; i++ ) {
	document.getElementById("checkInquiry10AllKey" + i).className = "form_checkbox_on";
	document.getElementById("allInquiry10OnTop").style.display = "none" ;
	document.getElementById("allInquiry10OffTop").style.display = "block" ;
	document.getElementById("allInquiry10OnBottom").style.display = "none" ;
	document.getElementById("allInquiry10OffBottom").style.display = "block" ;
	}
}

/* ---------------------------------------------------------
□  function checkInquiry10AllOff
--------------------------------------------------------- */

function checkInquiry10AllOff() {
	for (i = 0; i < 10; i++ ) {
	document.getElementById("checkInquiry10AllKey" + i).className = "form_checkbox";
	document.getElementById("allInquiry10OffTop").style.display = "none" ;
	document.getElementById("allInquiry10OnTop").style.display = "block" ;
	document.getElementById("allInquiry10OffBottom").style.display = "none" ;
	document.getElementById("allInquiry10OnBottom").style.display = "block" ;
	}
}

/* ---------------------------------------------------------
□  function checkInquiry4AllOn
--------------------------------------------------------- */

function checkInquiry4AllOn() {
	for (i = 0; i < 10; i++ ) {
	document.getElementById("checkInquiry4AllKey" + i).className = "form_checkbox_on";
	document.getElementById("allInquiry4On").style.display = "none" ;
	document.getElementById("allInquiry4Off").style.display = "block" ;
	}
}

/* ---------------------------------------------------------
□  function checkInquiry4AllOff
--------------------------------------------------------- */

function checkInquiry4AllOff() {
	for (i = 0; i < 10; i++ ) {
	document.getElementById("checkInquiry4AllKey" + i).className = "form_checkbox";
	document.getElementById("allInquiry4Off").style.display = "none" ;
	document.getElementById("allInquiry4On").style.display = "block" ;
	}
}

/* ---------------------------------------------------------
□  function checkRankingAllOn
--------------------------------------------------------- */

function checkRankingAllOn() {
	for (i = 0; i < 10; i++ ) {
	document.getElementById("checkRankingAllKey" + i).className = "form_checkbox_on";
	document.getElementById("allRankingOn").style.display = "none" ;
	document.getElementById("allRankingOff").style.display = "block" ;
	}
}

/* ---------------------------------------------------------
□  function checkRankingAllOff
--------------------------------------------------------- */

function checkRankingAllOff() {
	for (i = 0; i < 10; i++ ) {
	document.getElementById("checkRankingAllKey" + i).className = "form_checkbox";
	document.getElementById("allRankingOff").style.display = "none" ;
	document.getElementById("allRankingOn").style.display = "block" ;
	}
}


/* ---------------------------------------------------------
□  getCookie
--------------------------------------------------------- */
//投稿した時のハンドルネームをcookieに保存する
function getCookie(item) {
    var i, index, arr;
    arr = document.cookie.split(";");
    for(i = 0; i < arr.length; i++) {
        index = arr[i].indexOf("=");
        if(arr[i].substring(0, index) == item || 
                arr[i].substring(0, index) == " " + item)
            return arr[i].substring(index + 1);
    }
    return "";
}

/* ---------------------------------------------------------
□  setCookie
--------------------------------------------------------- */
//前回投稿した時のハンドルネームをフォームに入れる
function setCookie(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=/";
}

/* ---------------------------------------------------------
□  selectTokumei
--------------------------------------------------------- */
//匿名リストで選択した名前をフォームに入れる
function selectTokumei(elm) {
  if(elm.tokumei.options[elm.tokumei.selectedIndex].value != '#') {
    elm.name.value = elm.tokumei.options[elm.tokumei.selectedIndex].value;
  }
}

/* ---------------------------------------------------------
□ submitRes
--------------------------------------------------------- */
//レス投稿時の確認画面
function submitRes(elm) {
  if(elm.name.value == '') {
    alert("名前を入力または匿名を選択してください。");
    return false;
  } else if(elm.body.value == '') {
    alert("本文を入力してください。");
    return false;
  } else {
    var conFirm = confirm("投稿します。誤字脱字・書き間違いはありませんか？");
    if(conFirm) {
      setCookie('name_local',encodeURIComponent(elm.name.value),90);
      elm.submit.disabled = true;
    }
    return conFirm;
  }
}

/* ---------------------------------------------------------
□ confirmThread
--------------------------------------------------------- */
//新規スレ立て確認
function confirmThread() {
  if( document.getElementById("confirm_sub").value == '') {
    alert("題名を入力してください。");
    return false;
  } else if( document.getElementById("confirm_name").value == '') {
    alert("名前を入力または匿名を選択してください。");
    return false;
  } else if( document.getElementById("confirm_com").value == '') {
    alert("本文を入力してください。");
    return false;
 } else {

 var url = '';
 var workcompany = '';
 var managecompany = '';
 var checkFlag = ''
 if(document.getElementById("redirectFlag")!=null){
  if(document.getElementById("redirectFlag").value == 'mibbs_index'){
   if(document.getElementById("checkThread").checked == true){
    checkFlag = 'true';
   }
  }else if (document.getElementById("redirectFlag").value == 'jj_new_thread'){
   checkFlag = 'true'; 
  }
  
  if(checkFlag == 'true'){
   if( document.getElementById("comfirm_url").value == '') {
    alert("物件URLが未入力です。物件ページが無い場合は、無しとご入力下さい。");
    return false;
   } else if(document.getElementById("confirm_workcompany").value == ''){
    alert("施工会社が未入力です。施工会社が複数社ある場合は、スペースで区切って全てご入力下さい。");
    return false;
   } else if(document.getElementById("comfirm_managecompany").value == ''){
    alert("管理会社が未入力です。未定・不明の場合は、その旨をご入力下さい。");
    return false;
   } 
 
   url = '公式URL：' + document.getElementById("comfirm_url").value + '\n';
   workcompany = '施工会社：' + document.getElementById("confirm_workcompany").value + '\n';
   managecompany = '管理会社：' + document.getElementById("comfirm_managecompany").value + '\n\n';
  }
 } 
 
 document.getElementById("confirm_thread").style.display = "block";
 document.getElementById("enter_thread").style.display = "none";
 
 var str = '' ;

 str = '<div style="font-size:14px;"><b>題名：</b>' + document.getElementById("confirm_sub").value + '\n' ;
 str += '<b>名前：</b>' + document.getElementById("confirm_name").value + '\n\n' ;
 str += '<b>本文：</b>\n' + document.getElementById("confirm_com").value ;
 str += url;
 str += workcompany;
 str += managecompany;
 str += '</div>';

 str += '<input type="submit" value="利用規約に同意しスレッドを立てる" name="submit">\n\n' ;
 str += '<input type="button" value="入力画面に戻る" onClick="return backThread();">' ;
 
  document.getElementById("confirm_thread").innerHTML = '<pre style="white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap;white-space: pre-wrap;word-wrap: break-word;">' + str + '</pre>' ;
 
 location.hash = "#mibbs_main";
 
  return true;
 }
}

/* ---------------------------------------------------------
□ submitThread
--------------------------------------------------------- */
//新規スレ立て実行
function submitThread(elm) {

/*
  if(elm.name.value == '') {
    alert("名前を入力または匿名を選択してください。");
    return false;
  } else if(elm.body.value == '') {
    alert("本文を入力してください。");
    return false;
  } else if(elm.title.value == '') {
    alert("題名を入力してください。");
    return false;
  } else {

 if(document.getElementById("comfirm_url")!=null){
	if(elm.url.value != '')	{
		var str = '';
		str = elm.body.value;
		str += '\n物件URL：' + elm.url.value;
		str += '\n施工会社：' + elm.workcompany.value;
		str += '\n管理会社：' + elm.managecompany.value;
  	elm.body.value = str;
	}
*/

    var conFirm = confirm("投稿します。誤字脱字・書き間違いはありませんか？");
    if(conFirm) {
     setCookie('name_local',encodeURIComponent(elm.name.value),90);
	   elm.submit.disabled = true;
	}
   return conFirm;
}

/* ---------------------------------------------------------
□ backThread
--------------------------------------------------------- */
//新規スレ立て確認画面から投稿フォームへ戻る
function backThread() {
 document.getElementById("confirm_thread").style.display = "none";
 document.getElementById("enter_thread").style.display = "block";
 location.hash = "#newthread";
}




/* ---------------------------------------------------------
□ loadMap
--------------------------------------------------------- */
//スレページの地図表示
var map;
var jsonData;
var mk = [];
var infoWindowTag = [];
var icon = [];
var noImgUrl = 'http://www.e-mansion.co.jp/img/map/noimg.gif';
var customMarkerURL = 'http://www.e-mansion.co.jp/img/map/markers/';
var newThreadCgiUrl = 'http://www.e-mansion.co.jp/bbs/estate/newthread';

function loadMap(num){
 if(GBrowserIsCompatible() && typeof(map) != 'object'){
  GDownloadUrl("/js/json/yre/" + mibbs_tn + ".js?dummy=" + Math.random(), function(data,status){
   jsonData = eval("(" + data + ")");
   map = new GMap2(document.getElementById("map"));
   var latlng = new GLatLng(jsonData.latitude,jsonData.longitude);
   map.setCenter(latlng,13);
   map.addControl(new GLargeMapControl());
   map.addControl(new GScaleControl());
   map.addControl(new GMapTypeControl());
   map.enableContinuousZoom();
   map.enableDoubleClickZoom();

   createMarker(0,jsonData);
    for(var i=0; i<jsonData.building_n.length; i++){
     createMarker(i+1,jsonData.building_n);
    }

   onresize = function() {map.checkResize();};
   onunload = GUnload;
 
 //  if(!num){
 //   openInfoWindow(0);
 //  } else {
 //   openInfoWindow(num);
 //  }

  });
 } else if(!GBrowserIsCompatible()) {
  document.getElementById("tab_area_bt_3").innerHTML = '大変申し訳ございませんが、お使いのブラウザでは、地図を表示することができません。';
 }
}

var selectedEstate = 'undef';
function switchSelectedEstateColor(num){
 if(selectedEstate != 'undef'){
  if(document.getElementById('mibbs_estatet_' + selectedEstate)){
   document.getElementById('mibbs_estatet_' + selectedEstate).style.backgroundColor = '';
  }
  if(document.getElementById('mibbs_estatep_' + selectedEstate)){
   document.getElementById('mibbs_estatep_' + selectedEstate).style.backgroundColor = '';
  }
 }
 if(document.getElementById('mibbs_estatet_' + num)){
  document.getElementById('mibbs_estatet_' + num).style.backgroundColor = 'FFDDDD';
 }
 if(document.getElementById('mibbs_estatep_' + num)){
  document.getElementById('mibbs_estatep_' + num).style.backgroundColor = 'FFDDDD';
 }
 selectedEstate = num;
}
 
function openInfoWindow(num) {
 mk[num].openInfoWindowHtml(infoWindowTag[num],{"maxWidth" : 400});
 switchSelectedEstateColor(num);
 return false;
}

/* ---------------------------------------------------------
□ createMarker
--------------------------------------------------------- */
 
function createMarker(num,ref) {
 icon[num] = new GIcon();
 if(num == 0){
  icon[num].image = customMarkerURL + 'start.png';
 } else {
  icon[num].image = customMarkerURL + 'marker' + num + '.png';
 }
 icon[num].iconsize = new GSize(20,34);
 icon[num].shadow = "http://www.google.com/mapfiles/shadow50.png";
 icon[num].shadowSize = new GSize(37,34);
 icon[num].iconAnchor = new GPoint(10,34);
 icon[num].infoWindowAnchor = new GPoint(20,5);
 if(num == 0){
  mk[num] = new GMarker(new GLatLng(jsonData.latitude,jsonData.longitude),icon[num]);
  infoWindowTag[num] = createTag(jsonData);
 } else {
  mk[num] = new GMarker(new GLatLng(ref[num - 1].latitude,ref[num - 1].longitude),icon[num]);
  infoWindowTag[num] = createTag(ref[num - 1]);
 }
 map.addOverlay(mk[num]);
 GEvent.addListener(mk[num],"click",function(){
  mk[num].openInfoWindowHtml(infoWindowTag[num],{"maxWidth" : 400});
  switchSelectedEstateColor(num);
 });
}
 
function createTag(ref) {
 var jjImgLinkTag = '<img height="50" width="75" border="0" src="' + noImgUrl + '">';
 var jjTextLinkTag = '';
 if(ref.sold_flag != 1 && ref.dtlurl){
  if(ref.imageurl){
   jjImgLinkTag = '<a href="' +  ref.dtlurl + '" target="_blank"><img border="0" src="' + ref.imageurl + '&w=70&h=70&auto_offset=1&size_img=0&zoom_in=0"></a>';
  } else {
   jjImgLinkTag = '<a href="' +  ref.dtlurl + '" target="_blank"><img height="50" width="75" border="0" src="' + noImgUrl + '&w=70&h=70&auto_offset=1&size_img=0&zoom_in=0"></a>';
  }

  jjTextLinkTag = '<font size="2"><a href="' +  ref.documenturl.replace("bid=","cbid=") + '" target="_blank"><img src="http://www.e-mansion.co.jp/img/map/btn_kensaku_siryo3.gif" border="0"></a></font>';
 }
 var tag = '<div class="mibbs_map_infowindow"><b>' + ref.buildingname + '</b><br>' + jjImgLinkTag + '<br>' + ref.addressfull + '</font>' + jjTextLinkTag;
 if(ref.entry && ref.entry.length > 0){
  tag += '<br><font size="2"><strong>検討スレ</strong></font><br>';
  for(var i = ref.entry.length - 1; i >= 0; i--){
   tag += '<font size="2"><a href="/bbs/thread/' + ref.entry[i].entry_id + '/">' + ref.entry[i].title + '(' + ref.entry[i].num_of_item + ')</a></font><span class="clear">&nbsp;</span>';
   if(i < ref.entry.length - 3){
    break;
   }
  }
 }
 if(ref.entry_r && ref.entry_r.length > 0){
  tag += '<br><font size="2"><strong>住民スレ</strong></font><br>';
  for(var i = ref.entry_r.length - 1; i >= 0; i--){
   tag += '<font size="2"><a href="/bbs/thread/' + ref.entry_r[i].entry_id + '/">' + ref.entry_r[i].title + '(' + ref.entry_r[i].num_of_item + ')</a></font><span class="clear">&nbsp;</span>';
   if(i < ref.entry_r.length - 3){
    break;
   }
  }
 }
 if(!ref.entry && !ref.entry_r){
  tag += '<font size="2"><br><a href="' + newThreadCgiUrl + '?bid=' + ref.buildingid + '" target="_blank"><b>物件の評判を他の人に聞く</b></a></font><span class="clear">&nbsp;</span>';
 }
 tag += '</div><div class="clear">&nbsp;</div>';
 return tag;
}
 
var estateListPageText = 1;
function switchEstateListPageText(num){
 if(document.getElementById('mibbs_listt_' + estateListPageText)){
  document.getElementById('mibbs_listt_' + estateListPageText).style.display = "none";
 }
 if(document.getElementById('mibbs_listt_' + num)){
  document.getElementById('mibbs_listt_' + num).style.display = "block";
 }
 estateListPageText = num;
 return false;
}
 
var estateListPagePhoto = 1;
function switchEstateListPagePhoto(num){
 if(document.getElementById('mibbs_listp_' + estateListPagePhoto)){
  document.getElementById('mibbs_listp_' + estateListPagePhoto).style.display = "none";
 }
 if(document.getElementById('mibbs_listp_' + num)){
  document.getElementById('mibbs_listp_' + num).style.display = "block";
 }
 estateListPagePhoto = num;
 return false;
}


/* ---------------------------------------------------------
□ checkValue
--------------------------------------------------------- */
//携帯電話にモバイル版URLを送る時のエラーメッセージ
function checkValue () {
  if(document.getElementById("domain").value == '#') {
    alert("ドメインを選択してください。");
    return false;
  } else if(document.getElementById("mail").value == '') {
    alert("メールアドレスを入力してください。");
    return false;
  }
  return true;
}

/* ---------------------------------------------------------
□ showHiddenForm
--------------------------------------------------------- */
//レス投稿フォームをPOPUPで出してドラッグで動かす
function showHiddenForm(e){
 var x;
 var y;
 
 var mainTop = document.getElementById('content_base').offsetTop;

 if(window.event != null){
  
  x = window.event.x + document.body.scrollLeft;
  
  if(document.all && window.XMLHttpRequest && !window.opera){
   //IE7
   y = window.event.clientY + document.body.scrollTop - mainTop;
  }else{
   //Opera and Chrome
   y = window.event.y + document.body.scrollTop - mainTop;
  }
 }else{
  //FF
  x = e.pageX;
  y = e.pageY - mainTop;
 }
 
 var hiddenform = document.getElementById('hiddenform');
 hiddenform.style.display  = 'block';
 //hiddenform.style.position = 'absolute';
 hiddenform.style.left    = '539px' ;
 hiddenform.style.top      = y ;
 hiddenform.style.zIndex   = 999;
 
 return false;
}

/* ---------------------------------------------------------
□ hideHiddenForm
--------------------------------------------------------- */
//レス投稿フォームをhiddenする
function hideHiddenForm(e){
 var hiddenform = document.getElementById('hiddenform');
 hiddenform.style.display  = 'none';
 return false;
}

/* ---------------------------------------------------------
□ openBlock
--------------------------------------------------------- */
//idを取得しdivを表示・非表示する
function openBlock(name){
  if (document.getElementById(name).style.display == "block") {
    document.getElementById(name).style.display = "none";
  } else {
    document.getElementById(name).style.display = "block";
  }
}

/* ---------------------------------------------------------
□ stopPropagation
--------------------------------------------------------- */
function stopPropagation(evt){
	if(evt && evt.stopPropagation){
	evt.stopPropagation();
	}else if(window.event){
	window.event.cancelBubble = true;
	}
}

/* ---------------------------------------------------------
□ foldThreadText
--------------------------------------------------------- */
/*
	スレッド本文を折りたたむ機能
　指定閲覧回数以上の場合、スレッド本文を指定行数以下に設定して戻す
　id：スレッドID
　n：指定行数
　k：指定閲覧回数
 */
function foldThreadText(id, n, k){
	body_text = document.getElementById("thread_body_all").innerHTML
	
	sep_str = body_text.split("<br>");
	if (sep_str.length == 1){
		sep_str = body_text.split("<BR>");
	}
	
	cookie_k = getCookie("mansion_bbs_" + id);
	if (cookie_k == null || cookie_k == ""){
		cookie_k = 0
	}
	
	cookie_k = Number(cookie_k);
	
	if (sep_str.length >= n && cookie_k >= k){
		con_str = sep_str[0]
		for (i=1; i < n; i++) {
			con_str = con_str + "<br>"
			con_str = con_str + sep_str[i]
		}
		document.getElementById("thread_body_fold").innerHTML = con_str;
		document.getElementById("thread_body_fold").style.display = "block";
		document.getElementById("thread_body_link").style.display = "block";
		document.getElementById("thread_body_all").style.display = "none";
	} else {
		setCookie("mansion_bbs_" + id, cookie_k + 1, 30);
		document.getElementById("thread_body_fold").style.display = "none";
		document.getElementById("thread_body_link").style.display = "none";
		document.getElementById("thread_body_all").style.display = "block";
	}
}

/* ---------------------------------------------------------
□ expandThreadText
--------------------------------------------------------- */
//スレ本文を折りたたんだ後、スレ全文を見るリンク
function expandThreadText(){
	document.getElementById("thread_body_fold").style.display = "none";
	document.getElementById("thread_body_link").style.display = "none";
	document.getElementById("thread_body_all").style.display = "block";
}

/* ---------------------------------------------------------
□ operationAdBlock
--------------------------------------------------------- */

function operationAdBlock(){
	document.getElementById("4bukken").style.display = "none";

//	if (document.getElementById("4mansionArea").style.display == "block") {
//		document.getElementById("4mansionArea").style.display = "none";
//		document.getElementById("adBlockAnchor").textContent = "枠を再表示";
//	} else {
//		document.getElementById("4mansionArea").style.display = "block";
//		document.getElementById("adBlockAnchor").textContent = "枠を非表示";
// 	}
}

/* ---------------------------------------------------------
□ searchEstate
--------------------------------------------------------- */
//スレと物件が関連付いていない時に出す、関連付けフォーム
function searchEstate(p,e){
  var estate = getJSONData('/bbs/estate/ajaxSearch?q=' + encodeURIComponent(document.getElementById('search_estate_ajax').value) + (p ? '&p=' + p : ''));
  var h = '';
  var b = estate.building;
  if(estate.error_code){
    h ='<b>エラーが発生しました：' + estate.error_code + '</b>';
  } else {
    for(var i=0; i < b.length; i++){
      h += '<a href="/bbs/estate/search?bid=' + b[i].buildingid + '" target="_blank">' + b[i].buildingname + '</a> : <a href="" onClick="return linkEstate(\'' + b[i].buildingid + '\',' + e + ')">関連付ける</a><br>';
    }
    var pager = estate.pager;
    if(pager.total_entries){
      if(pager.current_page != 1){
        h += '<br /><b><a href="" onClick="return searchEstate(' + pager.previous_page + ',' + e + ')">前の' + pager.entries_per_page + '件</a></b>';
      }
      if(pager.current_page != pager.last_page){
        h += '<br /><b><a href="" onClick="return searchEstate(' + pager.next_page + ',' + e + ')">次の' + pager.entries_per_page + '件</a></b>';
      }
    } else {
      h = '<b>検索キーワードにマッチする物件が存在しません。</b><br />別のマンション名で検索してください。<br /><br />例）「The Tokyo Towers」を検索したい場合、「東京タワーズ」など違う文字列で検索';
    }
  }
  document.getElementById('search_estate_result').innerHTML = h;
  return false;
}


/* ---------------------------------------------------------
□ linkEstate
--------------------------------------------------------- */
//関連付けフォームのアラート文
function linkEstate(bid,e){
  if(!confirm('関連づけを行いますが、よろしいですか？')){
    return false;
  }
  var result = getJSONData('/bbs/estate/link?bid=' + bid + '&entry_id=' + e);
  var h = '';
  if(result.error_code){
	  if(result.error_code == '1603'){
		  h = 'この物件はすでに関連付けが完了しています。明日以降、この場所に物件が表示されます。';
	  } else {
		  h = 'error:' + result.error_code;
	  }
  } else {
	  h = '<span style="color:#FF3300;font-weight:bold;">関連づけが完了しました。<br>明日以降、この場所に物件が表示されます。</span>';
  }
  document.getElementById('search_estate_result').innerHTML = h;
  return false;
}


/* ---------------------------------------------------------
□ jquery.corner.js
--------------------------------------------------------- */
//角丸のjQuery
/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.12 (23-MAY-2011)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Authors: Dave Methvin and Mike Alsup
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl.  (default is all corners)
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (yes, it must be pixels).
 */
;(function($) { 

var style = document.createElement('div').style,
    moz = style['MozBorderRadius'] !== undefined,
    webkit = style['WebkitBorderRadius'] !== undefined,
    radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined,
    mode = document.documentMode || 0,
    noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8),

    expr = $.browser.msie && (function() {
        var div = document.createElement('div');
        try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
        catch(e) { return false; }
        return true;
    })();

$.support = $.support || {};
$.support.borderRadius = moz || webkit || radius; // so you can do:  if (!$.support.borderRadius) $('#myDiv').corner();

function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    while(node) {
        var v = $.css(node,'backgroundColor'), rgb;
        if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
            if (v.indexOf('rgb') >= 0) { 
                rgb = v.match(/\d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            return v;
        }
        if (node.nodeName.toLowerCase() == 'html')
            break;
        node = node.parentNode; // keep walking if transparent
    }
    return '#ffffff';
};

function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
    case 'sharp':  return width-i;
    case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
    case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
    case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
    case 'curl':   return Math.round(width*(Math.atan(i)));
    case 'tear':   return Math.round(width*(Math.cos(i)));
    case 'wicked': return Math.round(width*(Math.tan(i)));
    case 'long':   return Math.round(width*(Math.sqrt(i)));
    case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
    case 'dogfold':
    case 'dog':    return (i&1) ? (i+1) : width;
    case 'dog2':   return (i&2) ? (i+1) : width;
    case 'dog3':   return (i&3) ? (i+1) : width;
    case 'fray':   return (i%2)*width;
    case 'notch':  return width; 
    case 'bevelfold':
    case 'bevel':  return i+1;
    case 'steep':  return i/2 + 1;
    case 'invsteep':return (width-i)/2+1;
    }
};

$.fn.corner = function(options) {
    // in 1.3+ we can fix mistakes with the ready state
    if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(options);
            });
        }
        return this;
    }

    return this.each(function(index){
        var $this = $(this),
            // meta values override options
            o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(),
            keep = /keep/.test(o),                       // keep borders?
            cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]),  // corner color
            sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]),  // strip color
            width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width
            re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog|invsteep|steep/,
            fx = ((o.match(re)||['round'])[0]),
            fold = /dogfold|bevelfold/.test(o),
            edges = { T:0, B:1 },
            opts = {
                TL:  /top|tl|left/.test(o),       TR:  /top|tr|right/.test(o),
                BL:  /bottom|bl|left/.test(o),    BR:  /bottom|br|right/.test(o)
            },
            // vars used in func later
            strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz;
        
        if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
            opts = { TL:1, TR:1, BL:1, BR:1 };
            
        // support native rounding
        if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
            if (opts.TL)
                $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
            if (opts.TR)
                $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
            if (opts.BL)
                $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
            if (opts.BR)
                $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
            return;
        }
            
        strip = document.createElement('div');
        $(strip).css({
            overflow: 'hidden',
            height: '1px',
            minHeight: '1px',
            fontSize: '1px',
            backgroundColor: sc || 'transparent',
            borderStyle: 'solid'
        });
    
        pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        cssHeight = $(this).outerHeight();

        for (j in edges) {
            bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                d = document.createElement('div');
                $(d).addClass('jquery-corner');
                ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                    ds.position = 'relative';
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (i=0; i < width; i++) {
                    w = Math.max(0,getWidth(fx,i, width));
                    e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
                
                if (fold && $.support.boxModel) {
                    if (bot && noBottomFold) continue;
                    for (c in opts) {
                        if (!opts[c]) continue;
                        if (bot && (c == 'TL' || c == 'TR')) continue;
                        if (!bot && (c == 'BL' || c == 'BR')) continue;
                        
                        common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
                        $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
                        switch(c) {
                        case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
                        case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
                        case 'BL': $horz.css({ top: 0, left: 0 }); break;
                        case 'BR': $horz.css({ top: 0, right: 0 }); break;
                        }
                        d.appendChild($horz[0]);
                        
                        var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
                        switch(c) {
                        case 'TL': $vert.css({ left: width }); break;
                        case 'TR': $vert.css({ right: width }); break;
                        case 'BL': $vert.css({ left: width }); break;
                        case 'BR': $vert.css({ right: width }); break;
                        }
                        d.appendChild($vert[0]);
                    }
                }
            }
        }
    });
};

$.fn.uncorner = function() { 
    if (radius || moz || webkit)
        this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
    $('div.jquery-corner', this).remove();
    return this;
};

// expose options
$.fn.corner.defaults = {
    useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
    metaAttr:  'data-corner' // name of meta attribute to use for options
};
    
})(jQuery);


/* ---------------------------------------------------------
□ estatenavisecondChange
--------------------------------------------------------- */
function estatenavisecondChange(no) {
	for(var i=1;i<8;i++){
		document.getElementById("navi_second_" + i).style.display = "none" ;
		document.getElementById("navi_li_" + i).className = "" ;
	}
	document.getElementById("navi_second_" + no).style.display = "block" ;
	document.getElementById("navi_li_" + no).className = "nv_selected" ;
}

/* ---------------------------------------------------------
□ openBlock
--------------------------------------------------------- */
function openBlock(name){
  if (document.getElementById(name).style.display == "block") {
    document.getElementById(name).style.display = "none";
  } else {
    document.getElementById(name).style.display = "block";
  }
}

/* ---------------------------------------------------------
□ dblcickMove
--------------------------------------------------------- */
function dblclickMove(category){
	if(category == 'all'){
	document.location = "http://www.e-mansion.co.jp/bbs/";
	}else if(category == 'buyer'){
	document.location = "http://www.e-mansion.co.jp/bbs/group/buyer/";
	}else if(category == 'resident'){
	document.location = "http://www.e-mansion.co.jp/bbs/group/resident/";
	}else if(category == 'knowledge'){
	document.location = "http://www.e-mansion.co.jp/bbs/group/relevant_knowledge/";
	}else if(category == 'special'){
	document.location = "http://www.e-mansion.co.jp/bbs/search/%E3%82%B9%E3%83%AC%E3%80%91";
	}else if(category == 'others'){
	document.location = "http://www.e-mansion.co.jp/bbs/group/others/";
	}else if(category == 'estate_search'){
	document.location = "http://www.e-mansion.co.jp/bbs/estate/search/";
	}else if(category == 'estate_area'){
	document.location = "http://www.e-mansion.co.jp/estate_area/";
	}else if(category == 'area'){
	document.location = "http://www.e-mansion.co.jp/area/";
	}else if(category == 'info'){
	document.location = "http://www.e-mansion.co.jp/information/";
	}else if(category == 'keywords'){
	document.location = "http://www.e-mansion.co.jp/yougo/";
	}else if(category == 'questionnaire'){
	document.location = "http://www.e-mansion.co.jp/information/20110523.html";
	}else if(category == 'ekodate'){
	window.open("http://www.e-kodate.com");
	}else if(category == 'wiki'){
	window.open("http://sutekicookan.com/");
	}else if(category == 'mikle'){
	window.open("http://mikle.jp/");
	}else if(category == 'friend'){
	window.open("http://mikle.co.jp/service_all.html");
	}

}

