// グローバルオブジェクト
var homesGlobal = new Object();
var address = new Object();
address.cityCode = "";
address.cityName = "";
address.city_code = "";
address.prefCode = "";
address.prefName = "";
address.prefecture_code = "";
	
var test = null;


/**
 * パラメータ取得処理
 *
 * @param
 * @return
 */
function initParam() {
	// グローバル初期設定
	// ベースURL
	homesGlobal.baseurl = "";
	// URLパラメータ
	homesGlobal.urlparam = homesutil.getURLParameter();
	// grp
	//homesGlobal.grp = "homes";
	homesGlobal.grp = "";
 	// Sell or Rent
 	homesGlobal.tk = "";
 	// 物件種別
 	homesGlobal.bsg = "";
 	// OEM
 	homesGlobal.oem = false;
	// OEMID
 	homesGlobal.oemid = null;
 	// ROUTE
 	homesGlobal.route = "4";
	// KDriveオブジェクト
	homesGlobal.map = null;
	// 検索条件フォームオブジェクト
	homesGlobal.ConditionForm = null;
	// 検索オブジェクト
	homesGlobal.search = null
	// 物件POI
	homesGlobal.bukkenpoi = null;
	// 物件POI範囲
	homesGlobal.bukkenpoirange = null;
	// ランドマークPOI
	homesGlobal.landmarkpoi = null;
	// ランドマーク選択
	homesGlobal.landmarkgenre = null;
	// 会員情報POI
	homesGlobal.realtorpoi = null;
	// そこどこオブジェクト
	homesGlobal.sokodoko = new sokodokoObject();
	// 家賃相場オブジェクト
	homesGlobal.MarketPriceAreaRent = null;
	// infoWindowオブジェクト
	homesGlobal.infowindow = null;
	// クリックした物件POIの座標
	homesGlobal.bukkenpos = null;
	// クリックした物件POIの範囲
	homesGlobal.bukkengeofb = null;
	// クリックした会員POIの座標
	homesGlobal.realtorpos = null;
	// クリックした物件の座標リスト
	homesGlobal.bukkenidlist = null;
	// poiのzIndex
	homesGlobal.zindex = new Object();
	homesGlobal.zindex.main = 11000;
	homesGlobal.zindex.select = 10000;
	homesGlobal.zindex.landmark = 1000;
	homesGlobal.zindex.bukken = 3000;
	homesGlobal.zindex.realtor = 2000;
	// 検索ピクセル数
	homesGlobal.movepx = new Array(50,50,50,50,50,50,50,50,50,50);
	// 混雑の範囲
	homesGlobal.confms = new Array(50,50,50,50,50,50,12000,5000,2000,5);
	// 前回の検索座標
	homesGlobal.position = null;
	homesGlobal.bounds = null;
	// 検索のタイマー
	homesGlobal.SearchTimer = new Object();
	homesGlobal.SearchTimer.tid = null;
	homesGlobal.SearchTimer.time = 500;
	// リサイズのタイマー
	homesGlobal.ResizeTimer = new Object();
	homesGlobal.ResizeTimer.tid = null;
	homesGlobal.ResizeTimer.time = 200;
	// 検索の最大件数
	homesGlobal.defaultmaxcount = 4000;
	homesGlobal.maxcount = 0;
	// 検索モード
	homesGlobal.SearchMode = "all";
	// タイムアウトフラグ
	homesGlobal.SearchTimeout = new Object();
	// 縮尺表示DIV
	homesGlobal.zoomelement = new Array(10);
	// 現在の縮尺
	homesGlobal.zoomlevel = 7;
	// リスト関連
	homesGlobal.list = new Object();
	homesGlobal.list.div = null;
	homesGlobal.list.count = new countObject();
	homesGlobal.list.page = 1;
	homesGlobal.list.pagecount = 0;
	homesGlobal.list.pagecountdiv = null;
	homesGlobal.list.type = "";
	homesGlobal.list.ListForm = null;
	homesGlobal.list.ListRequestForm = null;
	homesGlobal.list.angle = new Array("","北","北東","東","南東","南","南西","西","北西");
	homesGlobal.list.detailurl = "http://realestate.homes.co.jp/search/detail.php";
	homesGlobal.list.detailurl2 = "http://realestate.homes.co.jp/search/detail/";
	homesGlobal.list.inquireurl = "http://realestate.homes.co.jp/search/inquire.php";
	// OEM番号
	homesGlobal.gyo = "";
	// 間取りのテキスト
	homesGlobal.madoritext = {11:"ワンルーム",12:"1K",13:"1DK",15:"1LDK",22:"2K",23:"2DK",25:"2LDK",32:"3K",33:"3DK",35:"3LDK",42:"4K",43:"4DK",45:"4LDK",52:"5K",53:"5DK",55:"5LDK"};
	// エラーページ
	homesGlobal.errorpage = "/map/uc/Errors?grp=homes";
	// 横幅取得用のDIV
	homesGlobal.widthdiv = null;
	// iframe
	homesGlobal.frame = new Object();
	homesGlobal.frame.header = null;
	homesGlobal.frame.footer = null
	// ラッパー
	homesGlobal.wrapper = new Object();
	homesGlobal.wrapper.div = null;
	homesGlobal.wrapper.defaultwidth = null;
	homesGlobal.wrapper.defaultheight = null;
	// ソートキー
	homesGlobal.sortby = "location";
	// 色
	homesGlobal.color = _homes_color;
	// ブロックドメイン
	homesGlobal.domain = _homes_domain;
	// Cookie
	homesGlobal.cookie = new Object();
	homesGlobal.cookie.domain = null;
	homesGlobal.cookie.time = 7 * 24 * 60 * 60;
	// パラメータ設定
	setParam();

}

/**
 * 初期表示
 *
 * @param
 * @return
 */
function homesinit() {
	
	// 横幅取得用のDIV
	homesGlobal.widthdiv = document.createElement("div");
	homesGlobal.widthdiv.style.width = "100%";
	homesGlobal.widthdiv.style.height = "0px";
	homesGlobal.widthdiv.style.top = "0px";
	homesGlobal.widthdiv.style.left = "0px";
	homesGlobal.widthdiv.style.position = "absolute";
	document.body.appendChild(homesGlobal.widthdiv);

	// 初期処理
	init();
	
	setCondition();
	
	
	// 初期表示
	var _map = document.getElementById("_map");
	if (_map == null) errorPage();
	var _el = 139.7568737;
	var _nl = 35.698136;
 	if (typeof(homesGlobal.urlparam.el) != "undefined") {
		_el = homesutil.change60to10(homesGlobal.urlparam.el[0]);
 	}
 	if (typeof(homesGlobal.urlparam.nl) != "undefined") {
		_nl = homesutil.change60to10(homesGlobal.urlparam.nl[0]);
 	}
 	if (typeof(homesGlobal.urlparam.gyo) != "undefined") {
		homesGlobal.gyo = homesGlobal.urlparam.gyo;
 	}
	if (typeof(MMap) != "undefined") {
		homesGlobal.map = new MMap(_map, {adapter: new adapterMapion("http://bm01.mapion.co.jp/m/", "b", "wgs")});
		homesGlobal.map.autoScroll = true;
		homesGlobal.map.centerAndZoom( homesGlobal.map.adp.util.tky.wgs( new MPoint(_el, _nl) ), homesGlobal.zoomlevel );
	}
	
	// wrapper
	homesGlobal.wrapper.div = document.getElementById("wrapper");
	
	// リストDIV
	homesGlobal.list.div = document.getElementById("list_table_inner");
	
	// リスト件数DIV
	homesGlobal.list.pagecountdiv = document.getElementById("_pagecount");
	homesGlobal.list.pagecount = homesGlobal.list.pagecountdiv.value;

	// InfoWindow作成
	if (homesGlobal.map) {
		homesGlobal.infowindow = new homesInfoWindow(homesGlobal.map);
	}
	
	// 検索条件フォーム
	homesGlobal.ConditionForm = document.getElementById("conditionForm");
	
	// リストフォーム
	homesGlobal.list.ListForm = document.getElementById("listForm");
	homesGlobal.list.ListRequestForm = document.getElementById("listrequestForm");
	
	// 縮尺表示DIV
	homesGlobal.zoomelement[9] = document.getElementById("_zoom9");
	homesGlobal.zoomelement[8] = document.getElementById("_zoom8");
	homesGlobal.zoomelement[7] = document.getElementById("_zoom7");
	homesGlobal.zoomelement[6] = document.getElementById("_zoom6");
	homesutil.setZoomElement(homesGlobal.zoomlevel);
	
	// 検索オブジェクト作成
	homesGlobal.search = new Object();
	homesGlobal.search.Sokodoko = new searchSokodoko(homesGlobal.map);
	homesGlobal.search.Landmark = new searchLandmark(homesGlobal.map);
	homesGlobal.search.BukkenSearch = new searchBukkenSearch(homesGlobal.map);
	homesGlobal.search.BukkenMapBalloon = new searchBukkenMapBalloon(homesGlobal.map);
	homesGlobal.search.BukkenMaps2 = new searchBukkenMaps2(homesGlobal.map);
	homesGlobal.search.RealtorMaps2 = new searchRealtorMaps2(homesGlobal.map);
	homesGlobal.search.RealtorDetail = new searchRealtorDetail(homesGlobal.map);
	homesGlobal.search.RegInfoMarketPriceAreaRent = new searchRegInfoMarketPriceAreaRent(homesGlobal.map);
	
	// 家賃相場オブジェクト
	if (homesGlobal.oemid != null && homesGlobal.oemid >= 10000000) {
		homesGlobal.MarketPriceAreaRent = null;
	} else {
		homesGlobal.MarketPriceAreaRent = new MarketPriceAreaRent(homesGlobal.search.RegInfoMarketPriceAreaRent);
		if (homesGlobal.tk == 1) {
			homesGlobal.MarketPriceAreaRent.show = false;
		} else {
			homesGlobal.MarketPriceAreaRent.show = true;
		}
	}

	// bind
	Binding(homesGlobal.sokodoko, "adna2", document.getElementById("_adna2"), "innerHTML");
	Binding(homesGlobal.sokodoko, "adna3", document.getElementById("_adna3"), "innerHTML");
	Binding(homesGlobal.sokodoko, "adna4", document.getElementById("_adna4"), "innerHTML");
	Binding(homesGlobal.sokodoko, "adna5", document.getElementById("_adna5"), "innerHTML");
	Binding(homesGlobal.list.count, "html", document.getElementById("_pagertext"), "innerHTML");
	Binding(homesGlobal.sokodoko, "admi3", address, "cityCode");
	Binding(homesGlobal.sokodoko, "adna3", address, "cityName");
	Binding(homesGlobal.sokodoko, "admi3", address, "city_code");
	Binding(homesGlobal.sokodoko, "admi2", address, "prefCode");
	Binding(homesGlobal.sokodoko, "adna2", address, "prefName");
	Binding(homesGlobal.sokodoko, "admi2", address, "prefecture_code");
	if (homesGlobal.MarketPriceAreaRent != null) {
		Binding(homesGlobal.sokodoko, "id", homesGlobal.MarketPriceAreaRent, "search");
		Binding(homesGlobal.sokodoko, "adna3", homesGlobal.MarketPriceAreaRent, "cityname");
	}
	
	// イベント設定
	if(homesGlobal.map != null) {
		MEvent.addListener( homesGlobal.map , "moveend"  , mapMoveHandler );
		MEvent.addListener( homesGlobal.map , "zoom"  , mapZoomHandler );
	}
		
	homesGlobal.search.Sokodoko.addEventListener( "onload" , CallbackSokodoko );
	homesGlobal.search.Sokodoko.addEventListener( "onerror" , OnerrorSokodoko );
	homesGlobal.search.Landmark.addEventListener( "onload" , CallbackLandmark );
	homesGlobal.search.Landmark.addEventListener( "onerror" , OnerrorLandmark );
	homesGlobal.search.BukkenSearch.addEventListener( "onload" , CallbackBukkenSearch );
	homesGlobal.search.BukkenSearch.addEventListener( "onerror" , OnerrorBukkenSearch );
	homesGlobal.search.BukkenMapBalloon.addEventListener( "onload" , CallbackBukkenMapBalloon );
	homesGlobal.search.BukkenMapBalloon.addEventListener( "onerror" , OnerrorBukkenMapBalloon );
	homesGlobal.search.BukkenMaps2.addEventListener( "onload" , CallbackBukkenMaps2 );
	homesGlobal.search.BukkenMaps2.addEventListener( "onerror" , OnerrorBukkenMaps2 );
	homesGlobal.search.RealtorMaps2.addEventListener( "onload" , CallbackRealtorMaps2 );
	homesGlobal.search.RealtorMaps2.addEventListener( "onerror" , OnerrorRealtorMaps2 );
	homesGlobal.search.RealtorDetail.addEventListener( "onload" , CallbackRealtorDetail );
	homesGlobal.search.RealtorDetail.addEventListener( "onerror" , OnerrorRealtorDetail );
	homesGlobal.search.RegInfoMarketPriceAreaRent.addEventListener( "onload" , CallbackRegInfoMarketPriceAreaRent );
	homesGlobal.search.RegInfoMarketPriceAreaRent.addEventListener( "onerror" , OnerrorRegInfoMarketPriceAreaRent );
	
	if(homesGlobal.infowindow != null) {
		homesGlobal.infowindow.addEventListener( "close" , CloseInfoWindow );
		homesGlobal.infowindow.addEventListener( "open" , OpenInfoWindow );
	}
	
	setLandmark(document.getElementById("genre"));
	
	//setTimeout(homesresize,100);
	homesresize();
	
}

