maskat.lang.Class.declare("maskat.widget.google.GooglePlugin").extend("maskat.core.Plugin",{_static:{initialize:function(){maskat.core.Plugin.register(this)}},getPluginId:function(){return"google"},getVersion:function(){return"2.3.0.v20110408"},isLoaded:function(){return typeof (google)!="undefined"&&typeof (GMap2)!="undefined"},load:function(){maskat.app.loadJavaScript("http://www.google.com/jsapi?key="+this.getProperty("key"),true);this.loader=new maskat.lang.Thread(this,this.loadModules,null,100);this.loader.start()},loadModules:function(){if(typeof (google)!="undefined"&&typeof (google.load)=="function"){this.loader.stop();google.load("maps","2",{callback:function(){}})}},start:function(){var A=maskat.layout.LayoutXMLReader.getInstance();var B=new maskat.widget.google.GoogleWidgetLibrary();A.addWidgetLibrary(B)}});maskat.lang.Class.declare("maskat.widget.google.GoogleWidgetLibrary").extend("maskat.layout.WidgetLibrary",{getBindingConfiguration:function(){return{googleMap:{type:maskat.widget.google.Map2Wrapper,attributes:{name:{type:"string",required:true},top:{type:"number",required:true},left:{type:"number",required:true},width:{type:"number",defaultValue:0},height:{type:"number",defaultValue:0},initialLongitude:{type:"number",defaultValue:0},initialLatitude:{type:"number",defaultValue:0},initialZoomLevel:{type:"number",defaultValue:10},mapControl:{type:"enum",values:["large","small"]},typeControl:{type:"boolean"},doubleClickZoom:{type:"boolean"},continuousZoom:{type:"boolean"}}}}}});maskat.lang.Class.declare("maskat.widget.google.Map2Wrapper").extend("maskat.layout.Widget",{defaultGetter:"getCenter",defaultSetter:"setCenter",createWidget:function(A){var D=document.createElement("div");D.style.position="absolute";D.style.left=this.left+"px";D.style.top=this.top+"px";D.style.width=this.width+"px";D.style.height=this.height+"px";A.appendChildElement(D);this.element=D;var B=new google.maps.Map2(D);var C=new google.maps.LatLng(this.initialLatitude,this.initialLongitude);B.setCenter(C,this.initialZoomLevel);switch(this.mapControl){case"large":B.addControl(new google.maps.LargeMapControl());break;case"small":B.addControl(new google.maps.SmallMapControl());break;default:break}if(this.typeControl){B.addControl(new google.maps.MapTypeControl())}if(this.doubleClickZoom){B.enableDoubleClickZoom()}else{B.disableDoubleClickZoom()}if(this.continuousZoom){B.enableContinuousZoom()}this.map=B;return B},getWidgetId:function(){return this.name},unwrap:function(){return this.map},getCenter:function(){return this.map.getCenter()},setCenter:function(A){this.map.setCenter(new google.maps.LatLng(A.lat,A.lng))},panTo:function(A){this.map.panTo(new google.maps.LatLng(A.lat,A.lng))},openInfoWindow:function(A){var C=new google.maps.LatLng(A.lat,A.lng);var B=document.createTextNode(A.text);this.map.openInfoWindow(C,B)},addMarker:function(B){var C=new google.maps.LatLng(B.lat,B.lng);var A=new google.maps.Marker(C);google.maps.Event.addListener(A,"click",function(){A.openInfoWindow(B.text)});this.map.addOverlay(A)},setMarkers:function(A){this.map.clearOverlays();if(A&&A instanceof Array){for(var B=0;B<A.length;B++){this.setValue(A[B],"addMarker")}}}});