// マウスイベントオブジェクト
var homesEvent = new Object();

// 物件アイコン
homesEvent.bukken = new Object();

// 会員情報アイコン
homesEvent.realtor = new Object();

// ランドマークアイコン
homesEvent.landmark = new Object();

// イベントスキップアイコン
homesEvent.noevent = new Object();
homesEvent.noevent.poi = null;
homesEvent.noevent.type = null;

/**
 * 物件マウスイベント追加
 *
 * @param
 * @return
 */
homesEvent.bukken.addEvent = function(marker) {
	marker.div.onclick = function(){homesEvent.bukken.click(marker)};
	marker.div.onmouseover = function(){homesEvent.bukken.mouseover(marker)};
	marker.div.onmouseout = function(){homesEvent.bukken.mouseout(marker)};
	marker.status = "close";
}

/**
 * 物件アイコンクリック
 *
 * @param
 * @return
 */
homesEvent.bukken.click = function(e) {
	homesGlobal.list.page = 1;
	if (e == homesEvent.noevent.poi) return;
	homesGlobal.maxcount = e.count;
	var param = new Object();
	param = setSearchCondition();
	param.collections = homesGlobal.tkname;
	if (homesGlobal.list.pagecount > homesGlobal.maxcount) {
		param.hits = homesGlobal.maxcount;
	} else {
		param.hits = homesGlobal.list.pagecount;
	}
	param.page = "1";
	param.flgadjust = "1";
	if (homesGlobal.sortby != null) {
		param.sortby = homesGlobal.sortby;
	}
	var tmprange = e.homesrange.split(";");
	var bukkenrange = new Array();
	bukkenrange[0] = tmprange[0].split(",")[0];
	bukkenrange[1] = tmprange[0].split(",")[1];
	bukkenrange[2] = tmprange[1].split(",")[0];
	bukkenrange[3] = tmprange[1].split(",")[1];
	/*
	debug.print(bukkenrange[0]+","+homesGlobal.bounds.minY);
	debug.print(bukkenrange[1]+","+homesGlobal.bounds.minX);
	debug.print(bukkenrange[2]+","+homesGlobal.bounds.maxY);
	debug.print(bukkenrange[3]+","+homesGlobal.bounds.maxX);
	*/
	if (bukkenrange[0] < homesGlobal.bounds.minY) bukkenrange[0] = homesGlobal.bounds.minY;
	if (bukkenrange[1] < homesGlobal.bounds.minX) bukkenrange[1] = homesGlobal.bounds.minX;
	if (bukkenrange[2] > homesGlobal.bounds.maxY) bukkenrange[2] = homesGlobal.bounds.maxY;
	if (bukkenrange[3] > homesGlobal.bounds.maxX) bukkenrange[3] = homesGlobal.bounds.maxX;
	
 	param.geofb = bukkenrange[0] + "," + bukkenrange[1] + ";" + bukkenrange[2] + "," + bukkenrange[3];

	homesGlobal.bukkengeofb = param.geofb;
	homesEvent.noevent.type = "balloon";
	homesGlobal.infowindow.close(homesGlobal.infowindow);
	homesGlobal.bukkenpos = e.rpos;
	homesutil.searchImage(true);
	homesGlobal.SearchTimeout.BukkenMapBalloon = false;
	homesGlobal.search.BukkenMapBalloon.request(param);
	homesEvent.noevent.poi = e;
	homesEvent.noevent.type = "bukken";
	e.div.style.zIndex = homesGlobal.zindex.select;
}

/**
 * 物件アイコンマウスオーバー
 *
 * @param
 * @return
 */
homesEvent.bukken.mouseover = function(e) {
	if (e == homesEvent.noevent.poi) return;
	e.div.style.zIndex = homesGlobal.zindex.main;
}

/**
 * 物件アイコンマウスアウト
 *
 * @param
 * @return
 */
homesEvent.bukken.mouseout = function(e) {
	if (e == homesEvent.noevent.poi) return;
	e.div.style.zIndex = homesGlobal.zindex.bukken;
}

/**
 * 会員情報マウスイベント追加
 *
 * @param
 * @return
 */
homesEvent.realtor.addEvent = function(marker) {
	marker.div.onclick = function(){homesEvent.realtor.click(marker)};
	marker.div.onmouseover = function(){homesEvent.realtor.mouseover(marker)};
	marker.div.onmouseout = function(){homesEvent.realtor.mouseout(marker)};
	marker.status = "close";
}

/**
 * 会員情報アイコンクリック
 *
 * @param
 * @return
 */
homesEvent.realtor.click = function(e) {
	if (e == homesEvent.noevent.poi) return;
	var param = new Object();
	param.collections = "BSale";
	param.mid = "" + e.memberid;
	homesEvent.noevent.type = "";
	homesGlobal.infowindow.close(homesGlobal.infowindow);
	homesGlobal.realtorpos = e.rpos;
	homesutil.searchImage(true);
	homesGlobal.SearchTimeout.RealtorDetail = false;
	homesGlobal.search.RealtorDetail.request(param);
	homesEvent.noevent.poi = e;
	homesEvent.noevent.type = "realtor";
	e.div.style.zIndex = homesGlobal.zindex.select;
}

/**
 * 会員情報アイコンマウスオーバー
 *
 * @param
 * @return
 */
homesEvent.realtor.mouseover = function(e) {
	if (e == homesEvent.noevent.poi) return;
	e.div.style.zIndex = homesGlobal.zindex.main;
}

/**
 * 会員情報アイコンマウスアウト
 *
 * @param
 * @return
 */
homesEvent.realtor.mouseout = function(e) {
	if (e == homesEvent.noevent.poi) return;
	e.div.style.zIndex = homesGlobal.zindex.realtor;
}

/**
 * ランドマークマウスイベント追加
 *
 * @param
 * @return
 */
homesEvent.landmark.addEvent = function(marker) {
	marker.div.onclick = function(){homesEvent.landmark.click(marker)};
	marker.div.onmouseover = function(){homesEvent.landmark.mouseover(marker)};
	marker.div.onmouseout = function(){homesEvent.landmark.mouseout(marker)};
}

/**
 * ランドマークアイコンクリック
 *
 * @param
 * @return
 */
homesEvent.landmark.click = function(e) {
	var windowdiv = document.createElement("DIV");
	var template = new templateWindow("windowLandmark");
	var data = new Object;
	data.name = e.name;
	data.size = e.name.length*16 + 16;
	homesEvent.noevent.type = "";
	homesGlobal.infowindow.close(homesGlobal.infowindow);
	homesGlobal.infowindow.setHTML(template.getHTML(data));
	homesGlobal.infowindow.show(e.rpos, 16, -16, "landmark");
	homesEvent.noevent.poi = e;
	homesEvent.noevent.type = "landmark";
	e.div.style.zIndex = homesGlobal.zindex.select;
}

/**
 * ランドマークアイコンマウスオーバー
 *
 * @param
 * @return
 */
homesEvent.landmark.mouseover = function(e) {
	if (e == homesEvent.noevent.poi) return;
	e.div.style.zIndex = homesGlobal.zindex.main;
}

/**
 * ランドマークアイコンマウスアウト
 *
 * @param
 * @return
 */
homesEvent.landmark.mouseout = function(e) {
	if (e == homesEvent.noevent.poi) return;
	e.div.style.zIndex = homesGlobal.zindex.landmark;
}




