var region_labels={};var tinies=[];var region_label_variants={};var region_sizes=[];var pad_length=2;function pad(item){var str=''+item;while(str.length<pad_length){str='0'+str;}
return str;}
for(var k in region_labels){region_label_variants[k]=[];var parts=region_labels[k].split('-');var last='';for(var i in parts){last+=parts[i];region_label_variants[k].push(last);}
region_sizes.push(pad(region_label_variants[k].pop().length)+':'+k);if(region_label_variants[k].length<1){tinies.push(k);}}
$(document).ready(function(){var $regions_childs=$('#regions').children(':not(div)');if($regions_childs.length>0){var $first_region=$regions_childs.first();if($first_region[0].nodeName=='STRONG'){$first_region=$first_region.find('a');}
var $last_region=$regions_childs.last();if($last_region[0].nodeName=='STRONG'){$last_region=$last_region.find('a');}
function multi_line_region_handler(){var sorted_regions=region_sizes.sort();while(($first_region.position().top!=$last_region.position().top)&&(sorted_regions.length>0)){var longest_region=sorted_regions.pop();var _t=longest_region.split(':');var size=parseInt(_t[0]);var id=_t[1];if($.inArray(id,tinies)!=-1){continue;}
var shorter_version;while(region_label_variants[id].length>0){shorter_version=region_label_variants[id].pop();if(shorter_version.length<size)break;}
if(region_label_variants[id].length==0){tinies.push(id);}
else{sorted_regions.push(pad(shorter_version.length)+':'+id);}
$('#'+id).text(shorter_version+'.');sorted_regions=region_sizes.sort();}}
$(document).bind('multi_line_region',multi_line_region_handler);var fr_pos=$first_region.position();var lr_pos=$last_region.position();if(fr_pos.top!=lr_pos.top){$(document).trigger('multi_line_region');}}});function multiColorize(index){var $this=$(this);var classes=$this.attr('class');var allCategories=['cat-cukrarny','cat-farmy','cat-kavarny','cat-lahudky','cat-maso','cat-ryby','cat-ovozel','cat-pekarny','cat-restaurace','cat-vino-destilaty'];if(!classes)var thisCategories=allCategories;else{var _thisCategories=classes.split(' ');var thisCategories=[]
for(var i in _thisCategories){if(jQuery.inArray(_thisCategories[i],allCategories)==-1)continue;thisCategories.push(_thisCategories[i]);}}
if(thisCategories.length<2)return;if($this.closest('.non-great').length!=0)return;$this.addClass('multi-colorized');var colorIndex=Math.round(Math.random()*(thisCategories.length-1));var headArray=$this.html().split('');var inside_tag=false;var inside_ent=false;$.each(headArray,function(index,value){if(!inside_tag&&(value=='<')){inside_tag=true;return true;}
else if(inside_tag&&(value=='>')){inside_tag=false;return true;}
else if(inside_tag){return true;}
else if(!inside_ent&&(value=='&')){inside_ent=true;return true;}
else if(inside_ent&&(value==';')){inside_ent=false;return true;}
else if(inside_ent){return true;}
if(value==' '){headArray[index]='<span class="space"> </span>';}else{headArray[index]='<span class="'+thisCategories[colorIndex]+'">'+value+'</span>';colorIndex++;if(colorIndex>thisCategories.length-1)colorIndex=0;}});$this.html(headArray.join(''));}
function handle_message_fadeout(){function blind_up(element){$('.notice').animate({top:'-200px'},400);}
setTimeout(blind_up,3000);}
$(document).ready(function(){$('a[class*="cat-"], #page_about #about article h1 span, .home .body a, .home h1 a, .home .what a, #fatal_box .text a').each(multiColorize);Cufon.set('hover',true);Cufon.set('fontFamily','ApexSerif-BoldItalic').replace('nav#categories li a');Cufon.set('fontFamily','ApexSerif-MediumItalic').replace('#content h1:first')('.box h1')('.info.types a')('#detail #detail-add-review .set.label_as_head label')('#detail #detail-add-review .set h2')('.cufonize');var $search=$('#search');if(!Modernizr.input.placeholder){$("html").addClass("no-placeholder");$search.find("input[placeholder]").each(function(){var $this=$(this);var placeholder=$this.attr('placeholder');if($this.val()==""&&placeholder!=""){$this.val(placeholder);$this.focus(function(){if($this.val()==placeholder)$this.val("");});$this.blur(function(){if($this.val()=="")$this.val(placeholder);});}});}
$('.clickable').click(function(){var href=$(this).find('a:first').attr('href');if(href)location.href=href;});if($('.notice').length)
handle_message_fadeout();});function MarkerClusterer(map,opt_markers,opt_options){this.extend(MarkerClusterer,google.maps.OverlayView);this.map_=map;this.markers_=[];this.clusters_=[];this.sizes=[53,56,66,78,90];this.styles_=[];this.ready_=false;var options=opt_options||{};this.gridSize_=options['gridSize']||60;this.maxZoom_=options['maxZoom']||null;this.styles_=options['styles']||[];this.imagePath_=options['imagePath']||this.MARKER_CLUSTER_IMAGE_PATH_;this.imageExtension_=options['imageExtension']||this.MARKER_CLUSTER_IMAGE_EXTENSION_;this.zoomOnClick_=options['zoomOnClick']||true;this.minClusterCount_=options['minClusterCount']||6;this.setupStyles_();this.setMap(map);this.prevZoom_=this.map_.getZoom();var that=this;google.maps.event.addListener(this.map_,'zoom_changed',function(){if(this.prevZoom_!=that.map_.getZoom()){this.prevZoom_=that.map_.getZoom();that.resetViewport();}});google.maps.event.addListener(this.map_,'bounds_changed',function(){that.redraw();});if(opt_markers&&opt_markers.length){this.addMarkers(opt_markers,false);}}
MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_='http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/'+'images/m';MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_='png';MarkerClusterer.prototype.extend=function(obj1,obj2){return(function(object){for(property in object.prototype){this.prototype[property]=object.prototype[property];}
return this;}).apply(obj1,[obj2]);};MarkerClusterer.prototype.onAdd=function(){this.setReady_(true);};MarkerClusterer.prototype.idle=function(){};MarkerClusterer.prototype.draw=function(){};MarkerClusterer.prototype.setupStyles_=function(){for(var i=0,size;size=this.sizes[i];i++){this.styles_.push({url:this.imagePath_+(i+1)+'.'+this.imageExtension_,height:size,width:size});}};MarkerClusterer.prototype.setStyles=function(styles){this.styles_=styles;};MarkerClusterer.prototype.getStyles=function(){return this.styles_;};MarkerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_;};MarkerClusterer.prototype.getMarkers=function(){return this.markers_;};MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_;};MarkerClusterer.prototype.setMaxZoom=function(maxZoom){this.maxZoom_=maxZoom;};MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_||this.map_.mapTypes[this.map_.getMapTypeId()].maxZoom;};MarkerClusterer.prototype.calculator_=function(markers,numStyles){var index=0;var count=markers.length;var dv=count;while(dv!==0){dv=parseInt(dv/10,10);index++;}
index=Math.min(index,numStyles);return{text:count,index:index};};MarkerClusterer.prototype.setCalculator=function(calculator){this.calculator_=calculator;};MarkerClusterer.prototype.getCalculator=function(){return this.calculator_;};MarkerClusterer.prototype.addMarkers=function(markers,opt_nodraw){for(var i=0,marker;marker=markers[i];i++){this.pushMarkerTo_(marker);}
if(!opt_nodraw){this.redraw();}};MarkerClusterer.prototype.pushMarkerTo_=function(marker){marker.setVisible(false);marker.setMap(null);marker.isAdded=false;if(marker['draggable']){var that=this;google.maps.event.addListener(marker,'dragend',function(){marker.isAdded=false;that.resetViewport();that.redraw();});}
this.markers_.push(marker);};MarkerClusterer.prototype.addMarker=function(marker,opt_nodraw){this.pushMarkerTo_(marker);if(!opt_nodraw){this.redraw();}};MarkerClusterer.prototype.removeMarker=function(marker){var index=-1;if(this.markers_.indexOf){index=this.markers_.indexOf(marker);}else{for(var i=0,m;m=this.markers_[i];i++){if(m==marker){index=i;continue;}}}
if(index==-1){return false;}
this.markers_.splice(index,1);marker.setVisible(false);marker.setMap(null);this.resetViewport();this.redraw();return true;};MarkerClusterer.prototype.setReady_=function(ready){if(!this.ready_){this.ready_=ready;this.createClusters_();}};MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length;};MarkerClusterer.prototype.getMap=function(){return this.map_;};MarkerClusterer.prototype.setMap=function(map){this.map_=map;};MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_;};MarkerClusterer.prototype.setGridSize=function(size){this.gridSize_=size;};MarkerClusterer.prototype.getExtendedBounds=function(bounds){var projection=this.getProjection();var tr=new google.maps.LatLng(bounds.getNorthEast().lat(),bounds.getNorthEast().lng());var bl=new google.maps.LatLng(bounds.getSouthWest().lat(),bounds.getSouthWest().lng());var trPix=projection.fromLatLngToDivPixel(tr);trPix.x+=this.gridSize_;trPix.y-=this.gridSize_;var blPix=projection.fromLatLngToDivPixel(bl);blPix.x-=this.gridSize_;blPix.y+=this.gridSize_;var ne=projection.fromDivPixelToLatLng(trPix);var sw=projection.fromDivPixelToLatLng(blPix);bounds.extend(ne);bounds.extend(sw);return bounds;};MarkerClusterer.prototype.isMarkerInBounds_=function(marker,bounds){return bounds.contains(marker.getPosition());};MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport();this.markers_=[];};MarkerClusterer.prototype.resetViewport=function(){for(var i=0,cluster;cluster=this.clusters_[i];i++){cluster.remove();}
for(var i=0,marker;marker=this.markers_[i];i++){marker.isAdded=false;marker.setMap(null);marker.setVisible(false);}
this.clusters_=[];};MarkerClusterer.prototype.redraw=function(){this.createClusters_();};MarkerClusterer.prototype.createClusters_=function(){if(!this.ready_){return;}
var mapBounds=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast());var bounds=this.getExtendedBounds(mapBounds);for(var i=0,marker;marker=this.markers_[i];i++){var added=false;if(!marker.isAdded&&this.isMarkerInBounds_(marker,bounds)){for(var j=0,cluster;cluster=this.clusters_[j];j++){if(!added&&cluster.getCenter()&&cluster.isMarkerInClusterBounds(marker)){added=true;cluster.addMarker(marker);break;}}
if(!added){var cluster=new Cluster(this);cluster.addMarker(marker);this.clusters_.push(cluster);}}}};function Cluster(markerClusterer){this.markerClusterer_=markerClusterer;this.map_=markerClusterer.getMap();this.gridSize_=markerClusterer.getGridSize();this.center_=null;this.markers_=[];this.bounds_=null;this.clusterIcon_=new ClusterIcon(this,markerClusterer.getStyles(),markerClusterer.getGridSize());}
Cluster.prototype.isMarkerAlreadyAdded=function(marker){if(this.markers_.indexOf){return this.markers_.indexOf(marker)!=-1;}else{for(var i=0,m;m=this.markers_[i];i++){if(m==marker){return true;}}}
return false;};Cluster.prototype.addMarker=function(marker){if(this.isMarkerAlreadyAdded(marker)){return false;}
if(!this.center_){this.center_=marker.getPosition();this.calculateBounds_();}
if(this.markers_.length<this.markerClusterer_.minClusterCount_){marker.setMap(this.map_);marker.setVisible(true);}else if(this.markers_.length==this.markerClusterer_.minClusterCount_){for(var i=0;i<this.markers_.length;i++){this.markers_[i].setMap(null);this.markers_[i].setVisible(false);}}
marker.isAdded=true;this.markers_.push(marker);this.updateIcon();return true;};Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_;};Cluster.prototype.getBounds=function(){this.calculateBounds_();return this.bounds_;};Cluster.prototype.remove=function(){this.clusterIcon_.remove();delete this.markers_;};Cluster.prototype.getCenter=function(){return this.center_;};Cluster.prototype.calculateBounds_=function(){var bounds=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(bounds);};Cluster.prototype.isMarkerInClusterBounds=function(marker){return this.bounds_.contains(marker.getPosition());};Cluster.prototype.getMap=function(){return this.map_;};Cluster.prototype.updateIcon=function(){var zoom=this.map_.getZoom();var mz=this.markerClusterer_.getMaxZoom();if(zoom>mz){for(var i=0,marker;marker=this.markers_[i];i++){marker.setMap(this.map_);marker.setVisible(true);}
return;}
if(this.markers_.length<this.markerClusterer_.minClusterCount_){this.clusterIcon_.hide();return;}
var numStyles=this.markerClusterer_.getStyles().length;var sums=this.markerClusterer_.getCalculator()(this.markers_,numStyles);this.clusterIcon_.setCenter(this.center_);this.clusterIcon_.setSums(sums);this.clusterIcon_.show();};function ClusterIcon(cluster,styles,opt_padding){cluster.getMarkerClusterer().extend(ClusterIcon,google.maps.OverlayView);this.styles_=styles;this.padding_=opt_padding||0;this.cluster_=cluster;this.center_=null;this.map_=cluster.getMap();this.div_=null;this.sums_=null;this.visible_=false;this.setMap(this.map_);}
ClusterIcon.prototype.triggerClusterClick=function(){var markerClusterer=this.cluster_.getMarkerClusterer();google.maps.event.trigger(markerClusterer,'clusterclick',[this.cluster_]);if(markerClusterer.isZoomOnClick()){this.map_.setCenter(this.cluster_.getCenter(),this.map_.fitBounds(this.cluster_.getBounds())+1);}};ClusterIcon.prototype.onAdd=function(){this.div_=document.createElement('DIV');if(this.visible_){var pos=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(pos);this.div_.innerHTML=this.sums_.text;}
var panes=this.getPanes();panes.overlayImage.appendChild(this.div_);var that=this;google.maps.event.addDomListener(this.div_,'click',function(){that.triggerClusterClick();});};ClusterIcon.prototype.getPosFromLatLng_=function(latlng){var pos=this.getProjection().fromLatLngToDivPixel(latlng);pos.x-=parseInt(this.width_/2,10);pos.y-=parseInt(this.height_/2,10);return pos;};ClusterIcon.prototype.draw=function(){if(this.visible_){var pos=this.getPosFromLatLng_(this.center_);this.div_.style.top=pos.y+'px';this.div_.style.left=pos.x+'px';}};ClusterIcon.prototype.hide=function(){if(this.div_){this.div_.style.display='none';}
this.visible_=false;};ClusterIcon.prototype.show=function(){if(this.div_){var pos=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(pos);this.div_.style.display='';}
this.visible_=true;};ClusterIcon.prototype.remove=function(){this.setMap(null);};ClusterIcon.prototype.onRemove=function(){if(this.div_&&this.div_.parentNode){this.hide();this.div_.parentNode.removeChild(this.div_);this.div_=null;}};ClusterIcon.prototype.setSums=function(sums){this.sums_=sums;this.text_=sums.text;this.index_=sums.index;if(this.div_){this.div_.innerHTML=sums.text;}
this.useStyle();};ClusterIcon.prototype.useStyle=function(){var index=Math.max(0,this.sums_.index-1);index=Math.min(this.styles_.length-1,index);var style=this.styles_[index];this.url_=style.url;this.height_=style.height;this.width_=style.width;this.textColor_=style.textColor;this.anchor_=style.anchor;this.textSize_=style.textSize;};ClusterIcon.prototype.setCenter=function(center){this.center_=center;};ClusterIcon.prototype.createCss=function(pos){var style=[];if(document.all){style.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader('+'sizingMethod=scale,src="'+this.url_+'");');}else{style.push('background:url('+this.url_+');');}
if(typeof this.anchor_==='object'){if(typeof this.anchor_[0]==='number'&&this.anchor_[0]>0&&this.anchor_[0]<this.height_){style.push('height:'+(this.height_-this.anchor_[0])+'px; padding-top:'+this.anchor_[0]+'px;');}else{style.push('height:'+this.height_+'px; line-height:'+this.height_+'px;');}
if(typeof this.anchor_[1]==='number'&&this.anchor_[1]>0&&this.anchor_[1]<this.width_){style.push('width:'+(this.width_-this.anchor_[1])+'px; padding-left:'+this.anchor_[1]+'px;');}else{style.push('width:'+this.width_+'px; text-align:center;');}}else{style.push('height:'+this.height_+'px; line-height:'+
this.height_+'px; width:'+this.width_+'px; text-align:center;');}
var txtColor=this.textColor_?this.textColor_:'black';var txtSize=this.textSize_?this.textSize_:11;style.push('cursor:pointer; top:'+pos.y+'px; left:'+
pos.x+'px; color:'+txtColor+'; position:absolute; font-size:'+
txtSize+'px; font-family:Arial,sans-serif; font-weight:bold; font-style:italic;');return style.join('');};window['MarkerClusterer']=MarkerClusterer;MarkerClusterer.prototype['addMarker']=MarkerClusterer.prototype.addMarker;MarkerClusterer.prototype['addMarkers']=MarkerClusterer.prototype.addMarkers;MarkerClusterer.prototype['clearMarkers']=MarkerClusterer.prototype.clearMarkers;MarkerClusterer.prototype['getCalculator']=MarkerClusterer.prototype.getCalculator;MarkerClusterer.prototype['getGridSize']=MarkerClusterer.prototype.getGridSize;MarkerClusterer.prototype['getMap']=MarkerClusterer.prototype.getMap;MarkerClusterer.prototype['getMarkers']=MarkerClusterer.prototype.getMarkers;MarkerClusterer.prototype['getMaxZoom']=MarkerClusterer.prototype.getMaxZoom;MarkerClusterer.prototype['getStyles']=MarkerClusterer.prototype.getStyles;MarkerClusterer.prototype['getTotalClusters']=MarkerClusterer.prototype.getTotalClusters;MarkerClusterer.prototype['getTotalMarkers']=MarkerClusterer.prototype.getTotalMarkers;MarkerClusterer.prototype['redraw']=MarkerClusterer.prototype.redraw;MarkerClusterer.prototype['removeMarker']=MarkerClusterer.prototype.removeMarker;MarkerClusterer.prototype['resetViewport']=MarkerClusterer.prototype.resetViewport;MarkerClusterer.prototype['setCalculator']=MarkerClusterer.prototype.setCalculator;MarkerClusterer.prototype['setGridSize']=MarkerClusterer.prototype.setGridSize;MarkerClusterer.prototype['onAdd']=MarkerClusterer.prototype.onAdd;MarkerClusterer.prototype['draw']=MarkerClusterer.prototype.draw;MarkerClusterer.prototype['idle']=MarkerClusterer.prototype.idle;ClusterIcon.prototype['onAdd']=ClusterIcon.prototype.onAdd;ClusterIcon.prototype['draw']=ClusterIcon.prototype.draw;ClusterIcon.prototype['onRemove']=ClusterIcon.prototype.onRemove;var ICON_URL='http://media.scuk.cz/master/media/img/mapmarks.png';var ICON_SIZE=new google.maps.Size(27,41);var ICON_ANCHOR=new google.maps.Point(13,41);var ICON_OFFSETS={'multi':0,'cukrarny':1,'farmy':2,'kavarny':3,'lahudky':4,'maso':5,'ryby':6,'ovozel':7,'pekarny':8,'restaurace':9,'vino-destilaty':10,'temata':11};var ICON_VARIANTS=1;var ICONS={};for(var k in ICON_OFFSETS){var _icon;var stack=[];for(var v=0;v<ICON_VARIANTS*2;v++){_icon=new google.maps.MarkerImage(ICON_URL,ICON_SIZE,new google.maps.Point(0+ICON_SIZE.width*v,ICON_OFFSETS[k]*ICON_SIZE.height),ICON_ANCHOR);stack.push(_icon);}
ICONS[k]=stack;}
var SHADOW_SIZE=new google.maps.Size(35,24);var SHADOW_ANCHOR=new google.maps.Point(1,23);SHADOW_ICON=new google.maps.MarkerImage(ICON_URL,SHADOW_SIZE,new google.maps.Point(27,1015),SHADOW_ANCHOR);function get_icons(k,extra){var variant=0;var icon_normal=ICONS[k][variant];var icon_selected=ICONS[k][variant+1];return[icon_normal,icon_selected];}
(function(c){function p(d,a,b){var e=this,l=d.add(this),h=d.find(b.tabs),j=a.jquery?a:d.children(a),i;h.length||(h=d.children());j.length||(j=d.parent().find(a));j.length||(j=c(a));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(b.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(i>=0)return e;f=b.initialIndex;k=h.eq(f)}if(f===i)return e;g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[b.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});i=f;h.removeClass(b.current);k.addClass(b.current);return e}},getConf:function(){return b},getTabs:function(){return h},getPanes:function(){return j},getCurrentPane:function(){return j.eq(i)},getCurrentTab:function(){return h.eq(i)},getIndex:function(){return i},next:function(){return e.click(i+1)},prev:function(){return e.click(i-1)}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(b[g])&&c(e).bind(g,b[g]);e[g]=function(k){c(e).bind(g,k);return e}});if(b.history&&c.fn.history){c.tools.history.init(h);b.event="history"}h.each(function(f){c(this).bind(b.event,function(g){e.click(f,g);return g.preventDefault()})});j.find("a[href^=#]").click(function(f){e.click(c(this).attr("href"),f)});if(location.hash)e.click(location.hash);else if(b.initialIndex===0||b.initialIndex>0)e.click(b.initialIndex)}c.tools=c.tools||{version:"1.2.2"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,a){o[d]=a}};var o={"default":function(d,a){this.getPanes().hide().eq(d).show();a.call()},fade:function(d,a){var b=this.getConf(),e=b.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(b.fadeInSpeed,a)},slide:function(d,a){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,a)},ajax:function(d,a){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),a)}},m;c.tools.tabs.addEffect("horizontal",function(d,a){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();a.call()})});c.fn.tabs=function(d,a){var b=this.data("tabs");if(b)return b;if(c.isFunction(a))a={onBeforeClick:a};a=c.extend({},c.tools.tabs.conf,a);this.each(function(){b=new p(c(this),d,a);c(this).data("tabs",b)});return a.api?b:this}})(jQuery);(function(b){function h(c){if(c){var a=d.contentWindow.document;a.open().close();a.location.hash=c}}var g,d,f,i;b.tools=b.tools||{version:"1.2.2"};b.tools.history={init:function(c){if(!i){if(b.browser.msie&&b.browser.version<"8"){if(!d){d=b("<iframe/>").attr("src","javascript:false;").hide().get(0);b("body").append(d);setInterval(function(){var a=d.contentWindow.document;a=a.location.hash;g!==a&&b.event.trigger("hash",a)},100);h(location.hash||"#")}}else setInterval(function(){var a=location.hash;a!==g&&b.event.trigger("hash",a)},100);f=!f?c:f.add(c);c.click(function(a){var e=b(this).attr("href");d&&h(e);if(e.slice(0,1)!="#"){location.href="#"+e;return a.preventDefault()}});i=true}}};b(window).bind("hash",function(c,a){a?f.filter(function(){var e=b(this).attr("href");return e==a||e==a.replace("#","")}).trigger("history",[a]):f.eq(0).trigger("history",[a]);g=a;window.location.hash=g});b.fn.history=function(c){b.tools.history.init(this);return this.bind("history",c)}})(jQuery);var map;var geocoder;var CLUSTER_URL='http://media.scuk.cz/master/media/img/shluk.png';var MAXIMAL_ZOOM=15;var UNSELECTED_MARKER_INDEX=10;var SELECTED_MARKER_INDEX=20;var INFO_WINDOW_INDEX=30;var CLUSTERRED_GRID_SIZE=36;var CLUSTERRED_MAX_ZOOM=13;var DEFAULT_LAT=49.817492;var DEFAULT_LNG=15.472962;var DEFAULT_ZOOM=7;var opened_window=undefined;var opened_marker=undefined;var opened_marker_icon_normal=undefined;function get_iw_content(data,type,link){var addr=data['addr'].split(',').join('<br />');var content='<p><strong>'+data['title']+'</strong><br />'+addr+'</p><p class="category_'+type+'" style="text-align:right">';if(link)content+='<a href="'+data['url']+'">'+data['url_title']+'</a>';content+='</p>';return content}
function put_marker(data,element,link,thin,json_url){if(!(data['lat']&&data['lon'])){return{'point':false,'marker':undefined};}
var latlng=new google.maps.LatLng(data['lat'],data['lon']);var k;if(data['type_classes'].length>1){k='multi';}
else{if(data['type_classes'][0]in ICONS)k=data['type_classes'][0];else k='multi';}
var _icons=get_icons(k,data['extra']);var icon_normal=_icons[0];var icon_selected=_icons[1];var marker=new google.maps.Marker({position:latlng,icon:icon_normal,shadow:SHADOW_ICON,title:data['title'],zIndex:UNSELECTED_MARKER_INDEX});google.maps.event.addListener(marker,'mouseover',function(){if(opened_marker!==marker)set_big_icon(marker,icon_selected);});google.maps.event.addListener(marker,'mouseout',function(){if(opened_marker!==marker)set_small_icon(marker,icon_normal);});var loader='<p class="loader">Momentíček...</p>';function open_bubble(iw,map,marker,icon_normal,icon_selected){if(opened_window){if(opened_window===iw){return;}
set_small_icon(opened_marker,opened_marker_icon_normal);opened_window.close();opened_window=undefined;opened_marker=undefined;opened_marker_icon_normal=undefined;}
set_big_icon(marker,icon_selected);opened_window=iw;opened_marker=marker;opened_marker_icon_normal=icon_normal;iw.open(map,marker);var content=iw.getContent();if(content==loader){$.getJSON(json_url,function(data){var content=get_iw_content(data,k,link);iw.setContent(content);});}}
if(thin){var content=loader;}
else{var content=get_iw_content(data,k,link);}
var infowindow=new google.maps.InfoWindow({content:content,zIndex:INFO_WINDOW_INDEX});google.maps.event.addListener(marker,'click',function(){open_bubble(infowindow,map,marker,icon_normal,icon_selected);});google.maps.event.addListener(infowindow,'closeclick',function(){set_small_icon(marker,opened_marker_icon_normal);opened_window=undefined;opened_marker=undefined;opened_marker_icon_normal=undefined;});if(element){element.hover(function(){element.addClass('hover');if(opened_marker!==marker)set_big_icon(marker,icon_selected);},function(){element.removeClass('hover');if(opened_marker!==marker)set_small_icon(marker,icon_normal);});element.find('p.adr a:not(.url)').click(function(){var current_bounds=map.getBounds();if(!current_bounds.contains(latlng)){map.panTo(latlng);}
else{if(map.getZoom()<MAXIMAL_ZOOM){map.setCenter(latlng);map.setZoom(MAXIMAL_ZOOM);}}
open_bubble(infowindow,map,marker,icon_normal,icon_selected);return false;});}
return{'point':true,'marker':marker};}
function set_big_icon(marker,icon){marker.setIcon(icon);marker.setZIndex(SELECTED_MARKER_INDEX);}
function set_small_icon(marker,icon){marker.setIcon(icon);marker.setZIndex(UNSELECTED_MARKER_INDEX);}
function fill_search_form(point1,point2){var $search=$('#search');$search.find('#id_p1').val(point1);$search.find('#id_p2').val(point2);}
function submit_handler(){var $search=$('#search');var $what=$search.find('#id_a');var $where=$search.find('#id_e');if($what.val()=='Co')$what.val('');if($where.val()=='Kde')$where.val('');var where=jQuery.trim($where.val());if(where){if(/\s*^\-?\d+(\.\d+)?\s*\,\s*\-?\d+(\.\d+)?\s*$/.test(where)){var latlng=parseLatLng(where);if(latlng==null){$where.val("");fill_search_form("","");return true;}
else{geocode({'latLng':latlng});}}else{geocode({'address':where});}
return false;}
else{fill_search_form("","");return true}}
function parseLatLng(value){value.replace('/\s//g');var coords=value.split(',');var lat=parseFloat(coords[0]);var lng=parseFloat(coords[1]);if(isNaN(lat)||isNaN(lng)){return null;}
else{return new google.maps.LatLng(lat,lng);}}
function geocode(request){request.language='cs';geocoder.geocode(request,processResults);}
function format_pos(pos){return pos.lat()+','+pos.lng();}
function _submit(){var $search=$('#search');$search.unbind('submit');$search.submit();}
function processResults(results,status){if(!results){fill_search_form("","");_submit();}
else{if(status==google.maps.GeocoderStatus.OK){var point1='';var point2='';if(results.length>0){if(results[0].geometry.bounds){point1=format_pos(results[0].geometry.bounds.getNorthEast());point2=format_pos(results[0].geometry.bounds.getSouthWest());}
else{point1=format_pos(results[0].geometry.viewport.getNorthEast());point2=format_pos(results[0].geometry.viewport.getSouthWest());}}
fill_search_form(point1,point2);_submit();}
else{fill_search_form("","");_submit();}}}
function cluster_markers(map,markers){var mcOptions={gridSize:CLUSTERRED_GRID_SIZE,maxZoom:CLUSTERRED_MAX_ZOOM};var mc=new MarkerClusterer(map,markers,mcOptions);mc.setStyles([{url:CLUSTER_URL,height:77,width:77,textColor:'#211f15',textSize:12}]);}
$(document).ready(function(){var $page_head=$('#page_head');var $logged=$('#logged');var $content=$('#content');var $map=$('#map');var $map_message_first=$('.map_message:eq(0)');var $map_message_second=$('.map_message:eq(1)');function resize_window(){var height_without_head=$(window).height()-$page_head.outerHeight()-$logged.outerHeight()-1;var content_padding=parseInt($content.css('paddingTop'))+parseInt($content.css('paddingBottom'));var map_width=$(window).width()-$content.outerWidth();var map_message_bottom=height_without_head/2-$map_message_first.outerHeight()/2;$content.css('height',height_without_head-content_padding+'px');$map.css({'height':height_without_head+'px','width':map_width+'px'});if(!!$map_message_first.length){$('.map_message').css({'bottom':map_message_bottom+'px','right':map_width/2-$map_message_first.outerWidth()/2+'px','margin':'0px'});}
if(!!$map_message_second.length){$map_message_first.css({'margin-right':'120px'});$map_message_second.css({'margin-right':'-120px'});}}
if(!!$('.template_map').length){resize_window();$(window).resize(resize_window);}
if(!!$('.map_message').length){$('.map_message .close').click(function(){$(this).parents('.map_message').hide();return false;});}
var myOptions={zoom:15,disableDefaultUI:true,mapTypeId:google.maps.MapTypeId.ROADMAP,navigationControl:true,navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL},mapTypeControl:true,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},scrollwheel:true};map=new google.maps.Map(document.getElementById("map"),myOptions);var zoom_listener=google.maps.event.addListener(map,'zoom_changed',function(){if(this.getZoom()>MAXIMAL_ZOOM){this.setZoom(MAXIMAL_ZOOM);}
google.maps.event.removeListener(zoom_listener);});geocoder=new google.maps.Geocoder();$('#search').bind('submit',submit_handler);});$(document).ready(function(){var bounds=new google.maps.LatLngBounds();var markers=[];var ids={};for(var k in shops){var _data=shops[k];if(_data['i']in ids)continue;var type_classes=[];for(var i=0;i<_data['y'].length;i++){type_classes.push(used_shop_types[_data['y'][i].toString()]);}
var data={'type_classes':type_classes,'url':'','title':_data['t'],'addr':'','lat':_data['a'],'lon':_data['o'],'id':_data['i'],'extra':undefined};var stat=put_marker(data,undefined,true,true,'/ajax/shop-address/catalogue/'+data['id']+'/');if(stat['point']){bounds.extend(stat['marker'].getPosition());markers.push(stat['marker']);}}
cluster_markers(map,markers);map.setCenter(bounds.getCenter(),map.fitBounds(bounds));});
