_start=false;
/**
	地図初期化、POI配信クラス（WebDrive、MapionWDクラスなど）初期化
*/
   function create_map() {
	if(_bi.type==3){
		document.getElementById("selectList").style.display="none";
		document.getElementById("poiList").style.display="block";
		document.getElementById("poiList").style.visibility="visible";
	}

      putContents();

//      if(bt<parseInt(20)) set_ora_date("print_start_date");
//      else set_ora_date("DATEF01")
      var mapElement = document.getElementById(_map);
//		var cacheDate=new Date()
//		var cacheClear="?"+((cacheDate.getYear() <2000 )? cacheDate.getYear()+1900 : cacheDate.getYear()) +parseInt(cacheDate.getMonth() +1) +cacheDate.getDate()+cacheDate.getHours()+cacheDate.getMinutes()+cacheDate.getSeconds();
//debug.print(cacheClear)
      _m = new ProAtlasMapCtrl(mapElement,"/sh/xml/sh_map.xml");
//      _m = new ProAtlasMapCtrl(mapElement,"/sh/xml/sh_map.xml"+cacheClear);
      _m.setEnableAutoLayerChange(true);
      _m.setEnableKeyboardOperation(false);
      _m.setEnableMagnifyOperation(false);
      _m.setEnableSmoothLayerOperation(false);
      _m.setEnableWheelOperation(false);
      //地図に対してそこどこを追加
      if(_sokodokoId ) _m.sd=new MapionWDSocoDoco(_sokodokoId);
		create_layers();

      AlpsEvent.addEvent(_m,"mapMoved",mapMoved);
      AlpsEvent.addEvent(_m,"mapMoving",mapMoving);
      AlpsEvent.addEvent(_m,"layerChanged",layerChanged);
      AlpsEvent.addEvent(_m,"smoothLayerChanged",smoothLayerChanged);

      AlpsEvent.addEvent(_m,"layerListChanged",layerListChanged);
      _ms = new MapsvrCtrl(_m,"/sh/xml/sh_bk.xml");
		_ms.mapMoving=function(){
			if(this.ctimer) window.clearTimeout(this.ctimer);
			this.hidePopup();
			this.moveContents();
			if(_mm) _mm.resetBalloon();
			this.showPopup(-1);
		};

//      _ms = new MapsvrCtrl(_m,"/sh/xml/sh_bk.xml"+cacheClear);
      _ms.setIconThreshold(_contentsLimit);
      _ms.objid="_ms";
    //1:mapsvr object, 2:type of poi(webdrive/PLBS), 3:crowd(true/false), 4:ajax(true/false->iframe)
      //_mm = new MapionWD(_ms,_croud_identifer,true,false);

      _mm = new MapionWD(_ms,"/sh/xml/mast/mst_"+skw+".xml");
	registReq("ses");

//      _mm = new MapionWD(_ms,"/sh/xml/sh_11.xml"+cacheClear);
      _mm.customParam=getCustomParamater();
//debug.print(".customParam:"+_mm.customParam);
//		_mm.si=true;
  //    _mm.checkConditions();
      //地図に対して検索中画像を追加
//alert("si;"+_mm.si);
	if(eval(_mm.si)){
//alert("si;"+_mm.si);
		var sI=document.createElement("img");
		sI.id=_searchImgId;
		sI.src=_searchImg;
		sI.style.display="none";
		sI.style.position="absolute";
		sI.style.zIndex=10;
		_mm.ms.map.getContainer().appendChild(sI);
		_mm.ms.map.si=sI;
//		_mm.si=sI;
	}
      _lms = new MapsvrCtrl(_m,"/sh/xml/land_poi.xml");
//      _lms = new MapsvrCtrl(_m,"/sh/xml/land_poi.xml"+cacheClear);
      _lms.objid="_lms";
      _lmm = new MapionWD(_lms,"/sh/xml/landmark.xml");
//      _lmm = new MapionWD(_lms,"/sh/xml/landmark.xml"+cacheClear);
      _lmm.checkConditions();

//debug.print(document.getElementById("cacheNl").value +","+ document.getElementById("cacheEl").value +","+ document.getElementById("cacheScl").value)
      if(document.getElementById("cacheNl").value && document.getElementById("cacheEl").value && document.getElementById("cacheScl").value){
			_iniScale=document.getElementById("cacheScl").value;
            _m.moveAndLayerTo(new LLPoint(document.getElementById("cacheNl").value+","+document.getElementById("cacheEl").value),_m.getLayerId(document.getElementById("cacheScl").value));
			_start=true;
/*キャッシュを展開
            window.setTimeout(function(){parseCache();},100);
*/          window.setTimeout(function(){_start=true;plot(_mm);_m.sd.getShopcode(el,nl);},200);
      }
      else{
            _m.moveAndLayerTo(_iniCenter,_m.getLayerId(_iniScale));
            window.setTimeout(function(){_start=true;plot(_mm);_m.sd.getShopcode(el,nl);},200);
      }

      _c = new MapionMapControl(_m,10,10);
      _c.e.onmousedown=function(e){CancelBubble(e);};
      _c.e.onclick=function(e){CancelBubble(e);};
      _c.e.ondblclick=function(e){CancelBubble(e);};
      _c.e.ondblclick=function(e){CancelBubble(e);};
      mapElement.appendChild(_c.e);
      _c.setnoneScale();
      _c.getHantei(_m.getLayerScaleList());
      _s = new MapionMapMeter(_m,10,10);
      _s.dispMeter();
      mapElement.appendChild(_s.e);

	// 2008.05.13 copyright変更により追加
	// --- start --- 2008.05.13 copyrightの修正
	_ms.map.mapView.copyright.style.backgroundImage= '';
	_ms.map.mapView.copyright.style.width="108px";
	_ms.map.mapView.copyright.innerHTML = '<img src="/api_images/copyright2.gif" alt="コピーライト" border="0" />';
	// ---  end  --- 2008.05.13 copyrightの修正


	//show_categories();

}


/**
	POI検索を検索実行する。
	原則1ページ目
	@param [Object]	mmobj	プロットするMapionWDクラスを指定
*/
function plot(mmobj){
	var mm=mmobj;
//debug.print(mm.ms.objid);
	mm.ms.contents.clear();
	mm.crdContents.clear();
	//POI
	mm.ms.clearCanvas();
	mm.resetCanvas();

	mm.makeQuery(1);
	mm.getLBSPoi();
}
/*
	function setSelect(objId,mmobj){
		document.getElementById(objId).onchange=function(){
			plot(mmobj);
		};
	}
*/



/**
	検索条件を指定できるHTMLオブジェクトにイベントハンドラを付加する
	@param [String]	objId	検索条件が記述されているHTMLオブジェクト（selectタグ、inputタグ）のid
	@param [Object]	mmobj	プロットするMapionWDクラスを指定
*/

	function setSelect(objId,mmobj){

//セレクトタグか、インプットタグかでイベントのつけ方が異なる
//alert(document.getElementById(objId));
		if(!document.getElementById(objId)){
			var elms=document.getElementsByName(objId);
			for(var i=0; i<elms.length;i++){
				elms[i].onclick=function(){
					plot(mmobj);
				};
			}
		}
		else{
			document.getElementById(objId).onchange=function(){
				plot(mmobj);
			};
		}
	}


/**
	縮尺を変更する

	@param [String]	index	移動したい縮尺のインデックスを指定する
*/
    function layerto(index){
      if(!_m)return;
		return function(e){
      _m.smoothLayerTo(index);
		};
    }


/**
	縮尺を変更するボタンを作成する
*/
   function create_layers(){
     if(!_m) return;
     if(!document.getElementById("layers")) return;
      for(var i=0;i<_layerCollect.length;i++){
        var menu=_layerCollect[i];
        document.getElementById("layers").removeChild(menu);
      }
      _layerCollect.length=0;
	  var tbl=document.createElement("table");
	  tbl.style.border="0";
	  tbl.cellSpacing="0";
	  tbl.cellPadding="0";
	  var tbdy=document.createElement("tbody");
	  tbdy.style.vAlign="top";
	  var tr=document.createElement("tr");
      for(var i=0;i<_m.getLayerCount();i++){
      var scale=_m.getLayerScale(i);
        if(!_layers['s'+scale])continue;
        var td=document.createElement('td');
        var menu=document.createElement("span");
		menu.style.width=56+"px";
		menu.style.height=18+"px";

        menu.setAttribute("layerid",i);
        menu.onclick=layerto(i);

//        menu.onmouseover=Layer_img_FB();
//        menu.onmouseout=Layer_img_FB();

//        menu.src=_layers['s'+scale]+".gif";
        _layerCollect.push(menu);
        td.appendChild(menu);
        tr.appendChild(td);
//        document.getElementById("layers").appendChild(td);
      }
		tbdy.appendChild(tr);
		tbl.appendChild(tbdy);
		document.getElementById("layers").appendChild(tbl)

      set_layers();
    }


