var map,maxZoomLevel=9,minZoomLevel=7,animationStarted=!1,animationTimeout=2E3,overlayImagesSrc={},overlayImages={},overlay,userlocation=!1,defaultLocation,browserSupportFlag=!1,swBound=new google.maps.LatLng(46.2,9),neBound=new google.maps.LatLng(49.2,18),bounds=new google.maps.LatLngBounds(swBound,neBound),animator,startListener,animate=!1,updateDataControl=!1,imageTime={};
checkBounds=function(){if(!allowedBounds.contains(map.getCenter())){var a=map.getCenter(),b=a.lng(),a=a.lat(),c=allowedBounds.getNorthEast().lng(),d=allowedBounds.getNorthEast().lat(),e=allowedBounds.getSouthWest().lng(),f=allowedBounds.getSouthWest().lat();b<e&&(b=e);b>c&&(b=c);a<f&&(a=f);a>d&&(a=d);map.setCenter(new google.maps.LatLng(a,b))}};removeStartListener=function(){google.maps.event.removeListener(startListener)};
setHomeLocation=function(){navigator.geolocation?(browserSupportFlag=!0,showLoading(),navigator.geolocation.getCurrentPosition(function(a){userlocation=initialLocation=new google.maps.LatLng(a.coords.latitude,a.coords.longitude);map.setOptions({center:userlocation,zoom:7});map.setCenter(userlocation);new google.maps.Marker({position:userlocation,map:map,icon:"/img/blue_dot_circle.png"});hideLoading()},function(){handleNoGeolocation(browserSupportFlag)})):(browserSupportFlag=!1,handleNoGeolocation(browserSupportFlag))};
LightningDataOverlay=function(a,b){this.bounds_=a;this.map_=b;this.div_=null;this.setMap(b)};LightningDataOverlay.prototype=new google.maps.OverlayView;LightningDataOverlay.prototype.onAdd=function(){var a=document.createElement("DIV");a.style.borderStyle="none";a.style.borderWidth="0";a.style.borderColor="#333";a.style.position="absolute";this.div_=a;this.loadImages();this.getPanes().mapPane.appendChild(a)};
LightningDataOverlay.prototype.refreshImages=function(){if(this.div_.hasChildNodes())for(;this.div_.childNodes.length>=1;)this.div_.removeChild(this.div_.firstChild);this.loadImages(!0)};
LightningDataOverlay.prototype.loadImages=function(a){var b=1,c;for(c in overlayImagesSrc){var d=document.createElement("img");d.id="overlayImage"+c;var e=a?overlayImagesSrc[c]+"?nocache="+Math.floor(Math.random()*100001):overlayImagesSrc[c];$(d).attr("src",e).load(function(){b-1==imageCount&&hideLoading()});$(d).css({position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",display:"none",border:"none","-moz-user-select":"none","user-select":"none","-khtml-user-select":"none"});$(d).addClass("overlayImage");
this.div_.appendChild(d);typeof fixPng=="function"&&fixPng(d);overlayImages[b]=d;b++}};LightningDataOverlay.prototype.draw=function(){var a=this.getProjection(),b=a.fromLatLngToDivPixel(this.bounds_.getSouthWest()),a=a.fromLatLngToDivPixel(this.bounds_.getNorthEast()),c=this.div_;c.style.left=b.x+"px";c.style.top=a.y+"px";c.style.width=a.x-b.x+"px";c.style.height=b.y-a.y+"px"};LightningDataOverlay.prototype.hide=function(){this.div_&&(animate?$(this.div_).fadeOut(500,this.hideReal()):this.hideReal())};
LightningDataOverlay.prototype.hideReal=function(){this.div_.style.visibility="hidden"};LightningDataOverlay.prototype.showReal=function(){this.div_.style.visibility="visible"};LightningDataOverlay.prototype.show=function(){this.div_&&(animate?$(this.div_).fadeIn(200,this.showReal()):this.showReal())};LightningDataOverlay.prototype.toggle=function(){this.div_&&(this.div_.style.visibility=="hidden"?this.show():this.hide())};hideLoading=function(){$(".loading").hide()};showLoading=function(){$(".loading").show()};
toggleLoading=function(){$(".loading").toggle()};handleNoGeolocation=function(){userlocation=initialLocation=defaultLocation};dataUpdater=function(a,b){var c=new Date,d=c.getMinutes(),c=c.getSeconds();a==60&&c!=b&&(a=1);c==b&&(updateDataControl&&d%5==0&&(overlay.refreshImages(),$("#timeSliderContent").length&&refreshSlider()),a=60);updateDataControl=!0;setTimeout("dataUpdater("+a+", "+b+")",a*1E3)};
refreshSlider=function(){$.ajax({url:"index.php?page=AjaxLoader&request=timeSlider",type:"GET",dataType:"html",timeout:9E4,cache:!1,beforeSend:function(){showLoading()},success:function(a){$("#timeSliderContent").html(a);hideLoading();animator.respring()}})};
function overlayAnimator(){var a=1;new Boolean;this.hideAll=function(){for(i in overlayImages)$("#overlayImage"+i).hide()};this.show=function(a){this.hideAll();$("#overlayImage"+a).show();$("#timeInfo").length>0&&$("#timeInfo").html(imageTime[a]);this.updateSlider(a)};this.respring=function(){this.hideAll();$("#overlayImage"+a).show();$("#timeInfo").length>0&&$("#timeInfo").html(imageTime[a]);this.updateSlider(a)};this.showFirst=function(){this.hideAll();a=1;$("#overlayImage1").show();$("#timeInfo").length>
0&&$("#timeInfo").html(imageTime[1]);this.updateSlider(1)};this.showLast=function(){this.hideAll();a=imageCount;$("#overlayImage"+imageCount).show();$("#timeInfo").length>0&&$("#timeInfo").html(imageTime[imageCount]);this.updateSlider(imageCount)};this.showNext=function(){this.hideAll();a==imageCount?a=1:a+=1;$("#overlayImage"+a).show();$("#timeInfo").length>0&&$("#timeInfo").html(imageTime[a]);this.updateSlider(a)};this.showPrev=function(){this.hideAll();a==1?a=imageCount:a-=1;$("#overlayImage"+
a).show();$("#timeInfo").length>0&&$("#timeInfo").html(imageTime[a]);this.updateSlider(a)};this.animationStart=function(a){a&&showLoading();this.animationRunning=!0;this.animationRun()};this.animationRun=function(){this.animationRunning&&(this.showNext(),window.setTimeout("animator.animationRun()",animationTimeout))};this.animationPause=function(){this.animationRunning=!1};this.updateSlider=function(a){$(".slider").length>0&&($("#sliderStart").val(startTimes[a]),$("#sliderStart").click(),$("#sliderStop").val(stopTimes[a]),
$("#sliderStop").click())}}controler=new controls;
function controls(){this.showPrev=function(){animator.animationRunning||animator.showPrev()};this.animationRun=function(){$("#play").css("display","none");$("#pause").css("display","inline");$("#backward").fadeTo(1,0.5);$("#forward").fadeTo(1,0.5);$("#backward").addClass("ui-state-nohover");$("#forward").addClass("ui-state-nohover");$("#forward").css("cursor","default");$("#backward").css("cursor","default");animator.animationStart(!1)};this.animationPause=function(){$("#play").css("display","inline");
$("#pause").css("display","none");$("#backward").fadeTo(1,1);$("#forward").fadeTo(1,1);$("#backward").removeClass("ui-state-nohover");$("#forward").removeClass("ui-state-nohover");$("#forward").css("cursor","pointer");$("#backward").css("cursor","pointer");animator.animationPause()};this.showNext=function(){animator.animationRunning||animator.showNext()}}var cache=[];preLoadImages=function(){for(var a=arguments.length;a--;)if(arguments[a]){var b=document.createElement("img");b.src=arguments[a];cache.push(b)}};