function homesresize() {
	if (homesGlobal.ResizeTimer.tid != null) {
		clearTimeout(homesGlobal.ResizeTimer.tid);
		homesGlobal.ResizeTimer.tid = null;
	}
	homesGlobal.ResizeTimer.tid = setTimeout(function() {
		// サイズ取得
		document.body.style.overflow = "auto";
		if (homesGlobal.widthdiv == null) {
			return;
		} else {
			//clearInterval(homesGlobal.ResizeTimer.tid);
		}
		homesGlobal.widthdiv.style.width = "100%";
		var windowheight = 0
		if (document.body.clientHeight) {
			if (MBrowser.opera) {
				windowheight = document.body.clientHeight - 30;
			} else {
				windowheight = document.body.clientHeight;
			}
		} else {
			windowheight = document.innerHeight;
		}
		document.body.style.overflow = "hidden";
		// 横
		if(homesGlobal.widthdiv.offsetWidth < _wrapper_width) {
			homesGlobal.wrapper.div.style.width = _wrapper_width + "px";
			document.body.style.overflow = "auto";
		} else {
			homesGlobal.wrapper.div.style.width = homesGlobal.widthdiv.offsetWidth + "px";
		}
		//縦
		if(windowheight < _wrapper_height ) {
			homesGlobal.wrapper.div.style.height = _wrapper_height  + "px";
			document.body.style.overflow = "auto";
		} else {
			homesGlobal.wrapper.div.style.height = (windowheight - 10) + "px";
		}
		// スクロールバーを調整する為に、もう１度横幅の調整
		if(homesGlobal.widthdiv.offsetWidth < _wrapper_width) {
			homesGlobal.wrapper.div.style.width = _wrapper_width + "px";
			document.body.style.overflow = "auto";
		} else {
			if(homesGlobal.map != null) {
				if (!MBrowser.ie5up && !MBrowser.opera && windowheight < _wrapper_height) {
					homesGlobal.wrapper.div.style.width = (homesGlobal.widthdiv.offsetWidth - 18) + "px";
				} else {
					homesGlobal.wrapper.div.style.width = (homesGlobal.widthdiv.offsetWidth) + "px";
				}
			} else {
				homesGlobal.wrapper.div.style.width = (homesGlobal.widthdiv.offsetWidth) + "px";
			}
		}
		// 後処理
		layout();
		if(homesGlobal.map != null) {
			homesGlobal.map.refreshMapDivSize();
		}
		mapMoveHandler(true);
		homesGlobal.ResizeTimer.tid = null;
	}, homesGlobal.ResizeTimer.time);
	
}


/**
 * 家賃相場DIV作成
 *
 * @param
 * @return
 */
function createPriceArea() {
	homesGlobal.pricediv = document.createElement("div");
	homesGlobal.map.div.appendChild(homesGlobal.pricediv);
	homesGlobal.pricediv.id = "_price";
	homesGlobal.pricediv.style.width = "100px";
	homesGlobal.pricediv.style.height = "100px";
	homesGlobal.pricediv.style.position = "absolute";
	homesGlobal.pricediv.style.backgroundColor = "#ffffff";
	homesGlobal.pricediv.style.top = "10px";
	homesGlobal.pricediv.style.left = "10px";
	homesGlobal.pricediv.style.zIndex = 10000;
	homesGlobal.pricediv.style.filter = "alpha(opacity=90)";
	homesGlobal.pricediv.style.MozOpacity = 0.9;
	homesGlobal.pricediv.style.opacity = 0.9;
	
}

/**
 * パラメータ設定
 *
 * @param
 * @return
 */
function setParam() {
 	// grp
	homesGlobal.grp = _grp;

 	// gyo
 	if (typeof(homesGlobal.urlparam.o) != "undefined" && homesGlobal.urlparam.o != null) {
 		homesGlobal.gyo = homesGlobal.urlparam.o[0];
 		homesGlobal.oemid = homesGlobal.gyo.split("h")[0];
 		if (homesGlobal.oemid >= 10000000) {
 			homesGlobal.oem = true;
 			homesGlobal.route = "5";
 		}
 	}

	var con = 0;
	if (typeof(homesGlobal.urlparam.con) != "undefined" && homesGlobal.urlparam.con[0] == 1) {
		con = 1;
		if (homesGlobal.oemid == null || homesGlobal.oemid < 100) {
			getCookie();
		}
	}
	
 	// scl
 	if (typeof(homesGlobal.urlparam.scl) != "undefined" && homesGlobal.urlparam.scl != null) {
 		homesGlobal.zoomlevel = homesGlobal.urlparam.scl[0];
 	}
 	
 	// tk
 	if (typeof(homesGlobal.urlparam.tk) != "undefined" && homesGlobal.urlparam.tk != null) {
 		if (homesGlobal.urlparam.tk[0] == 1) {
	 		homesGlobal.tk = 1;
	 		homesGlobal.tkname = "BSale";
 		}
 		if (homesGlobal.urlparam.tk[0] == 3) {
	 		homesGlobal.tk = 3;
	 		homesGlobal.tkname = "BRent";
 		}
 	}

 	// bsg
 	if (typeof(homesGlobal.urlparam.bsg) != "undefined" && homesGlobal.urlparam.bsg != null) {
 		homesGlobal.bsg = homesGlobal.urlparam.bsg[0];
 	}
 	
	// エラー処理
	if (homesGlobal.urlparam.el == null || homesGlobal.urlparam.el == "") {
		errorPage();
	}
	if (homesGlobal.urlparam.nl == null || homesGlobal.urlparam.nl == "") {
		errorPage();
	}
	if (homesGlobal.grp == null || homesGlobal.grp == "") {
		errorPage();
	}
	if (homesGlobal.tk == null || homesGlobal.tk == "") {
		errorPage();
	}
	if (homesGlobal.bsg == null || homesGlobal.bsg == "") {
		errorPage();
	}
	if (homesGlobal.zoomlevel < 6 || homesGlobal.zoomlevel > 9) {
		homesGlobal.zoomlevel = 7;
	}
	if (con == 1 && homesGlobal.oemid >= 100) {
		errorPage();
	}
	if (homesGlobal.oemid != null && homesGlobal.oemid != "" && _generalcount == 0) {
		errorPage();
	}
}

/**
 * 検索条件表示
 *
 * @param
 * @return
 */