/**
	縮尺を変更ボタンのマウスオーバー時のフォーカス、blur処理
*/
	function Layer_img_FB(){
		return function(e){
//debug.print(typeof(e));
			if(typeof(e)=='undefined'){
//debug.print("IE ok");
				if(window.event.type=="mouseover"){
//					this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+"_o.gif";
					if(_m.getCurrentLayerId() != this.getAttribute("layerid")){
						this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+"_o.gif";
					}else{
						this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+"_a.gif";
					}
				}
				else if(window.event.type=="mouseout"){
	//debug2.print(_m.getCurrentLayerId() +":"+ this.getAttribute("layerid"))
					if(_m.getCurrentLayerId() != this.getAttribute("layerid")){
						this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+".gif";
					}
					else{
						this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+"_a.gif";
					}
				}
			}
			else if(e.type=="mouseover"){
				if(_m.getCurrentLayerId() != this.getAttribute("layerid")){
					this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+"_o.gif";
				}else{
					this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+"_a.gif";
				}
			}
			else if(e.type=="mouseout"){
//debug2.print(_m.getCurrentLayerId() +":"+ this.getAttribute("layerid"))
				if(_m.getCurrentLayerId() != this.getAttribute("layerid")){
					this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+".gif";
				}
				else{
					this.src=_layers['s'+_m.getLayerScale(this.getAttribute("layerid"))]+"_a.gif";

				}
			}

		};
	}


	function selectchanged(){

	}


/**
	地図を移動させた後、縮尺リスト（縮尺選択ボタン）を更新する

*/
    function set_layers(){
      if(!_m) return;
      var s=_m.getLayerScaleList();
      for(var i=0;i<_layerCollect.length;i++){
        var menu=_layerCollect[i];
        var layerid=menu.getAttribute("layerid");
        var scale=_m.getLayerScale(layerid);
        if(layerid==_m.getCurrentLayerId()){
//          menu.src=_layers['s'+scale]+"_a.gif";
        }else{
//          menu.src=_layers['s'+scale]+".gif";
        }
        if(!s) continue;
        if(s.find(scale)<0){
          menu.style.display="none";
        }else{
          menu.style.display="block";
        }
      }
    }


/**
	未使用	フォローしなくてOKです
*/
    function parse_hash(){
      var h=null;
      if(document.location.search){
        h=document.location.search.substring(1);
        _sep="?";
      }else if(document.location.hash){
        h=document.location.hash.substring(1);
        _sep="#";
      }
      if(!h) return;
      var pairs=h.split(";");
      var s=25000;
      var p;
      for(var i=0;i<pairs.length;i++){
        var pair=pairs[i].split("=");
        if(pair[0]=="s"){
          s=pair[1];
        }else if(pair[0]=="p"){
          p=pair[1];
        }
      }
      if(p){
        _iniScale=s;
        _iniCenter=new LLPoint(p);
        return true;
      }
    }

    function setURLLatLon(inNl,inEl){
		if(!inNl || !inEl){
			var CTR = _m.getCenterLatLon();
			var CTRd=(CTR.toString()).split(",");
			inNl=Converter.convert60to10(CTRd[0]);
			inEl=Converter.convert60to10(CTRd[1]);
		}
		var scl=_m.getCurrentScale();
		document.getElementById("cacheNl").value=inNl;
		document.getElementById("cacheEl").value=inEl;
		document.getElementById("cacheScl").value=scl;


/*
		var URLSelf = location.href;
		var d=URLSelf.split("&nl=");
		var nl=d[1].split("&el=");
		var el=nl[1].split("&scl=");
		var scl=el[1].split("&");
		el[0]=inEl;
		nl[0]=inNl;
		var sclValue=_m.getCurrentScale();
		scl[0]=_m.getCurrentScale();
//		scl[0]=
*/		var q=decodeURL(_mm.gatherConditions());
//		document.getElementById("cacheForm").value=d[0]+"&nl="+nl[0]+"&el="+el[0]+"&scl="+scl.join("&");

		document.getElementById("cacheParam").value=q.join("");
		if(_mm.customParam) document.getElementById("cacheParam").value+=_mm.customParam;
    }

	function setCacheAtUnload(){
		var CTR = _m.getCenterLatLon();
		_m.moveAndLayerTo(CTR,_m.getCurrentScale());
	}
    function mapMoving(){
    }

    function mapMoved(){
		var CTR = _m.getCenterLatLon();
		var CTRd=(CTR.toString()).split(",");
		var Dnl=Converter.convert60to10(CTRd[0]);
		var Del=Converter.convert60to10(CTRd[1]);
		setURLLatLon(Dnl,Del);
		if(!_m.sd) return;
		_m.sd.parse(Del,Dnl);
		// 営業所分け
		_m.sd.getShopcode(Del,Dnl);
		// ログ集計
		mapionTracker('/map/map/scroll');

		// 2008.09.17
		/*if(_bi.type!=1 && typeof(_c)!="undefined") _c.setnoneScale();
		else if(_bi.type!=1) _c.setnoneScale();
		if(_bi.type!=1 && typeof(_c)!="undefined") _c.resetCnt();
		else if(_bi.type!=1) _c.resetCnt();
		if(_bi.type!=1 && typeof(_s)!="undefined") _s.changeMeter();
		else if(_bi.type!=1) _s.changeMeter();
		if(_bi.type!=1 && typeof(_c)!="undefined") _c.getHantei(_m.getLayerScaleList());
		else if(_bi.type!=1) _c.getHantei(_m.getLayerScaleList());*/
		_c.setnoneScale();
		_c.resetCnt();
		_s.changeMeter();
		_c.getHantei(_m.getLayerScaleList());
		checkList('undo');
		//チェックリストを元に戻す
//		if(document.getElementById("allcheck1").checked==true){
//			document.getElementById("allcheck1").checked="";
//			if(_bi.type!=3) removeCheck();
//		}
    }


    function layerChanged(){
		setURLLatLon();
		set_layers();

		// 2008.09.17
		/*if(_bi.type!=1 && typeof(_c)!="undefined") _c.setnoneScale();
		else if(_bi.type!=1) _c.setnoneScale();
		if(_bi.type!=1 && typeof(_c)!="undefined") _c.resetCnt();
		else if(_bi.type!=1) _c.resetCnt();
		if(_bi.type!=1 && typeof(_S)!="undefined") _s.changeMeter();
		else if(_bi.type!=1) _s.changeMeter();
		if(_bi.type!=1 && typeof(_c)!="undefined") _c.getHantei(this.ms.getLayerScaleList());
		else if(_bi.type!=1) _c.getHantei(this.ms.getLayerScaleList());*/
		_c.setnoneScale();
		_c.resetCnt();
		_s.changeMeter();
		_c.getHantei(this.ms.getLayerScaleList());
		checkList('undo');
    }

    function smoothLayerChanged(){
		setURLLatLon();
		set_layers();

		// 2008.09.17
		/*if(_bi.type!=1 && typeof(_c)!="undefined") _c.setnoneScale();
		else if(_bi.type!=1) _c.setnoneScale();
		if(_bi.type!=1 && typeof(_c)!="undefined") _c.resetCnt();
		else if(_bi.type!=1) _c.resetCnt();
		if(_bi.type!=1 && typeof(_s)!="undefined") _s.changeMeter();
		else if(_bi.type!=1) _s.changeMeter();
		if(_bi.type!=1 && typeof(_c)!="undefined") _c.getHantei(this.ms.getLayerScaleList());
		else if(_bi.type!=1) _c.getHantei(this.ms.getLayerScaleList());*/
		_c.setnoneScale();
		_c.resetCnt();
		_s.changeMeter();
		_c.getHantei(this.ms.getLayerScaleList());
		checkList('undo');
    }

/**
	縮尺リストが更新された時に発火する

	@param [String]	id	地図パッケージのid
*/
    function layerListChanged(id){
		if(!_m) return;
		if(id==_m.getCurrentPackageId()){
        	set_layers();
		}
		if(typeof(_mm.ms.hidepopup)=="function") _mm.ms.hidepopup();
    }




    function add_shape(){
      // ????????????MapsvrCtrl???????
/*      _ms.addContents(line1a);
      _ms.addContents(line1b);
      _ms.addContents(line2);
      _ms.addContents(area);
      _ms.addContents(circle1);
      _ms.addContents(circle2);
*/
      // ??????????????????
      // MapsvrCtrl.removeContents(string id) ???????
      // ?????????"??-???"????????????
      //     ????????????
      // _ms.removeContents("line1-a");
    }


