
function popKTO(mode) {

	if(mode == 1) {
		for(i=1;i<5;i++) {
			if (navigator.appName.indexOf("Explorer") != -1){
				document.getElementById("kto_"+ i).style.display = "block";
			} else {
				document.getElementById("kto_"+ i).style.display = "table-row";
			}	
		}
	} else {
		for(i=1;i<5;i++) {
			document.getElementById("kto_"+ i).style.display = "none";
		}
	}

}

function showpass(id,name,lat,lng) {
    map.setCenter(new GLatLng(lat, lng));
	map.setZoom(10);
	$.getJSON('./get-Pass',
			  {
                poi_type: 'pässe',
                poi_name: name,
                poi_id:  id
              },
              function(preview) {
              	document.getElementById("pass").innerHTML = preview.full;
              });
}

function showpassbycountry(id) {
	$.getJSON('./get-Pass-By-Country',
			  {
                country_id: id
              },
              function(preview) {
              	document.getElementById("subnavi").innerHTML = preview.subnavi;
              });
}


if(typeof google != "undefined") {

	google.load("maps", "2.x");
	google.load("search", "1");

	site = function() {
	  // private functions
	  var loadMarkers = function() {
	    $.getJSON('./get-Pois',
			{
				domain_id: 11
				//domain_id: 19
			},
			function(data) {
	      var markers = Array();
	      jQuery.each(data, function(name, stack) {
	        if(name != 'Hotels') {
		        legendPic = document.createElement('img');
		        legendPic.src = "/images/cabrioaktiv/resources/"+stack.icon;
		        document.getElementById('controll').appendChild(legendPic);
						document.getElementById('controll').appendChild(document.createTextNode(name+' '));
		      }
	        var icon = new GIcon();
	        icon.image = "/images/cabrioaktiv/resources/"+stack.icon;
	        icon.iconSize = new GSize(31, 28);
	        icon.shadowSize = new GSize(0, 0);
	        icon.shadow = "";
	        icon.iconAnchor = new GPoint(9, 34);
	        icon.infoWindowAnchor = new GPoint(9, 2);
	        icon.infoShadowAnchor = new GPoint(18, 25);
	        jQuery.each(stack.marker, function(key, poi) {
	          var point = new GLatLng(poi.lat, poi.lng);
	          var markerOptions = {
	            title: poi.name,
	            icon: icon
	          };
			var marker = new GMarker(point, markerOptions);
	
	          GEvent.addListener(marker, 'click', function(){
				map.setZoom(10);
				map.panTo(marker.getLatLng());
	          	$.getJSON('./get-Pass',
				  {
	                poi_type: name,
	                poi_name: poi.name,
	                poi_id:   poi.id
	              },
	              function(preview) {
	              	document.getElementById("pass").innerHTML = preview.full;
	              	//alert(preview.title);
	              	//alert(preview.full);
	              });
	          });
	          
	          markers.push(marker);
	          jMap.markers = markers;
	        })
	      });
	      jMap.addMarkers(0);
				//jMap.lockMap();
	    })
	  }
	  // public space
	  return {
	    // Public vars
	 
	    // public methods
	    init: function() {     
	      loadMarkers();
	    }
	  };
	}();
	$(window).load(function () {
	  var mapContainer = document.getElementById('map');
	  var options = {
	    Lat: 47.18597932702905,
	    Lng: 11.07421875,
	    Zoom: 8
	  };
	  jMap.init(mapContainer, options);
	  site.init();
	});
	$(window).unload(function() {
	  GUnload();
	})

}
/*  ALTE EVENT FUNKTION MIT POPUP
		GEvent.addListener(marker, 'click', function(){
			  
            $.getJSON('./get-Preview',
              {
                poi_type: name,
                poi_id:   poi.id
              },
              function(preview) {
								if(stack.icon == 'hotel.png') {
									var infoWinowOptions = {
	                  maxContent:  preview.full,
	                  maxTitle:    preview.title,
	                  maxWidth:    450
	                };
								} else {
									var infoWinowOptions = {};
								}
                marker.openInfoWindowHtml(preview.preview, infoWinowOptions);
                var win = map.getInfoWindow();
                var moreButton = $('#more');
                moreButton.css({
                  'cursor': 'pointer'
                });
                moreButton.click(function() {
                  win.maximize();
                });
                GEvent.addListener(win, 'maximizeend', function(){
        
                });
              }
              
            );
          });
*/