function setCondition() {
	var conditionDiv = document.getElementById("condition");
	var data = new Object();
	data.tk = homesGlobal.tk;
	data.bsg = homesGlobal.bsg;
	if (homesGlobal.oem) {
		data.oem = "oem";
	} else {
		data.oem = "";
	}
	
	var conditionhtml = getConditionHTML(data);
	if (conditionhtml != null) {
		conditionDiv.innerHTML = getConditionHTML(data);
	} else {
		errorPage();
	}
	// リストヘッダ項目
	homesGlobal.list.type = getListType(data);
}

/**
 * 地図移動イベントハンドラ
 *
 * @param
 * @return
 */
function mapMoveHandler(flag) {
	
	if(homesGlobal.map == null) {
		return;
	}

	if (homesGlobal.infowindow.nosearch) {
		homesGlobal.infowindow.nosearch = false;
		return;
	}
	
	if (homesGlobal.SearchTimer.tid != null) {
		clearTimeout(homesGlobal.SearchTimer.tid);
		homesGlobal.SearchTimer.tid = null;
	}
	
	homesutil.markImage(false);

	homesGlobal.list.page = 1;

	homesGlobal.SearchTimer.tid = setTimeout(function(){
		homesGlobal.search.Sokodoko.request();
		
		if (homesGlobal.position != null) {
			var newpos = homesGlobal.map.r2p(homesGlobal.map.getCenterLatLng());
			var prepos = homesGlobal.map.r2p(homesGlobal.position);
			var posx = Math.abs(newpos.x - prepos.x);
			var posy = Math.abs(newpos.y - prepos.y);
			var movepx = homesGlobal.movepx[homesGlobal.map.getZoomLevel()];
		}
		
		if (homesGlobal.position == null || posx > movepx || posy > movepx || flag == true) {
			homesutil.searchImage(true);
			if (homesGlobal.oemid == null || homesGlobal.oemid < 100) {
				setCookie();
			}
			Search();
			homesGlobal.position = homesGlobal.map.getCenterLatLng();
			homesGlobal.bounds = homesGlobal.map.getBoundsLatLng();
		}
	}, homesGlobal.SearchTimer.time);
	

}

/**
 * 縮尺変更イベントハンドラ
 *
 * @param
 * @return
 */
function mapZoomHandler() {
	
	if (homesGlobal.SearchTimer.tid != null) {
		clearTimeout(homesGlobal.SearchTimer.tid);
		homesGlobal.SearchTimer.tid = null;
	}
	
	homesutil.markImage(false);
	
	homesGlobal.infowindow.close(homesGlobal.infowindow);
	
	homesGlobal.list.page = 1;
	
	homesutil.removePoi(homesGlobal.map, homesGlobal.landmarkpoi);
	homesGlobal.landmarkpoi = new Array();
	homesutil.removePoi(homesGlobal.map, homesGlobal.bukkenpoi);
	homesGlobal.bukkenpoi = new Array();
	homesutil.removePoi(homesGlobal.map, homesGlobal.realtorpoi);
	homesGlobal.realtorpoi = new Array();

	homesGlobal.SearchTimer.tid = setTimeout(function(){
		homesutil.searchImage(true);
		if (homesGlobal.oemid == null || homesGlobal.oemid < 100) {
			setCookie();
		}
		Search();
		homesGlobal.bounds = homesGlobal.map.getBoundsLatLng();
	}, homesGlobal.SearchTimer.time);
}

/**
 * 条件指定POI検索処理
 *
 * @param
 * @return
 */
function ConditionSearch() {
	if(homesGlobal.map == null) {
		return;
	}
	
	if (homesGlobal.infowindow.nosearch) {
		homesGlobal.infowindow.nosearch = false;
		return;
	}
	
	if (homesGlobal.SearchTimer.tid != null) {
		clearTimeout(homesGlobal.SearchTimer.tid);
		homesGlobal.SearchTimer.tid = null;
	}

	homesGlobal.list.page = 1;

	homesGlobal.SearchTimer.tid = setTimeout(function(){
		
		homesutil.searchImage(true);
		Search();
		homesGlobal.position = homesGlobal.map.getCenterLatLng();

	}, homesGlobal.SearchTimer.time);
}

/**
 * こだわり条件文字部分のクリック
 *
 * @param
 * @return
 */
function CheckClick(ckid) {
	var ck = document.getElementById(ckid);
	if (ck.checked) {
		ck.checked = false;
	} else {
		ck.checked = true;
	}
}

/**
 * POI検索処理
 *
 * @param
 * @return
 */
function Search() {
	homesGlobal.SearchTimer.tid = null;
	var paramBukkenLandmark = new Object();
	var paramBukkenMaps2 = new Object();
	var paramRealtorMaps2 = new Object();

	paramBukkenLandmark.genre1_code = homesGlobal.landmarkgenre;
	paramBukkenMaps2 = setSearchCondition();
	paramRealtorMaps2.collections = homesGlobal.tkname;
	paramBukkenMaps2.lllv = homesGlobal.confms[homesGlobal.zoomlevel];
	paramRealtorMaps2.lllv = homesGlobal.confms[homesGlobal.zoomlevel];
	paramBukkenMaps2.sortby = "location";
	paramRealtorMaps2.sortby = "location";
	paramBukkenMaps2.with_ids = "1";
	homesGlobal.maxcount = homesGlobal.defaultmaxcount;
	paramBukkenMaps2.hits = homesGlobal.maxcount;
	paramRealtorMaps2.hits = homesGlobal.maxcount;

	homesGlobal.SearchTimeout = new Object();
	if (homesGlobal.landmarkgenre != null && homesGlobal.landmarkgenre != "") {
		homesGlobal.search.Landmark.request(paramBukkenLandmark);
	}
	homesGlobal.search.BukkenMaps2.request(paramBukkenMaps2);
	homesGlobal.search.RealtorMaps2.request(paramRealtorMaps2);
	
	if (homesGlobal.SearchTimeout.master != null) {
		clearTimeout(homesGlobal.SearchTimeout.master);
	}
	//homesGlobal.SearchTimeout.master = setTimeout(function(){homesutil.searchImage(false);}, 10000);
}

/**
 * リスト検索処理
 *
 * @param
 * @return
 */
function SearchAPIBukkenSearch() {
	homesutil.searchImage(true);
	var param = new Object();
	param = setSearchCondition();
	param.hits = homesGlobal.list.pagecount;
	param.page = homesGlobal.list.page;
	if (homesGlobal.sortby != null) {
		param.sortby = homesGlobal.sortby;
	}
	homesGlobal.search.BukkenSearch.request(param);
}

function SearchAPIBukkenBalloon(sortby) {
	homesutil.searchImage(true);
	var param = new Object();
	param = setSearchCondition();
	param.collections = homesGlobal.tkname;
	if (homesGlobal.list.pagecount * homesGlobal.list.page > homesGlobal.maxcount) {
		param.offset = (homesGlobal.list.page - 1) * homesGlobal.list.pagecount;
		param.hits = homesGlobal.maxcount % homesGlobal.list.pagecount;
	} else {
		param.page = homesGlobal.list.page;
		param.hits = homesGlobal.list.pagecount;
	}
	param.geofb = homesGlobal.bukkengeofb;
	param.flgadjust = "1";
	if (homesGlobal.sortby != null) {
		param.sortby = homesGlobal.sortby;
	}
	homesGlobal.search.BukkenMapBalloon.request(param);
}


/**
 * 物件検索の条件設定
 *
 * @param
 * @return
 */
function setSearchCondition() {
	var searchcondition = new Object();
	
	// BSale or BRent
	searchcondition.collections = homesGlobal.tkname;
	
	// 物件種別
	if (homesGlobal.ConditionForm.bs) {
		var bsstring = "";
		if (typeof(homesGlobal.ConditionForm.bs.value) != "undefined") {
			bsstring = (homesGlobal.tk) * 1000 + parseInt(homesGlobal.ConditionForm.bs.value);
		} else {
			var bscheckedstring = "";
			var bschecked = false;
			for (var i = 0; i < homesGlobal.ConditionForm.bs.length; i++) {
				if (homesGlobal.ConditionForm.bs[i].checked) {
					bschecked = true;
					bsstring += (parseInt(homesGlobal.tk) * 1000 + parseInt(homesGlobal.ConditionForm.bs[i].value)) + ",";
				}
			}
			if(bschecked == false) {
				for (var i = 0; i < homesGlobal.ConditionForm.bs.length; i++) {
					bsstring += (parseInt(homesGlobal.tk) * 1000 + parseInt(homesGlobal.ConditionForm.bs[i].value)) + ",";
				}
			}
			bsstring += "";
			bsstring = bsstring.substr(0, bsstring.length - 1);
		}
		searchcondition.btg = bsstring;
	}
		
	// 賃料・価格
	if (homesGlobal.ConditionForm.kanri && homesGlobal.ConditionForm.kanri.checked) {
		if (homesGlobal.ConditionForm.sale1.value != "") {
			searchcondition.moneycombo = homesGlobal.ConditionForm.sale1.value;
		}
		if (homesGlobal.ConditionForm.sale2.value != "") {
			searchcondition.moneycomboh = homesGlobal.ConditionForm.sale2.value;
		}
	} else {
		if (homesGlobal.ConditionForm.sale1.value != "") {
			if (homesGlobal.tk == "1") {
				searchcondition.moneyroom = homesGlobal.ConditionForm.sale1.value;
			}
			if (homesGlobal.tk == "3") {
				searchcondition.monthmoneyroom = homesGlobal.ConditionForm.sale1.value;
			}
		}
		if (homesGlobal.ConditionForm.sale2.value != "") {
			if (homesGlobal.tk == "1") {
				searchcondition.moneyroomh = homesGlobal.ConditionForm.sale2.value;
			}
			if (homesGlobal.tk == "3") {
				searchcondition.monthmoneyroomh = homesGlobal.ConditionForm.sale2.value;
			}
		}
	}
	
	// 面積
	if (homesGlobal.ConditionForm.area1) {
		if (homesGlobal.ConditionForm.area1.value != "") {
			if (homesGlobal.bsg == "2") {
				searchcondition.landarea = homesGlobal.ConditionForm.area1.value;
			} else {
				searchcondition.housearea = homesGlobal.ConditionForm.area1.value;
			}
		}
	}
	if (homesGlobal.ConditionForm.area2) {
		if (homesGlobal.ConditionForm.area2.value != "") {
			if (homesGlobal.bsg == "2") {
				searchcondition.landareah = homesGlobal.ConditionForm.area2.value;
			} else {
				searchcondition.houseareah = homesGlobal.ConditionForm.area2.value;
			}
		}
	}
	
	// 間取り
	if (homesGlobal.ConditionForm.madori) {
		var madoristring = "";
		for (var i = 0; i < homesGlobal.ConditionForm.madori.length; i++) {
			if (homesGlobal.ConditionForm.madori[i].checked) {
				madoristring += homesGlobal.ConditionForm.madori[i].value + ",";
			}
		}
		madoristring += "";
		if (madoristring.length != 0) {
			madoristring = madoristring.substr(0, madoristring.length - 1);
		}
		searchcondition.madori = madoristring;
	}
	
	// こだわり条件
	if (homesGlobal.ConditionForm.ccf) {
		var ccfstring = "";
		for (var i = 0; i < homesGlobal.ConditionForm.ccf.length; i++) {
			if (homesGlobal.ConditionForm.ccf[i].checked) {
				if (homesGlobal.ConditionForm.ccf[i].value == "A") {
					searchcondition.pictmadori = "1";
				} else if (homesGlobal.ConditionForm.ccf[i].value == "B") {
					searchcondition.pictmisc = "1";
				} else if (homesGlobal.ConditionForm.ccf[i].value == "C") {
					
				} else {
					ccfstring += homesGlobal.ConditionForm.ccf[i].value + ",";
				}
			}
		}
		ccfstring += "";
		if (ccfstring.length != 0) {
			ccfstring = ccfstring.substr(0, ccfstring.length - 1);
		}
		searchcondition.ccf = ccfstring;
	}
	
	return searchcondition;
}