/**
	地図の大きさが変化した際に発火する
*/
function resize_map(){
	//if(!_m) return;
	var mp=document.getElementById(_map);
//	var pl=document.getElementById(_poiList);
//	var sl=document.getElementById("selectList");

//	var sh= parseInt(screen.availHeight);
	var sw= parseInt(screen.availWidth);

   if(_bi.type==1){

		/*
		if(parseInt(document.body.clientWidth)<450){
			if(mp.style.height&&mp.style.width) return;
		}
		*/
//		var ch= parseInt(document.documentElement.clientHeight);
		var cw= parseInt(document.documentElement.clientWidth);
		if(!cw) cw=parseInt(document.body.clientWidth);
//debug.print("ch:"+ch);
		if(!mp) return;

//		var mHeight=ch-_layout_map_h;
		var mWidth=cw-_layout_map_w;

//		var mHeight=(ch < 768)? 768-_layout_map_h : ch-_layout_map_h;
//		var mWidth=(cw < 1024)? 1024-_layout_map_w : cw-_layout_map_w;
//debug.print("mHeight:"+mHeight);
//alert(document.body.clientHeight+","+mHeight);
//		var lHeight=0;

//		var lHeight=mHeight-_layout_diff_l;
//		if(mHeight&&mHeight>0) mp.style.height=mHeight+"px";
		if(mWidth&&mWidth>resize_width[skw]) mp.style.width=mWidth+"px";
		else mp.style.width=resize_width[skw]+"px";
		//mp.style.height=200+"px";
		//pl.style.height=150+"px";
//		if(lHeight&&lHeight>0){
//			pl.style.height=lHeight+"px";
//			sl.style.height=lHeight+"px";
//		}

		var smav = ScriptEngineMajorVersion() //メジャーバージョン
		var smiv = ScriptEngineMinorVersion() //マイナーバージョン
		var sv   = smav + smiv/10
		if(sv <= 5.5 ){
//		if(_bi.type ==1 && _bi.version <= 5 && document.getElementById('mainArea')){
			if(document.getElementById('mainArea')) document.getElementById('mainArea').style.width = (mWidth-20)+"px";

//			var list = document.getElementById('poiList');
//			if(list){
//				document.getElementById('oshirase').style.width = list.style.width;
//			}

		}

		measureWidth();
	}
    if(_bi.type!=1){
		/*
		if(parseInt(window.innerHeight)<250){
			return;
		}
		*/
//		var ih=parseInt(window.innerHeight);
	    var iw=parseInt(window.innerWidth);
//		var mHeight=(ih < 768 )? 768-_layout_map_h : ih-_layout_map_h;
//		var mWidth=(iw < 1024)? 1024-_layout_map_w : iw-_layout_map_w;
//		var mHeight=ih-_layout_map_h;
		var mWidth=iw-_layout_map_w;

//		var lHeight=mHeight-_layout_diff_l;

//		window.setTimeout(function(){
			if(mWidth&&mWidth>resize_width[skw]) mp.style.width=mWidth+"px";
			else mp.style.width=resize_width[skw]+"px";
			(mp.parentNode).parentNode.style.width=mp.style.width;
			measureWidth();
		if(_lms) _lms.width=parseInt(mp.style.width);
			/*if(mHeight) mp.style.height=mHeight+"px";
			if(lHeight){
						pl.style.height=lHeight+"px";
						sl.style.height=lHeight+"px";
			}*/
		if (_m) {_m.mapView.resizeMapView();if(_mm) _mm.ms.resizeCanvas();if(_lmm) _lmm.ms.resizeCanvas();
}
//		},10);
		if (!_m) return;
//		_lms.height=_m.getContainer().offsetHeight;
//debug.print("_lms width"+_lms.width);
//debug.print("_lms height"+_lms.height);
	}
	if(_mm) _mm.ms.resizeCanvas();
	if(_lmm) _lmm.ms.resizeCanvas();
}


/*ピタットハウス用*/
/*リストの表示件数を変えたとき*/

function poi_list_changed(){
/*
	if(document.getElementById(_select1)){
			var op1Idx = document.getElementById(_select1).selectedIndex;
			var op1V = (document.getElementById(_select1).options[document.getElementById(_select1).selectedIndex]).value;
//alert("s1"+op1Idx+","+op1V);
		if(op1V > 0){
			this.pmtr.push("&"+_select1+"="+op1V);
			//this.pmtr[(this.pmtr.length-1)]+=(document.getElementById(_select1).options[document.getElementById(_select1).selectedIndex]).value;
		}
	}
*/
}

/**
	画像が存在しない、データにエラーがあった際にに発火する

*/
function imgOnError(img){
	img.style.display="none";
};





/**
	縮尺リストが更新された時に発火する

	@param [String]	id	地図パッケージのid
*/
function iconMousemove(iconimg){
	if(_mm.plotPOIType[_mm.plotPOITypeStatus]!="amount") {_mm.innerLink(iconimg.poiid);}
//	_mm.innerLink('pnum'+_mm.getPOIIndex(this.poiid)-1);
	poiList.focused_table(iconimg.poiid);

}


function iconMouseover(iconimg){
//debug.print("-----");
	if(_mm.iconPopup && _mm.plotPOIType[_mm.plotPOITypeStatus]!= "amount"){
		if(_bi.type==3){
			if(_timer4safari) clearTimeout(_timer4safari);
			poiList.blured_table(poiList.focusId);
			_mm.emphImg.style.display="none";
			_mm.ms.closePopup();
		}
		if(_mm.plotPOIType[_mm.plotPOITypeStatus]== "webdrive") _mm.ms.showPopup(iconimg.icnid);
	 	else  _mm.ms.showPopup(_mm.getPOIIndex(iconimg.poiid)-1);
	 }
}

function iconMouseout(iconimg){
	if(_mm.iconPopup && _mm.plotPOIType[_mm.plotPOITypeStatus]!= "amount"){
		_mm.ms.ptimer=window.setTimeout(_mm.ms.eventHandler('closePopup'),100);
	}
	if(_mm.plotPOIType[_mm.plotPOITypeStatus]=="amount") {
		if(_amoutListTimer) clearTimeout(_amoutListTimer)
		_amoutListTimer=window.setTimeout(enlargeList,200);
	}
	poiList.blured_table(iconimg.poiid);
}

function enlargeList(list){
	if(_amoutListTimer) clearTimeout(_amoutListTimer)
	var tables=poiList.document.getElementsByTagName("table");

	for(var i=0 ; i< tables.length; i++){
		tables[i].style.display="block";
	}
	poiList.reduceTmp=new Array();
	_amoutListTimer=null;
}





function launch(array, id){
for(var i=0;i<array.length;i++){
alert(array[i]);
}


alert(id-1);
alert(array[id-1]);
	window.open(array[id-1]);
}

function eraseZero(idokeido){
	var tmp=idokeido.split('/');
	var ret="";
	for(var i=0; i<tmp.length; i++){
		if(tmp[i].substring(0,1)=="0"){
			tmp[i]=tmp[i].substring(1,tmp[i].length);
		}
	}
	ret=tmp.join("/");

	return ret;
}

function clickPop(evt,flag){
	if(!evt) evt=window.event;
	if(_mm.plotPOIType[_mm.plotPOITypeStatus]!="amount") return;
	if(flag){
		if(!document.getElementById("cp")){
			var pop=document.createElement("div");
			var popt=document.createTextNode("click!!!");
			pop.style.borderStyle="solid";
			pop.style.borderWidth="2px 2px 2px 2px";
			pop.style.borderColor="#445566";
			pop.style.backgroundColor="#FFFFFF";
			pop.style.padding="1px 2px 2px 1px";
			pop.id="cp";
			pop.style.position="absolute";
			pop.style.top=parseInt(parseInt(evt.clientY)-20)+"px";
			pop.style.left=parseInt(parseInt(evt.clientX)+10)+"px";
			pop.style.display="block";
			pop.appendChild(popt);
			document.body.appendChild(pop);
		}
		else{
			var cp=document.getElementById("cp");
			cp.style.top=parseInt(evt.clientY-20)+"px";
			cp.style.left=parseInt(evt.clientX+10)+"px";
			cp.style.display="block";
		}
	}
	else{
		if(!document.getElementById("cp")) return;
		var cp=document.getElementById("cp");
		cp.style.display="none";
	}
}



