function bJ(R,dp){this.R=R;this.dp=(dp)?dp:"";this.div=this.hy();R.appendChild(this.div);this.mo=null;this.imap="";};bJ.prototype.kC=function(imap){this.imap=imap;};bJ.prototype.iY=function(dp){if(dp){this.dp=dp;this.gA();}};bJ.prototype.hy=function(){var div=document.createElement("div");div.id="fQ";this.R.appendChild(div);return div;};bJ.prototype.gA=function(){var he=this.div.childNodes;while(he.length>0){this.div.removeChild(he[0]);}var T=this.hV();var imap=this.imap;imap.aD.eY();if(T.length==0){var ev=document.createElement("p");ev.innerHTML="No Result!";this.div.appendChild(ev);}for(var i=0;i<T.length;i++){var ev=document.createElement("a");ev.href="javascript:void(0)";ev.innerHTML=T[i].name+", "+T[i].bC+", "+T[i].bK;ev.mj=T[i].ai.x;ev.mn=T[i].ai.y;var icon=new fD();icon.image="image/ui12.gif";icon.az={width:16,height:32};icon.bG={width:32,height:32};icon.shadow="image/shadow.png";icon.aO={width:10,height:34};icon.aX={width:37,height:34};icon.aT="0,0,0,129,129,129,80,200,174,129,249,129,249,0";T[i].m=new bu(ev.mj,ev.mn);var cD=new fI(T[i],{icon:icon,title:T[i].name});ev.cD=cD;ev.onclick=function(){if(imap){imap.aD.eY();imap.ar(this.cD.m,true);imap.aD.gr(this.cD);imap.aD.refresh();imap.bq(this.cD.m,this.cD.aW,null);}return false;};this.div.appendChild(ev);this.div.appendChild(document.createElement("p"));}};bJ.prototype.hV=function(){var tags=this.dp.getElementsByTagName("GeoPosition");var ht=new Array();for(var i=0;i<tags.length;i++){var name=tags[i].getElementsByTagName("POIName")[0].firstChild.nodeValue;var ix=parseInt(tags[i].getElementsByTagName("X")[0].firstChild.nodeValue);var iy=parseInt(tags[i].getElementsByTagName("Y")[0].firstChild.nodeValue);var bC=tags[i].getElementsByTagName("Town")[0].firstChild.nodeValue;var bK=tags[i].getElementsByTagName("City")[0].firstChild.nodeValue;var bO=tags[i].getElementsByTagName("Category")[0].firstChild.nodeValue;var p=new mu(name,{x:ix,y:iy},bK,(bC)?bC:"&nbsp;",(bO)?bO:"&nbsp;");ht.push(p);}return ht;};function mu(name,ai,bC,bK,bO){this.name=name;this.ai=ai;this.bK=bK;this.bC=bC;this.bO=bO;};function bI(){this.url="EMapSDK.aspx";this.dp=new bl();this.jD=null;this.fy=200;this.dH=new Array();};bI.prototype.gF=function(dR){var lm=new Array();lm.push({iF:"CommandID",value:"Search0001"});lm.push({iF:"KeyWord",value:dR});lm.push({iF:"MaxRecord",value:this.fy});this.jd(lm);};bI.prototype.ji=function(ai,mL){};bI.prototype.jd=function(bc){var dR="";for(var i=0;i<bc.length;i++){if(i!=0){dR+="&"};if(bc[i].iF=="KeyWord"){dR+=bc[i].iF+"="+escape(bc[i].value);}else{dR+=bc[i].iF+"="+bc[i].value;}}var url=this.url;var lJ=this.lv;var source=this;var lW=new Ajax.Request(url,{method:"post",postBody:dR,onSuccess:function(ge){var xml=ge.responseXML;source.jD=xml;source.ip({jD:xml,source:source});}});};bI.prototype.t=function(f){this.dH.push(f);};bI.prototype.cd=function(f){};bI.prototype.ip=function(e){for(var i=0;i<this.dH.length;i++){this.dH[i](e);}};bI.prototype.hN=function(fb){this.fy=fb;};bI.prototype.hM=function(){return this.fy;};bI.prototype.iT=function(){return this.jD;};function bl(){this.bg=new Array();};bl.prototype.kV=function(){this.bg.clear();};bl.prototype.kp=function(){return this.bg;};bl.prototype.iN=function(index){return this.bg[index];};bl.prototype.iN=function(md,lY){return this.bg.slice(md,lY);};bl.prototype.lA=function(bg){if(bg.length){var iQ=null;for(var i=0;i<bg.length;i++){iQ=bg[i];this.bg.push(iQ);}}else{this.bg.push(bg);}};bl.prototype.jV=function(){return this.bg.length;};function lw(gO,bK,bC,type,bO){this.gO=gO;this.bK=bK;this.bC=bC;this.type=type;this.bO=bO;};function fI(ht,bL){var aW=document.createElement("div");aW.className="infowin";aW.innerHTML="<ui>"+"<li>名稱："+ht.name+"</li>"+"<li>縣市："+ht.bK+","+ht.bC+"</li>"+"<li>電話："+"02-1234-5678"+"</li>"+"</ui>";bL.aW=aW;return new U(ht.m,bL);} 