/**
 * リストの表示項目の追加
 *
 * @param
 * @return
 */
function addListValue(row) {
	var parkingkubun = ["","空有","空無","近隣","無","有"];
	for(var i = 0; i < row.length; i++) {
		row[i].col1_1m2 = false;
		row[i].col1_2m2 = false;
		row[i].col2_1m2 = false;
		row[i].col2_2m2 = false;
		row[i].col3_1m2 = false;
		row[i].col3_2m2 = false;
		row[i].col4_1m2 = false;
		row[i].col4_2m2 = false;
		row[i].col4_3m2 = false;
		if (homesGlobal.list.type == "LIST1-1") {
			if (row[i].MADORITEXT != null) {
				row[i].col1_1 = "<span>" + row[i].MADORITEXT + "</span>";
			} else {
				row[i].col1_1 = "-";
			}
			row[i].col1_2 = "";
			if (row[i].HOUSEAREA != null) {
				row[i].col2_1 = "<strong>" + row[i].HOUSEAREA + "</strong>";
				row[i].col2_1m2 = true;
			} else {
				row[i].col2_1 = "-";
			}
			row[i].col2_2 = "";
			if (row[i].HOUSEAGE == null) {
				row[i].col3_1 = "-";
			} else if (row[i].HOUSEAGE == 0) {
				row[i].col3_1 = "<span>" + "新築" + "</span>";
			} else {
				row[i].col3_1 = "<span>" + row[i].HOUSEAGE + "年" + "</span>";
			}
			if (row[i].WINDOWANGLE != null && row[i].WINDOWANGLE != "&nbsp;") {
				row[i].col3_2 = "<span>" + homesGlobal.list.angle[row[i].WINDOWANGLE] + "</span>";
			} else {
				row[i].col3_2 = "-";
			}
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col4_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col4_1 = "-";
			}
			row[i].col4_2 = "-";
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST1-2") {
			if (row[i].LANDKENPEI != null) {
				row[i].col1_1 = "<span>" + row[i].LANDKENPEI + "％" + "</span>";
			} else {
				row[i].col1_1 = "-";
			}
			if (row[i].LANDYOUSEKI != null) {
				row[i].col1_2 = "<span>" + row[i].LANDYOUSEKI + "％" + "</span>";
			} else {
				row[i].col1_2 = "-";
			}
			if (row[i].LANDAREA != null) {
				row[i].col2_1 = "<strong>" + row[i].LANDAREA + "</strong>";
				row[i].col2_1m2 = true;
			} else {
				row[i].col2_1 = "-";
			}
			row[i].col2_2 = "" ;
			if (row[i].LANDRIGHTNAME != null) {
				row[i].col3_1 = "<span>" + row[i].LANDRIGHTNAME + "</span>";
			} else {
				row[i].col3_1 = "-";
			}
			row[i].col3_2 = "";
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col4_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col4_1 = "-";
			}
			if (row[i].MONEYTSUBO != null) {
				row[i].col4_2 = "<span>" + homesutil.addDelimiterCeil(row[i].MONEYTSUBO) + "万円" + "</span>";
			} else {
				row[i].col4_2 = "-";
			}
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST1-3") {
			if (row[i].ADDR2NAME != null) {
				row[i].col1_1 = "<span>" + row[i].ADDR2NAME + "</span>";
			} else {
				row[i].col1_1 = "-";
			}
			row[i].col1_2 = "";
			if (row[i].HOUSEAGE == null) {
				row[i].col2_1 = "-";
			} else if (row[i].HOUSEAGE == 0) {
				row[i].col2_1 = "<span>" + "新築" + "</span>";
			} else {
				row[i].col2_1 = "<span>" + row[i].HOUSEAGE + "年" + "</span>";
			}
			row[i].col2_2 = "" ;
			if (row[i].HOUSEAREA != null) {
				row[i].col3_1 = "<strong>" + row[i].HOUSEAREA + "</strong>";
				row[i].col3_1m2 = true;
			} else {
				row[i].col3_1 = "-";
			}
			if (row[i].ROOMKAISUU != null) {
				row[i].col3_2 = "<span>" + row[i].ROOMKAISUU + "</span>";
			} else {
				row[i].col3_2 = "-";
			}
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col4_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col4_1 = "-";
			}
			if (row[i].MONEYKYOUEKI != null) {
				row[i].col4_2 = "<span>" + homesutil.addDelimiter(row[i].MONEYKYOUEKI) + "円" + "</span>";
			} else {
				row[i].col4_2 = "-";
			}
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST1-4") {
			if (row[i].MADORITEXT != null) {
				row[i].col1_1 = "<span>" + row[i].MADORITEXT + "</span>";
			} else {
				row[i].col1_1 = "-";
			}
			if (row[i].ALLNUMBER != null) {
				row[i].col1_2 = "<span>" + row[i].ALLNUMBER + "戸" + "</span>";
			} else {
				row[i].col1_2 = "-";
			}
			if (row[i].HOUSEAREA != null) {
				row[i].col2_1 = "<strong>" + row[i].HOUSEAREA + "</strong>";
				row[i].col2_1m2 = true;
			} else {
				row[i].col2_1 = "-";
			}
			if (row[i].BALCONYAREA != null) {
				row[i].col2_2 = "<strong>" + row[i].BALCONYAREA + "</strong>";
				row[i].col2_2m2 = true;
			} else {
				row[i].col2_2 = "-";
			}
			if (row[i].HOUSEAGE == null) {
				row[i].col3_1 = "-";
			} else if (row[i].HOUSEAGE == 0) {
				row[i].col3_1 = "<span>" + "新築" + "</span>";
			} else {
				row[i].col3_1 = "<span>" + row[i].HOUSEAGE + "年" + "</span>";
			}
			if (row[i].WINDOWANGLE != null && row[i].WINDOWANGLE != "&nbsp;") {
				row[i].col3_2 = "<span>" + homesGlobal.list.angle[row[i].WINDOWANGLE] + "</span>";
			} else {
				row[i].col3_2 = "-";
			}
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col4_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col4_1 = "-";
			}
			row[i].col4_2 = "";
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST1-5") {
			if (row[i].MADORITEXT != null) {
				row[i].col1_1 = "<span>" + row[i].MADORITEXT + "</span>";
			} else {
				row[i].col1_1 = "-";
			}
			if (row[i].HOUSEKAISUU != null) {
				row[i].col1_2 = "<span>" + row[i].HOUSEKAISUU + "</span>";
			} else {
				row[i].col1_2 = "-";
			}
			if (row[i].HOUSEAREA != null) {
				row[i].col2_1 = "<strong>" + row[i].HOUSEAREA + "</strong>";
				row[i].col2_1m2 = true;
			} else {
				row[i].col2_1 = "-";
			}
			if (row[i].LANDAREA != null) {
				row[i].col2_2 = "<strong>" + row[i].LANDAREA + "</strong>";
				row[i].col2_2m2 = true;
			} else {
				row[i].col2_2 = "-";
			}
			if (row[i].HOUSEAGE == null) {
				row[i].col3_1 = "-";
			} else if (row[i].HOUSEAGE == 0) {
				row[i].col3_1 = "<span>" + "新築" + "</span>";
			} else {
				row[i].col3_1 = "<span>" + row[i].HOUSEAGE + "年" + "</span>";
			}
			if (row[i].WINDOWANGLE != null && row[i].WINDOWANGLE != "&nbsp;") {
				row[i].col3_2 = "<span>" + homesGlobal.list.angle[row[i].WINDOWANGLE] + "</span>";
			} else {
				row[i].col3_2 = "-";
			}
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col4_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col4_1 = "-";
			}
			row[i].col4_2 = "";
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST1-6") {
			if (row[i].HOUSEAREA != null) {
				row[i].col1_1 = "<strong>" + row[i].HOUSEAREA + "</strong>";
				row[i].col1_1m2 = true;
			} else {
				row[i].col1_1 = "-";
			}
			if (row[i].LANDAREA != null) {
				row[i].col1_2 = "<strong>" + row[i].LANDAREA + "</strong>";
				row[i].col1_2m2 = true;
			} else {
				row[i].col1_2 = "-";
			}
			if (row[i].MONEYRIMAWARI != null) {
				row[i].col2_1 = "<span>" + row[i].MONEYRIMAWARI + "％" + "</span>";
			} else {
				row[i].col2_1 = "-";
			}
			row[i].col2_2 = "";
			if (row[i].ROOMKAISUU != null) {
				row[i].col3_1 = "<span>" + row[i].ROOMKAISUU + "</span>";
			} else {
				row[i].col3_1 = "-";
			}
			row[i].col3_2 = "";
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col4_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col4_1 = "-";
			}
			row[i].col4_2 = "";
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST1-7") {
			row[i].col1_1 = "<span>" + row[i].ADDR2NAME + "</span>";
			row[i].col1_2 = "-";
			if (row[i].HOUSEAGE == null) {
				row[i].col3_1 = "-";
			} else if (row[i].HOUSEAGE == 0) {
				row[i].col2_1 = "<span>" + "新築" + "</span>";
			} else {
				row[i].col2_1 = "<span>" + row[i].HOUSEAGE + "年" + "</span>";
			}
			row[i].col2_2 = "" ;
			if (row[i].LANDAREA != null) {
				row[i].col3_1 = "<strong>" + row[i].LANDAREA + "</strong>";
				row[i].col3_1m2 = true;
			} else {
				row[i].col3_1 = "-";
			}
			row[i].col3_2 = "";
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col4_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col4_1 = "-";
			}
			if (row[i].MONEYKYOUEKI != null) {
				row[i].col4_2 = "<span>" + homesutil.addDelimiter(row[i].MONEYKYOUEKI) + "円" + "</span>";
			} else {
				row[i].col4_2 = "-";
			}
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST3-1") {
			if (row[i].HOUSEAREA != null) {
				row[i].col1_1 = "<strong>" + row[i].HOUSEAREA + "</strong>";
				row[i].col1_1m2 = true;
			} else {
				row[i].col1_1 = "-";
			}
			if (row[i].MADORITEXT != null) {
				row[i].col1_2 = "<span>" + row[i].MADORITEXT + "</span>";
			} else {
				row[i].col1_2 = "-";
			}
			if (row[i].HOUSEAGE == null) {
				row[i].col3_1 = "-";
			} else if (row[i].HOUSEAGE == 0) {
				row[i].col2_1 = "<span>" + "新築" + "</span>";
			} else {
				row[i].col2_1 = "<span>" + row[i].HOUSEAGE + "年" + "</span>";
			}
			if (row[i].WINDOWANGLE != null && row[i].WINDOWANGLE != "&nbsp;") {
				row[i].col2_2 = "<span>" + homesGlobal.list.angle[row[i].WINDOWANGLE] + "</span>";
			} else {
				row[i].col2_2 = "-";
			}
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col3_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col3_1 = "-";
			}
			if (row[i].MONEYKYOUEKI != null) {
				row[i].col3_2 = "<span>" + homesutil.addDelimiter(row[i].MONEYKYOUEKI) + "円" + "</span>";
			} else {
				row[i].col3_2 = "-";
			}
			if (row[i].MONEYSHIKIKINTEXT != null) {
				row[i].col4_1 = "<span>" + row[i].MONEYSHIKIKINTEXT + "</span>";
			} else {
				row[i].col4_1 = "-";
			}
			if (row[i].MONEYREIKINTEXT != null) {
				row[i].col4_2 = "<span>" + row[i].MONEYREIKINTEXT  + "</span>";
			} else {
				row[i].col4_2 = "-";
			}
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST3-2") {
			if (row[i].LANDAREA != null) {
				row[i].col1_1 = "<strong>" + row[i].LANDAREA + "</strong>";
				row[i].col1_1m2 = true;
			} else {
				row[i].col1_1 = "-";
			}
			row[i].col1_2 = "";
			if (row[i].LANDKENPEI != null) {
				row[i].col2_1 = "<span>" + row[i].LANDKENPEI + "％" + "</span>";
			} else {
				row[i].col2_1 = "-";
			}
			if (row[i].LANDYOUSEKI != null) {
				row[i].col2_2 = "<span>" + row[i].LANDYOUSEKI + "％" + "</span>";
			} else {
				row[i].col2_2 = "-";
			}
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col3_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col3_1 = "-";
			}
			if (row[i].MONTHMONEYTSUBO != null) {
				row[i].col3_2 = "<span>" + homesutil.addDelimiterCeil(row[i].MONTHMONEYTSUBO) + "万円" + "</span>";
			} else {
				row[i].col3_2 = "-";
			}
			if (row[i].MONEYSHIKIKINTEXT != null) {
				row[i].col4_1 = "<span>" + row[i].MONEYSHIKIKINTEXT  + "</span>";
			} else {
				row[i].col4_1 = "-";
			}
			if (row[i].MONEYREIKINTEXT != null) {
				row[i].col4_2 = "<span>" + row[i].MONEYREIKINTEXT  + "</span>";
			} else {
				row[i].col4_2 = "-";
			}
			row[i].col4_3 = "";
		}
		if (homesGlobal.list.type == "LIST3-3") {
			if (row[i].HOUSEAREA != null) {
				row[i].col1_1 = "<strong>" + row[i].HOUSEAREA + "</strong>";
				row[i].col1_1m2 = true;
			} else {
				row[i].col1_1 = "-";
			}
			row[i].col1_2 = "";
			if (row[i].HOUSEAGE == null) {
				row[i].col3_1 = "-";
			} else if (row[i].HOUSEAGE == 0) {
				row[i].col2_1 = "<span>" + "新築" + "</span>";
			} else {
				row[i].col2_1 = "<span>" + row[i].HOUSEAGE + "年" + "</span>";
			}
			if (typeof(parkingkubun[row[i].PARKINGKUBUN]) != "undefined") {
				row[i].col2_2 = "<span>" + parkingkubun[row[i].PARKINGKUBUN] + "</span>";
			} else {
				row[i].col2_2 = "-";
			}
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col3_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col3_1 = "-";
			}
			if (row[i].MONTHMONEYTSUBO != null) {
				row[i].col3_2 = "<span>" + homesutil.addDelimiterCeil(row[i].MONTHMONEYTSUBO) + "万円" + "</span>";
			} else {
				row[i].col3_2 = "-";
			}
			if (row[i].MONEYKYOUEKI != null) {
				row[i].col4_1 = "<span>" + homesutil.addDelimiter(row[i].MONEYKYOUEKI) + "円" + "</span>";
			} else {
				row[i].col4_1 = "-";
			}
			if (row[i].MONEYSHIKIKINTEXT != null) {
				row[i].col4_2 = "<span>" + row[i].MONEYSHIKIKINTEXT  + "</span>";
			} else {
				row[i].col4_2 = "-";
			}
			if (row[i].MONEYREIKINTEXT != null) {
				row[i].col4_3 = "<span>" + row[i].MONEYREIKINTEXT  + "</span>";
			} else {
				row[i].col4_3 = "-";
			}
		}
		if (homesGlobal.list.type == "LIST3-4") {
			if (row[i].ADDR2NAME != null) {
				row[i].col1_1 = "<span>" + row[i].ADDR2NAME + "</span>";
			} else {
				row[i].col1_1 = "-";
			}
			row[i].col1_2 = "";
			if (row[i].MONEYROOMTEXT != null) {
				row[i].col2_1 = "<strong>" + row[i].MONEYROOMTEXT + "</strong>";
			} else {
				row[i].col2_1 = "-";
			}
			if (row[i].MONTHMONEYTSUBO != null) {
				row[i].col2_2 = "<span>" + homesutil.addDelimiterCeil(row[i].MONTHMONEYTSUBO) + "万円" + "</span>";
			} else {
				row[i].col2_2 = "-";
			}
			if (row[i].MONEYSHIKIKINTEXT != null) {
				row[i].col3_1 = "<span>" + row[i].MONEYSHIKIKINTEXT  + "</span>";
			} else {
				row[i].col3_1 = "-";
			}
			if (row[i].MONEYREIKINTEXT != null) {
				row[i].col3_2 = "<span>" + row[i].MONEYREIKINTEXT  + "</span>";
			} else {
				row[i].col3_2 = "-";
			}
			row[i].col4_1 = "";
			row[i].col4_2 = "";
			row[i].col4_3 = "";
		}
	}
	return row;
}