function getCondition(selectId,arrayObj){
	var ret=null;
	var array0=arrayObj;
	var id0=selectId;
//inputタグのときは_を足す(idの重複を避ける)
	var dom0=(document.getElementById(id0))? document.getElementById(id0):document.getElementsByName(id0)[0];
//	if(!dom0) dom0=document.getElementById(id0+"_1");
	if(!id0||!array0 || !dom0) return;
//select タグのとき
	 if(dom0.tagName.toLowerCase()=="select"){
		var op1Idx = dom0.selectedIndex;
		var op1V = (dom0.options[op1Idx]).value;
//alert("s1"+op1Idx+","+op1V);
		if(op1V > 0){
			array0.push("&"+id0+"="+op1V);
		return array0;
		}
	}
//インプットタグのとき
	 else if(dom0.tagName.toLowerCase()=="input"){
		iType=dom0.type.toLowerCase();

		if(iType=="text"){
				if(dom0.value) array0.push("&"+id0+"="+dom0.value)
		}
		else if(iType=="checkbox"||iType=="radio"){
			var count=0;
			var tmp="";
			for(var i=0; i< document.getElementsByName(selectId).length;i++){
				if(document.getElementsByName(selectId)[i].checked) {
//複数のときはカンマで区切る
					tmp+=(count>0)? "," : "" ;
					tmp+=document.getElementsByName(selectId)[i].value;
					count++;
				}
			}
			if(tmp.length > 0 && tmp!="0") array0.push("&"+id0+"="+tmp);
			return array0;
		}

/*
		switch(iType){

//テキスト入力のとき
			case "text":
				if(dom0.value) array0.push("&"+id0+"="+dom0.value)
//				break;

//チェックボックスのとき(radioボタンも同一ロジックで対応可。このときのidはName属性となるので注意)
			case "checkbox" || "radio":
				var count=0;ZZ
				var tmp="";
				for(var i=0; i< document.getElementsByName(selectId).length;i++){
debug.print("tmp:"+tmp);
					if(document.getElementsByName(selectId)[i].checked) {
alert("ok");
//複数のときはカンマで区切る
						tmp+=(count>0)? "," : "" ;
						tmp+=document.getElementsByName(selectId)[i].value;
						count++;
					}
				}
				if(tmp.length > 0 ) array0.push("&"+id0+"="+tmp);
				return array0;
//				break;
				default :
//				break;

		}
*/
	}
}


function getLandMarkCondition(){
	var ret="";
	var count=0;
	var c=document.getElementById("categories");
//debug.print("cate:"+c);
	if(!c) return ret=null;
	var ipt=c.getElementsByTagName("input");
//debug.print("input:"+ipt);
	if(!ipt) return ret=null;
	for(var i=0; i<ipt.length; i++){
//debug.print(ipt[i].checked);
		if(ipt[i].checked){
			ret+=(count>0)? "," : "" ;
			ret+=ipt[i].id;
			count++;
		}
	}
	return ret;
}

	function show_contents(){
		_lmm.makeQuery(1);
		_lmm.getLBSPoi();

	}

    function show_categories(){

      var p=document.getElementById('categories');
      var s="";
      var c=_lms.getCategoryList();      // 登録されているジャンルリスト(カテゴリリスト)を取得
      var scale=_m.getCurrentScale();
      s+="<table><tbody><tr>"
      for(var i=0;i<c.length;i++){
        var id=c[i].id;
          // ジャンルリストが未設定の場合、その名前やアイコンを設定します。
          // （HTMLロード時のみ）
          // チェックされた時に、show_contents()を呼び出します。
          if(i%15==0) s+="</td><td>"
          s+='<input name="genre1_code" type="checkbox" id="'+id+'" value="'+id+'"onclick="show_contents()">'+
             '<label style="vertical-align:top;" for="'+id+'"><img src="'+c[i].iconImage[0]+'"> '+c[i].name+'</label><br>\n';
      }
      s+="</td></tbody></table>"
      if(s) p.innerHTML+=s;
    }

function getAttr(obj,nsVal,attrVal){
	if(!obj || !attrVal) return;
	if(_bi.type!=3) return obj.getAttribute(attrVal);
    else  return obj.getAttributeNS(nsVal,attrVal);
}

function getElmByTag(obj,nsVal,Element){
	if(!obj || !Element) return;
	if(_bi.type==1) return obj.getElementsByTagName(nsVal+":"+Element);
    else  return obj.getElementsByTagNameNS(nsVal,Element);
}

function setLandMarkVisible(flag){
	var c= document.getElementById("categories");
	//画面上に存在する地図でウインドウサイズによってレイアウトを変更するものについては追加で同様の処理を行う
	var mp=document.getElementById(_map);
	//画面上に存在するPOI用リスト（表示用）でウインドウサイズによってレイアウトを変更するものについては追加で同様の処理を行う
	var pl=document.getElementById(_poiList);
	var sl=document.getElementById("selectList");
	if(flag) {
		if(_bi.type==1){
			var ch=parseInt(document.body.clientHeight);
			if(!mp) return;
			var mHeight=ch-800;
			var lHeight=mHeight-_layout_diff_l;
			if(mHeight&&mHeight>0) mp.style.height=mHeight+"px";
			if(lHeight&&lHeight>0) pl.style.height=lHeight+"px";
		}
		else{
			var ih=parseInt(window.innerHeight);
			var mHeight=ih-700;
			var lHeight=mHeight-_layout_diff_l;
	        if(mHeight) mp.style.height=mHeight+"px";
			if(lHeight){
				pl.style.height=lHeight+"px";
				sl.style.height=lHeight+"px";
			}
		}
		document.getElementById('lmON').style.display='none';
//		if(document.getElementById("canvas")) document.getElementById(_map).removeChild(document.getElementById("canvas"));
		if(c &&!c.hasChildNodes()){
			if(_LANDMARK) show_categories();
		}
		document.getElementById('categories').style.display='block';
		document.getElementById('lmOFF').style.display='block';
		if (!_m) return;
			_m.resetCenter();
			_mm.ms.resizeCanvas();
			_lmm.ms.resizeCanvas();
		_m.mapView.resizeMapView();
		AlpsEvent.triggerEvent(_m,"resize");

	}
	else {
		if(_bi.type==1){
			var ch=parseInt(document.body.clientHeight);
			if(!mp) return;
			var mHeight=ch;
			var lHeight=mHeight-_layout_diff_l;
			if(mHeight&&mHeight>0) mp.style.height=mHeight+"px";
			if(lHeight&&lHeight>0) pl.style.height=lHeight+"px";
		}
		else{
			if(c &&!c.hasChildNodes()){
				if(_LANDMARK) show_categories();
			}
			var ih=parseInt(window.innerHeight);
			var mHeight=ih-document.getElementById("categories").offsetHeight;
			var lHeight=mHeight-_layout_diff_l;
	        if(mHeight) mp.style.height=mHeight+"px";
			if(lHeight){
				pl.style.height=lHeight+"px";
				sl.style.height=lHeight+"px";
			}
		}
		document.getElementById('lmOFF').style.display='none';
		document.getElementById('categories').style.display='none';
		document.getElementById('lmON').style.display='block';
		if (!_m) return;
			_m.resetCenter();
			_mm.ms.resizeCanvas();
			_lmm.ms.resizeCanvas();
			_m.mapView.resizeMapView();
		AlpsEvent.triggerEvent(_m,"resize");

	}
}


function set_ora_date(parameter){
	var dName=parameter;
	if(!dName) return;
	var dateIFs=document.getElementsByName(dName);
	if(!dateIFs) return;
	//今日
	var tD;
	tD=new Date();
	for(var i=0; i<dateIFs.length ;i++){
		if(dateIFs[i].value) var spDate=(dateIFs[i].value).split("/");
		else continue;
//debug.print(spDate);
//debug.print(parseInt(tD.getFullYear())-parseInt(spDate[0]));
//debug.print(parseInt(tD.getMonth())+1-parseInt(spDate[1]));
//debug.print(parseInt(tD.getDate())-parseInt(spDate[2]));

		var retDate=(tD.getFullYear()-spDate[0]).toString()+(tD.getMonth()+1-spDate[1]).toString()+"01";//+(tD.getDate()-spDate[2]).toString();
//debug.print(retDate);
		dateIFs[i].value=retDate+":";

//		dateIFs[i].setAttribute("date",retDate);
	}
}



