﻿/*
 * Compressed by iPow(www.iPow.cn)
 */
var TimerControl=function(C,E){var G,B,F=this;function A(){B=setTimeout(D,E)}function D(){if(F.run()===true)A();else B=null}this.reset=function(){this.stop();G=setTimeout(A,C)};this.run=function(){};this.stop=function(){if(G){clearTimeout(G);G=null}if(B){clearTimeout(B);B=null}}};function isChildOf(C,D,B){while(D&&D!=C){try{D=D.parentNode}catch(A){return false}}return D==C}function newEventPassthru(C,A,B){return function(D){if(B&&C[A])C[A](D||window.event,this);else GEvent.trigger(C,A,D||window.event,this)}}function fixEnterLeave(C,A,B){return function(E){var D=E.relatedTarget;if(this==D||isChildOf(this,D,A))return;if(B&&C[A])C[A](E,this);else GEvent.trigger(C,A,E||window.event,this)}}function getPriceStyle(A){if(A<=200)return"colorS";else if(A>200&&A<=300)return"colorM";else if(A>300&&A<=500)return"colorL";else return"colorXL"}function HotelMarker(A,C,D,B){this.order=A;this.latlng=C;this.props=D;this.seq=D.seq;this.markers=B;this.markerPic=D.markerPic}var markerID=0;HotelMarker.prototype=new GOverlay();HotelMarker.prototype.initialize=function(I){this._map=I;var A=this.props,E=null;this.width=21;this.height=25;this.width=19;this.height=22;var F="hmk"+(markerID++),L="hmm"+(markerID++),J=[];if(this.markerPic!=""&&this.markerPic!=undefined)J.push("<span  id=\"",L,"\"  class=\"left\"><a target=\"_blank\" href=\"",A.Url,"\"><img border=0 src=\"",this.markerPic+"\"/></a></span>");else J.push("<span  id=\"",L,"\"  class=\"left\"><a target=\"_blank\" href=\"",A.Url,"\">",this.seq+"</a></span>");J.push("<span class=\"right\" id=\"",F,"\">");if(A.Type=="Sight")J.push(" <span  "," class=\"bar_bg1 colorXL\"><a target=\"_blank\" href=\"",A.Url,"\">",A.Name,"</a></span>");if(A.Type=="Hotel")J.push(" <span  id=\"",F,"\" class=\"bar_bg1 ",getPriceStyle(A.Price),"\"><a target=\"_blank\" href=\"",A.Url,"\">\xa5",A.Price,"</span>");J.push("</span>");var B=this.markerPanel=document.createElement("div");B.className="link_icon";B.innerHTML=J.join("");this._map.getPane(G_MAP_MARKER_PANE).appendChild(B);var C=this.label=$("#"+F).get(0),D=this.mabel=$("#"+L).get(0),K=["click","dblclick","mousedown","mouseup"];for(var G=0;G<K.length;G++)var H=K[G];if(jQuery.browser.msie){GEvent.addDomListener(C,"mouseenter",newEventPassthru(this,"mouseenter",true));GEvent.addDomListener(C,"mouseleave",newEventPassthru(this,"mouseleave",true));GEvent.addDomListener(D,"mouseenter",newEventPassthru(this,"mouseenter",true));GEvent.addDomListener(D,"mouseleave",newEventPassthru(this,"mouseleave",true))}else{GEvent.addDomListener(C,"mouseover",fixEnterLeave(this,"mouseenter",true));GEvent.addDomListener(C,"mouseout",fixEnterLeave(this,"mouseleave",true));GEvent.addDomListener(D,"mouseover",fixEnterLeave(this,"mouseenter",true));GEvent.addDomListener(D,"mouseout",fixEnterLeave(this,"mouseleave",true))}};HotelMarker.prototype.showTip=function(A){if(!this.tipPanel){var B=this.props,E=this.tipPanel=document.createElement("div");E.className="icon_right1";var C="";if(B.Type=="Sight"){C=["<div class=\"top\">","<div style=\"clear: both; width: 100%;\" class=\"bar_bg4\">"];C.push("<span style=\"padding: 0px 5px; float: left;\">",B.Name,"</span>");C.push("<span style=\"float:right;padding-right:3px;\">",B.Price>0?"\xa5"+B.Price:"\u514d\u8d39","</span>");C.push("</div>");C.push("<div class=\"bottom\">");C.push("<span class=\"font1\">\u666f\u533a\u7c7b\u522b\uff1a",B.SightType,"</span>");C.push("<span class=\"font2\" >\u5730\u5740\uff1a",B.Address,"</span>");C.push("<img src=\"",B.ImageSrc,"\" class=\"ico\"/>");C.push("<span class=\"spanIco\">");C.push("<em class=\"emComm\">",B.CommCount,"</em>");C.push("<em class=\"emImg\">",B.PicCount,"</em>");C.push(" </span>");C.push(" <a target=\"_blank\" href=\"",B.Url,"\" class=\"mapLook\">\u67e5\u770b</a>");C.push("</div>");C.push("</div>")}if(B.Type=="Hotel"){C=["<div class=\"top\">","<div style=\"clear: both; width: 100%;\" class=\"bar_bg4 ",getPriceStyle(B.Price),"\">"];C.push("<span style=\"padding: 0px 5px; float: left;\">\xa5",B.Price,"</span>");C.push("<span style=\"float:right;padding-right:3px;\">",B.HotelType,"</span>");C.push("</div>");C.push("<div class=\"bottom\">");C.push("<span class=\"font1\">",B.Name,"</span>");C.push("<span class=\"font2\" >\u5730\u5740\uff1a",B.Address,"</span>");C.push("<img src=\"",B.ImageSrc,"\" class=\"ico\"/>");C.push("<span class=\"spanIco\">");C.push("<em class=\"emComm\">",B.CommCount,"</em>");C.push("<em class=\"emImg\">",B.PicCount,"</em>");C.push(" </span>");C.push(" <a target=\"_blank\" href=\"",B.Url,"\" class=\"mapLook\">\u9884\u5b9a</a>");C.push("</div>");C.push("</div>")}E.innerHTML=C.join("");$("#"+this._map.tipPanel).append(E);if(jQuery.browser.msie)$("#"+this._map.tipPanel).get(0).style.display="";if(jQuery.browser.msie){GEvent.addDomListener(E,"mouseenter",newEventPassthru(this,"mouseenter",true));GEvent.addDomListener(E,"mouseleave",newEventPassthru(this,"mouseleave",true))}else{GEvent.addDomListener(E,"mouseover",fixEnterLeave(this,"mouseenter",true));GEvent.addDomListener(E,"mouseout",fixEnterLeave(this,"mouseleave",true))}}var D=this._map.fromLatLngToContainerPixel(this.latlng);this.tipPanel.style.left=(D.x+this.width-1)+"px";this.tipPanel.style.top=(D.y-22)+"px";this.tipPanel.style.zIndex=this.markerPanel.style.zIndex+1;ddShow(this.tipPanel,A)};HotelMarker.prototype.hideTip=function(){ddShow(null)};HotelMarker.prototype.redraw=function(B){var A=this._map.fromLatLngToDivPixel(this.latlng);this.markerPanel.style.left=(A.x)+"px";this.markerPanel.style.top=(A.y-this.height)+"px";this.markerPanel.style.zIndex=100-this.seq};HotelMarker.prototype.remove=function(){GEvent.clearInstanceListeners(this.markerPanel);GEvent.clearInstanceListeners(this.label);GEvent.clearInstanceListeners(this.mabel);if(this.markerPanel.outerHTML)this.markerPanel.outerHTML="";if(this.markerPanel.parentNode)this.markerPanel.parentNode.removeChild(this.markerPanel);this.markerPanel=null;if(this.tipPanel){GEvent.clearInstanceListeners(this.tipPanel);if(this.tipPanel.outerHTML)this.tipPanel.outerHTML="";if(this.tipPanel.parentNode)this.tipPanel.parentNode.removeChild(this.tipPanel);this.tipPanel=null}};HotelMarker.prototype.copy=function(){return new HotelMarker(this.order,this.latlng,this.props)};var zindexId=0;HotelMarker.prototype.flickup=function(){if(this.markerPanel)this.markerPanel.style.zIndex=100+(zindexId++)};HotelMarker.prototype.mouseenter=function(){this.flickup();HotelMarker.showMarker(this.order,400,true,this._map,this.markers)};HotelMarker.prototype.mouseleave=function(){HotelMarker.showMarker(null,200,true,this._map,this.markers)};HotelMarker.resetMarkers=function(D,A){var B=D.markers;for(var G in B){D.removeOverlay(B[G]);D.clearOverlays()}$("#"+D.tipPanel).html("<div style=\"position:absolute;height:1px;width:1px;\"></div>");for(G=0;G<A.length;G++){var C=A[G];if(C.point){var E=B[G]=new HotelMarker(G,C.point,C,B);if(C.DomID){var F=$("#"+C.DomID).get(0);GEvent.addDomListener(F,"mouseover",newEventPassthru(B[G],"mouseenter",true));GEvent.addDomListener(F,"mouseout",newEventPassthru(B[G],"mouseleave",true))}D.addOverlay(E)}}};var hm_worker=null;function _showMarker(C,B,E,D){currentOrder=E.currentOrder;if(hm_worker)clearTimeout(hm_worker);hm_worker=null;if(C==E.currentOrder)return;if(E.currentOrder>=0&&D[E.currentOrder])D[E.currentOrder].hideTip();if(C>=0&&D[C]){var F=D[C],G=E.getBounds();if(!G.containsLatLng(F.latlng)){var A=GEvent.addListener(E,"moveend",function(){F.flickup();F.showTip(B);GEvent.removeListener(A)});E.panTo(F.latlng)}else{F.flickup();F.showTip(B,E)}}E.currentOrder=C}HotelMarker.showMarker=function(D,E,A,C,B){if(!E)E=20;if(hm_worker)clearTimeout(hm_worker);hm_worker=setTimeout(function(){_showMarker(D,A,C,B)},E)};HotelMarker.setCenterAndZoom=function(A,B){var C=getBound(B);A.setCenter(C.getCenter(),Math.min(A.getBoundsZoomLevel(C),15))};var ddControl=new TimerControl(50,50);ddControl.run=function(){var A=this.layer;if(A&&A.style.display==""){this.from+=15;if(this.from>this.to)this.from=this.to;if(jQuery.browser.msie){if(this.from>=100)A.style.filter="";else A.style.filter="alpha(opacity="+this.from+")"}else A.style.opacity=this.from/100;if(this.from>=this.to)return false;else return true}};function ddShow(D,B){var C=ddControl.layer;ddControl.stop();if(C)C.style.display="none";ddControl.layer=D;if(D)if(B){var E=20,A=100;if(jQuery.browser.msie)D.style.filter="alpha(opacity="+E+")";else D.style.opacity=E/100;D.style.display="";ddControl.from=E;ddControl.to=A;ddControl.reset()}else{if(jQuery.browser.msie)D.style.filter="";else D.style.opacity="";D.style.display=""}}function getBound(B){var D=new GLatLngBounds(),A=false;for(var E=0;E<B.length;E++){var C=B[E].point;if(C){A=true;D.extend(C)}}return A?extendBound(D):null}function extendBound(D,A){var E=D.toSpan(),C=D.getSouthWest(),B=D.getNorthEast();return D}var geocoder,globalMapData,hotels,mapInital=false,OLD_LEVEL,OLD_CENTER;function mapinitialize(F,A,I,D){var C=D;mapInital=true;var E,B=jQuery("#showmode").val();E=new GMap2(document.getElementById(A));E.tipPanel=I;E.currentOrder=null;E.markers={};E.TestPro="test only";E.addControl(new GSmallMapControl());var G=mapDataProcess(F),H=getBound(G);E.setCenter(H.getCenter(),Math.min(E.getBoundsZoomLevel(H),15));E.enableContinuousZoom();E.enableScrollWheelZoom();HotelMarker.resetMarkers(E,G);if(C&&C==true)GEvent.bind(E,"moveend",E,function(A){var C=extendBound(E.getBounds());E.reDraw=false;OLD_CENTER=E.getCenter();OLD_LEVEL=E.getZoom();jQuery.each(globalMapData,function(B,A){var D=new GLatLng(A.Latitude,A.Longitude);globalMapData[B].outBound=!(D&&C.containsLatLng(D));if(!globalMapData[B].hide)globalMapData[B].hide=0});G=new Array();for(var D=0;D<globalMapData.length;D++)if(!globalMapData[D].outBound&&globalMapData[D].hide==0)G.push(globalMapData[D]);tempMapData=G;$("#ResultCount").text(tempMapData.length);if(globalMapData[0].Type=="Sight")rPage(0,10,1);if(globalMapData[0].Type=="Hotel")rhPage(0,10,1,B)})}function mapDataProcess(A){var B=new Array();$.each(A,function(D,A){if(A.Latitude&&A.Latitude!=0&&A.Latitude!=""){var C=new GLatLng(A.Latitude,A.Longitude);A.point=C;if(A.OrderID&&!isNaN(A.OrderID))A.seq=A.OrderID;else A.seq=D+1;A.hide=0;B.push(A)}});return B}var filterManager=this.filterManager=new function(){this.filters={"price":function(F,B,E){var D=1;for(var G=0;G<globalMapData.length;G++){var C=parseInt(globalMapData[G].Price);if(C>=B&&C<=E)globalMapData[G].hide&=~(1<<D);else globalMapData[G].hide|=1<<D}A()},"star":function(B,E){var D=2;for(var F=0;F<globalMapData.length;F++){var C=globalMapData[F].star.num;if(C>=B&&C<=E)globalMapData[F].hide&=~(1<<D);else globalMapData[F].hide|=1<<D}A()},"stars":function(E,F){var C=3;for(var G=0;G<globalMapData.length;G++){var D=(F.length==0);if(!D){var B=globalMapData[G].HotelType;if(B==F)globalMapData[G].hide&=~(1<<C);else globalMapData[G].hide|=1<<C}}A()},"fea":function(C){var B=4;for(var D=0;D<globalMapData.length;D++)if(!C||((globalMapData[D].fea&C)>=C))globalMapData[D].hide&=~(1<<B);else globalMapData[D].hide|=1<<B;A()},"brand":function(B){var C=5,D={};for(var E=0;E<B.length;E++)D[B[E]]=true;for(E=0;E<globalMapData.length;E++)if(B.length==0||D[globalMapData[E].bid])globalMapData[E].hide&=~(1<<C);else globalMapData[E].hide|=1<<C;A()},"point":function(C){if(C===false);else if(C){filterManager.pointFiltered=true;for(var D=0;D<globalMapData.length;D++){var B=globalMapData[D].point;globalMapData[D].outBound=!(B&&C.containsLatLng(B))}}else for(D=0;D<globalMapData.length;D++)globalMapData[D].outBound=!globalMapData[D].point;A()},"order":function(E,C,I){var G,D=7;C="Price";I=parseInt(I);var B=globalMapData;switch(I){case 0:for(var J=1;J<globalMapData.length;++J){var H=J,F=globalMapData[J][""+C+""];while(H>0&&globalMapData[H-1][""+C+""]>F){globalMapData[H]=globalMapData[H-1];--H}}A();break;case 1:break;default:break}}};function A(){var A=jQuery("#showmode").val();filtered=[];var C=0;for(var D=0;D<globalMapData.length;D++){var B=(globalMapData[D].hide!=0);if(!B)C++;if(!B&&!globalMapData[D].outBound)filtered.push(globalMapData[D])}tempMapData=filtered;rhPage(0,10,1,A)}this.doFilter=function(A){this.filters[A].apply(this,arguments)}}
