/* * © Altamira Softworks, ltd 2006 - 2010 * info@altamira.sk | http://www.altamira.sk * All Rights Reserved */ $(document).ready(function($) { //$('.subregions').hide(); }); function loadSubregions(id) { if($('#subregion_'+id).is(':visible')){ $('#subregion_'+id).fadeOut(); } else { $('#subregion_'+id).fadeIn(); } } function ajax_getWeather(locid,regid,ref) { if(locid!='') { if($('#weather_'+regid).is(':visible')){ $('#weather_'+regid).fadeOut(); } else { xhr = $.ajax({ url: 'https://www.reisen.cz/ajax/weather.php', cache: false, type: "GET", data: ({ locid : locid, ref : ref }), success: function(html){ $('#weather_'+regid).html(html).hide().fadeIn('slow'); } }); } } else { alert('Bohužiaľ k tejto lokalite nemáme k dispozícií dáta o počasí.'); } } function ajax_getMap(gmapid,regid) { initMap('mapdiv_'+regid); //alert('Doplnit hladanie google mapky pre '+gmapid); } /***************************************************************** GOOGLE MAPS API ********/ function initMap(mapdiv, lat, lon, zoom, description) { var mapDivObj = $('#'+mapdiv); mapDivObj.slideToggle('slow', function() { // Display the map, with some controls and set the initial location map = new GMap2(mapDivObj[0]); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); //map.enableScrollWheelZoom(); map.setCenter(new GLatLng(lat,lon), zoom); addMarker(lat, lon, description, map); }); } function addMarker(lat, lon, html, map) { var point = new GLatLng(lat,lon); var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); map.addOverlay(marker); return marker; } function searchOnMap(sender, mapdiv, search) { var googleZoom = 8; // Ak sa najde dohlada sa podla nazvu geo = new GClientGeocoder(); geo.getLocations(search, function (result) { if (result && (result.Status.code == 200) && (result.Placemark.length >= 1)) { var p = result.Placemark[0].Point.coordinates; initMap(mapdiv, p[1], p[0], googleZoom, result.Placemark[0].address); } else //alert(getLocalityErrorMsg() + ' ' + result.name); alert('Nepodarilo sa nájsť lokalitu '+result.name); }); }