function switchList(idList,urlpara){
	var il=idList;
	var para=urlpara;
	var domP=document.getElementById("poiList");
//	var domS=document.getElementById("selectList")
//	var domC=document.getElementById("contents")

//alert("ok");
	//	domS.style.display="none";
	//	domS.style.visibility="hidden";
	//	domS.style.zIndex=0
//debug.print("though" + il+","+para);

	if(!il || !urlpara){
//alert("1");
		_id_list="";
		_mm.ucStatus=0;
//		switchCLName("poi_all","map1on");
//		switchCLName("poi_point","map1off");
		//とりあえず地図内をアクティブ
//		setButton("_all","/sh/images/tab_001.gif");
/*		//地点をオフ
		if(flag){
			 setButton("_point","/pitat/images/point_off.gif");
		}
*/		//地点を消す
//		else{
//			setButton("_point",null);
//		}

//		if(_bi.type!=3) listVisible("poiList");
/*
		domS.style.display="none";
		domS.style.visibility="hidden";
		domS.style.zIndex=0
		domP.style.zIndex=10;
		domP.style.display="block";
		domP.style.visibility="visible";
*/
		return;
	}
	else{
		_ids=il;
		_id_list=poiList.poiIndex;
		var host=location.host;
		_mm.ucStatus=1;

		//積和コードが無いとき（一応ShaMaisonでも同じScriptで使えるように）
/*		if(!skw) var u= "http://"+host+"/map/uc/"+_mm.uc[_mm.ucStatus].type+"?"+_mm.uc[_mm.ucStatus].pmtr.join("&")+para.join("")+"&poi_code="+il+"&srt=room_status,distance";
		else var u= "http://"+host+"/map/uc/"+_mm.uc[_mm.ucStatus].type+"?"+_mm.uc[_mm.ucStatus].pmtr.join("&")+para.join("")+"&poi_code="+il+"&srt=rent_price,distance";
*/
		var pmSelector=document.getElementById("pm");
		var pmValue= pmSelector.options[pmSelector.selectedIndex].value;

		if(_ids.split(",").length >70){
			var ina=new Array();
			var iva=new Array();
			for(var i=0; i<_mm.uc[_mm.ucStatus].pmtr.length; i++){
				var param=(_mm.uc[_mm.ucStatus].pmtr[i]).split("=");
				ina.push(param[0]);
				iva.push(param[1]);
			}
			ina.push("poi_code");ina.push("pm");ina.push("start");ina.push("srt");
			iva.push(_ids);iva.push(pmValue);iva.push(1);iva.push("rent_price,distance");
			iframePostFunction("selectedPOI",ina,iva)
		}
		else{

			if(!skw) var u= "http://"+host+"/map/uc/PoiAttr?"+_mm.uc[_mm.ucStatus].pmtr.join("&")+"&poi_code="+il+"&srt=room_status,distance&pm="+pmValue;
			else var u= "http://"+host+"/map/uc/PoiAttr?"+_mm.uc[_mm.ucStatus].pmtr.join("&")+"&poi_code="+il+"&srt=rent_price,distance&pm="+pmValue;

			if(_mm.customParam) u+=_mm.customParam;
			_mm.listURLPoint=u;
	//debug.print(u);
	//alert(document.getElementById("selectList").style.display);
			poiList.location.replace(u);
		}
		changeListB("poi_point",false);
		_mm.ucStatus=0;
	}
}

function iframePostFunction(formName,inputNameArray, inputValueArray,reuseFlag){
	var form4=document.getElementById(formName);
	if(!reuseFlag){
		initIframePost(formName);
	//alert(form4)
		var j=0
		for(var i=0; i<form4.childNodes.length; i++){
			if(form4.childNodes[i].nodeType!=1 || form4.childNodes[i].nodeName.toLowerCase()!="input") continue;
			form4.childNodes[i].name=inputNameArray[j];
			form4.childNodes[i].value=inputValueArray[j];
			j++;
			if(!inputValueArray[j]) break;
		}
	//	window.open('',"test",'');

	//	form4.target="test";
		form4.target="poiList"
		form4.action="http://"+location.host+"/map/uc/PoiAttr";
		form4.submit();
	}
	else{
		form4.submit();
	}
}

function initIframePost(formName){
	var form4=document.getElementById(formName);
//alert(form4)
	for(var i=0; i<form4.childNodes.length; i++){
		if(form4.childNodes[i].nodeType!=1 || form4.childNodes[i].nodeName.toLowerCase()!="input") continue;
		form4.childNodes[i].name="";
		form4.childNodes[i].value="";
	}
}

function setBGImg(_Tab,imgSrc){
	var DOMa=document.getElementById("poi_all");
	var DOMp=document.getElementById("poi_point");

		DOMp.onclick="";
//		DOMp.style.cursor="default";
//		DOMp.status="_off";
		DOMp.className="off";
		DOMp.style.display="none";
		//積和コードが無いとき（一応ShaMaisonでも使えるように）
		if(!skw) DOMp.src="/sh/images/point_off.gif";
		else DOMp.src="/sh/images/mast/"+skw+"/point_off.gif";
		DOMa.onclick="";
//		DOMa.style.cursor="default";
//		DOMa.status="_on";
		DOMa.className="on";
//		DOMa.src="/sh/images/all_on.gif";
		//積和コードが無いとき（一応ShaMaisonでも使えるように）
		if(!skw) DOMa.src=(stl!="00")? "/sh/images/all_on.gif" : "/sh/images/all00_on.gif";
		else DOMa.src="/sh/images/mast/"+skw+"/all_on.gif";
		DOMa.style.display="block";
/*
		if(DOM.getAttribute("status")=="on")
		DOM.style.backgroundImage= imgSrc? "url("+imgSrc+")" : "";
		//変えた画像がoffだったら
		if(imgSrc.indexOf("off")>0){
			 DOM.onclick=function(){changeListB(this.id)};
			 DOM.style.cursor="pointer";
		}
*/
}


function changeListB(idf,listChangeFlag){
	var DOM1p =document.getElementById("poi_all");
	var DOM2p =document.getElementById("poi_point");
	//地図内リストをアクティブにするとき
	if(idf.indexOf("all")>0){
		checkList('undo');
		_mm.listURLPoint=poiList.location.href;
		if(! skw) {
			DOM1p.src=(stl!="00")? "/sh/images/all_on.gif" : "/sh/images/all00_on.gif";
			DOM2p.src="/sh/images/point_off.gif";
		}
		else {
			DOM1p.src="/sh/images/mast/"+skw+"/all_on.gif"
			DOM2p.src="/sh/images/mast/"+skw+"/point_off.gif";
		}
//alert(_mm.listURLAll)
		//イベント切り替え
		DOM1p.onclick="";
//		DOM2p.onclick=function(){changeListB(this.id);};
//		DOM1p.style.cursor="default";
		DOM1p.style.display="block";
//		D	OM2p.style.cursor="pointer";
		DOM1p.className="on";
		DOM2p.className="off";

//		DOM1p.status="_on";
//		DOM2p.status="_off";
		poiList.location.replace(_mm.listURLAll);
	}

	//選択したPOIをアクティブにするとき
	if(idf.indexOf("point")>0){
		checkList('undo');
		//積和コードが無いとき（一応ShaMaisonでも使えるように）
		if(!skw){
			DOM1p.src="/sh/images/all_off.gif";
			DOM2p.src=(stl!="00")? "/sh/images/point_on.gif" : "/sh/images/point00_on.gif";
		}
		else{
			DOM1p.src="/sh/images/mast/"+skw+"/all_off.gif";
			DOM2p.src="/sh/images/mast/"+skw+"/point_on.gif";
		}
//		DOM2p.src="/sh/images/point_on.gif";
//		DOMC.style.backgroundImage="url(/pitat/images/table_Map2_bg.gif)";
		//画像切り替え
		//イベント切り替え
//		DOM1p.onclick=function(){changeListB(this.id)};
		DOM2p.onclick="";
//		DOM1p.style.cursor="pointer";
//		DOM2p.style.cursor="default";
		DOM2p.style.display="block";
		DOM1p.className="off";
		DOM2p.className="on";

//		DOM1p.status="_off";
//		DOM2p.status="_on";
		if(listChangeFlag) {
			if((_ids.split(",")).length <= 70 ) poiList.location.replace(_mm.listURLPoint);
			else iframePostFunction("selectedPOI",null,null,true);
		}
	}

}

//para1がtrueでpara2を入力できなくする
function condDisable(flag,para2){
	var outPara=document.getElementsByName(para2);
	var DF=true;
	for(var i=0; i<outPara.length; i++){
		if(outPara[i].checked){
				outPara[i].checked="";
		}
		if(flag||flag=="checked") outPara[i].disabled="disabled";
		else outPara[i].disabled="";
	}
}


function douki(id1,id2){
	document.getElementById(id1);
	document.getElementById(id2);
}

//デフォルトの絞り込み条件で否定がある場合、絞込み条件を追加する
function setValue(obj){
	var elms = document.getElementsByName(obj.name);
	var flag1=false;
	var flag2=false;
	var past=0;
//クリックされていたら、value値を変える
	for(i=0; i<elms.length;i++){
//debug.print(elms.length);
		if(elms[i].checked==true){
			elms[i].value=elms[i].getAttribute("checkedValue");
//チェックがあった
//2個以上チェックがある
			if(i!=past&&flag1) {flag2=true;/*debug.print(i)*/}
			past=i;
			flag1=true;
		}
		else{
			elms[i].value="";
		}
	}
//チェックが一個も無かったとき
	if(!flag1){
//debug.print("A");
//		elms = document.getElementsByName(obj.name);
		for(var i=0; i<_mm.uc.length;i++){
			_mm.uc[i].pmtr.push(obj.name+"="+elms[0].getAttribute("dv"));
		}
	}
//一個だけチェックがあったとき
	else if(flag1 && !flag2 ) {
//debug.print("B");
		for(var i=0; i<_mm.uc.length;i++){
			if(_mm.uc[i].pmtr.length >7 ) var out =_mm.uc[i].pmtr.pop();
//debug.print(out);
		}
	}
//debug.print(_mm.uc[0].pmtr);
}

function new_window_open(URL){
	if(URL) window.open(URL);
}