/**
 * ウィンドウクローズイベントハンドラ
 *
 * @param
 * @return
 */
function CloseInfoWindow(e) {
	if (homesEvent.noevent.type == "bukken") {
		homesEvent.noevent.poi.div.style.zIndex = homesGlobal.zindex.bukken;
		homesGlobal.list.page = 1;
		homesGlobal.maxcount = homesGlobal.defaultmaxcount;
		setTimeout(function(){
			SearchAPIBukkenSearch();
		}, homesGlobal.SearchTimer.time);
	}
	if (homesEvent.noevent.type == "landmark") {
		homesEvent.noevent.poi.div.style.zIndex = homesGlobal.zindex.landmark;
	}
	if (homesEvent.noevent.type == "realtor") {
		homesEvent.noevent.poi.div.style.zIndex = homesGlobal.zindex.realtor;
	}
	homesutil.markImage(false);
	homesEvent.noevent.poi = null;
	homesEvent.noevent.type = null;
}

/**
 * ウィンドウオープンイベントハンドラ
 *
 * @param
 * @return
 */
function OpenInfoWindow(e) {
}

/**
 * Sokodoko検索イベントハンドラ
 *
 * @param
 * @return
 */
function CallbackSokodoko(e) {
	if (homesGlobal.SearchTimeout[e.target.json.scriptId]) {
		return;
	}
	if (typeof(e.target.data.mbml.PoiList) == "undefined") return;
	homesGlobal.sokodoko.setSokodoko(e.target.data.mbml.PoiList.Poi);
}
function OnerrorSokodoko(e) {
	var template = new templateWindow("marketPriceAreaRent");
	var html = template.getHTML({"error":"家賃相場データはありません"});
	homesGlobal.MarketPriceAreaRent.setHTML(html);
	homesGlobal.SearchTimeout[e.target.json.scriptId] = true;
}

