var APP_GMAP={};APP_GMAP.params={enableMapDoubleClick:true,enableMapDragging:true,enableMapLargeControl:false,enableMapSmallControl:true,enableMapTypeControl:false,zoomLevel:12,zoomLevelMin:0,zoomLevelMax:0,centerMap:["",""],showInfoOnSingleMarker:true,msgBrowserNotCompatible:"The current browser does not support the Google Maps API Library"};APP_GMAP.setup=function(a,b){APP_GMAP.params=$merge(APP_GMAP.params,b);APP_GMAP._gmap_is_compatible=(GBrowserIsCompatible())?true:false;if(a!=undefined){if(APP_GMAP._gmap_is_compatible==true){if(APP_GMAP.params.zoomLevel==""){APP_GMAP.params.zoomLevel=12}APP_GMAP._gmap=new GMap2(a);APP_GMAP._saved_icons={app_gmap_default:new GIcon()};APP_GMAP._saved_markers=[];APP_GMAP._show_info_window=null;APP_GMAP.addControls();APP_GMAP._gmap.setCenter(new GLatLng(APP_GMAP.params.centerMap[0],APP_GMAP.params.centerMap[1]),APP_GMAP.params.zoomLevel)}else{a.innerHTML=APP_GMAP.params.msgBrowserNotCompatible}}};APP_GMAP.addControls=function(){if(!APP_GMAP.params.enableMapDoubleClick){APP_GMAP._gmap.disableDoubleClickZoom()}if(!APP_GMAP.params.enableMapDragging){APP_GMAP._gmap.disableDragging()}if(APP_GMAP.params.enableMapLargeControl){APP_GMAP._gmap.addControl(new GLargeMapControl())}else{if(APP_GMAP.params.enableMapSmallControl){APP_GMAP._gmap.addControl(new GSmallMapControl())}else{}}if(APP_GMAP.params.enableMapTypeControl){APP_GMAP._gmap.addControl(new GMapTypeControl())}};APP_GMAP.addIcons=function(b){if(b.length>0){var d={};for(var a=0;a<b.length;a++){var c=b[a];var e=new GIcon();e.image=c.src;e.iconSize=new GSize(c.size[0],c.size[1]);e.iconAnchor=new GPoint(c.offset[0],c.offset[1]);if($chk(c.infoOffset)){e.infoWindowAnchor=new GPoint(c.infoOffset[0],c.infoOffset[1])}d[c.typ]=e}APP_GMAP._saved_icons=d}};APP_GMAP.addMarkers=function(h){if($type(h)=="object"){h=[h]}var f=h.length;for(var d=0;d<f;d++){var a=h[d];if($chk(a.lat)&&$chk(a.lng)){var e={};if($chk(a.icon)&&a.icon!=""&&$chk(APP_GMAP._saved_icons[a.icon])){e.icon=APP_GMAP._saved_icons[a.icon]}else{e.icon=APP_GMAP._saved_icons.app_gmap_default}if($chk(a.title)){e.title=a.title.clean()}var c=new GMarker(new GLatLng(a.lat,a.lng),e);if($chk(a.html)){c.bindInfoWindowHtml(a.html.clean())}APP_GMAP._gmap.addOverlay(c);if($chk(a.html)){if(f==1&&APP_GMAP.params.showInfoOnSingleMarker==true){APP_GMAP._saved_markers[0]=[c,a.html];APP_GMAP._show_info_window=0}else{if($chk(a.open)&&a.open==true&&!APP_GMAP._info_window_is_opened){APP_GMAP._saved_markers[d]=[c,a.html];APP_GMAP._show_info_window=d}}}}}if(APP_GMAP._show_info_window!=null){var b=APP_GMAP._saved_markers[APP_GMAP._show_info_window][0];var g=APP_GMAP._saved_markers[APP_GMAP._show_info_window][1];b.openInfoWindowHtml(g)}};APP_GMAP.addMarker=function(a){if($type(a)=="object"){a=[a]}APP_GMAP.addMarkers(a)};APP_GMAP.getBounds=function(b,a){var c=new GLatLngBounds();c.extend(new GLatLng(b[0],b[1]));c.extend(new GLatLng(a[0],a[1]));return c};APP_GMAP.setCenter=function(b){switch($type(b)){case"object":if($chk(b.boundMin)&&$chk(b.boundMax)){var d=APP_GMAP.getBounds(b.boundMin,b.boundMax);var a=(d.getNorthEast().lat()+d.getSouthWest().lat())/2;var e=(d.getNorthEast().lng()+d.getSouthWest().lng())/2;var c=APP_GMAP._gmap.getBoundsZoomLevel(d);if(1<c){c=c}if(2>APP_GMAP._saved_markers.length){c=APP_GMAP.params.zoomLevel}APP_GMAP._gmap.setCenter(new GLatLng(a,e));APP_GMAP._gmap.setZoom(c)}break;case"array":if($chk(b[0])&&$chk(b[1])){APP_GMAP._gmap.setCenter(new GLatLng(b[0],b[1]));APP_GMAP._gmap.setZoom(APP_GMAP.params.zoomLevel)}break;case"string":if($chk(b[0])&&$chk(b[1])){APP_GMAP._gmap.setCenter(new GLatLng(b[0],b[1]));APP_GMAP._gmap.setZoom(APP_GMAP.params.zoomLevel)}break;case"default":alert("APP_GMAP.setCenter() can't used without parameter");break}};