/* 指定したidのリストを表示させる*/
function listVisible(listId1){
		var list2;
		var list1=document.getElementById(listId1);

		if(listId1=="poiList") list2 = document.getElementById("selectList");
		else list2=document.getElementById("poiList");
		if(_bi.type!=3) {
			if((!list1 || !list2)) return;
			list2.style.display="none";
			list2.style.visibility="hidden";
			list2.style.zIndex=0;
			list1.style.zIndex=10;
			list1.style.display="block";
			list1.style.visibility="visible";
		}
		else{
			var host=location.host;
			if(listId1=="poiList"){
				if(!_mm.conflict){
					_mm.ucStatus=0;
					var u= "http://"+host+"/map/uc/"+_mm.uc[_mm.ucStatus].type+"?"+_mm.uc[_mm.ucStatus].pmtr.join("&")+_mm.pmtr.join("");
					poiList.location.replace(u);
					_mm.ucStatus=0;
				}
			}
			else{
				if(!_mm.conflict){
					_mm.ucStatus=1;
					var u= "http://"+host+"/map/uc/"+_mm.uc[_mm.ucStatus].type+"?"+_mm.uc[_mm.ucStatus].pmtr.join("&")+_mm.pmtr.join("")+"&poi_code="+_ids;
					poiList.location.replace(u);
					_mm.ucStatus=0;
				}

			}
		}
}

function addBalloon(ucType,nameArray,valueArray){
	var qdoc="";
	var path="/map/uc/"+ucType+"?";
	if(nameArray&&valueArray&&nameArray.length==valueArray.length){
		for(var i =0; i< nameArray.length; i++){
			if(i!=0) qdoc+="&";
			qdoc+=nameArray[i]+"="+valueArray[i];
		}
	}
	var XHR=AlpsUtil.getXMLHttp();
	var e=document.getElementById("balloonPopup");
	if(!e)return;
	if(!XHR)return;
	var URL=path+qdoc;
//debug.print(URL)
	XHR.open("GET",URL,true);
	if(_bi.type!=1) XHR.overrideMimeType("application/xml");
	 XHR.setRequestHeader("Referer", location.href);
	if(_bi.type==1) XHR.setRequestHeader("Content-Type", "text/xml; charset=UTF-8;");
	else XHR.setRequestHeader("Content-Type", "application/application/x-www-form-urlencoded; charset=UTF-8");
	XHR.onreadystatechange=function(){
		if(XHR.readyState==4){
		var pop=(XHR.responseText.toLowerCase().indexOf("div")>0)? XHR.responseText : "";
		e.innerHTML=pop;
		e.style.display="block";
		}
	};
	XHR.send(null);

};


function moveBalloon(icon){
	var node=icon;
	var mapPos=getObjPos2(document.getElementById("map"));
	var index=icon.icnid;
//alert("icnid:"+index);
//alert("poi_icon_"+parseInt(index+1));
	while(node.id!="poi_icon_"+parseInt(index+1)){
		node=node.parentNode;
//alert(node.id);
	}
	var x=parseInt(node.style.left);
	var y=parseInt(node.style.top);
//alert(x+","+y);
//alert(mapPos);

	document.getElementById("balloonPopup").style.top=parseInt(y+mapPos.y)+"px";
	document.getElementById("balloonPopup").style.left=parseInt(x+mapPos.x)+"px";
};

function clearBalloon(){
	document.getElementById("balloonPopup").style.display="none";
	document.getElementById("balloonPopup").innerHTML="";

};


function getCustomParamater(){
//	if(!_propert) return;
	var param=location.hash;
	var ret=null;
	var cacheParam=document.getElementById("cacheParam");
//debug.print(cacheParam.value);
//debug.print("in:"+param);
	if(!cacheParam.value&&param&&param.length>=1){
//debug.print("キャッシュがないとき")
		param=parseCustomCondition(param);
/*		dispValue();
		ret=translateCondition(param);
//alert(ret);
//		parseCustomCondition(ret[1]);
//debug.print("out:"+ret[1]);
		return (ret);
*/	}
	else if(cacheParam.value){
//debug.print("キャッシュがあるとき")
		//裏じゃないのを削る
		param=parseCustomCondition(cacheParam.value);
	}
	else{
		return ret;
	}
	dispValue();
	ret=translateCondition(param);
	return (ret=="&")? "" :ret;
};

/*
裏パラメータを読み込んで、絞り込み用HTML要素があった場合はその値に設定する。
*/
function parseCustomCondition(_property){
	var ret=_property;
	var retA=new Array();
	var doneSTO=false;
	var sindexSTO=-1;
	var doneCTO=false;
	var sindexCTO=-1;
//	var retV=null;
//debug.print(ret);
	if(ret && ret.match(/&/)){
		var conds=ret.split('&');
		//#を削る
		if(conds[0]=='#') conds.shift();
		for(var i= 0; i< conds.length; i++){

//debug.print(i+" : conds ::"+conds);
//debug.print("cond["+i+"] : "+conds[i]);
//debug.print("--------------");

			if(!conds[i]) continue;
			var cond=conds[i].split('=');
			var e=document.getElementsByName(cond[0]);
//debug.print(cond[0]+":"+e+", "+e.length);
			if(e.length ==0 && !e.tagName){
				e=document.getElementById(cond[0]);
				if(!e) {
					retA.push(conds[i]);
					continue;
				}
				if( e.tagName.toLowerCase()=="select"){
				//nameでDOMが参照できなくて、selectタグのとき（CMJとTCIでパラメータ名が異なる場合）
//debug.print("A:"+cond[0]);
	//debug.print(cond[0]+" : "+e.tagName+", len:"+e.length);
					for(var j=0; j<e.options.length; j++){
	//debug.print(e.options[j].value+"?"+cond[1]);
//						if(e.options[j].value== cond[1]){ e.options[j].selected="selected"; /*最後なら抜ける*/if(j==e.options.length-1){conds.shift();i--;}break;}
						if(e.options[j].value== cond[1]){
							e.options[j].selected="selected"; /*最後なら抜けるif(j==e.options.length-1){}*/
							if(cond[0]=="CTO") { sindexCTO = j; doneCTO=true;}
							else if(cond[0]=="STO") { sindexSTO = j; doneSTO=true;}
							else if(cond[0]=="CFR") { makeRange('CFR','CTO','priceR',1);if(doneCTO) document.getElementById("CTO").options[sindexCTO-j].selected="selected"}
							else if( cond[0]=="SFR") { makeRange('SFR','STO','areaR',2);if(doneSTO) document.getElementById("STO").options[sindexSTO-j].selected="selected"}
							break;
						}
					}
				}
				else if(e.tagName.toLowerCase()=="input"){
				//nameでDOMが参照できなくて、inputタグのとき（CMJとTCIでパラメータ名が異なる場合）

				}
			}

			else if(e.length && e.length > 1){
			//nameでDOMが参照でき、複数該当する場合（CMJとTCIでパラメータ名が同じ場合）
//debug.print("B:"+cond[0]);
//debug.print(cond[0]+" : "+e[0].tagName+", len:"+e.length);
				if(e[0].tagName == undefined) {
//					retA.push(conds[i]);
					continue;
				}
				//複数あるとき
//debug.print(e[0].tagName.toLowerCase());
				//inputタグ
				if(e[0].tagName.toLowerCase()=="input"){

					//複数の値が選択されている可能性がある
					var v=cond[1].split(",");
					for(var k=0; k<v.length; k++){
						for(var j=0; j<e.length; j++){
//debug.print(e[j].value+"?"+v[k]);
							if(v[k] !="" && e[j].value.indexOf(v[k]) > -1){
//							if(e[j].value== v[k]){
								e[j].checked=true;
//								conds.splice(i,1,null);
//								if(k==v.length-1){
//									conds.shift();
//									 i--;
//								}
								break;
							}
						}
					}
				}
				else if(e[0].tagName.toLowerCase()=="select"){
					for(var j=0; j<e.length; j++){
//debug.print(e[j].options.length);
						for(var k=0; k<e[j].options.length; k++){
//debug.print(e[j].options[k].value+"?"+cond[1]);
							if(e[j].options[k].value== cond[1]){
								e[j].options[k].selected="selected";
//								conds.splice(i,1,null);
//								conds.shift();
//								i--;
								break;
							}
						}
					}
				}
			}
			else{
				//nameでDOMが参照でき、1つのみ該当する場合（CMJとTCIでパラメータ名が同じ場合）
//debug.print("C:"+cond[0]);
				//inputタグ
				if(e[0].tagName.toLowerCase()=="input"){

//debug.print("name:"+e[0].name+", value:"+cond[1]+", ");
					if(cond[1]!= "" && cond[1]!= 0 && cond[1]!= false){
						e[0].checked=true;
//						conds.splice(i,1,null);
//							conds.shift();
//							i--;
					}
				}
				else if(e[0].tagName.toLowerCase()=="select"){
					for(var j=0; j<e[0].options.length; j++){
						if(e[0].options[j].value== cond[1]){
							e[0].options[j].selected="selected";
//							conds.shift();
//							i--;
						}
					}
				}
			}
		}
//debug.print("conds.length:"+conds.length);
//		 retV=(conds.length > 1 )? conds.join("&") :conds.toString();
		 retA=(retA.length > 1 )? retA.join("&") :retA.toString();
//		retV="&"+retV;
		retA="&"+retA;
//debug.print("retA:"+retA);
		return retA;
	}
};