/**
 * Landmark検索イベントハンドラ
 *
 * @param
 * @return
 */
function CallbackLandmark(e) {
	if (homesGlobal.SearchTimeout[e.target.json.scriptId]) {
		return;
	}
	if (e.target.json.scriptId != homesGlobal.search.Landmark.json.scriptId) {
		return;
	}
	if (typeof(e.target.data.mbml.PoiList) == "undefined") return;
	var row = e.target.data.mbml.PoiList.Poi;

	if (typeof(row) != "undefined" && !row.length) {
		row = new Array();
		row.push(e.target.data.mbml.PoiList.Poi);
	}
	
	homesutil.removePoi(homesGlobal.map, homesGlobal.landmarkpoi);
	homesGlobal.landmarkpoi = new Array();
	
	var template = new templateIcon("icon", "Landmark");
	var openwindow = false;
	
	if (row) {
		homesGlobal.landmarkpoi = new Array();
		
		for (var i = row.length - 1; i >= 0; i--) {
			var icon = new MIcon();
			var html = template.getHTML(row[i]);
			icon.getHTML = function() {
				return html;
			}
			icon.width = 18;
			icon.height = 18;
			icon.offsetX = 9;
			icon.offsetY = 9;
			var pos = new MPoint(row[i].longitude, row[i].latitude);
	  		var marker = new MMarker( pos, icon, false );
	  		marker.div.style.zIndex = homesGlobal.zindex.landmark;
	  		marker.name = row[i].name;
			homesEvent.landmark.addEvent( marker );
	  		homesGlobal.landmarkpoi.push( marker );
			homesGlobal.map.addOverlay( marker );
			if (homesGlobal.infowindow.opentype == "landmark" && homesGlobal.infowindow.openrpos.x == pos.x && homesGlobal.infowindow.openrpos.y == pos.y) {
				openwindow = true;
			}
		}
	}
	
	if (!openwindow) {
		if (homesGlobal.infowindow.opentype == null || homesGlobal.infowindow.opentype == "landmark") {
			homesGlobal.infowindow.close(homesGlobal.infowindow);
		}
	}
	
}
function OnerrorLandmark(e) {
	homesGlobal.SearchTimeout[e.target.json.scriptId] = true;
}

/**
 * Bukken/Search検索イベントハンドラ
 *
 * @param
 * @return
 */
function CallbackBukkenSearch(e) {
	if (homesGlobal.SearchTimeout[e.target.json.scriptId]) {
		return;
	}
	if (e.target.json.scriptId != homesGlobal.search.BukkenSearch.json.scriptId) {
		return;
	}
	if (typeof(e.target.data.RESULTSET) == "undefined") return;
	if (typeof(e.target.data.ROWSET) == "undefined") return;
	if (e.target.data.RESULTSET.TOTALHITS > homesGlobal.maxcount) e.target.data.RESULTSET.TOTALHITS = homesGlobal.maxcount;
	homesGlobal.list.count.setMaxCount(e.target.data.RESULTSET.TOTALHITS);
	homesGlobal.list.count.setFirstCount(e.target.data.RESULTSET.FIRSTHIT);
	homesGlobal.list.count.setLastCount(e.target.data.RESULTSET.LASTHIT);

	var row = e.target.data.ROWSET;
	row.listtype = homesGlobal.list.type;
	row = addListValue(row);
	var ListHTML = getListHtml(row, homesGlobal.list.type);
	homesGlobal.list.div.innerHTML = ListHTML;
	homesutil.searchImage(false);
	homesGlobal.SearchMode = "all";
	listTitleAll();
	setPager();
}
function OnerrorBukkenSearch(e) {
	homesGlobal.SearchTimeout[e.target.json.scriptId] = true;
}

/**
 * Bukken/MapBalloon検索イベントハンドラ
 *
 * @param
 * @return
 */
function CallbackBukkenMapBalloon(e) {
	if (homesGlobal.SearchTimeout[e.target.json.scriptId]) {
		return;
	}
	if (e.target.json.scriptId != homesGlobal.search.BukkenMapBalloon.json.scriptId) {
		return;
	}
	if (typeof(e.target.data.ROWSET) == "undefined") return;
	var row = e.target.data.ROWSET;
	homesGlobal.SearchMode = "select";
	listTitleSelect();
	
	// リスト
	row.listtype = homesGlobal.list.type;
	row = addListValue(row);
	var ListHTML = getListHtml(row, homesGlobal.list.type);
	homesGlobal.list.div.innerHTML = ListHTML;
	homesutil.searchImage(false);

	if (e.target.data.RESULTSET.TOTALHITS > homesGlobal.maxcount) e.target.data.RESULTSET.TOTALHITS = homesGlobal.maxcount;
	homesGlobal.list.count.setMaxCount(e.target.data.RESULTSET.TOTALHITS);
	homesGlobal.list.count.setFirstCount(e.target.data.RESULTSET.FIRSTHIT);
	homesGlobal.list.count.setLastCount(e.target.data.RESULTSET.LASTHIT);

	//ウィンドウ
	var template = new templateWindow("windowBukken");
	var windowdiv = document.createElement("DIV");
	var data = new Object;
	if (typeof(row[0]) == "undefined") return;
	row[0].pos = new MPoint();
	data = row[0];
	data.gyo = homesGlobal.gyo;
	data.color = homesGlobal.color;
	if (homesGlobal.tk == 1) {
		data.text = "売買";
	} else {
		data.text = "賃貸";
	}
	var bustime = "";
	var walktime = "";
	var wtime = "";
	data.timetext = "";
	if (data.BUSSTOP1 != null && data.BUSSTOP1 != "") {
		if (data.BUSTIME1 != null && data.BUSTIME1 != "" && data.WALKDISTANCE1 != null && data.WALKDISTANCE1 != "") {
			bustime = data.BUSTIME1;
			walktime = Math.ceil(data.WALKDISTANCE1 / 80);
			data.timetext = "バス" + bustime + "分、徒歩" + walktime + "分";
		} else {
			if (data.W1 != null && data.W1 != "") {
				data.timetext = "所要時間" + data.W1 + "分";
			}
		}
	} else {
		if (data.W1 != null && data.W1 != "") {
			data.timetext = "徒歩" + data.W1 + "分";
		}
	}
	data.route = homesGlobal.route;
	if (homesGlobal.bukkenpos != null) {
		homesGlobal.infowindow.setHTML(template.getHTML(data));
		homesGlobal.infowindow.show(homesGlobal.bukkenpos, 24, -20, "bukken");
		homesGlobal.bukkenpos = null;
	}
	setPager();
}
function OnerrorBukkenMapBalloon(e) {
	if (e.target.json.scriptId != homesGlobal.search.BukkenMapBalloon.json.scriptId) {
		homesutil.searchImage(false);
	}
	homesGlobal.SearchTimeout[e.target.json.scriptId] = true;
}

/**
 * Bukken/Maps2検索イベントハンドラ
 *
 * @param
 * @return
 */
function CallbackBukkenMaps2(e) {
	if (e.target.json.scriptId != homesGlobal.search.BukkenMaps2.json.scriptId) {
		return;
	}
	if (homesGlobal.SearchTimeout[e.target.json.scriptId]) {
		return;
	}
	if (typeof(e.target.data.ROWSET) == "undefined") return;
	var row = e.target.data.ROWSET;
	
	homesutil.removePoi(homesGlobal.map, homesGlobal.bukkenpoi);
	homesGlobal.bukkenpoi = new Array();
	homesGlobal.bukkenidlist = new Object();
	
	var template = new templateIcon("icon", "Bukken");
	var openwindow = false;

	for (var i = row.length - 1; i >= 0; i--) {
		var pos = new MPoint(row[i].LON, row[i].LAT);
		if (homesGlobal.infowindow.opentype == "bukken" && homesGlobal.infowindow.openrpos.x == pos.x && homesGlobal.infowindow.openrpos.y == pos.y) {
			openwindow = true;
		}
	}	
	if (!openwindow) {
		if (homesGlobal.infowindow.opentype == null || homesGlobal.infowindow.opentype == "bukken") {
			SearchAPIBukkenSearch();
		}
	}
	var iconhtml = template.getHTML(new Object());
	for (var i = row.length - 1; i >= 0; i--) {
		var icon = new MIcon();
//		var html = template.getHTML(row[i]);
		var html = iconhtml.replace("#COUNT#", row[i].COUNT);
		icon.getHTML = function() {
			return html;
		}
		icon.offsetX = 20;
		if (row[i].COUNT < 10) {
			icon.offsetX = 16;
		}
		if (row[i].COUNT >= 100) {
			icon.offsetX = 24;
		}
		icon.offsetY = 13;
  		
 		var pos = new MPoint(row[i].LON, row[i].LAT);
  		var marker = new MMarker( pos, icon, false );
  		marker.homesrange = row[i].RANGE;
  		marker.count = row[i].COUNT;
  		marker.div.style.zIndex = homesGlobal.zindex.bukken;
		homesEvent.bukken.addEvent( marker );
		homesGlobal.bukkenpoi.push( marker );
		marker.div.style.width = "";
		if (MBrowser.opera) {
			marker.offsetDiv.style.width = "100px";
		}
		homesGlobal.map.addOverlay( marker );
		var idarray = row[i].ID.split(",");
		for (j = 0; j < idarray.length; j++) {
			homesGlobal.bukkenidlist[idarray[j]] = pos;
		}
	}
	homesGlobal.searchedit = false;
	if (!openwindow) {
		if (homesGlobal.infowindow.opentype == null || homesGlobal.infowindow.opentype == "bukken") {
			homesGlobal.infowindow.close(homesGlobal.infowindow);
		} else {
			homesutil.searchImage(false);
		}
	} else {
		if (homesGlobal.SearchMode == "select") {
			homesutil.searchImage(false);
		}
	}
	
}
function OnerrorBukkenMaps2(e) {
	if (e.target.json.scriptId != homesGlobal.search.BukkenMapBalloon.json.scriptId) {
		homesGlobal.SearchTimeout[e.target.json.scriptId] = true;
	}
	homesutil.searchImage(false);
}

