webMap = {
   map : null,
   width : null,
   height : null,
   centerLat : null,
   centerLng : null,
   type : null,
   zoom : null,
   typeControl : null,
   controler : null,
   overview : null,
   marker : null,
   markerPosLat : null,
   markerPosLng : null,
   markerText : null,
   charSet : null,

   createMap : function(){
      var urlData = document.getElementById('MapaMapySk').innerHTML;
      document.getElementById('MapaMapySk').innerHTML = '';
      var ifrm = document.createElement("iframe");
      var iframeUrl = 'http://www.mapa-mapy.sk/widgets.php?w='+webMap.width+'&h='+webMap.height+'&centerLat='+webMap.centerLat+'&centerLng='+webMap.centerLng+'&type='+webMap.type+'&zoom='+webMap.zoom+'&typeControl='+webMap.typeControl+'&controler='+webMap.controler+'&overview='+webMap.overview+'&marker='+webMap.marker+'&markerPosLat='+webMap.markerPosLat+'&markerPosLng='+webMap.markerPosLng+'&markerText='+webMap.markerText+'&charSet='+webMap.charSet+'&rand='+(Math.random()*1000);
      ifrm.setAttribute('src', iframeUrl);
      ifrm.setAttribute('scrolling', 'no');
      ifrm.setAttribute('frameBorder', '0');
      ifrm.style.width = this.width;
      ifrm.style.height = this.height;
      
      ifrm.style.border = 0;
      document.getElementById('MapaMapySk').appendChild(ifrm);
      document.getElementById("MapaMapySk").innerHTML += '<br/><small style="text-align:center; display:block; width:'+this.width+';"><a href="http://www.mapa-mapy.sk" target="_blank" title="Mapy">www.mapa-mapy.sk</a></small>';
   },

   initWidgets : function() {
      if (GBrowserIsCompatible()) {
         this.map = new GMap2(document.getElementById('MapaMapySk'));
         var cntr = new GLatLng(this.centerLat, this.centerLng);
         this.map.setCenter(cntr,this.zoom);
         this.map.enableDoubleClickZoom();
         this.map.enableScrollWheelZoom();
         this.map.enableContinuousZoom();
         this.map.addMapType(G_PHYSICAL_MAP);

         if (this.type==2){
            this.map.setMapType(G_SATELLITE_MAP);
         } else if (this.type==3){
            this.map.setMapType(G_HYBRID_MAP);
         } else if (this.type==4){
            this.map.setMapType(G_PHYSICAL_MAP);
         } else {
            this.map.setMapType(G_NORMAL_MAP);
         }

         if (this.typeControl==1){
            this.mapTypeControl = new GMapTypeControl();
            this.map.addControl(this.mapTypeControl);
         } else if (this.typeControl==2){
            this.mapTypeControl = new GMenuMapTypeControl();
            this.map.addControl(this.mapTypeControl);
         }

         if (this.controler==1){
            this.mapControler = new GSmallZoomControl();
            this.map.addControl(this.mapControler);
         } else if (this.controler==2){
            this.mapControler = new GSmallMapControl();
            this.map.addControl(this.mapControler);
         } else if (this.controler==3){
            this.mapControler = new GLargeMapControl();
            this.map.addControl(this.mapControler);
         }

         if (this.overview==1){
            this.mapOverview = new GOverviewMapControl();
            this.map.addControl(this.mapOverview);
         }

         if (this.marker >= 1){
            var markerPos = new GLatLng(this.markerPosLat, this.markerPosLng);
            var mapMarker = new GMarker(markerPos, {draggable: false});
            this.map.addOverlay(mapMarker);

            if (this.marker == 2){
               mapMarker.openInfoWindowHtml( this.markerText );
            }
         }
      }
      return false;
   }
};