/*
function parseCustomCondition(_property){
	var ret=_property;
debug.print(ret);
	if(ret){
		var conds=ret.split('&');
		for(var i= 1; i< conds.length; i++){
			var cond=conds[i].split('=');
			var e=document.getElementsByName(cond[0]);
debug.print(cond[0]+" : "+e[0].tagName+", len:"+e.length);
			if(e[0].tagName == undefined) break;
			//複数あるとき
			if(e.length && e.length > 1){
debug.print(e[0].tagName.toLowerCase());
				//inputタグ
				if(e[0].tagName.toLowerCase()=="input"){
					for(var j=0; j<e.length; j++){
						if(e[j].value== cond[1]) e[j].checked=true;
					}
				}
				else if(e[0].tagName.toLowerCase()=="select"){
					for(var j=0; j<e.length; j++){
debug.print(e[j].options.length);
						for(var k=0; k<e[j].options.length; k++){
debug.print(e[j].options[k].value+"?"+cond[1]);
							if(e[j].options[k].value== cond[1]) e[j].options[k].selected="selected";
						}
					}
				}
			}
			else{
				//inputタグ
				if(e[0].tagName.toLowerCase()=="input"){
					if(cond[1]!= "" || cond[1]!= 0 || cond[1]!= false) e[0].checked=true;
				}
				else if(e[0].tagName.toLowerCase()=="select"){
					for(var j=0; j<e[0].options.length; j++){
						if(e[0].options[j].value== cond[1]) e[0].options[j].selected=true;
					}
				}
			}
		}
	}
};
*/


/*
パラメータの際を吸収する

*/
function translateCondition(_property){
	var ret=_property
//debug.print(ret);
	if(ret){
//価格最大値、最小値
		if( (ret.search(/&CFR/) >= 0 ) && (ret.search(/&CTO/) >= 0)){
//debug.print("a");
			ret=ret.toString().replace(/CFR/,"rent_price");
			ret=ret.toString().replace(/&CTO=/,':');
		}
		else if(ret.search(/&CT/) >= 0){
			ret=ret.toString().replace(/CFR=/,"rent_price=:");
		}
		else if(ret.search(/&CFR/) >= 0){
			var props=ret.split('&');
			for(var i=0 ; i<props.length; i++){
				if(props[i].search(/CTO/) >= 0){
					props[i]=props[i].replace(/CTO/,"rent_price");
					props[i]+=":"
					break;
				}
			}
			ret=props.join('&');
		}

//エリア面積最大値、最小値 SFR STO
		if( (ret.search(/&SFR/) >= 0 ) && (ret.search(/&STO/) >= 0)){
			ret=ret.toString().replace(/SFR/,"area_size");
			ret=ret.toString().replace(/&STO=/,':');
		}
		else if(ret.search(/&STO/) >= 0){
			ret=ret.toString().replace(/SFR=/,"area_size=:");
		}
		else if(ret.search(/&SFO/) >= 0){
			var props=ret.split('&');
			for(var i=0 ; i<props.length; i++){
				if(props[i].search(/STO/) >= 0){
					props[i]=props[i].replace(/STO/,"area_size");
					props[i]+=":"
					break;
				}
			}
			ret=props.join('&');
		}
	}


//debug.print("ret:"+ret);
return ret;
};

function decodeURL(array){
	retArray=array;
//debug.print(retArray)
	outArray=new Array();
	for (var i=0; i< retArray.length; i++){
		if(!retArray[i]||!retArray[i].match(/=/)) continue;
		var q=retArray[i].split("=");
//debug.print(q)
		if(q[1].indexOf(":") != -1 && (q[0]=="&area_size" || q[0] =="&rent_price")){
			var qd=q[1].split(":");
			for(var j=0; j<qd.length;j++){
				if(qd[j]){
//debug.print(qd[j])
					var outValue=(q[0].indexOf("area") == -1 )?  ( (j==0)? ("&CFR="+qd[j]) : ("&CTO="+qd[j]) ) : ((j==0)? ("&SFR="+qd[j]) : ("&STO="+qd[j]) );
					outArray.push(outValue);
				}
			}
		}
		else{
			outArray.push(retArray[i]);
		}
	}
	return outArray;
};

function parseCache(){
	var cPOI=document.getElementById("cachePOI").value;
	var cList=document.getElementById("cacheList").value;
	var host=location.host;
	window.setTimeout( function(){_mm.connection("GET",cPOI);},0);
	window.setTimeout( function(){if(host) eval(_mm.poiListName).location.replace(cList)},0);
	window.setTimeout(function(){_mm.checkListDisplay();},3000);
};


function checkScrollHeight(listHeight){
//alert(document.getElementById("poiList").getAttribute("baseheight"));
	if(listHeight){
		if(document.getElementById("poiList").getAttribute("baseheight") >= listHeight) parent.document.getElementById("poiList").height=listHeight;
		else  document.getElementById("poiList").height = document.getElementById("poiList").getAttribute("baseheight");
	}
};

function registReq(type,queryArray){
	if(!_mm.auto) return;

	var i_f_regist=AlpsUtil.getXMLHttp();
	if(skw) var branchiBaseUrl=skwfUrl[skw];
	//積和コードが無いとき（一応ShaMaisonでも使えるように）
	if(!skw) var url=(type=="cond")? "/sh_tci/save/regist" : (type=="id")? "/sh_tci/favorite/regist" : "/sh_tci/favorite/createsession";
	else var url=(type=="cond")? "/sh_tci2"+branchiBaseUrl+"save/regist" : (type=="id")? "/sh_tci2"+branchiBaseUrl+"favorite/regist" : "/sh_tci2"+branchiBaseUrl+"favorite/createsession";
//	var url=(type=="cond")? "http://202.143.67.40/save/regist" : "http://202.143.67.40/favorite/regist";
//	var url="/sh/xml/retvalue2.xml";
	var qdoc="";
	var styleF="";
//debug.print(document.getElementById("roomId").value);
//debug.print(queryArray.length);
	if(type!="ses"){
		qdoc=queryArray;
		if(qdoc.length >0){
			if(type=="cond"){
				qdoc.shift();
				qdoc=decodeURL(qdoc);
				qdoc=qdoc.join("");
	//debug.print("stl:"+stl);
				if(stl && parseInt(stl)<4) styleF="&STL="+stl;
				qdoc+=styleF;
//				qdoc+="&scl="+_mm.ms.map.getCurrentScale();
			}
			else{qdoc="&"+qdoc.join("");}
		}
	}
//debug.print("QUERY:"+qdoc);
//debug.print("URL:"+url);

/*とりあえずリクエストしない*/
//	return;
	i_f_regist.open("POST",url , true);


//debug.print("open");
//	i_f_regist.setRequestHeader("Referer", location.href);
	i_f_regist.setRequestHeader("Referer", "http://maps.skwf.net");
//	var contentType=(_bi.type==1)? "text/xml; charset=UTF-8;" : "application/x-www-form-urlencoded; charset=UTF-8;";
//	i_f_regist.setRequestHeader("content-type",contentType);
	i_f_regist.setRequestHeader("content-type","application/x-www-form-urlencoded;charset=UTF-8");

	i_f_regist.onreadystatechange=function() {
//debug.print("ready state : "+i_f_regist.readyState);
//debug.print("status : "+i_f_regist.status);

		if (i_f_regist.readyState == 4 ) {
//debug.print("result : "+i_f_regist.responseText);
			if(type!= "ses") openResult(type,i_f_regist.responseXML);
//			else{alert(i_f_regist.responseText);}
		}
	};
	i_f_regist.send(encodeURI(qdoc));
//debug.print("send");
	if(_bi.type==3 && type!="ses"){
		setTimeout(function(){
/*debug.print("status : "+i_f_regist.status);*/
//debug.print("status : "+i_f_regist.status);
//debug.print("status : "+i_f_regist.readyState);
			if(i_f_regist.status==undefined) openResult(type,null);
		},1000);
	}
};

function uriEncode(data,url){
	var encdata =(url.indexOf('?')==-1)?'?dmy':'';
	if(typeof data=='object'){
		for(var i in data)
			encdata+='&'+encodeURIComponent(i)+'='+encodeURIComponent(data[i]);
		}
	else if(typeof data=='string'){
		if(data=='')return '';
		//&と=で一旦分解しencode
		var encdata = '';
		var datas = data.split('&');
		for(var i=1;i<datas.length;i++){
			var dataq = datas[i].split('=');
			encdata += '&'+encodeURIComponent(dataq[0])+'='+encodeURIComponent(dataq[1]);
		}
	}
	return encdata;
}