/**
 * Realtor/Maps2検索イベントハンドラ
 *
 * @param
 * @return
 */
function CallbackRealtorMaps2(e) {
	if (e.target.json.scriptId != homesGlobal.search.RealtorMaps2.json.scriptId) {
		return;
	}
	if (homesGlobal.SearchTimeout[e.target.json.scriptId]) {
		return;
	}
	if (typeof(e.target.data.ROWSET) == "undefined") return;
	var row = e.target.data.ROWSET;
	
	homesutil.removePoi(homesGlobal.map, homesGlobal.realtorpoi);
	homesGlobal.realtorpoi = new Array();
	
	var template = new templateIcon("icon", "Realtor");
	var openwindow = false;
	
	for (var i = 0; i < row.length; i++) {
		var icon = new MIcon();
		var html = template.getHTML(row[i]);
		icon.getHTML = function() {
			return html;
		}
		icon.width = 27;
		icon.height = 22;
		icon.offsetX = 13;
		icon.offsetY = 11;
  		var pos = new MPoint(row[i].LON, row[i].LAT);
  		var marker = new MMarker( pos, icon, false );
  		marker.memberid = row[i].MEMBERID;
  		marker.div.style.zIndex = homesGlobal.zindex.realtor;
		homesEvent.realtor.addEvent( marker );
		homesGlobal.realtorpoi.push( marker );
		homesGlobal.map.addOverlay( marker );
		if (homesGlobal.infowindow.opentype == "realtor" && homesGlobal.infowindow.openrpos.x == pos.x && homesGlobal.infowindow.openrpos.y == pos.y) {
			openwindow = true;
		}
	}
	if (!openwindow) {
		if (homesGlobal.infowindow.opentype == null || homesGlobal.infowindow.opentype == "realtor") {
			homesGlobal.infowindow.close(homesGlobal.infowindow);
		}
	}
	
}
function OnerrorRealtorMaps2(e) {
	homesGlobal.SearchTimeout[e.target.json.scriptId] = true;
}


/**
 * Realtor/Detail検索イベントハンドラ
 *
 * @param
 * @return
 */
function CallbackRealtorDetail(e) {
	if (e.target.json.scriptId != homesGlobal.search.RealtorDetail.json.scriptId) {
		return;
	}
	if (homesGlobal.SearchTimeout[e.target.json.scriptId]) {
		return;
	}
	if (typeof(e.target.data) == "undefined") return;
	var row = new Array();
	var rowdata = e.target.data;
	for (var key in rowdata) {
		row.push(rowdata[key]);
	}
	homesutil.searchImage(false);

	var template = new templateWindow("windowRealtor");
	
	//ウィンドウ
	var windowdiv = document.createElement("DIV");
	var data = new Object;
	data = row;
	data.gyo = homesGlobal.gyo;
	if (homesGlobal.realtorpos != null) {
		homesGlobal.infowindow.setHTML(template.getHTML(data));
		homesGlobal.infowindow.show(homesGlobal.realtorpos, 24, -16, "realtor");
		homesGlobal.realtorpos = null;
	}
}
function OnerrorRealtorDetail(e) {
	if (e.target.json.scriptId != homesGlobal.search.BukkenMapBalloon.json.scriptId) {
		homesutil.searchImage(false);
	}
	homesGlobal.SearchTimeout[e.target.json.scriptId] = true;
}

/**
 * RegInfo/MarketPriceAreaRent検索イベントハンドラ
 *
 * @param
 * @return
 */
function CallbackRegInfoMarketPriceAreaRent(e) {
	if (homesGlobal.SearchTimeout[e.target.json.scriptId]) {
		return;
	}
	if (typeof(e.target.data) == "undefined") return;
	var responsedata = e.target.data[homesGlobal.MarketPriceAreaRent.admicodebackup];
	if (!responsedata) return;
	homesGlobal.MarketPriceAreaRent.list = new Array();
	for (var i = 0; i < responsedata.length; i++) {
		var row = responsedata[i];
		for (var key in row) {
			row[key].madori = homesGlobal.madoritext[row[key].ROOM_KIND];
			homesGlobal.MarketPriceAreaRent.list.push(row[key]);
		}
	}
	var template = new templateWindow("marketPriceAreaRent");
	var html = template.getHTML(homesGlobal.MarketPriceAreaRent);
	homesGlobal.MarketPriceAreaRent.setHTML(html);
}
function OnerrorRegInfoMarketPriceAreaRent(e) {
	var template = new templateWindow("marketPriceAreaRent");
	var html = template.getHTML({"error":"家賃相場データはありません"});
	homesGlobal.MarketPriceAreaRent.setHTML(html);
	homesGlobal.SearchTimeout[e.target.json.scriptId] = true;
}

/**
 * ランドマーク選択
 *
 * @param
 * @return
 */
function setLandmark(selectobject) {
	var paramBukkenLandmark = new Object();
	var selectLandmark = selectobject.options[selectobject.selectedIndex].value;

	if(homesGlobal.map == null) {
		return;
	}
	
	if (selectLandmark != "") {
		homesGlobal.landmarkgenre = selectobject.options[selectobject.selectedIndex].value;

		homesutil.removePoi(homesGlobal.map, homesGlobal.landmarkpoi);
		homesGlobal.landmarkpoi = new Array();
		
		paramBukkenLandmark.genre1_code = homesGlobal.landmarkgenre;
		homesGlobal.search.Landmark.request(paramBukkenLandmark);
	}
}

/**
 * 縮尺変更
 *
 * @param
 * @return
 */
function setZoomLevel(zm) {
	if(homesGlobal.map == null) {
		return;
	}
	homesutil.setZoomElement(zm);
	homesGlobal.zoomlevel = zm;
	homesGlobal.map.zoomTo(zm);
}

/**
 * ソート指定時の再検索
 *
 * @param
 * @return
 */
function searchSortChange(sortby) {
	homesGlobal.list.pagecount = homesGlobal.list.pagecountdiv.value;
	homesGlobal.list.page = 1;
	homesGlobal.sortby = sortby;
	setTimeout(function(){
		if (homesGlobal.SearchMode == "all") {
			SearchAPIBukkenSearch()
		}
		if (homesGlobal.SearchMode == "select") {
			SearchAPIBukkenBalloon();
		}
	}, homesGlobal.SearchTimer.time);
}

/**
 * ページ変更時の再検索
 *
 * @param
 * @return
 */
function searchPageChange() {
	if(homesGlobal.map == null) {
		return;
	}
	setTimeout(function(){
		if (homesGlobal.SearchMode == "all") {
			SearchAPIBukkenSearch()
		}
		if (homesGlobal.SearchMode == "select") {
			SearchAPIBukkenBalloon();
		}
	}, homesGlobal.SearchTimer.time);
}

function infowindowClose() {
	homesGlobal.infowindow.close(homesGlobal.infowindow);
}

/**
 * リスト件数変更
 *
 * @param
 * @return
 */
function setPageCount() {
	homesGlobal.list.pagecount = homesGlobal.list.pagecountdiv.value;
	homesGlobal.list.page = 1;
	if (homesGlobal.SearchTimer.tid != null) {
		clearTimeout(homesGlobal.SearchTimer.tid);
		homesGlobal.SearchTimer.tid = null;
	}
	homesGlobal.SearchTimer.tid = setTimeout(function(){
		searchPageChange();
	}, homesGlobal.SearchTimer.time);
	setPager();
}

/**
 * ページャー設定
 *
 * @param
 * @return
 */
function setPager() {
	var pagerdiv = document.getElementById("_pager");
	var data = new Object();
	data.page = homesGlobal.list.page;
	data.pagecount = homesGlobal.list.pagecount;
	data.maxcount = homesGlobal.list.count.maxcount;
	data.lastcount = homesGlobal.list.count.maxcount % homesGlobal.list.pagecount;
	data.maxpage = Math.floor((homesGlobal.list.count.maxcount - 1) / homesGlobal.list.pagecount) + 1;
	if (data.maxpage <= 10) {
		data.startpage = 1;
		data.endpage = data.maxpage;
	} else {
		if (data.page < 6) {
			data.startpage = 1;
			data.endpage = 10;
		} else {
			data.startpage = data.page - 5;
			data.endpage = data.startpage + 9;
			if (data.endpage > data.maxpage) {
				data.endpage = data.maxpage;
			}
		}
	}
	var template = new templateCondition("pager", pagerdiv);
	template.putTemplate(data);
}

/**
 * ページ遷移
 *
 * @param
 * @return
 */
function pageChange(page) {
	homesGlobal.list.page = page;
	if (homesGlobal.SearchTimer.tid != null) {
		clearTimeout(homesGlobal.SearchTimer.tid);
		homesGlobal.SearchTimer.tid = null;
	}
	homesGlobal.SearchTimer.tid = setTimeout(function(){
		searchPageChange();
	}, homesGlobal.SearchTimer.time);
	setPager();
}

/**
 * リストの"詳細表示"ボタンクリック
 *
 * @param
 * @return
 */
