var AppClass=Class.create();AppClass.prototype={_mapControl:null,initialize:function(){if(this.isCompatible()){Event.observe(window,"load",this.onLoadDocument.bind(this));}},isCompatible:function(){if(GBrowserIsCompatible()){if(is_ie6up||is_nav8up||(is_fx&&(parseFloat(is_fx_ver)>=1))){return true;}else{if(is_moz){var va=is_moz_ver.fsplit(".");var nf=parseInt(va.splice(2));var mf=parseFloat(va.join("."));if(mf>1.7||(mf==1.7&&nf>=5)){return true;}}else{if(is_safari){var s=agt.indexOf("safari/",0);var _5=(agt.substring(s+7));var _6=parseInt(_5.split(".")[0]);if(_6>=312){return true;}}}}}return false;},onLoadDocument:function(){var fo=new FlashObject("loader.swf","main","100%","100%","8","#ffffff");fo.addParam("wmode","transparent");fo.addParam("allowScriptAccess","always");fo.write("flash");this._flash=(navigator.appName.indexOf("Microsoft")!=-1)?window["main"]:document["main"];this._icons=[];var _8;_8=new GIcon();_8.image="images/map/marker_start.png";_8.iconSize=new GSize(43,60);_8.iconAnchor=new GPoint(21,53);this._icons["start"]=_8;_8=new GIcon();_8.image="images/map/marker_goal.png";_8.iconSize=new GSize(43,60);_8.iconAnchor=new GPoint(21,53);this._icons["goal"]=_8;_8=new GIcon();_8.image="images/map/marker_shop.png";_8.iconSize=new GSize(43,60);_8.iconAnchor=new GPoint(21,53);this._icons["shop"]=_8;_8=new GIcon();_8.image="images/map/marker_small2.png";_8.iconSize=new GSize(14,14);_8.iconAnchor=new GPoint(7,7);this._icons["corner"]=_8;},loadInitialGMap:function(){if(this._map==undefined){this._map=new GMap2(document.getElementById("map"));this._map.disableDragging();this._map.setCenter(new GLatLng(34.67979437177848,135.49833565950394),17);$A(["click","move","movestart","moveend","zoom"]).each((function(ev){GEvent.addListener(this._map,ev,(function(){var _a=$A(arguments);_a.unshift(ev);this.handleGMapEvent.apply(this,_a);}).bind(this));}).bind(this));Event.observe(window,"resize",this.onResize.bind(this));}else{this._map.setCenter(new GLatLng(34.679787,135.498454),17);}},onResize:function(){this.handleGMapEvent("resize");},callGMap:function(){var _b=arguments[0];var _c=[];switch(_b){case "recenterOrPanToLatLng":case "recenterOrPanToBitmap":_c.push(new GPoint(arguments[1],arguments[2]));break;case "centerBitmap":var _d=this._map.fromLatLngToDivPixel(new GLatLng(0,0));var _e=this._map.fromLatLngToDivPixel(this._map.getCenter());var _f=this.subGPoints(_e,_d);return _f;break;case "getBitmapCoordinate":var pt=this.convertPoint(arguments[1]);return pt;break;case "centerAndZoom":_b="setCenter";arg.push(new GLatLng(arguments[1].y,arguments[1].x));arg.push(17-arguments[2]);console.log(_c);break;case "pan":this._map.panBy(new GSize(arguments[1],arguments[2]));console.log(arguments);return;break;default:for(var i=1;i<arguments.length;i++){_c.push(arguments[i]);}break;}console.log(arguments);return this._map[_b].apply(this._map,_c);},handleGMapEvent:function(ev,a,b,c,d,e){switch(ev){case "click":if(arguments[1] instanceof GMarker){this.enableFlash();this._flash.callApp("showInfoWindow",arguments[1].pointName);}break;default:this._flash.handleGMapEvent(ev,a,b,c,d,e);break;}},isTileImageLoaded:function(){var _18=this._map.tileImages;var _19=0;var _1a=0;for(var i=0;i<_18.length;i++){for(var j=0;j<_18[i].length;j++){var img=_18[i][j];if(img.complete){_19++;}_1a++;}}return {completed:_19,total:_1a};},checkTileImageLoaded:function(){var _1e=this._map.tileImages;this._totalTiles=0;for(var i=0;i<_1e.length;i++){for(var j=0;j<_1e[i].length;j++){var img=_1e[i][j];img.onload=this.tileImageLoaded.bind(this);if(!img.complete){this._totalTiles++;}}}},tileImageLoaded:function(){if(--this._totalTiles==0){this.handleGMapEvent("load");}},disableFlash:function(){if(is_safari){Element.setStyle($("flash"),{height:"59px",width:"1000px"});setTimeout(function(){Element.setStyle($("flash"),{height:"59px",width:"100%"});},1);}else{Element.setStyle($("flash"),{height:"59px",width:"100%"});}this._map.enableDragging();this.addMapControl();},enableFlash:function(){this.removeMapControl();this._map.disableDragging();if(is_safari){Element.setStyle($("flash"),{height:"100%",width:"2000px"});setTimeout(function(){Element.setStyle($("flash"),{height:"100%",width:"100%"});},1);}else{Element.setStyle($("flash"),{height:"100%",width:"100%"});}},closeFlash:function(_22){this.disableFlash();for(var pn in this._routeInfo.points){var pt=this._routeInfo.points[pn];switch(pt.type){case "goal":case "shop":var mk=new GMarker(new GPoint(pt.x,pt.y),this._icons[pt.type]);mk.pointName=pn;this._map.addOverlay(mk);break;}}var _26=[];var lp;for(var i=0;i<_22.length;i++){var act=_22[i];switch(act.type){case "point":var pt=this._routeInfo.points[act.name];if(pt.type=="corner"||pt.type=="start"){var mk=new GMarker(new GPoint(pt.x,pt.y),this._icons[pt.type]);mk.pointName=act.name;this._map.addOverlay(mk);}break;case "line":for(var j=0;j<act.points.length;j++){var cp=act.points[j];if(lp!=cp){_26.push(cp);lp=cp;}}break;}}for(var i=0;i<_26.length;i++){var p=this._routeInfo.points[_26[i]];_26[i]=new GPoint(p.x,p.y);}this._map.addOverlay(new GPolyline(_26,"#CC0000",5,1));},addMapControl:function(){if(!this._mapControl){this._mapControl=new GLargeMapControl();}this._map.addControl(this._mapControl,new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(10,59)));},removeMapControl:function(){this._map.removeControl(this._mapControl);},onClickShop:function(_30){console.log("onClickShop",arguments,this);app.enableFlash();app._flash.callApp("showInfoWindow",this.pointName);return false;},onClickCorner:function(_31){console.log("onClickCorner",arguments);},convertPoint1:function(pt){console.log("convertPoint",pt);var p=this._map.fromLatLngToDivPixel(new GLatLng(pt.y,pt.x));var ne=this._map.fromLatLngToDivPixel(this._map.getBounds().getNorthEast());var sw=this._map.fromLatLngToDivPixel(this._map.getBounds().getSouthWest());console.log({pt:pt,p:p,ne:ne,sw:sw});return {x:p.x-sw.x,y:p.y-ne.y};},convertPoint2:function(pt){console.log("convertPoint",pt);var _37=this._map.fromLatLngToDivPixel(this._map.getCenter());var _38=this._map.fromLatLngToDivPixel(new GLatLng(pt.y,pt.x));var _39=this.subGPoints(_38,_37);console.log(_37,_38,_39);return _39;},convertPoint:function(pt){console.log(pt);var _3b=this._map.fromLatLngToDivPixel(new GLatLng(0,0));console.log(_3b);var _3c=this._map.fromLatLngToDivPixel(new GLatLng(pt.y,pt.x));console.log(_3c);var _3d=this.subGPoints(_3c,_3b);console.log(_3b,_3c,_3d);pt.x=_3d.x;pt.y=_3d.y;return pt;},subGPoints:function(a,b){return new GPoint(a.x-b.x,a.y-b.y);},setRouteInfo:function(_40){this._routeInfo=_40;}};function jsApp(){var _41=$A(arguments);var f=_41.shift();return app[f].apply(app,_41);}if(!console){var console=new Object();console.log=function(){};}var app=new AppClass();