function sendCond(){
	var regq=new Array();
//	document.getElementById('cond_correct').style.display="none";
	regq=_mm.gatherConditions(regq);
	regq.push("&nl="+document.getElementById("cacheNl").value);
	regq.push("&el="+document.getElementById("cacheEl").value);
	if(document.getElementById("where")){
		regq.push("&PRF="+document.getElementById("where").getAttribute("admi2"));
		regq.push("&CTY="+document.getElementById("where").getAttribute("admi3"));
		if(regq.length) registReq("cond",regq);
	}
};

function sendID(){
	poiList.holdCheck();
	document.getElementById('id_correct').style.display="none";
	document.getElementById('id_error').style.display="none";
	if(document.getElementById('roomId').value){
//debug.print('in');
		var sendId =new Array('PCD='+document.getElementById('roomId').value);
		document.getElementById('tabBalloon11').className="bgBorderballoonA01";
//debug.print(sendId);
		registReq("id",sendId);
		document.getElementById('id_correct').style.display="block";
	}
	else{
		document.getElementById('tabBalloon11').className="bgBorderballoonA07";
		document.getElementById('id_error').style.display="block";
	}
};

function openResult(type,XML){
//if(XML) debug.print("XML:"+XML.getElementsByTagName('retvalue').length);
//	document.getElementById(type+'_correct').style.display="block";
	var tDivF=document.getElementById(type+"_title_fail");
	var tDivS=document.getElementById(type+"_title_succ");
	tDivF.style.display="none";
	tDivS.style.display="none";
	var div=document.getElementById(type+"_data");
	var mess=new Array();
	var retcd=false;
	var code;
	var retText={"0":"物件は", "9":"お気に入り物件"};
	if(!XML || XML.getElementsByTagName('retvalue').length <= 0){
//debug.print("in")
		var XML;
		var err=AlpsUtil.createXMLDOM();
		var errR=err.createElement("retvalue");
		var errCD=err.createElement("retcd");
		var err1=err.createElement("row1");
		var err2=err.createElement("row2");
		var errTextCD=err.createTextNode("9");
		var errText1=err.createTextNode("登録に失敗しました。");
		errCD.appendChild(errTextCD);
		err1.appendChild(errText1);
		errR.appendChild(errCD);
		errR.appendChild(err1);
		errR.appendChild(err2);
		err.appendChild(errR);
		XML=err;
	}
//debug.print(XML.hasChildNodes());
	var messData=XML.getElementsByTagName("retvalue")[0].childNodes;

	for(var i=0; i< messData.length; i++){
		if(messData[i].nodeType!=1) continue;
		//最後の「N件になりました」の記述
		if(i== messData.length-1 && messData[i].firstChild) {
			document.getElementById(type+"_num").innerHTML=messData[i].firstChild.nodeValue;
			break;
		}
		if(messData[i].nodeName!="retcd"){
			if(messData[i].hasChildNodes() && !retcd){
				for(var j=0; j<messData[i].childNodes.length ;j++){
					if(messData[i].childNodes[j].nodeType==1){
						if(messData[i].childNodes[j].firstChild) mess.push('<'+messData[i].childNodes[j].tagName+'>'+messData[i].childNodes[j].firstChild.nodeValue+'</'+messData[i].childNodes[j].tagName+'>');
					}
					else{
						if(messData[i].childNodes[j].nodeValue) mess.push(messData[i].childNodes[j].nodeValue);
					}
				}
				mess.push("<br />");
			}
			else{
				mess.push("<br />");
			}
		}
		else{
				if(type=='cond'){
//					document.getElementById(type+"_title").innerHTML=messData[i].firstChild.nodeValue;
					var resultNode=messData[i].nextSibling;
					while(resultNode.nodeType!=1){
						resultNode=resultNode.nextSibling;
					}
					if( resultNode.hasChildNodes() && resultNode.firstChild.nodeValue.search(/登録/)>=0 && resultNode.firstChild.nodeValue.search(/.。/)>=0){
//debug.print("head:"+retText[messData[i].firstChild.nodeValue]);
						tDivF.innerHTML=resultNode.firstChild.nodeValue;
						tDivF.style.display="block";
						retcd=true;
					}
					else{
						tDivS.style.display="block";
					}
				}
				else{
					var resultNode=messData[i].nextSibling;
					while(resultNode.nodeType!=1){
						resultNode=resultNode.nextSibling;
					}
//debug.print("nodeType:"+resultNode.nodeType);
//debug.print("nodeType:"+resultNode.hasChildNodes()+", "+resultNode.firstChild.nodeValue.indexOf("登録"))
					//失敗時
//debug.print("s:"+resultNode.firstChild.nodeValue.search(/登録/) +","+resultNode.firstChild.nodeValue.search(/.。/));
					if( resultNode.hasChildNodes() && resultNode.firstChild.nodeValue.search(/登録/)>=0 && resultNode.firstChild.nodeValue.search(/.。/)>=0){
//debug.print("head:"+retText[messData[i].firstChild.nodeValue]);
						tDivF.innerHTML=retText[messData[i].firstChild.nodeValue]+resultNode.firstChild.nodeValue;
						tDivF.style.display="block";
						retcd=true;
					}
					else{
						tDivS.style.display="block";
					}
				}
		}
	}
	div.innerHTML=mess.join("");
	if(type=="cond") document.getElementById("popup10").style.visibility="visible";
	else if(type=="id") document.getElementById("popup11").style.visibility="visible";
};

function slideBalloon(balNum,type){
//debug.print(_mm.slideStatus)
//debug.print("in :: id="+balNum +", type:" + type);
	var inIdNum=balNum;
	var inType=type;
	if(_mm.slideStatus==0){
		if(type=="forward"){
			_mm.slideStatus=260;
			document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.left=260+'px';
			document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.display='block';
			document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.position='absolute';
		}
		else{
			_mm.slideStatus=-260;
			document.getElementById('balloon_'+(parseInt(balNum)-parseInt(1))).style.left=-260+'px';
			document.getElementById('balloon_'+(parseInt(balNum)-parseInt(1))).style.display='block';
			document.getElementById('balloon_'+(parseInt(balNum)-parseInt(1))).style.position='absolute';
		}
		window.setTimeout(function(){moveSlideBalloons(inIdNum,inType)},100);
	}
};

function moveSlideBalloons(balNum,type){
//debug.print("id="+balNum +", type:" + type);
	var inIdNum=balNum;
	var inType=type;
	if(type=="forward"){
//debug.print('balloon_'+(parseInt(balNum)+parseInt(1))+":"+document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))))
//debug.print(parseInt(document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.left))
		if(parseInt(document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.left)>0){
			_mm.slideStatus-=30;
			document.getElementById('balloon_'+(parseInt(balNum))).style.left=(_mm.slideStatus-260)+'px';
			document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.left=_mm.slideStatus+'px';
			window.setTimeout(function(){moveSlideBalloons(inIdNum,inType)},5);
		}
		else{
				document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.left=0+'px';
			if(_bi.type!=1){
//				document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.visibility='hidden';
				document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.zIndex='11000';
				document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.position='relative';
				document.getElementById('balloon_'+(parseInt(balNum))).style.display='none';
	//			document.getElementById('balloon_'+(parseInt(balNum))).style.position='relative';
				document.getElementById('balloon_'+(parseInt(balNum))).style.zIndex='0';
//				document.getElementById('balloon_'+(parseInt(balNum)+parseInt(1))).style.visibility='visible';
			}
			_mm.slideStatus=0;
		}
	}
	else{
		if(parseInt(document.getElementById('balloon_'+(parseInt(balNum)-parseInt(1))).style.left)<0){
			document.getElementById('balloon_'+(parseInt(balNum))).style.left=_mm.slideStatus+'px';
			_mm.slideStatus+=30;
			document.getElementById('balloon_'+(parseInt(balNum))).style.left=(_mm.slideStatus+260)+'px';
			document.getElementById('balloon_'+(parseInt(balNum)-parseInt(1))).style.left=_mm.slideStatus+'px';
			window.setTimeout(function(){moveSlideBalloons(inIdNum,inType)},5);
		}
		else{
			document.getElementById('balloon_'+(parseInt(balNum)-parseInt(1))).style.left=0+'px';
			if(_bi.type!=1){
				document.getElementById('balloon_'+(parseInt(balNum)-parseInt(1))).style.zIndex='9999';
				document.getElementById('balloon_'+(parseInt(balNum)-parseInt(1))).style.position='relative';
				document.getElementById('balloon_'+(parseInt(balNum))).style.display='none';
	//			document.getElementById('balloon_'+(parseInt(balNum))).style.position='relative';
				document.getElementById('balloon_'+(parseInt(balNum))).style.zIndex='0';
			}
			_mm.slideStatus=0;
		}
	}
//debug.print("ok")
};