function listButtonClick(mode) {
	if (homesGlobal.list.ListForm.b) {
		var bstring = "";
		if (typeof(homesGlobal.list.ListForm.b.checked) != "undefined") {
			if (homesGlobal.list.ListForm.b.checked) {
				bstring += "b[]=" + homesGlobal.list.ListForm.b.value + "&";
			}
		} else {
			for (var i = 0; i < homesGlobal.list.ListForm.b.length; i++) {
				if (homesGlobal.list.ListForm.b[i].checked) {
					bstring += "b[]=" + homesGlobal.list.ListForm.b[i].value + "&";
				}
			}
		}
		bstring += "";
		if (bstring.length != 0) {
			bstring = bstring.substr(0, bstring.length - 1);
		}
	}
	
	if (bstring.length == 0) {
		alert("まず物件を選択してください");
	} else {
		var openURL = "";
		if (mode == "detail") {
			openURL += homesGlobal.list.detailurl + "?changesort=0&detail=1&favorite=0&";
		} else if (mode == "inquire") {
			openURL += homesGlobal.list.inquireurl + "?changesort=0&detail=0&favorite=0&";
		}
		openURL += "route=" + homesGlobal.route + "&";
		openURL += "o=" + homesGlobal.gyo + "&";
		openURL += "tk=" + homesGlobal.tk + "&";
		openURL += bstring;
		window.open(openURL, '_blank');
	}
}

function listButtonClick2(mode) {
	var bcount = 0;
	if (homesGlobal.list.ListForm["b[]"]) {
		var bstring = "";
		for (var i = 0; i < homesGlobal.list.ListForm["b[]"].length; i++) {
			if (homesGlobal.list.ListForm["b[]"][i].checked) {
				bcount++;
			}
		}
	}
	
	if (bcount == 0) {
		alert("まず物件を選択してください");
	} else if (bcount > 40) {
		alert("同時に指定できる物件数は40件までです");
	} else {
		if (mode == "detail") {
			homesGlobal.list.ListForm.action = homesGlobal.list.detailurl;
			homesGlobal.list.ListForm.changesort.value = 0;
			homesGlobal.list.ListForm.detail.value = 1;
			homesGlobal.list.ListForm.favorite.value = 0;
			homesGlobal.list.ListForm.o.value = homesGlobal.gyo;
			homesGlobal.list.ListForm.route.value = homesGlobal.route;
			homesGlobal.list.ListForm.tk.value = homesGlobal.tk;
		} else if (mode == "inquire") {
			homesGlobal.list.ListForm.action = homesGlobal.list.inquireurl;
			homesGlobal.list.ListForm.changesort.value = 0;
			homesGlobal.list.ListForm.detail.value = 0;
			homesGlobal.list.ListForm.favorite.value = 0;
			homesGlobal.list.ListForm.o.value = homesGlobal.gyo;
			homesGlobal.list.ListForm.route.value = homesGlobal.route;
			homesGlobal.list.ListForm.tk.value = homesGlobal.tk;
		}
		homesGlobal.list.ListForm.target = "_blank";
		homesGlobal.list.ListForm.method = "post";
		homesGlobal.list.ListForm.submit();
	}
}

/**
 * 家賃相場のon/off
 *
 * @param
 * @return
 */
function setMarketPriceAreaRentShow() {
	if (homesGlobal.MarketPriceAreaRent.show) {
		homesGlobal.MarketPriceAreaRent.show = false;
	} else {
		homesGlobal.MarketPriceAreaRent.show = true;
	}
	var template = new templateWindow("marketPriceAreaRent");
	var html = template.getHTML(homesGlobal.MarketPriceAreaRent);
	homesGlobal.MarketPriceAreaRent.setHTML(html);
}

/**
 * 強調アイコン表示
 *
 * @param
 * @return
 */
function setMarker(bukkenid) {
	homesutil.markImage(true, homesGlobal.bukkenidlist[bukkenid]);
}


/**
 * エラーページへ
 *
 * @param
 * @return
 */
function errorPage() {
	location.replace(homesGlobal.errorpage);
	return false;
}

/**
 * Cookieセット
 *
 * @param
 * @return
 */
function setCookie() {
 	var latlng = homesGlobal.map.getCenterLatLng();
 	var scl = homesGlobal.map.getZoomLevel();
	homesutil.setCookie("/homes", "scl", scl, homesGlobal.cookie.time);
	homesutil.setCookie("/homes", "nl", latlng.y, homesGlobal.cookie.time);
	homesutil.setCookie("/homes", "el", latlng.x, homesGlobal.cookie.time);
	homesutil.setCookie("/homes", "bsg", homesGlobal.bsg, homesGlobal.cookie.time);
	homesutil.setCookie("/homes", "tk", homesGlobal.tk, homesGlobal.cookie.time);
	var img = document.createElement("img");
	img.src = "http://realestate.homes.co.jp/search/smc.php?nocache=" + (new Date()).getTime();
	document.body.appendChild(img);
	document.body.removeChild(img);
	img = null;
}

/**
 * Cookie取得
 *
 * @param
 * @return
 */
function getCookie() {
	homesGlobal.urlparam.scl = new Array(homesutil.getCookie("scl"));
	homesGlobal.urlparam.nl = new Array(homesutil.getCookie("nl"));
	homesGlobal.urlparam.el = new Array(homesutil.getCookie("el"));
	homesGlobal.urlparam.bsg = new Array(homesutil.getCookie("bsg"));
	homesGlobal.urlparam.tk = new Array(homesutil.getCookie("tk"));
}

/**
 * そこどこオブジェクト
 *
 * @param
 * @return
 */
function sokodokoObject() {
	EventDispatcher.implement(this);
	this.id = "";
	this.name = "";
	this.admi2 = "";
	this.admi3 = "";
	this.admi4 = "";
	this.admi5 = "";
	this.adna2 = "";
	this.adna3 = "";
	this.adna4 = "";
	this.adna5 = "";
	this.adnak2 = "";
	this.adnak3 = "";
	this.adnak4 = "";
	this.adnak5 = "";
	this.latitude = "";
	this.longitude = "";
	this.zip = "";
	this.zip1 = "";
	this.zip2 = "";
}

sokodokoObject.prototype.setSokodoko = function(poi) {
	this.id = this.str(poi.id);
	this.name = this.str(poi.name);
	this.admi2 = this.str(poi.admi2);
	this.admi3 = this.str(poi.admi3);
	this.admi4 = this.str(poi.admi4);
	this.admi5 = this.str(poi.admi5);
	this.adna2 = this.str(poi.adna2);
	this.adna3 = this.str(poi.adna3);
	this.adna4 = this.str(poi.adna4);
	this.adna5 = this.str(poi.adna5);
	this.adnak2 = this.str(poi.adnak2);
	this.adnak3 = this.str(poi.adnak3);
	this.adnak4 = this.str(poi.adnak4);
	this.adnak5 = this.str(poi.adnak5);
	this.latitude = this.str(poi.latitude);
	this.longitude = this.str(poi.longitude);
	this.zip = this.str(poi.zip);
	this.zip1 = this.str(poi.zip1);
	this.zip2 = this.str(poi.zip2);
	this.dispatchEvent("adna2Changed");
	this.dispatchEvent("adna3Changed");
	this.dispatchEvent("adna4Changed");
	this.dispatchEvent("adna5Changed");
	this.dispatchEvent("admi2Changed");
	this.dispatchEvent("admi3Changed");
	this.dispatchEvent("admi4Changed");
	this.dispatchEvent("admi5Changed");
	this.dispatchEvent("idChanged");
}

sokodokoObject.prototype.str = function(str) {
	if(str != null && (typeof(str) == "string" || typeof(str) == "number")) {
		return "" + str;
	} else {
		return "";
	}
}

/**
 * 件数表示オブジェクト
 *
 * @param
 * @return
 */
countObject = function() {
	EventDispatcher.implement(this);
	this.maxcount = "";
	this.firstcount = "";
	this.lastcount = "";
	this.html = "";
}

countObject.prototype.setMaxCount = function(count) {
	this.maxcount = count;
	this.changeHTML();
}

countObject.prototype.setFirstCount = function(count) {
	this.firstcount = count;
	this.changeHTML();
}

countObject.prototype.setLastCount = function(count) {
	this.lastcount = count;
	this.changeHTML();
}

countObject.prototype.changeHTML = function() {
	if (this.maxcount == null || this.maxcount == 0) {
		this.html = '';
	} else {
		this.html = '<dt>該当件数<strong>' + this.maxcount + '</strong>件中&nbsp;<strong>' + this.firstcount + '</strong>～<strong>' + this.lastcount + '</strong>件を表示</dt>';
	}
	this.dispatchEvent("htmlChanged");
}

/**
 * 家賃相場オブジェクト
 *
 * @param
 * @return
 */
MarketPriceAreaRent = function(searchobj) {
	this.searchObject = searchobj;
	this.bukkenGrouop = 0;
	this.admicode = "";
	this.admicodebackup = "";
	this.list = new Array();
	this.div = document.createElement("div");
	this.div.style.position = "absolute";
	this.div.style.top = "4px";
	this.div.style.left = "4px";
	this.div.style.zIndex = 10000;
	this.cityname = "";
	this.walk_dist_type = "1";
	this.show = false;

	this.div.id = "_price";
	this.div.style.width = "100px";

	if(homesGlobal.map != null) {
		homesGlobal.map.div.appendChild(this.div);
	}
}

MarketPriceAreaRent.prototype.setBukkenGorup = function(g) {
	this.bukkenGrouop = g;
}

MarketPriceAreaRent.prototype.setHTML = function(html) {
	if (this.div != null) {
		this.div.innerHTML = html;
	}
}

MarketPriceAreaRent.prototype.search = function(admicode) {
	this.admicode = admicode.substr(0,5);
	if (this.admicodebackup != this.admicode) {
		var template = new templateWindow("marketPriceAreaRent");
		var paramSearch = new Object();
		paramSearch.addr1 = this.admicode;
		paramSearch.walk_dist_type = this.walk_dist_type;
		paramSearch.bukken_group = this.bukkenGrouop;
		if (this.cityname == "") {
			var html = template.getHTML({"error":"家賃相場データはありません"});
			this.setHTML(html);
			this.admicode = "";
		} else {
			homesGlobal.SearchTimeout.RegInfoMarketPriceAreaRent = false;
			this.searchObject.request(paramSearch);
		}
		this.admicodebackup = this.admicode;
	}
}


