{SZN.MapEngine.Port.prototype.MIN_HEIGHT=200;SZN.MapEngine.Port.prototype.resizeManual=function(){this._repairSize();};SZN.MapEngine.Port.prototype.resizeManual.access="public";SZN.WebEngine=SZN.ClassMaker.makeClass({"NAME":"WebEngine","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.prototype.TOP_LEVEL=true;SZN.WebEngine.prototype.HOMEPAGE_HIT="Akg6D6cpS9elShrDpYTbc5ZzTO6pMavipkH7pJH34t3.B7";SZN.WebEngine.prototype.LIST_HIT="nA46EQAPSw4A4VUEqEkIFXXW.qfZfwc3BnAEcBnUzNb.W7";SZN.WebEngine.prototype.SEARCH_HIT=".K6azvAiW1ga5ar0aAezZKQO.ogGvgcn60yuvrgi39D.07";SZN.WebEngine.makeCounterHit=function(hitCode){try{pp_gemius_hit(hitCode);}catch(e){}};SZN.WebEngine.prototype.$constructor=function(mapElement,options){this.options={"showPoi":true,"showAnimation":false,"animationServer":"http://mapserver.mapy.cz"};for(var p in options){this.options[p]=options[p];}this.inited=false;this.firstStep=true;this.firstCallPoiLayer=false;this.setting=SZN.MapSetting;this.components=new Array({"part":SZN.Signals,"name":"signals"},{"part":SZN.WebEngine.HistoryMaker,"name":"historyMaker"},{"part":SZN.WebEngine.Controls,"name":"controls"},{"part":SZN.WebEngine.MyWeatherManager,"name":"myWeatherManager"},{"part":SZN.WebEngine.MenuMaker,"name":"menuMaker"},{"part":SZN.WebEngine.ResultMaker,"name":"resultMaker"},{"part":SZN.WebEngine.WthAdvert,"name":"wthAdvert"});this.actionFolder={};this._preConfigure();this.mapEngine=new SZN.MapEngine(mapElement,true);if(this.options.showAnimation){this._initAnimation();}this.addAllComponents();this._mapSetting();this.actionFolder.load=SZN.Events.addListener(window,"load",this,"init",false,1);this.actionFolder.unload=SZN.Events.addListener(window,"unload",this,"$destructor",false,1);this.mapEngine.setOwnerApp(this);if(this.options.showPoi){this.mapEngine.addApiListener(this,"weatherpoiLoaded","runPostInit");this.mapEngine.addListener(this,"inited","poiInitAction");this.mapEngine.setting.poiServers.weatherpoi={"source":"/weatherpoi","data":null,"queryFormat":"xmlhttp","output":"json"};this.mapEngine.setting.poiLayersSeq.push("weatherpoi");}this.hashAction=true;};SZN.WebEngine.prototype.$destructor=function(){if(this.historyMaker.active){this.mapEngine.removeApiListener(this,"onUserActionEnd","storeMapState");}this.callChildDestructor();for(var i in this.actionFolder){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;delete (this.actionFolder[i]);}this.mapEngine.$destructor();this.sConstructor.destroy(this);};SZN.WebEngine.prototype.init=function(){this.mapEngine.init();this.controls.init();this.wthAdvert.init();this.menuMaker.init();this.resultMaker.init();this.historyMaker.init();this.historyMaker.register(this);this.mapEngine.disableLayer("weatherpoi");if(this.historyMaker.active){this.mapEngine.addApiListener(this,"onUserActionEnd","storeMapState");}this.inited=true;this.makeEvent("inited","private");SZN.gEl("w").focus();};SZN.WebEngine.prototype._initAnimation=function(){var base=this.options.animationBase;var hbase=this.options.hybridBase;var s=new SZN.MapEngine.TileSource(hbase+"/hybrid-pocasi/",[],"alpha");var l=new SZN.MapEngine.MapLayers.TileLayer("animation_hybrid",s,false);var sw=new SZN.Visual.WeatherSwitch(this.mapEngine,{});sw.addDefault("base-n","Základní");sw.addLayer("animation_cloudiness","Mraky",base+"/cloudiness__date__/");sw.addLayer("animation_rainfall","Srážky",base+"/rainfall__date__/");sw.addLayer("animation_wind","Vítr",base+"/wind__date__/");sw.addLayer("animation_temperature","Teplota",base+"/temperature__date__/");this.mapEngine.addLayer(l);sw.setBackground("ophoto","animation_hybrid");sw.switchTo("base-n");var o=this.mapEngine.getLayer("ophoto").maxZoom=6;sw.setIndex(0);this._sw=sw;};SZN.WebEngine.prototype._checkHash=function(){if((!document.location.hash)){return false;}return true;};SZN.WebEngine.prototype.poiInitAction=function(result){if(!this.firstCallPoiLayer&&this.mapEngine.inited&&!this.mapEngine.getLayer("weatherpoi")){this.firstCallPoiLayer=true;this.mapEngine.getPoiparams("weatherpoi");}};SZN.WebEngine.prototype.runPostInit=function(){if(typeof SZN.signals.getMessage("menuStatus")!="undefined"){var time=SZN.signals.getMessage("menuStatus").time;this.resultMaker.updatePoiQuery(time,time,1);}this.mapEngine.disableLayer("weatherpoi");};SZN.WebEngine.prototype._preConfigure=function(){mapSetting.copyVisible=false;};SZN.WebEngine.prototype._mapSetting=function(){this.mapEngine.portSetSizeType("dynamic","dynamic");this.mapEngine.setHeightCorrection(16);this.mapEngine.mouseSet(7);this.mapEngine.enableSelection(1);var moveControl=new SZN.Visual.MoveControl();var zoomControl=new SZN.Visual.ZoomControl("full");var move=this.mapEngine.addControls(moveControl,10,12);var pos=this.mapEngine.getControlById(move).getSize().height+17;this.mapEngine.addControls(zoomControl,25,pos);this.mapEngine.portAddOffset({"top":10,"right":70});};SZN.WebEngine.prototype.storeMapState=function(){this.historyMaker.storeState(this);};SZN.WebEngine.prototype.argsIn=function(args){var setting=this.setting;if(this._checkHash()){if((typeof args.x=="undefined")&&(typeof args.z=="undefined")&&(typeof args.y=="undefined")){this.setFromResult=true;return;}else{this.setFromResult=false;}}var ppx=typeof args.x!="undefined"?parseInt(args.x):setting.center.x;var ppy=typeof args.y!="undefined"?parseInt(args.y):setting.center.y;var zoom=(typeof args.z!="undefined"&&!isNaN(parseInt(args.z)))?parseInt(args.z):setting.zoom;var center=this.mapEngine.getCenter();if(ppx!==center.x||ppy!==center.y){if(zoom!==this.mapEngine.zoomGet()){this.mapEngine.zoomSet(zoom,true);}this.mapEngine.setCenter(ppx,ppy);}else{if(zoom!==this.mapEngine.zoomGet()){this.mapEngine.zoomSet(zoom);}}};SZN.WebEngine.prototype.argsOut=function(){var out={};var mapCenter=this.mapEngine.getCenter();out.x=mapCenter.x;out.y=mapCenter.y;out.z=this.mapEngine.zoomGet();return out;};SZN.WebEngine.prototype.getUrlHash=function(){return this.historyMaker.getHash();};SZN.WebEngine.Controls=SZN.ClassMaker.makeClass({"NAME":"Controls","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.Controls.prototype.COL_ID="column";SZN.WebEngine.Controls.prototype.COL_CONTENT_ID="content";SZN.WebEngine.Controls.prototype.$constructor=function(owner,name){this._owner=owner;this._name=name;this.main=this.getMain();this.signals=this.setInterface("signals");this.column=null;this.content=null;this.mapa=this.main.mapEngine;this.mapa.addApiListener(this,"portResize","resizeAction");};SZN.WebEngine.Controls.prototype.$destructor=function(){this.sConstructor.destroy(this);};SZN.WebEngine.Controls.prototype.init=function(){this.column=SZN.gEl(this.COL_ID);this.content=SZN.gEl(this.COL_CONTENT_ID);this.main.mapEngine.disableLayer("base");this.main.mapEngine.enableLayer("base-n");this.resizeAction();};SZN.WebEngine.Controls.prototype.resizeAction=function(evnt){var heightCorrection=12;if(SZN.gEl("adStripBox")&&(SZN.gEl("adStripBox").style.display=="block")){var advertCorrection=SZN.gEl("adStripBox").offsetHeight+6;}else{var advertCorrection=0;}var o=this.mapa.port.getSize();var columnHeight=o.height;this.column.style.height=(columnHeight+heightCorrection+advertCorrection)+"px";var contentHeight=columnHeight+heightCorrection+advertCorrection;this.content.style.height=contentHeight+"px";};SZN.WebEngine.HistoryMaker=SZN.ClassMaker.makeClass({"NAME":"HistoryMaker","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.HistoryMaker.prototype.$constructor=function(owner,name){this._owner=owner;this._name=name;this.components=new Array();this.actionFolder={};this.listeners=[];this.lastArgs={};this.sending=false;this.active=true;this.backwardCompatibility=true;this.main=this.getMain();this.addAllComponents();this.signals=this.setInterface("signals");};SZN.WebEngine.HistoryMaker.prototype.$destructor=function(){this.callChildDestructor();for(var i=0;i<this.listeners.length;i++){this.listeners[i]=null;}this.sConstructor.destroy(this);};SZN.WebEngine.HistoryMaker.prototype.init=function(){if(typeof active!="undefined"){this.active=active;}if(this.active){this.history=new SZN.History(this,this.update);}else{this.update(SZN.History.getHashFromUrl());}};SZN.WebEngine.HistoryMaker.prototype.register=function(obj){this.listeners.push(obj);if(this.lastArgs!=={}){return obj.argsIn(this.lastArgs);}else{return false;}};SZN.WebEngine.HistoryMaker.prototype.update=function(data){if(!data){this.firstStepAction();return;}if(this.sending){return;}this.sending=true;var pairs=data.split("@");this.lastArgs={};for(var i=0;i<pairs.length;i++){var x=pairs[i].indexOf("=");if(x>0){var varName=pairs[i].substring(0,x);var varValue=pairs[i].substring(x+1).replace(/\%2540/g,"@");this.lastArgs[varName]=varValue;}}for(var i=0;i<this.listeners.length;i++){this.listeners[i].argsIn(this.lastArgs);}this.sending=false;try{this.makeEvent("historyUpdate","public");}catch(e){;}};SZN.WebEngine.HistoryMaker.prototype.getHash=function(){var data={};for(var i=0;i<this.listeners.length;i++){var x=this.listeners[i].argsOut();for(var j in x)data[j]=x[j];}var str="";for(var i in data){if(str!==""){str+="@";}if(typeof data[i]=="string"){var val=data[i].replace(/@/g,"%2540");}else{var val=data[i];}str+=i+"="+val;}this.lastArgs=data;return str;};SZN.WebEngine.HistoryMaker.prototype.storeState=function(arg){if(!this.active){return;}this.history.add(this.getHash());this.makeEvent("historyUpdate","public");};SZN.WebEngine.HistoryMaker.prototype.firstStepAction=function(){var out={};if(SZN.weatherUser){out.rt="listResult";out.tt="today";out.mt="myweather";out.ct="";}else{out.rt="listResult";out.tt="today";out.mt="cr_all";out.ct="";}this.main.resultMaker.argsIn(out,true);};SZN.WebEngine.ResultMaker=SZN.ClassMaker.makeClass({"NAME":"ResultMaker","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.ResultMaker.prototype.$constructor=function(owner,name){this._owner=owner;this._name=name;this.main=this.getMain();this.signals=this.setInterface("signals");this.components=new Array({"part":SZN.WebEngine.SearchResult,"name":"searchResult"},{"part":SZN.WebEngine.ListResult,"name":"listResult"});this.actionFolder={};this.addAllComponents();this.resultBox=null;this.activeResult=null;this.activeCategory=null;};SZN.WebEngine.ResultMaker.prototype.$destructor=function(){this.callChildDestructor();for(var i in this.actionFolder){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;delete (this.actionFolder[i]);}this.sConstructor.destroy(this);};SZN.WebEngine.ResultMaker.prototype.init=function(){this.resultBox=SZN.gEl("resultBox");this.listResult.init();this.searchResult.init();this.main.mapEngine.addApiListener(this,"cardClose","cardCloseAction");this.main.historyMaker.register(this);};SZN.WebEngine.ResultMaker.prototype.argsIn=function(args,except){if(!args){return;}if(typeof this[args["rt"]]!="undefined"){this[args["rt"]].argsIn(args,except);}};SZN.WebEngine.ResultMaker.prototype.argsOut=function(){var resultType="";var out={};if(this.activeResult==this.searchResult){out=this.searchResult.argsOut();}else{if(this.activeResult==this.listResult){out=this.listResult.argsOut();}}return out;};SZN.WebEngine.ResultMaker.prototype.cardCloseAction=function(evnt){if(this.activeResult&&(typeof this.activeResult.cardCloseAction=="function")){this.activeResult.cardCloseAction();}};SZN.WebEngine.ResultMaker.prototype._make=function(){};SZN.WebEngine.ResultMaker.prototype.fillCategory=function(category){if(this.activeCategory){if(!category){if(this.activeResult){this.activeResult.clearCategory();}}this.activeCategory=null;}if(category){this.resultBox.appendChild(category.box);this.activeCategory=category;}};SZN.WebEngine.ResultMaker.prototype.fillResult=function(obj,result,noImplicitAction,historyAction){if(!this.resultBox){return;}if(this.activeResult){this.fillCategory();if(this.activeResult.result){this.activeResult.clearResult(1);}this.activeResult=null;}if(obj){this.activeResult=obj;this.activeResult.result=result;if(this.activeCategory){this.resultBox.appendChild(this.activeResult.result.box);}else{this.resultBox.appendChild(this.activeResult.result.box);}if((result.type=="nearSearch")||(result.type=="inSearch")){if(result.data.mapSetup){if(!result.data.mapSetup.direct){this.activeResult.markRemoveFlag=true;}else{this.activeResult.markRemoveFlag=true;this.activeResult.addRegionMark(result.data.mapSetup.direct.mark.x,result.data.mapSetup.direct.mark.y);}}}if(result.type=="regionSearch"){this.main.mapEngine.disableLayer("weatherpoi");this.main.mapEngine.enableLayer("searchPoi");}else{if(!this.main.mapEngine.getLayer("weatherpoi").running){if(!this.main.firstStep){this.main.mapEngine.enableLayer("weatherpoi");}}}if(this.main.setFromResult){this.setMap(result);this.main.setFromResult=false;}if(!noImplicitAction&&!this.main.firstStep){this.setMap(result);}else{if(historyAction&&this.main.firstStep){this.main.firstStep=false;}}if(!this.main.mapEngine.getLayer("weatherpoi")&&(result.type!="regionSearch")){this.main.poiInitAction();}if(!historyAction){this.main.historyMaker.storeState(this);}else{obj.historyAction=false;}}};SZN.WebEngine.ResultMaker.prototype.setMap=function(result){if(!result.data.mapSetup){return;}if((typeof result.data.mapSetup.direct!="undefined")&&result.data.mapSetup.direct){this.main.mapEngine.setCenter(result.data.mapSetup.direct.x,result.data.mapSetup.direct.y,1);this.main.mapEngine.zoomSet(result.data.mapSetup.direct.zoom);}else{if(result.data.mapSetup.boundingBox!="undefined"){var coord=result.data.mapSetup.boundingBox;if(!coord){return;}var obj=this.main.mapEngine.setFromBoudingBox(coord.leftBottX,coord.rightTopY,coord.rightTopX,coord.leftBottY,true);this.main.mapEngine.zoomSet(obj.zoom,1);this.main.mapEngine.setCenter(obj.x,obj.y);}}this.firstEnablePoiLayer(result);};SZN.WebEngine.ResultMaker.prototype.firstEnablePoiLayer=function(result){if(this.main.firstStep&&(result.type!="regionSearch")&&!this.main.mapEngine.getLayer("weatherpoi").running){this.main.firstStep=false;this.main.mapEngine.enableLayer("weatherpoi");}};SZN.WebEngine.ResultMaker.prototype.updatePoiQuery=function(timeFrom,timeTo,noSwitchLayer){var layer=this.main.mapEngine.getLayer("weatherpoi");if(!layer){return;}var dayFrom=SZN.timeManager.stringToDate(timeFrom)/1000;var dayTo=SZN.timeManager.stringToDate(timeTo)/1000;var str="&dayFrom="+dayFrom+"&dayTo="+dayTo;layer.source.setExpandedQuery(str);if(!noSwitchLayer){this.main.mapEngine.disableLayer("weatherpoi");this.main.mapEngine.enableLayer("weatherpoi");}};SZN.WebEngine.ResultMaker.prototype.mapReSet=function(data){var mapSetting={};mapSetting.x=data.context.x;mapSetting.y=data.context.y;if(data.zomm){mapSetting.zoom=data.zoom;}else{mapSetting.zoom=this.main.mapEngine.zoomGet();}var newMapStatus=this._getNewMapStatus(mapSetting);switch(newMapStatus.type){case "update":this.main.mapEngine.setCenter(newMapStatus.data.x,newMapStatus.data.y,1);this.main.mapEngine.zoomSet(newMapStatus.data.zoom);this.main.historyMaker.storeState(this);break;case "move":this.main.mapEngine.setMove(newMapStatus.data.hor,newMapStatus.data.vert);this.main.historyMaker.storeState(this);default:break;}};SZN.WebEngine.ResultMaker.prototype._getNewMapStatus=function(mapData){var center=this.main.mapEngine.getCenter();var zoom=this.main.mapEngine.zoomGet();if(zoom!=mapData.zoom){return {"type":"update","data":mapData};}if((center.x!=mapData.x)||(center.x!=mapData.x)){var h_diff=center.x-mapData.x;var v_diff=center.y-mapData.y;return this._recalcPosition(v_diff,h_diff,mapData);}else{return {"type":"nothing","data":mapData};}};SZN.WebEngine.ResultMaker.prototype._recalcPosition=function(vert,hor,mapData){var port=this.main.mapEngine.portGetSize();var yDir=vert<0?-1:1;var xDir=hor<0?1:-1;var px_hor=this.main.mapEngine.ppToPixel(Math.abs(hor));var px_vert=this.main.mapEngine.ppToPixel(Math.abs(vert));if((px_hor==0)&&(px_vert==0)){return {"type":"nothing","data":mapData};}else{if((px_hor>port.height)||(px_vert>port.width)){return {"type":"update","data":mapData};}else{return {"type":"nothing","data":{"hor":xDir*px_hor,"vert":yDir*px_vert}};}}};SZN.WebEngine.SearchResult=SZN.ClassMaker.makeClass({"NAME":"SearchResult","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.SearchResult.prototype.INPUT_ID="w";SZN.WebEngine.SearchResult.prototype.FORM_ID="srchForm";SZN.WebEngine.SearchResult.prototype.SEARCH_URL="/searchEntities?";SZN.WebEngine.SearchResult.prototype.NEAR_URL="/listNearEntities?";SZN.WebEngine.SearchResult.prototype.$constructor=function(owner,name){this._owner=owner;this._name=name;this.main=this.getMain();this.signals=this.setInterface("signals");this.actionFolder={};this.components=new Array();this.isPagging=false;this.poiLayer=null;this.endListNum=0;this.listItems=[];this.poiItems=[];this.activeId=null;this.empty=true;this.open=false;this.result=null;this.inputElement=SZN.gEl(this.INPUT_ID);this.formElement=SZN.gEl(this.FORM_ID);this.request=new SZN.HTTPRequest("",this,"_answerProcess");this.regionMark=null;this.markRemoveFlag=true;this.historyAction=false;this.poiLayer=null;this.poiData=null;this.addAllComponents();};SZN.WebEngine.SearchResult.prototype.$destructor=function(){for(var i in this.actionFolder){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;delete (this.actionFolder[i]);}this.sConstructor.destroy(this);};SZN.WebEngine.SearchResult.prototype.init=function(){this._searchActivate();};SZN.WebEngine.SearchResult.prototype.argsOut=function(){var out={};out.rt=this._name;out.st=this.result.type;out.ph=this.result.phrase;if(this.result.pagging){out.pg=this.result.pagging.activePage?this.result.pagging.activePage:0;}else{out.pg=0;}return out;};SZN.WebEngine.SearchResult.prototype.argsIn=function(args){if(this.result){if((this.result.type==args.st)&&(this.result.phrase==args.ph)){if(this.result.pagging&&(this.result.pagging.activePage==args.pg)){return;}else{if(!this.result.pagging){return;}}}}if(args.st=="regionSearch"){this._autoRegionSearch(args.st,args.ph,args.pg);}else{if(args.st=="listSearch"||args.st=="nearSearch"||args.st=="inSearch"){this._autoListSearch(args.st,args.ph,args.pg);}}};SZN.WebEngine.SearchResult.prototype.rebuildFromURLData=function(type,phrase,page){};SZN.WebEngine.SearchResult.prototype._autoRegionSearch=function(type,phrase,page){this.historyAction=true;this.sendQuery(phrase,null,page,null,null,null);};SZN.WebEngine.SearchResult.prototype._autoListSearch=function(type,phrase){this.historyAction=true;this.sendQuery(phrase,null,null,null,null,null);};SZN.WebEngine.SearchResult.prototype.formAction=function(e,elm){SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);var str=this.inputElement.value;this.sendQuery(str);};SZN.WebEngine.SearchResult.prototype.sendQuery=function(query,mapType,page,port,cmbQuery,loop){if(!query){return;}var lp=loop?loop:"";var mt=mapType?mapType:this.main.mapEngine.getFirstLayer().name;var pg=page?page:0;if(port&&(typeof port=="object")){var pw=port.width;var ph=port.height;}else{var o=this.main.mapEngine.portGetSize();var pw=o.width;var ph=o.height;}if(cmbQuery){var qStr=query;var sUrl=this.NEAR_URL;}else{var qStr="phrase="+encodeURI(query);var sUrl=this.SEARCH_URL;this.query=query;}qStr+="&mapType="+mt+"&portWidth="+pw+"&portHeight="+ph+"&page="+pg+"&js=1&loop="+lp;var urlStr=sUrl+qStr;this.sendedReguest=this.request.send(urlStr,null,null,null);};SZN.WebEngine.SearchResult.prototype.sendFromPagging=function(page){if(this.query){this.sendQuery(this.query,false,page,false,false,false);}};SZN.WebEngine.SearchResult.prototype.sendFromRegResult=function(data){var zoom=data.zoom;var x=data.context.x;var y=data.context.y;oC=this.main.mapEngine.getCenter();if(zoom!=this.main.mapEngine.zoomGet()||(x!=oC.x||y!=oC.y)){this.main.mapEngine.setCenter(x,y,1);this.main.mapEngine.zoomSet(zoom);}this.removeRegionMark();this.addRegionMark(data.mark.x,data.mark.y);this.markRemoveFlag=false;var out="regionServerType="+data.regionType+"&regionServerId="+data.regionId;this.sendQuery(out,false,false,false,true,false);};SZN.WebEngine.SearchResult.prototype.addRegionMark=function(x,y){if(!arguments.length){this.removeRegionMark();}this.regionMark=this.main.mapEngine.makeMark("center","Střed hledání");this.main.mapEngine.addMark(x,y,this.regionMark);};SZN.WebEngine.SearchResult.prototype.removeRegionMark=function(){if(this.regionMark){this.main.mapEngine.removeMark(this.regionMark);this.regionMark=null;}};SZN.WebEngine.SearchResult.prototype.clearResult=function(){this.result.$destructor();this.result=null;this.closeCard();if(this.markRemoveFlag){this.removeRegionMark();}else{this.markRemoveFlag=true;}if(this.poiLayer){this.main.mapEngine.disableLayer("searchPoi");}this._owner.fillResult(null,null,true);};SZN.WebEngine.SearchResult.prototype._searchActivate=function(){this.actionFolder.sendQuery=SZN.Events.addListener(this.formElement,"submit",this,"formAction",false,true);};SZN.WebEngine.SearchResult.prototype._answerProcess=function(answer,status){this._updateTime();this.main.menuMaker.deactivateMenu();this.main.sConstructor.makeCounterHit(this.main.SEARCH_HIT);this.main.wthAdvert.getKMSAdvert();if(!this.empty){this.clearResult();}if(status!=200){var err={"searchResult":{"type":"empty"},"phrase":""};this._makeEmptyResult(err);return;}eval("var data = "+answer);if(!data.searchResult.resultSize){this._makeEmptyResult(data);return;}this.resultType=data.searchResult.type;switch(this.resultType){case "regionSearch":this._makeRegionResult(data);break;case "nearSearch":this._makeListResult(data);break;case "inSearch":this._makeListResult(data);break;case "listSearch":this._makeListResult(data);break;default:break;}};SZN.WebEngine.SearchResult.prototype._makeRegionResult=function(data){var result=new SZN.Visual.RegionSearchResult(data,this);this.setFormFromAnswer(result.phrase);var tt=SZN.cEl("h3");tt.style.fontSize="100%";tt.style.color="#B2B2B2";tt.innerHTML="Nalezené obce a regiony:";tt.style.marginBottom="1.2em";result.insertNode(tt);var noImpl=this.historyAction?this.historyAction:this.noImplicitAction;this._owner.fillResult(this,result,noImpl,this.historyAction);this.historyAction=false;this.result.addPagging();};SZN.WebEngine.SearchResult.prototype._makeEmptyResult=function(data){var result=new SZN.Visual.EmptySearchResult(data,this);this.setFormFromAnswer(result.phrase);var noImpl=this.historyAction?this.historyAction:this.noImplicitAction;this._owner.fillResult(this,result,noImpl,this.historyAction);this.historyAction=false;};SZN.WebEngine.SearchResult.prototype._makeListResult=function(data){var result=new SZN.Visual.ListSearchResult(data,this);this.setFormFromAnswer(result.phrase);if(result.type=="nearSearch"||result.type=="inSearch"){var tt=SZN.cEl("h3");tt.style.fontSize="100%";tt.innerHTML="Pro tuto lokalitu nemáme předpověď,<br />ale můžeme vám nabídnout tato místa:";tt.style.marginBottom="2.5em";result.insertNode(tt);}var noImpl=this.historyAction?this.historyAction:this.noImplicitAction;this._owner.fillResult(this,result,noImpl,this.historyAction);this.historyAction=false;if(result.resultData.data.length==1){result.resultData.listItems[0].clickAction(null,null);}};SZN.WebEngine.SearchResult.prototype.poiLayerManage=function(poiData){if(!this.poiData){this.poiData={"source":"","data":poiData};}else{while(this.poiData.data.length){this.poiData.data.pop();}for(var i=0;i<poiData.length;i++){this.poiData.data.push(poiData[i]);}}if(!this.poiLayer){this.poiLayer=new SZN.MapEngine.MapLayers.PoiLayer("searchPoi",false,1,this.poiData,null);this.main.mapEngine.addLayer(this.poiLayer);this.main.mapEngine.enableLayer("searchPoi");}};SZN.WebEngine.SearchResult.prototype.setFormFromAnswer=function(str){this.inputElement.value=str;};SZN.WebEngine.SearchResult.prototype._updateTime=function(){var timeFrom="today";var timeTo="today";var newStatus={};if(typeof SZN.signals.getMessage("menuStatus")!="undefined"){newStatus.type=SZN.signals.getMessage("menuStatus").type;}else{newStatus.type="cr_all";}newStatus.time="today";SZN.signals.setMessage("menuStatus",newStatus);this._owner.updatePoiQuery(timeFrom,timeTo,1);};SZN.WebEngine.SearchResult.prototype.getCard=function(data){this.closeCard();this._owner.mapReSet(data);var layer=this.main.mapEngine.getLayer("weatherpoi");if(layer){var q=layer.source.getExpandedQuery();layer.source.setExpandedQuery("");var source=layer.source;}var query="id="+data.id+"&";this.main.mapEngine.cards.cardPoi={"pos":{"x":data.mark.x,"y":data.mark.y},"id":data.id};this.main.mapEngine.setCenter(data.mark.x,data.mark.y,1);this.main.mapEngine.zoomSet(data.zoom);if(layer){this.main.mapEngine.makeMapQuery(source,"detail",query,SZN.MapEngine.DataLoader,"answerProcess","mapicon");layer.source.setExpandedQuery(q);}};SZN.WebEngine.SearchResult.prototype.closeCard=function(){if(this.main.mapEngine.cards.card){this.main.mapEngine.cards.removeCard(true);}};SZN.WebEngine.SearchResult.prototype.cardCloseAction=function(){if(this.result&&this.result.activeListItem){this.result.closeCardAction();}};SZN.WebEngine.SearchResult.prototype.clearCategory=function(){};SZN.WebEngine.ListResult=SZN.ClassMaker.makeClass({"NAME":"ListResult","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.ListResult.prototype.LIST_ADDRESS="/listEntities?";SZN.WebEngine.ListResult.prototype.MAP_TYPES="mapType=base-n";SZN.WebEngine.ListResult.prototype.HEADLINES_CR={"today":"Dnešní předpověď:","tomorrow":"Předpověď na zítra:","aftertomorrow":"Předpověď na pozítří:","longdistance":"Dlouhodobá předpověď:"};SZN.WebEngine.ListResult.prototype.$constructor=function(owner,name){this._owner=owner;this._name=name;this.main=this.getMain();this.signals=this.setInterface("signals");this.actionFolder={};this.resultBox=null;this.activeCategoryId=null;this.categoryList={};this.activeCategory=null;this.request=new SZN.HTTPRequest("",this,"_answerProcess");this.sendedReguest=null;this.result=null;this.timeChangeFlag=false;this.noImplicitAction=false;this.historyAction=true;this.fst=false;this.firstStep=true;this.myweather=this.main.myWeatherManager;};SZN.WebEngine.ListResult.prototype.$destructor=function(){for(var i in this.actionFolder){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;delete (this.actionFolder[i]);}this.sConstructor.destroy(this);};SZN.WebEngine.ListResult.prototype.init=function(){this._buildCategoryList();SZN.signals.addListener(this,"statusUpdate","menuChange");};SZN.WebEngine.ListResult.prototype.argsOut=function(){var out={};out.rt=this._name;out.tt=this.timeType;out.mt=this.menuType;out.ct=this.activeCategoryId?this.activeCategoryId:"";return out;};SZN.WebEngine.ListResult.prototype.argsIn=function(args,except){this.menuType=args.mt;this.timeType=args.tt;if(except){this.fst=true;}else{this.fst=false;}this.rebuildFromURLData(args.mt,args.tt,args.ct);};SZN.WebEngine.ListResult.prototype.menuChange=function(evnt){if(typeof SZN.signals.getMessage("menuStatus")!="undefined"){var type=SZN.signals.getMessage("menuStatus").type;var time=SZN.signals.getMessage("menuStatus").time;this.menuType=type;this.timeType=time;}if(!this._isNewState(type,time)){return;}if(this.result){if((this.result.menuType==type)&&(this.activeCategoryId==this.result.category)){this.noImplicitAction=true;}else{this.noImplicitAction=false;}if((time!=this.result.timeType)&&(type==this.result.menuType)){this.timeChangeFlag=true;}else{if((time!=this.result.timeType)&&(type!=this.result.menuType)){this.timeChangeFlag=true;this._updateTime({"timeType":time,"menuType":type},1);}}if(type==this.result.menuType){this.clearResult(1);this._buildQuery(type,time);return;}this.clearResult(1);}else{this.timeChangeFlag=true;}if(this.activeCategory){this.clearCategory();}if(type in this.categoryList){this.activeCategoryId=null;this.categoryList[type].activate(0,1);this.activeCategory=this.categoryList[type];this.activeCategoryId=this.activeCategory.activeItem.id;this._owner.fillCategory(this.activeCategory);}else{this._owner.fillCategory();}this._buildQuery(type,time);};SZN.WebEngine.ListResult.prototype.rebuildFromURLData=function(type,time,category){this.historyAction=true;this.noImplicitAction=true;this.timeChangeFlag=false;if(!this._isNewState(type,time)){if(this.activeCategoryId==category){return;}else{this.historyAction=true;this.setCategoryId(category);return;}}SZN.signals.setMessage("menuStatus",{"type":type,"time":time});var poiLayerUpdate=true;if(this.main.mapEngine.getLayer("weatherpoi")){if(this.result){if((time!=this.result.timeType)&&(type==this.result.menuType)){this.timeChangeFlag=true;poiLayerUpdate=false;}}this._updateTime({"timeType":time},poiLayerUpdate);}this.main.menuMaker.update(type,time,false);if(category){this.setCategoryId(category);}else{this._buildQuery(type,time);}};SZN.WebEngine.ListResult.prototype.restoreMyWeatherResult=function(type,time){this.historyAction=true;this.noImplicitAction=true;this.timeChangeFlag=false;SZN.signals.setMessage("menuStatus",{"type":type,"time":time});var poiLayerUpdate=true;if(this.main.mapEngine.getLayer("weatherpoi")){if(this.result){if((time!=this.result.timeType)&&(type==this.result.menuType)){this.timeChangeFlag=true;poiLayerUpdate=false;}}this._updateTime({"timeType":time},poiLayerUpdate);}this.main.menuMaker.update(type,time,false);this._buildQuery(type,time);};SZN.WebEngine.ListResult.prototype.setCategoryId=function(id){if(id){if(this.result&&!this.historyAction){var menu=this.result.menuType;var time=this.result.timeType;this.clearResult();this.activeCategoryId=id;this._buildQuery(menu,time);}else{if(this.result){this.clearResult();}this.activeCategoryId=id;var type=SZN.signals.getMessage("menuStatus").type;var time=SZN.signals.getMessage("menuStatus").time;this._buildQuery(type,time);}}else{this.activeCategoryId=null;}};SZN.WebEngine.ListResult.prototype._buildCategoryList=function(){var menu=SZN.WebSetting.menu;for(var i=0;i<menu.length;i++){if(typeof menu[i].category!="undefined"){this.categoryList[menu[i].name]=new SZN.Visual.WeatherCategory(this,menu[i].category);}}};SZN.WebEngine.ListResult.prototype._buildQuery=function(menuStatus,timeStatus){var urlField=[];var js="&js=1";var time="&time="+(timeStatus?timeStatus:"today");var menu="&menuEntry="+(menuStatus?menuStatus:"cr_all");var category="&submenuEntry="+(this.activeCategoryId?this.activeCategoryId:"");if((menuStatus=="cr_all")&&(timeStatus=="today")){var url=this.LIST_ADDRESS+this.MAP_TYPES+"&time=longdistance"+menu+category+js+"&loop=today_change";}else{var url=this.LIST_ADDRESS+this.MAP_TYPES+time+menu+category+js+"&loop=";}this.sendedReguest=this.request.send(url,null,null,null);};SZN.WebEngine.ListResult.prototype._answerProcess=function(data,status){this.main.wthAdvert.getKMSAdvert();if(status==404){eval("var answer = "+data);if(answer.loop.indexOf("today_change")!=-1){answer.timeType="today";}this._makeEmptyResult(answer,status);return;}else{if(status==401){if(this.myweather.isLoged){var test=window.confirm("Pro dokončení akce je potřeba se přihlásit.\nPřihlásit nyní?");if(test){this.myweather.goToLogin();}else{this.main.menuMaker.update("cr_all","today",true);return;}}else{this.myweather.goToLogin();}}else{if(status!=200){this._makeEmptyResult({},status);return;}}}eval("var answer = "+data);if(answer.loop.indexOf("today_change")!=-1){answer.timeType="today";}this.manageResult(answer);};SZN.WebEngine.ListResult.prototype.manageResult=function(answer,status){if(answer.menuType=="cr_all"){if(answer.timeType!="longdistance"){this._makeCrResultDay(answer);if(answer.timeType=="today"){this.main.sConstructor.makeCounterHit(this.main.HOMEPAGE_HIT);return;}}else{this._makeCrResultLong(answer);}}else{if(answer.menuType=="myweather"){this._makeMyWeatherResult(answer);}else{this._makeListResult(answer);}}this.main.sConstructor.makeCounterHit(this.main.LIST_HIT);};SZN.WebEngine.ListResult.prototype._makeCrResultDay=function(data){var result=new SZN.Visual.CrAllDayListResult(data);this._setResultHeadline(result);var noSetFlag=this.firstStep?true:this.noImplicitAction;this._owner.fillResult(this,result,noSetFlag,this.historyAction);this._updateTime(result);this.firstStep=false;};SZN.WebEngine.ListResult.prototype._makeCrResultLong=function(data){var result=new SZN.Visual.CrAllLongListResult(data);this._setResultHeadline(result);var noSetFlag=this.firstStep?true:this.noImplicitAction;this._owner.fillResult(this,result,noSetFlag,this.historyAction);this._updateTime(result);this.firstStep=false;};SZN.WebEngine.ListResult.prototype._makeMyWeatherResult=function(data){var result=new SZN.Visual.WeatherListFavorite(data,this);this._owner.fillResult(null,null,true,false);this.main.myWeatherManager.favorite=result.idTable;this._setCategory(result);var noSetFlag=this.firstStep?true:this.noImplicitAction;this._owner.fillResult(this,result,noSetFlag,this.historyAction);this._updateTime(result);this.firstStep=false;};SZN.WebEngine.ListResult.prototype._makeListResult=function(data){var result=new SZN.Visual.WeatherListResult(data,this);this._owner.fillResult(null,null,true,false);this._setCategory(result);var noSetFlag=this.firstStep?true:this.noImplicitAction;this._owner.fillResult(this,result,noSetFlag,this.historyAction);this._updateTime(result);this.firstStep=false;};SZN.WebEngine.ListResult.prototype._makeEmptyResult=function(data,status){var result=new SZN.Visual.WeatherEmptyResult(data,status);this._owner.fillResult(null,null,true,false);this._setCategory(result);var noSetFlag=this.firstStep?true:this.noImplicitAction;this._owner.fillResult(this,result,noSetFlag);this._updateTime(result);};SZN.WebEngine.ListResult.prototype._updateTime=function(result,noSwitchLayer){if(this.timeChangeFlag){var timeFrom=result.timeType=="longdistance"?"today":result.timeType;var timeTo=result.timeType=="longdistance"?"today":result.timeType;this._owner.updatePoiQuery(timeFrom,timeTo,noSwitchLayer);this.timeChangeFlag=false;}this.noImplicitAction=false;};SZN.WebEngine.ListResult.prototype._setResultHeadline=function(result){if(result.timeType!="longdistance"){return;}if(result.menuType=="cr_all"){var head=SZN.cEl("h2");head.innerHTML=this.HEADLINES_CR[result.timeType];result.insertNode(head);}};SZN.WebEngine.ListResult.prototype._setCategory=function(result){var menuId=result.menuType;var categoryId=result.category;if(menuId in this.categoryList){if(this.activeCategory){this.activeCategory.deActivate();}this.categoryList[menuId].activate(categoryId,1);this.activeCategory=this.categoryList[menuId];}this.activeCategoryId=categoryId;this._owner.fillCategory(this.activeCategory);};SZN.WebEngine.ListResult.prototype.clearResult=function(noPropagate){this.result.$destructor();this.result=null;this.closeCard();if(!noPropagate){this._owner.fillResult(null,null,true,false);}};SZN.WebEngine.ListResult.prototype.clearCategory=function(){if(this.activeCategory){this.activeCategory.box.parentNode.removeChild(this.activeCategory.box);this.activeCategory.deActivate();this.activeCategory=null;this.activeCategoryId=null;}};SZN.WebEngine.ListResult.prototype._isNull=function(item){if(item!=null){return false;}else{return true;}};SZN.WebEngine.ListResult.prototype._isNewState=function(type,time){if(this.result){if((this.result.timeType==time)&&(this.result.menuType==type)){return false;}else{return true;}}else{return true;}};SZN.WebEngine.ListResult.prototype.getCard=function(data){if(this.main.mapEngine.cards.card){this.main.mapEngine.cards.removeCard(true);}this._owner.mapReSet(data);var layer=this.main.mapEngine.getLayer("weatherpoi");var q=layer.source.getExpandedQuery();layer.source.setExpandedQuery("");var source=layer.source;var query="id="+data.id+"&";this.main.mapEngine.cards.cardPoi={"pos":{"x":data.mark.x,"y":data.mark.y},"id":data.id};this.main.mapEngine.setCenter(data.mark.x,data.mark.y,1);this.main.mapEngine.zoomSet(data.zoom);this.main.mapEngine.makeMapQuery(source,"detail",query,SZN.MapEngine.DataLoader,"answerProcess","mapicon");layer.source.setExpandedQuery(q);};SZN.WebEngine.ListResult.prototype.closeCard=function(){if(this.main.mapEngine.cards.card){this.main.mapEngine.cards.removeCard(true);}};SZN.WebEngine.ListResult.prototype.cardCloseAction=function(){if(this.result&&this.result.activeListItem){this.result.closeCardAction();}};SZN.WebEngine.MenuMaker=SZN.ClassMaker.makeClass({"NAME":"MenuMaker","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.MenuMaker.prototype.MENU_ID="menu";SZN.WebEngine.MenuMaker.prototype.TIME_MENU_ID="days";SZN.WebEngine.MenuMaker.prototype.PREFIX_LENGTH=3;SZN.WebEngine.MenuMaker.prototype.LD_TIME_TYPE="longdistance";SZN.WebEngine.MenuMaker.prototype.TODAY_TIME_TYPE="today";SZN.WebEngine.MenuMaker.prototype.LD_MENU_TYPE="cr_all";SZN.WebEngine.MenuMaker.prototype.MENU_PREFIX="mm_";SZN.WebEngine.MenuMaker.prototype.TIME_PREFIX="mt_";SZN.WebEngine.MenuMaker.prototype.FAVOURITE_MENU_TYPE="myweather";SZN.WebEngine.MenuMaker.prototype.TIME_INHERITED=false;SZN.WebEngine.MenuMaker.prototype.DAY_ONLY_MENU_TYPES={"rivers":1,"winter_all":1,"winter_cr":1};SZN.WebEngine.MenuMaker.prototype.$constructor=function(owner,name){this._owner=owner;this._name=name;this.main=this.getMain();this.signals=this.setInterface("signals");this.actionFolder={};this.webSetting=SZN.WebSetting;this.menu=null;this.menuItems={};this.menuLeftBorder=null;this.menuRightBorder=null;this.timeMenu=null;this.timeMenuItems={};this.menuStatus=null;this.timeStatus=null;this.isLoged=false;this.refreshLastUpdate=SZN.bind(this,this._refreshLastUpdate);this._make();};SZN.WebEngine.MenuMaker.prototype.$destructor=function(){for(var i in this.actionFolder){if(this.actionFolder[i]){SZN.Events.removeListener(this.actionFolder[i]);}this.actionFolder[i]=null;delete (this.actionFolder[i]);}this.sConstructor.destroy(this);};SZN.WebEngine.MenuMaker.prototype.init=function(){};SZN.WebEngine.MenuMaker.prototype._lastUpdateResponse=function(str){var data=eval("("+str+")");var ts=parseInt(data.lastStateUpdate);var date=new Date(1000*ts);var delta=Math.round(new Date().getTime()/1000)-ts;var txt="";if(delta/(60*60)<12){txt+="Aktualizováno ";if(date.getDate()!=new Date().getDate()){txt+="včera";}else{txt+="dnes";}var h=date.getHours();var m=date.getMinutes();if(m<10){m="0"+m;}txt+=" v "+h+":"+m;}this.lastUpdate.innerHTML=txt;};SZN.WebEngine.MenuMaker.prototype._refreshLastUpdate=function(){var xhr=new SZN.HTTPRequest();xhr.send("/lastStateUpdate",this,"_lastUpdateResponse");};SZN.WebEngine.MenuMaker.prototype._make=function(){this.menu=SZN.gEl(this.MENU_ID);this.timeMenu=SZN.gEl(this.TIME_MENU_ID);this.lastUpdate=SZN.cEl("div","last-update");this.menuLeftBorder=SZN.cEl("span",false,"rowleft");this.menuRightBorder=SZN.cEl("span",false,"rowright");this._makeMenu();this._makeTimeMenu();this.refreshLastUpdate();setInterval(this.refreshLastUpdate,10*60*1000);};SZN.WebEngine.MenuMaker.prototype._makeMenu=function(){var mn=SZN.cEl("ul");var def=this.webSetting.menu;for(var i=0;i<def.length;i++){var item=SZN.cEl("li");var aItem=SZN.cEl("a");aItem.href="#";aItem.innerHTML=def[i].desc;aItem.id=this.MENU_PREFIX+def[i].name;this.actionFolder[aItem.id]=SZN.Events.addListener(aItem,"click",this,"menuAction",false,true);this.menuItems[def[i].name]=aItem;item.appendChild(aItem);mn.appendChild(item);}this.menu.appendChild(mn);this.menu.appendChild(SZN.cEl("div",false,"cleaner"));};SZN.WebEngine.MenuMaker.prototype._XXXmakeMenu=function(){var mn=SZN.cEl("ul");var def=this.webSetting.menu;for(var i=0;i<def.length;i++){var item=SZN.cEl("li");var aItem=SZN.cEl("a");aItem.href="#";aItem.innerHTML=def[i].desc;aItem.id=this.MENU_PREFIX+def[i].name;this.actionFolder[aItem.id]=SZN.Events.addListener(aItem,"click",this,"menuAction",false,true);this.menuItems[def[i].name]=aItem;item.appendChild(aItem);mn.appendChild(item);}this.menu.appendChild(mn);this.menu.appendChild(SZN.cEl("div",false,"cleaner"));};SZN.WebEngine.MenuMaker.prototype._makeMenu=function(){var mn=SZN.cEl("ul");var def=this.webSetting.menu;for(var i=0;i<def.length;i++){var item=SZN.cEl("li");var itemBox=SZN.cEl("div",null,"body");var item_L_C=SZN.cEl("div",null,"corner m_left");var item_R_C=SZN.cEl("div",null,"corner m_right");var itemIn=SZN.cEl("div",null,"in");var itemDiv=SZN.cEl("div");item.appendChild(itemBox);itemBox.appendChild(item_L_C);itemBox.appendChild(item_R_C);itemBox.appendChild(itemIn);itemIn.appendChild(itemDiv);var aItem=SZN.cEl("a");aItem.href="#";aItem.innerHTML=def[i].desc;aItem.id=this.MENU_PREFIX+def[i].name;this.actionFolder[aItem.id]=SZN.Events.addListener(aItem,"click",this,"menuAction",false,true);this.menuItems[def[i].name]=aItem;itemDiv.appendChild(aItem);mn.appendChild(item);}this.menu.appendChild(mn);this.menu.appendChild(SZN.cEl("div",false,"cleaner"));};SZN.WebEngine.MenuMaker.prototype._makeTimeMenu=function(){var mn=SZN.cEl("ul");var def=this.webSetting.time;for(var i=0;i<def.length;i++){var item=SZN.cEl("li");if(i<(def.length-1)){item.className="day";}else{item.className="forecast";}var aItem=SZN.cEl("a");aItem.href="#";aItem.innerHTML=def[i].desc;aItem.id=this.TIME_PREFIX+def[i].name;this.actionFolder[aItem.id]=SZN.Events.addListener(aItem,"click",this,"timeMenuAction",false,true);this.timeMenuItems[def[i].name]=aItem;item.appendChild(aItem);mn.appendChild(item);}this.timeMenu.appendChild(mn);this.timeMenu.appendChild(this.lastUpdate);this.timeMenu.appendChild(SZN.cEl("div",false,"cleaner"));};SZN.WebEngine.MenuMaker.prototype.menuAction=function(e,elm){if(e&&(e.type!="manualEvent")){SZN.Events.cancelDef(e);}if(this.menuStatus){if(this.menuStatus.node==elm){return 0;}this.deactivateMenuItem(this.menuStatus.node);}var out=this.activateMenuItem(elm);if(e){this.statusUpdate();}return out;};SZN.WebEngine.MenuMaker.prototype.deactivateMenuItem=function(nd){var t=nd;while(t.nodeName.toLowerCase()!="li"){t=t.parentNode;}t.className="";this.menuStatus=null;};SZN.WebEngine.MenuMaker.prototype.activateMenuItem=function(nd){var t=nd;while(t.nodeName.toLowerCase()!="li"){t=t.parentNode;}t.className="active";if((SZN.Browser.client=="ie")&&(SZN.Browser.version<7)){if(t.offsetWidth%2){var n=SZN.Dom.getElementsByClass("m_right",t)[0];n.style.right="-1px";}}var menuType=this.menuStatus?this.menuStatus.type:"fake";this.menuStatus={"node":nd,"type":nd.id.substring(this.PREFIX_LENGTH)};if(!this.TIME_INHERITED){if(menuType!=nd.id.substring(this.PREFIX_LENGTH)){this.timeMenuAction(null,SZN.gEl(this.TIME_PREFIX+this.TODAY_TIME_TYPE));}}return this._correctTime();};SZN.WebEngine.MenuMaker.prototype._correctTime=function(){var corrected=0;if(this.menuStatus.type in this.DAY_ONLY_MENU_TYPES){for(var i in this.timeMenuItems){if(i!=this.TODAY_TIME_TYPE){this.timeMenuItems[i].style.display="none";}else{this.timeMenuAction(null,this.timeMenuItems[this.TODAY_TIME_TYPE]);corrected=1;}}}else{for(var i in this.timeMenuItems){this.timeMenuItems[i].style.display="block";}}if(this.menuStatus.type!=this.LD_MENU_TYPE){SZN.gEl(this.TIME_PREFIX+this.LD_TIME_TYPE).style.display="none";if(this.timeStatus&&(this.timeStatus.type==this.LD_TIME_TYPE)){this.timeMenuAction(null,this.timeMenuItems[this.TODAY_TIME_TYPE]);corrected=1;}}else{SZN.gEl(this.TIME_PREFIX+this.LD_TIME_TYPE).style.display="block";}if(!this.timeStatus){this.timeMenuAction(null,this.timeMenuItems[this.TODAY_TIME_TYPE]);corrected=1;}return corrected;};SZN.WebEngine.MenuMaker.prototype.timeMenuAction=function(e,elm){if(e&&(e.type!="manualEvent")){SZN.Events.cancelDef(e);}if(!this.menuStatus){return;}if((this.menuStatus.type!=this.LD_MENU_TYPE)&&(elm.id==(this.TIME_PREFIX+this.LD_TIME_TYPE))){return;}if(this.timeStatus){if(this.timeStatus.node==elm){return;}this.deactivateTimeItem(this.timeStatus.node);}this.activateTimeItem(elm);if(e){this.statusUpdate();}};SZN.WebEngine.MenuMaker.prototype.deactivateTimeItem=function(nd){if(nd.parentNode.className.indexOf("forecast")!=-1){nd.parentNode.className="forecast";}else{nd.parentNode.className="day";}this.timeStatus=null;};SZN.WebEngine.MenuMaker.prototype.activateTimeItem=function(nd){nd.parentNode.className+=" active";this.timeStatus={"node":nd,"type":nd.id.substring(this.PREFIX_LENGTH)};};SZN.WebEngine.MenuMaker.prototype.deactivateMenu=function(main,time){if(this.menuStatus){this.deactivateMenuItem(this.menuStatus.node);}if(this.timeStatus){this.deactivateTimeItem(this.timeStatus.node);}};SZN.WebEngine.MenuMaker.prototype.statusUpdate=function(){var obj={"type":this.menuStatus.type,"time":this.timeStatus.type};SZN.signals.setMessage("menuStatus",obj);SZN.signals.makeEvent("statusUpdate",this,"public",new Date().getTime());};SZN.WebEngine.MenuMaker.prototype.update=function(menu,time,propagate){var ev=null;if(propagate){ev={"type":"manualEvent"};}var menuType=this.menuStatus?this.menuStatus.type:"fake";if(!(menu in this.menuItems)){var menu=this.LD_MENU_TYPE;}var time=(time||(time==0))?this._convertTime(time):false;if(menu){if(menuType!=menu){if(this.menuItems[menu]){var timeSetFromMenu=this.menuAction(null,this.menuItems[menu]);var timeSetFromTime=time?this._timeUpdate(time,null):false;if(ev){this.statusUpdate();}return;}}}if(time){this._timeUpdate(time,null);if(ev){this.statusUpdate();}}};SZN.WebEngine.MenuMaker.prototype._timeUpdate=function(time,fakeEvent){var ev=fakeEvent;var timeType=this.timeStatus?this.timeStatus.type:"fake";if((this.menuStatus.type in this.DAY_ONLY_MENU_TYPES)&&(time!=this.LD_TIME_TYPE)){if(timeType!=time){this.timeMenuAction(ev,this.timeMenuItems[time]);return 1;}}else{if((time==this.LD_TIME_TYPE)&&(this.menuStatus.type==this.LD_MENU_TYPE)){if(timeType!=time){this.timeMenuAction(ev,this.timeMenuItems[time]);return 1;}}}if(!ev){this.timeMenuAction(ev,this.timeMenuItems[time]);}return 0;};SZN.WebEngine.MenuMaker.prototype._convertTime=function(data){if(isNaN(data)){if(data in this.timeMenuItems){return data;}else{return this.TODAY_TIME_TYPE;}}else{return SZN.timeManager.dateToString(data);}};SZN.WebEngine.WthAdvert=SZN.ClassMaker.makeClass({"NAME":"WthAdvert","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.WthAdvert.obj=null;SZN.WebEngine.WthAdvert.getAdvert=function(data){if(SZN.WebEngine.WthAdvert.obj){SZN.WebEngine.WthAdvert.obj["_kmsAnswer"](data);}};SZN.WebEngine.WthAdvert.getAdvert_2=function(data){if(SZN.WebEngine.WthAdvert.obj){SZN.WebEngine.WthAdvert.obj["_kmsAnswer_2"](data);}};SZN.WebEngine.WthAdvert.prototype.adverts=[{"zoneId":"seznam.pocasi.komercni-sdeleni","boxId":"advertBox"},{"zoneId":"seznam.pocasi.prouzek","boxId":"advertFlexBox"}];SZN.WebEngine.WthAdvert.prototype.$constructor=function(owner,name){this._owner=owner;this._name=name;this.main=this.getMain();this.signals=this.setInterface("signals");this.actionFolder={};this.kmsBox=null;this.advertURL=SZN.advertURL;this.showBottomStrip=SZN.bind(this,this._showBottomStrip);};SZN.WebEngine.WthAdvert.prototype.$destructor=function(){for(var i in this){this[i]=null;}};SZN.WebEngine.WthAdvert.prototype.init=function(){this.sConstructor.obj=this;this.kmsBox=SZN.gEl(this.adverts[0].boxId);this._kmsAnswer=SZN.bind(this,this.answer_1Tmp),this._kmsAnswer_2=SZN.bind(this,this.answer_2Tmp);};SZN.WebEngine.WthAdvert.prototype.answer_2Tmp=function(data){if(!data){return;}var advTrg=SZN.gEl("adStripBox");if(data.indexOf("impress?")!=-1){SZN.Dom.addClass(advTrg,"adFull");var adv=this._adParser(data);advTrg.innerHTML=adv.codeHTML;advTrg.style.visibility="hidden";advTrg.style.position="absolute";advTrg.style.top="-2000px";advTrg.style.left="-2000px";advTrg.style.display="block";var h=advTrg.offsetHeight;this.main.mapEngine.portSetOuterBottomOffset(h);this.main.mapEngine.portResizeManual();adv.codeJS.forEach(eval);this._showBottomStrip();}else{var adv=this._adParser(data);advTrg.innerHTML=adv.codeHTML;advTrg.style.display="none";}};SZN.WebEngine.WthAdvert.prototype._showBottomStrip=function(){var advTrg=SZN.gEl("adStripBox");advTrg.style.position="static";advTrg.style.visibility="visible";};SZN.WebEngine.WthAdvert.prototype.answer_1Tmp=function(data){if(!data){return;}if(data.indexOf("impress?")!=-1){if(data.indexOf("id=\"advertContainer\"")!=-1){var adv=this._adParser(data);var code="<div style=\"padding-left:0px;font-size:85%;color:#666666;\">Reklama:</div>"+adv.codeHTML+"<div class=\"clear\"></div>";this.kmsBox.className="advertBox2";this.kmsBox.innerHTML=code;adv.codeJS.forEach(eval);}else{var adv=this._adParser(data);var code="<div style=\"padding-left:10px;font-size:85%;color:#666666;\">Komerční sdělení:</div>"+adv.codeHTML+"<div class=\"clear\"></div>";this.kmsBox.className="advertBox";this.kmsBox.innerHTML=code;adv.codeJS.forEach(eval);}}else{var adv=this._adParser(data);this.kmsBox.className="";this.kmsBox.innerHTML="<div style=\"width:1px;height:1px;overflow:hidden\">"+adv.codeHTML+"</div>";}};SZN.WebEngine.WthAdvert.prototype._adParser=function(str){var jsField=[];var out={};var s=str.replace(/<script.*?>([\s\S]*?)<\/script>/g,function(tag,code){jsField.push(code);return "";});return {"codeHTML":s,"codeJS":jsField};};SZN.WebEngine.WthAdvert.prototype.getKMSAdvert=function(){try{im.ajaxAd(SZN.WebEngine.WthAdvert.getAdvert,this.adverts[0].zoneId,"","");im.ajaxAd(SZN.WebEngine.WthAdvert.getAdvert_2,this.adverts[1].zoneId,"","");}catch(e){}};SZN.Visual.Pagging=SZN.ClassMaker.makeClass({"NAME":"Pagging","VERSION":"2.0","CLASS":"class"});SZN.Visual.Pagging.prototype.TAP_MARGIN=4;SZN.Visual.Pagging.prototype.Pagging=function(owner,data){this.owner=owner;if(data.searchResult.pagging){this.activePage=parseInt(data.searchResult.pagging.pageNumber);}else{this.activePage=null;}this.activePagging=null;this.actionFolder={};this._make();this.box=this.tmp.cloneNode("false");};SZN.Visual.Pagging.prototype.$destructor=function(){this.deActivate();};SZN.Visual.Pagging.prototype.init=function(){};SZN.Visual.Pagging.prototype.deActivate=function(){for(var i in this.actionFolder){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;delete (this.actionFolder[i]);}this.remove;};SZN.Visual.Pagging.prototype.remove=function(){if(this.activePagging){this.activePagging.parentNode.removeChild(this.activePagging);this.activePagging=null;}};SZN.Visual.Pagging.prototype.reBuild=function(data,trg){this.deActivate();if(this.activePagging){this.activePagging.style.visibility="hidden";}var next=null;var prev=null;var cont=this.box;if(typeof data.pg_prev!="undefined"){prev=this.prev;prev.dataFold="prev";cont.appendChild(prev);this.actionFolder["prev"]=SZN.Events.addListener(prev,"click",this,"_goToPage",false,true);}for(var i=0;i<data.pg_links.length;i++){var flag=(i+1)%2;var ac=data.pg_links[i].name==data.pageNumber+1?true:false;var tap=this.tap.cloneNode(false);tap.dataFold=data.pg_links[i].name-1;if(ac){tap.className+=" sel_"+flag;tap.innerHTML="<strong>"+data.pg_links[i].name+"</strong>";this.activePage=parseInt(data.pg_links[i].name)-1;}else{tap.className+=" ac_"+flag;tap.innerHTML=data.pg_links[i].name;this.actionFolder["tp_"+i]=SZN.Events.addListener(tap,"click",this,"_goToPage",false,true);}tap.style.margin="0 "+this.TAP_MARGIN+"px";cont.appendChild(tap);}if(typeof data.pg_next!="undefined"){next=this.next;next.dataFold="next";cont.appendChild(next);this.actionFolder["next"]=SZN.Events.addListener(next,"click",this,"_goToPage",false,true);}var clr=SZN.cEl("div");clr.className="clear";cont.appendChild(clr);var n=0;var m=cont.offsetWidth;for(var i=0;i<(cont.childNodes.length-1);i++){n+=cont.childNodes[i].offsetWidth+2*this.TAP_MARGIN;}var w=Math.floor((m-n)/2);cont.style.width=n+"px";cont.style.marginLeft=w+"px";cont.style.visibility="visible";this.activePagging=cont;};SZN.Visual.Pagging.prototype._goToPage=function(e,elm){var pg=0;switch(elm.dataFold){case "prev":pg=this.activePage-1;break;case "next":pg=this.activePage+1;break;default:pg=elm.dataFold;break;}this.owner.goToPage(pg);};SZN.Visual.Pagging.prototype._make=function(){this.tmp=SZN.cEl("div");this.tmp.className="resultPagging";this.tmp.style.visibility="hidden";this.prev=SZN.cEl("div");this.prev.innerHTML="<span>Predchozi</span>";this.prev.className="resultPrev";this.next=SZN.cEl("div");this.next.innerHTML="<span>Další</span>";this.next.className="resultNext";this.tap=SZN.cEl("div");this.tap.className="resultTap";this.activeTap=SZN.cEl("div");};SZN.WebEngine.MyWeatherManager=SZN.ClassMaker.makeClass({"NAME":"MyWeatherManager","VERSION":"1.0","IMPLEMENT":[SZN.Components,SZN.SigInterface],"CLASS":"class"});SZN.WebEngine.MyWeatherManager.prototype.ADD_ADDRESS="/addToMyWeather?entityId=";SZN.WebEngine.MyWeatherManager.prototype.REMOVE_ADDRESS="/removeFromMyWeather?entityId=";SZN.WebEngine.MyWeatherManager.prototype.$constructor=function(owner,name){this._owner=owner;this._name=name;this.main=this.getMain();this.request=new SZN.HTTPRequest("",this,"_answerProcess");this.isLoged=SZN.weatherUser;this.favorite={};this.loginURL=SZN.weatherLoginURL;};SZN.WebEngine.MyWeatherManager.prototype.$destructor=function(){};SZN.WebEngine.MyWeatherManager.prototype.init=function(){};SZN.WebEngine.MyWeatherManager.prototype.favoriteAdd=function(ids){var url=this.ADD_ADDRESS+ids+"&js=1";this.request.send(url,this,"_answerProcess");};SZN.WebEngine.MyWeatherManager.prototype.favoriteRemove=function(ids){var url=this.REMOVE_ADDRESS+ids+"&js=1";this.request.send(url,this,"_answerProcess");};SZN.WebEngine.MyWeatherManager.prototype._answerProcess=function(data,status){if(status==200){eval("var answer = "+data);this.cardUpdate(answer);}else{if(status==401){if(this.isLoged){var test=window.confirm("Pro dokončení akce je třeba se znovu přihlásit.\nChcete se nyní přihlásit?");}else{var test=window.confirm("Pro dokončení akce je třeba se přihlásit.\nChcete se nyní přihlásit?");}if(test){eval("var answer = "+data);if(answer.action=="add"){window.location=this.loginURL+encodeURIComponent(this.ADD_ADDRESS)+answer.id;}else{window.location=this.loginURL+encodeURIComponent(this.REMOVE_ADDRESS)+answer.id;}}return;}else{alert("Akce nemohla být dokončena");}}};SZN.WebEngine.MyWeatherManager.prototype.loginTest=function(){if(!this._isLoged){this.goToLogin();return false;}this.request.send(this.loginURL,this,"_menuAnswer");};SZN.WebEngine.MyWeatherManager.prototype.isFavorite=function(id){if(id in this.favorite){return true;}return false;};SZN.WebEngine.MyWeatherManager.prototype.set=function(id,cardTab){this.cardTab=cardTab;if(this.isFavorite(id)){this.favoriteRemove(id);}else{this.favoriteAdd(id);}};SZN.WebEngine.MyWeatherManager.prototype.cardUpdate=function(obj){if(obj.action=="add"){this.addFavorite(obj.id);if(this.cardTab&&this.cardTab.card.poiId==obj.id){this.cardTab.setFavorite({"action":"add","success":true});}}else{this.removeFavorite(obj.id);if(this.cardTab&&this.cardTab.card.poiId==obj.id){this.cardTab.setFavorite({"action":"remove","success":true});}}if(SZN.signals.getMessage("menuStatus").type=="myweather"){this.main.resultMaker.listResult.restoreMyWeatherResult("myweather",SZN.signals.getMessage("menuStatus").time);}};SZN.WebEngine.MyWeatherManager.prototype.addFavorite=function(ids){if(!this.isFavorite(ids)){this.favorite[ids]=true;return 0;}return 1;};SZN.WebEngine.MyWeatherManager.prototype.removeFavorite=function(ids){if(this.isFavorite(ids)){this.favorite[ids]=null;delete (this.favorite[ids]);return 0;}return 1;};SZN.WebEngine.MyWeatherManager.prototype.goToLogin=function(){window.location=this.loginURL;};SZN.Visual.WTH_IMG_PATH="/st/img/";SZN.Visual.WeatherCategory=SZN.ClassMaker.makeClass({"NAME":"WeatherCategory","VERSION":"1.0","CLASS":"class"});SZN.Visual.WeatherCategory.prototype.$constructor=function(owner,data,listenObj){this.owner=owner;this.box=null;this.actionFolder={};this.listenObj=listenObj?listenObj:null;this.data=data;this.nodesList={};this._make();this.activeItem=null;this.isActive=false;};SZN.Visual.WeatherCategory.prototype.$destructor=function(data){for(var i in this.actionFolder){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;delete (this.actionFolder[i]);}this.sConstructor.destroy(this);};SZN.Visual.WeatherCategory.prototype._make=function(){var box=SZN.cEl("div");box.className="categoryBox";var header=SZN.cEl("h2",false,"blind");var list=SZN.cEl("ul");for(var i=0;i<this.data.length;i++){var item=SZN.cEl("li");var aItem=SZN.cEl("a");aItem.href="#";aItem.innerHTML=this.data[i].desc;aItem.id=this.data[i].name;this.actionFolder[aItem.id]=SZN.Events.addListener(aItem,"click",this,"action",false,true);this.nodesList[aItem.id]=aItem;item.appendChild(aItem);list.appendChild(item);}box.appendChild(header);box.appendChild(list);box.appendChild(SZN.cEl("div",false,"cleaner"));this.header=header;box.id="locations";this.box=box;};SZN.Visual.WeatherCategory.prototype.activate=function(id){var id=id?id:this.box.getElementsByTagName("a")[0].id;if(!this.activeItem){this.selectItem(this.nodesList[id]);if(!arguments[1]){this._sendMessage();}}this.isActive=true;};SZN.Visual.WeatherCategory.prototype.deActivate=function(){if(this.activeItem){this.deselectItem(this.activeItem);}this.isActive=false;};SZN.Visual.WeatherCategory.prototype.action=function(e,elm){if(e&&(e.type!="fakeEvent")){SZN.Events.cancelDef(e);}if(this.activeItem){this.deselectItem(this.activeItem);}this.selectItem(elm);if(e){this._sendMessage();}};SZN.Visual.WeatherCategory.prototype.selectItem=function(nd){nd.parentNode.className="active";this.header=nd.innerHTML;this.activeItem=nd;};SZN.Visual.WeatherCategory.prototype.deselectItem=function(nd){nd.parentNode.className="";this.header="";this.activeItem=null;};SZN.Visual.WeatherCategory.prototype._sendMessage=function(){var id=this.activeItem?this.activeItem.id:null;this.owner.setCategoryId(id);};SZN.Visual.AbstractWeatherListResult=SZN.ClassMaker.makeClass({"NAME":"AbstractWeatherListResult","VERSION":"1.0","CLASS":"class"});SZN.Visual.AbstractWeatherListResult.prototype.$constructor=function(data){this.actionFolder={};this.data=data;this.box=null;this.menuType=data.menuType?data.menuType:null;this.timeType=data.timeType?data.timeType:null;this.category=data.category?data.category:null;this.mapType=null;this.boundingBox=null;this.init();};SZN.Visual.AbstractWeatherListResult.prototype.$destructor=function(){if((SZN.Browser.klient=="gecko")&&(SZN.Browser.version==2)&&(typeof Iterator=="function")){var n=new Iterator(this.actionFolder);try{while(true){var i=n.next();if(this.actionFolder[i]){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;}delete (this.actionFolder[i]);}}catch(e){;}}else{for(var i in this.actionFolder){if(this.actionFolder[i]){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;}delete (this.actionFolder[i]);}}if(this.box.parentNode){this.box.parentNode.removeChild(this.box);}this.sConstructor.destroy(this);};SZN.Visual.AbstractWeatherListResult.prototype.init=function(){if(typeof this.data.mapSetup!="undefined"){var tmp=this.data.mapSetup;if(tmp.mapType){this.mapType=tmp.mapType.split(",");}else{this.mapType=["base-n"];}if(tmp.boundingBox){this.boundingBox={};for(var i in tmp.boundingBox){this.boundingBox[i]=tmp.boundingBox[i];}}}this._make();};SZN.Visual.AbstractWeatherListResult.prototype._make=function(){var box=SZN.cEl("div");this.box=box;};SZN.Visual.AbstractWeatherListResult.prototype.getBox=function(){return this.box;};SZN.Visual.AbstractWeatherListResult.prototype.getState=function(){return {"menu":this.menuType,"time":this.timeType,"category":this.category};};SZN.Visual.AbstractWeatherListResult.prototype._isNull=function(item){if(item!=null){return false;}else{return true;}};SZN.Visual.AbstractWeatherListResult.prototype.pushNode=function(node){this.box.appendChild(node);};SZN.Visual.AbstractWeatherListResult.prototype.insertNode=function(node){this.box.insertBefore(node,this.box.firstChild);};SZN.Visual.CrAllDayListResult=SZN.ClassMaker.makeClass({"NAME":"CrAllDayListResult","EXTEND":SZN.Visual.AbstractWeatherListResult,"VERSION":"1.0","CLASS":"class"});SZN.Visual.CrAllDayListResult.prototype.$constructor=function(data){this.wthTable=null;this.callSuper("$constructor",arguments.callee)(data);};SZN.Visual.CrAllDayListResult.prototype._make=function(){var box=SZN.cEl("div");box.style.paddingTop="13px";var nodes=new Array();var data=this.data;if(!this._isNull(data.item.type)||!this._isNull(data.item.temperatureNight)||!this._isNull(data.item.bio)){var picLine=SZN.cEl("div");picLine.className="picLine";var item=SZN.cEl("div");item.style.cssText="text-align:center; width:112px;float:left;";if(!this._isNull(data.item.type)){var day=item.cloneNode(true);var desc=SZN.cEl("div",false,"typeBox");desc.innerHTML="DEN";day.className="flBox dayShort";var image=SZN.cEl("img");image.width=32;image.height=32;image.src=SZN.Visual.WTH_IMG_PATH+"ico_big/"+data.item.type+".gif";image.alt=data.item.dayDesc;image.title=data.item.dayDesc;day.appendChild(image);day.appendChild(desc);if(!this._isNull(data.item.temperatureDay.min)||!this._isNull(data.item.temperatureDay.max)){var txt=SZN.cEl("p");var min=!this._isNull(data.item.temperatureDay.min)?data.item.temperatureDay.min:"";var max=!this._isNull(data.item.temperatureDay.max)?data.item.temperatureDay.max:"";txt.innerHTML=""+(min?" <strong>"+min+" </strong>až ":"")+"<strong>"+max+"</strong>&deg;C";day.appendChild(txt);}picLine.appendChild(day);}if(!this._isNull(data.item.temperatureNight)){var night=item.cloneNode(true);night.className="flBox nightShort";var desc=SZN.cEl("div",false,"typeBox");desc.innerHTML="NOC";var image=SZN.cEl("img");image.width=32;image.height=32;image.src=SZN.Visual.WTH_IMG_PATH+"ico_moon.gif";image.alt=data.item.nightDesc;image.title=data.item.nightDesc;night.appendChild(image);night.appendChild(desc);var txt=SZN.cEl("p");txt.innerHTML="<strong>"+data.item.temperatureNight+"&deg;C</strong>";night.appendChild(txt);picLine.appendChild(night);}if(!this._isNull(data.item.bio)){var bio=item.cloneNode(true);bio.className="flBox bioShort";var image=SZN.cEl("img");var desc=SZN.cEl("div",false,"typeBox");desc.innerHTML="BIO";image.width=32;image.height=32;var bioId=parseInt(data.item.bio);if(!isNaN(bioId)){image.src=SZN.Visual.WTH_IMG_PATH+"ico_bio_"+bioId+".gif";}else{image.src=SZN.Visual.WTH_IMG_PATH+"ico_bio.gif";}image.alt=data.item.bioDesc;image.title=data.item.bioDesc;bio.appendChild(image);bio.appendChild(desc);var txt=SZN.cEl("p");txt.innerHTML="<span>"+data.item.bioDesc+"</span>";bio.appendChild(txt);picLine.appendChild(bio);}picLine.appendChild(SZN.cEl("div",false,"clear"));nodes.push(picLine);}if(!this._isNull(data.item.description)){var desc=SZN.cEl("p");desc.className="dayDescription";desc.innerHTML=data.item.description+" ";nodes.push(desc);}var acBox=SZN.cEl("span",false,"showNextBox");acBox.style.background="transparent url("+SZN.Visual.WTH_IMG_PATH+"ico_plus_mini.gif)  100% 50% no-repeat";acBoxActiv=SZN.cEl("a");acBoxActiv.href="#";acBoxActiv.innerHTML="Podrobná&nbsp;předpověď";acBox.appendChild(acBoxActiv);this.actionFolder.acAction=SZN.Events.addListener(acBoxActiv,"click",this,"showNextAction",false,true);var tableSet=false;var tbl="<table>";for(var i=0;i<data.item.table.length;i++){var item=data.item.table[i];if(!this._isNull(item.data)){tbl+="<tr>";tableSet=true;if(item.type!="record"){tbl+="<td width=\"100\" class=\"nameCol\">"+item.name+": </td><td>"+item.data+"</td>";}else{tbl+="<td  width=\"100\" class=\"nameCol\">"+item.name+": </td><td>";if(!this._isNull(item.data.min)){tbl+=item.data.min+" &deg;C (rok "+item.data.minYear+")";}if(!this._isNull(item.data.max)){tbl+="<br />"+item.data.max+" &deg;C (rok "+item.data.maxYear+")";}tbl+="</td>";}tbl+="</tr>";}}tbl+="</table>";if(tableSet){desc.appendChild(acBox);var tab=SZN.cEl("div",false,false,{"display":"none"});this.wthTable=tab;tab.innerHTML=tbl;nodes.push(tab);}var ldInfo=this._makeLongPreview();if(ldInfo){nodes.push(ldInfo);}var news=this._makeIntelligence();if(news){nodes.push(news);}if(nodes.length){for(var i=0;i<nodes.length;i++){box.appendChild(nodes[i]);}}else{box.innerHTML="<p style=\"color:red\"><strong>Nejsou dostupná data pro předpověď...</strong></p>";}this.box=box;};SZN.Visual.CrAllDayListResult.prototype._makeLongPreview=function(){var data=this.data.longPreview;if(!data||!data.length){return false;}var box=SZN.cEl("div","longPreview");var hd=SZN.cEl("h5");var hdDesc="Předpověď na další dny";hd.innerHTML=hdDesc;box.appendChild(hd);for(var j=0;j<data.length;j++){var itemBox=SZN.cEl("div",null,"lpItem");if(j==(data.length-1)){itemBox.style.borderRight="none";itemBox.style.marginRight=0;}var item=data[j];var img=SZN.cEl;var image=SZN.cEl("img");image.width=32;image.height=32;image.src=SZN.Visual.WTH_IMG_PATH+"ico_big/"+item.type+".gif";image.alt=item.dayDesc;image.title=item.dayDesc;itemBox.appendChild(image);var name=SZN.cEl("div");name.innerHTML=item.time.dayName;itemBox.appendChild(name);if(item.dayMax!=null){var desc=SZN.cEl("p");desc.innerHTML="<strong>"+item.dayMax+" </strong>&deg;C";itemBox.appendChild(desc);}box.appendChild(itemBox);}box.appendChild(SZN.cEl("div",null,"clear"));return box;};SZN.Visual.CrAllDayListResult.prototype._makeIntelligence=function(){var box=SZN.cEl("div","newsBox");var data=(typeof this.data.newsData!="undefined")?this.data.newsData:[];if(!data.length){return false;}var hd=SZN.cEl("h5");hd.innerHTML="Zpravodajství";box.appendChild(hd);for(var i=0;i<data.length;i++){var item=SZN.cEl("div",false,"newsItem");var code="<span class=\"nDt\">"+data[i].date+"</span>"+"<span class=\"nLink\"><a href=\""+data[i].link+"\">"+data[i].title+"</a></span>";item.innerHTML=code;box.appendChild(item);}box.appendChild(SZN.cEl("div",false,"clear"));return box;};SZN.Visual.CrAllDayListResult.prototype.showNextAction=function(e,elm){SZN.Events.cancelDef(e);if(SZN.gEl("longPreview")){SZN.gEl("longPreview").style.paddingTop="2em";}elm.parentNode.style.display="none";this.wthTable.style.display="block";};SZN.Visual.CrAllLongListResult=SZN.ClassMaker.makeClass({"NAME":"CrAllLongListResult","EXTEND":SZN.Visual.AbstractWeatherListResult,"VERSION":"1.0","CLASS":"class"});SZN.Visual.CrAllLongListResult.prototype.$constructor=function(data){this.callSuper("$constructor",arguments.callee)(data);};SZN.Visual.CrAllLongListResult.prototype._make=function(){var box=SZN.cEl("div");box.style.paddingTop="13px";var nodes=new Array();var data=this.data;var desc=null;tblBox=box.cloneNode(false);var tbl="<table class=\"longDistance\">";tbl+="<tr><th class=\"colDay\"><strong>&nbsp;</strong></th><th class=\"colDate\"><strong>Datum </strong></th><th class=\"colTempr\"><strong>Vzduch </strong><span>&deg;C</span></th></tr>";var isSet=false;for(var i=0;i<data.item.length;i++){if(i>3&&!desc){if(!this._isNull(item.desc)){desc=SZN.cEl("p");desc.className="dayDescription";desc.innerHTML=item.desc;nodes.push(desc);}}var item=data.item[i];if(!this._isNull(item.type)&&!this._isNull(item.dayMax)){isSet=true;tbl+="<tr>";var tmp=SZN.timeManager.dateToString(item.time.timestamp,"long");switch(tmp){case "today":var dayName="Dnes";break;case "tomorrow":var dayName="Zítra";break;default:var dayName=item.time.dayName;break;}tbl+="<td class=\"colDay\"><span>"+dayName+"</span></td>";tbl+="<td class=\"colDate\"><span>"+item.time.date+"</span></td>";tbl+="<td class=\"colTempr\">";if(!this._isNull(item.type)){if(SZN.Browser.klient=="ie"){var bg="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+SZN.Visual.WTH_IMG_PATH+"ico_small/"+item.type+".png',sizingMethod='scale';";tbl+="<span "+(item.dayDesc?"title=\""+item.dayDesc+"\" ":"")+"style=\"display:inline-block;width:20px;height:20px;margin-right:5px;overflow:hidden;"+bg+"\"></span>";}else{tbl+="<img "+(item.dayDesc?"title=\""+item.dayDesc+"\" ":"")+"src=\""+SZN.Visual.WTH_IMG_PATH+"ico_small/"+item.type+".png"+"\" width=\"20\" height=\"20\" alt=\""+(item.dayDesc?item.dayDesc:"")+"\" />";}}if(!this._isNull(item.dayMax)){tbl+=" <span class=\"dayTemperature\">"+item.dayMax+"</span>";}tbl+="</td>";tbl+="</tr>";}}if(isSet){tblBox.innerHTML=tbl;nodes.push(tblBox);}if(nodes.length){for(var i=0;i<nodes.length;i++){box.appendChild(nodes[i]);}}else{box.innerHTML="<p style=\"color:red\"><strong>Nejsou dostupná žádná data...</strong></p>";}this.box=box;};SZN.Visual.WeatherListResult=SZN.ClassMaker.makeClass({"NAME":"WeatherListResult","EXTEND":SZN.Visual.AbstractWeatherListResult,"VERSION":"1.0","CLASS":"class"});SZN.Visual.WeatherListResult.prototype.COL_TYPES={"air":{"name":"Vzduch","type":"&deg;C"},"wind":{"name":"Vítr","type":"m/s"},"snow":{"name":"Sníh","type":"cm"},"water":{"name":"Voda","type":"&deg;C"}};SZN.Visual.WeatherListResult.prototype.$constructor=function(data,owner){this.owner=owner;this.resultData={};this.resultData.rows=[];this.resultData.data=[];this.callSuper("$constructor",arguments.callee)(data);};SZN.Visual.WeatherListResult.prototype.$destructor=function(){if(this.resultData.rows.length){for(var i=0;i<this.resultData.rows.length;i++){this.resultData.rows[i].$destructor();}this.resultData=null;}this.callSuper("$destructor",arguments.callee)();};SZN.Visual.WeatherListResult.prototype._make=function(){var box=SZN.cEl("div");var data=this.data;var nodes=[];var items=data.items?data.items:null;if(!items||!items.length){box.innerHTM="<strong>Nejsou data!</strong>";return;}var headRow=this._makeHeadRow(data.colTypes);nodes.push(headRow);var rowCSS=[{"css":"width:160px;float:left;overflow:hidden","className":"rowName"},{"css":"width:90px;float:left;overflow:hidden","className":"rowWth"},{"css":"width:130px;float:left;overflow:hidden;","className":"rowDt"}];for(var i=0;i<items.length;i++){var itemRow=new SZN.Visual.WeatherListRow(rowCSS,false,"listRow",items[i].id,i);itemRow.colls[0].innerHTML="<span>"+items[i].name+"</span>";if(SZN.Browser.klient=="ie"){var bg="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+SZN.Visual.WTH_IMG_PATH+"ico_small/"+items[i].type+".png',sizingMethod='scale';";itemRow.colls[1].innerHTML="<span "+(items[i].dayDesc?"title=\""+items[i].dayDesc+"\" ":"")+"style=\"display:inline-block;width:20px;height:20px;overflow:hidden;margin-right:5px;"+bg+"\"></span>"+(items[i].temperature?"<em>"+items[i].temperature+"</em>":"");}else{itemRow.colls[1].innerHTML="<img "+(items[i].dayDesc?"title=\""+items[i].dayDesc+"\" ":"")+"src=\""+SZN.Visual.WTH_IMG_PATH+"ico_small/"+items[i].type+".png\" width=\"20\" height=\"20\" alt=\""+(items[i].dayDesc?items[i].dayDesc:"")+"\" /> "+(items[i].temperature?"<em>"+items[i].temperature+"</em>":"");}itemRow.colls[2].innerHTML=items[i].spec?"<span style=\"margin-top:0px;\">"+items[i].spec.value+"</span>":"";nodes.push(itemRow.rowBox);itemRow.activate(this);this.resultData.rows.push(itemRow);}var res=SZN.cEl("div");for(var i=0;i<nodes.length;i++){res.appendChild(nodes[i]);}box.appendChild(res);this.box=box;};SZN.Visual.WeatherListResult.prototype._makeHeadRow=function(data){var headRow=[{"css":"width:160px;float:left;overflow:hidden;","className":"headName"},{"css":"width:90px;float:left;overflow:hidden;","className":"headWth"},{"css":"width:130px;float:left;overflow:hidden;","className":"headDt"}];var row=new SZN.Visual.WeatherListRow(headRow,false,"listHead");for(var i=0;i<data.length;i++){if(data[i]){var res=this.COL_TYPES[data[i]];row.colls[i].innerHTML="<strong>"+res.name+" </strong><span>"+res.type+"<span>";}else{row.colls[i].innerHTML="&nbsp;";}}return row.rowBox;};SZN.Visual.WeatherListResult.prototype.callCard=function(num,item){if(this.activeListItem==item){this.closeCard();return;}this.owner.getCard(this.data.items[num]);this.activeListItem=item;};SZN.Visual.WeatherListResult.prototype.closeCard=function(){this.owner.closeCard();};SZN.Visual.WeatherListResult.prototype.closeCardAction=function(){if(!this.activeListItem){return;}this.activeListItem.active=false;this.activeListItem.changeState({"type":"mouseout"},null);this.activeListItem=null;};SZN.Visual.WeatherListRow=SZN.ClassMaker.makeClass({"NAME":"WeatherListRow","VERSION":"1.0","CLASS":"class"});SZN.Visual.WeatherListRow.prototype.$constructor=function(rowCss,typeId,className,id,index){this.actionFolder={};this.nameClass=className?className:false;this.id=id?id:false;this.typeId=typeId?typeId:false;this.data=rowCss;this.rowBox=null;this.colls=[];this.actionFolder={};this.index=index;this.active=false;this._make();};SZN.Visual.WeatherListRow.prototype.$destructor=function(){for(var i in this.actionFolder){SZN.Events.removeListener(this.actionFolder[i]);}};SZN.Visual.WeatherListRow.prototype._make=function(){this.rowBox=SZN.cEl("div",false,false);if(this.nameClass){this.rowBox.className=this.nameClass;}this.rowBox.style.cssText="width:400px;overflow:hidden;border-bottom:1px solid #E8E8E8";for(var i=0;i<this.data.length;i++){var coll=SZN.cEl("div",false,false);if(this.data[i].css){coll.style.cssText=this.data[i].css;}if(this.data[i].className){coll.className=this.data[i].className;}this.colls.push(coll);this.rowBox.appendChild(coll);}this.rowBox.appendChild(SZN.cEl("div",false,"clear"));};SZN.Visual.WeatherListRow.prototype.activate=function(obj){this.owner=obj;this.actionFolder.over=SZN.Events.addListener(this.rowBox,"mouseover",this,"changeState",false,true);this.actionFolder.out=SZN.Events.addListener(this.rowBox,"mouseout",this,"changeState",false,true);this.actionFolder.click=SZN.Events.addListener(this.rowBox,"click",this,"clickAction",false,true);};SZN.Visual.WeatherListRow.prototype.changeState=function(e,elm){if(!this.active){if(e.type=="mouseover"){this.rowBox.style.backgroundColor="#FFFFCC";}else{if(e.type=="mouseout"){this.rowBox.style.backgroundColor="transparent";}}}};SZN.Visual.WeatherListRow.prototype.clickAction=function(e,elm){this.active=true;this.owner.callCard(this.index,this);this.changeState({"type":"mouseover"},null);};SZN.Visual.WeatherListFavorite=SZN.ClassMaker.makeClass({"NAME":"WeatherListFavorite","EXTEND":SZN.Visual.WeatherListResult,"VERSION":"1.0","CLASS":"class"});SZN.Visual.WeatherListFavorite.prototype.COL_TYPES={"location":{"name":"Lokalita","type":""},"air":{"name":"Vzduch","type":"&deg;C"},"remove":{"name":"Odebrat","type":""}};SZN.Visual.WeatherListFavorite.prototype.$constructor=function(data,owner){this.idTable={};this.callSuper("$constructor",arguments.callee)(data,owner);};SZN.Visual.WeatherListFavorite.prototype.$destructor=function(){this.callSuper("$destructor",arguments.callee)();};SZN.Visual.WeatherListFavorite.prototype._setIDTable=function(id){this.idTable[id]=true;};SZN.Visual.WeatherListFavorite.prototype._make=function(){var box=SZN.cEl("div");var data=this.data;var nodes=[];var headline=SZN.cEl("h4",false,false,{"margin":"0.1em 0 1.8em 10px","fontSize":"115.5%"});headline.innerHTML="Moje počasí";nodes.push(headline);var items=data.items?data.items:null;if(!items||!items.length){box.innerHTM="<strong>Nejsou data!</strong>";return;}var headRow=this._makeHeadRow(data.colTypes);nodes.push(headRow);var rowCSS=[{"css":"width:160px;float:left;overflow:hidden","className":"rowName"},{"css":"width:90px;float:left;overflow:hidden","className":"rowWth"},{"css":"width:130px;float:left;overflow:hidden;","className":"rowDt"}];for(var i=0;i<items.length;i++){var itemRow=new SZN.Visual.WeatherListRow(rowCSS,false,"listRow",items[i].id,i);this._setIDTable(items[i].id);itemRow.colls[0].innerHTML="<span>"+items[i].name+"</span>";if(!items[i].empty){if(SZN.Browser.klient=="ie"){var bg="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+SZN.Visual.WTH_IMG_PATH+"ico_small/"+items[i].type+".png',sizingMethod='scale';";itemRow.colls[1].innerHTML="<span "+(items[i].dayDesc?"title=\""+items[i].dayDesc+"\" ":"")+"style=\"display:inline-block;width:20px;height:20px;overflow:hidden;margin-right:5px;"+bg+"\"></span>"+(items[i].temperature?"<em>"+items[i].temperature+"</em>":"");}else{itemRow.colls[1].innerHTML="<img "+(items[i].dayDesc?"title=\""+items[i].dayDesc+"\" ":"")+"src=\""+SZN.Visual.WTH_IMG_PATH+"ico_small/"+items[i].type+".png\" width=\"20\" height=\"20\" alt=\""+(items[i].dayDesc?items[i].dayDesc:"")+"\" /> "+(items[i].temperature?"<em>"+items[i].temperature+"</em>":"");}}else{itemRow.colls[1].innerHTML="<strong>N/A</strong>";}itemRow.colls[2].innerHTML="<img id=\"rmPic_"+items[i].id+"\" src=\""+SZN.Visual.WTH_IMG_PATH+"ico_red_cross.gif\" width=\"16\" height=\"16\" alt=\"odebrat\" />";itemRow.colls[2].style.textAlign="center";var img=itemRow.colls[2].getElementsByTagName("img")[0];this.actionFolder[items[i].id]=SZN.Events.addListener(img,"click",this,"removeAction",false,true);nodes.push(itemRow.rowBox);itemRow.activate(this);this.resultData.rows.push(itemRow);}var res=SZN.cEl("div");for(var i=0;i<nodes.length;i++){res.appendChild(nodes[i]);}box.appendChild(res);this.box=box;};SZN.Visual.WeatherListFavorite.prototype._makeHeadRow=function(data){var headRow=[{"css":"width:150px;padding-left:10px;float:left;overflow:hidden;","className":"headName"},{"css":"width:75px;padding-right:15px;float:left;overflow:hidden;","className":"headWth"},{"css":"width:115px;padding-right:15px;float:left;overflow:hidden;","className":"headDt"}];var row=new SZN.Visual.WeatherListRow(headRow,false,"listHead");for(var i=0;i<data.length;i++){if(data[i]){var res=this.COL_TYPES[data[i]];row.colls[i].innerHTML="<strong>"+res.name+" </strong><span>"+res.type+"<span>";}else{row.colls[i].innerHTML="&nbsp;";}}return row.rowBox;};SZN.Visual.WeatherListFavorite.prototype.removeAction=function(e,elm){if(e&&e.type!="fakeEvent"){SZN.Events.stopEvent(e);}var ids=elm.id.substring(6);if(this.owner.main.mapEngine.cards.card&&this.owner.main.mapEngine.cards.card.tabs[0]&&(typeof this.owner.main.mapEngine.cards.card.tabs[0].inst.setFavorite=="function")&&(this.owner.main.mapEngine.cards.card.poiId==ids)){var cardTab=this.owner.main.mapEngine.cards.card.tabs[0].inst;}else{var cardTab=null;}this.owner.myweather.set(ids,cardTab);};SZN.Visual.WeatherEmptyResult=SZN.ClassMaker.makeClass({"NAME":"WeatherEmptyResult","EXTEND":SZN.Visual.AbstractWeatherListResult,"VERSION":"1.0","CLASS":"class"});SZN.Visual.WeatherEmptyResult.prototype.$constructor=function(data,status){this.status=status;this.callSuper("$constructor",arguments.callee)(data);};SZN.Visual.WeatherEmptyResult.prototype._make=function(){var box=SZN.cEl("div");if((this.status>=400)&&(this.status<500)){box.innerHTML="<p><strong>Pro daný výběr nejsou dostupné žádné údaje o počasí</strong></p>";}else{if((this.status>=500)&&(this.status<600)){box.innerHTML="<p><strong>Při zpracování dotazu došlo k chybě na straně serveru</strong></p>";}else{box.innerHTML="<p><strong>Při zpracování dotazu došlo k chybě</strong></p>";}}this.box=box;};SZN.Visual.AbstractSearchResult=SZN.ClassMaker.makeClass({"NAME":"AbstractSearchResult","VERSION":"1.0","CLASS":"class"});SZN.Visual.AbstractSearchResult.prototype.$constructor=function(data,owner){this.actionFolder={};this.data=data;this.box=null;this.mapType=null;this.boundingBox=null;this.owner=owner;this.result=null;this.box=null;this.init();};SZN.Visual.AbstractSearchResult.prototype.$destructor=function(){if((SZN.Browser.klient=="gecko")&&(SZN.Browser.version==2)&&(typeof Iterator=="function")){var n=new Iterator(this.actionFolder);try{while(true){var i=n.next();if(this.actionFolder[i]){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;}delete (this.actionFolder[i]);}}catch(e){;}}else{for(var i in this.actionFolder){if(this.actionFolder[i]){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;}delete (this.actionFolder[i]);}}};SZN.Visual.AbstractSearchResult.prototype.clearResult=function(){this.$destructor();};SZN.Visual.AbstractSearchResult.prototype.init=function(){if(typeof this.data.mapSetup!="undefined"){var tmp=this.data.mapSetup;if(tmp.mapType){this.mapType=tmp.mapType.split(",");}else{this.mapType=["base-n"];}if(tmp.boundingBox){this.boundingBox={};for(var i in tmp.boundingBox){this.boundingBox[i]=tmp.boundingBox[i];}}}this._make();};SZN.Visual.AbstractSearchResult.prototype._make=function(){var box=SZN.cEl("div");this.box=box;};SZN.Visual.AbstractSearchResult.prototype.getBox=function(){return this.box;};SZN.Visual.AbstractSearchResult.prototype.pushNode=function(node){this.box.appendChild(node);};SZN.Visual.AbstractSearchResult.prototype.insertNode=function(node){this.box.insertBefore(node,this.box.firstChild);};SZN.Visual.RegionSearchResult=SZN.ClassMaker.makeClass({"NAME":"RegionSearchResult","VERSION":"1.0","EXTEND":SZN.Visual.AbstractSearchResult,"CLASS":"class"});SZN.Visual.RegionSearchResult.prototype.$constructor=function(data,owner){this.pagging=new SZN.Visual.Pagging(this,data);this.type="regionSearch";this.callSuper("$constructor",arguments.callee)(data,owner);};SZN.Visual.RegionSearchResult.prototype.$destructor=function(){this.callSuper("$destructor",arguments.callee)();if(this.pagging){this.pagging.$destructor();}if(this.box.parentNode){this.box.parentNode.removeChild(this.box);}for(var i=0;i<this.resultData.listItems.length;i++){this.resultData.listItems[i].$destructor();}};SZN.Visual.RegionSearchResult.prototype.clearResult=function(){this.$destructor();};SZN.Visual.RegionSearchResult.prototype._make=function(){var box=SZN.cEl("div");var result=this.data.searchResult;if(result.resultSize==0){return;}var pagging=this.data.searchResult.pagging;this.type=result.type;this.phrase=this.data.phrase;this.pageDrift=0;if(pagging.resultCount>1){this.pageDrift=(((pagging.pageNumber+1)*pagging.resultsPerPage)-pagging.resultsPerPage);}this.resultData=this._buildRegionResult(result,this.pageDrift);this.resultData.type="regionResult";this.owner.poiLayerManage(this.resultData.poiItems);this.box=box;this.pushNode(this.resultData.resultBox);};SZN.Visual.RegionSearchResult.prototype._buildRegionResult=function(inp,num){var out={};var box=SZN.cEl("div");var cnt=inp.items.length;var data=inp.items;out.listItems=new Array();out.poiItems=new Array();out.data=new Array();out.resultBox=box;if(typeof this.data.mapSetup!="undefined"){this.data.mapSetup.direct={"zoom":this.data.mapSetup.zoom,"x":this.data.mapSetup.context.x,"y":this.data.mapSetup.context.y};}else{this.data.mapSetup.direct=null;}for(var i=0;i<cnt;i++){var item=new SZN.Visual.SearchItem(data[i],i,this,num);var poi=new SZN.Visual.ResultMark(data[i].mark.x,data[i].mark.y,data[i].type,data[i].ids,data[i].icoTitle,i+1,this,num);out.listItems.push(item);out.poiItems.unshift(poi);out.resultBox.appendChild(item.box);out.data.push(data[i]);}return out;};SZN.Visual.RegionSearchResult.prototype.addPagging=function(){var result=this.data.searchResult;var pagging=this.data.searchResult.pagging;if(result.resultSize==0){return;}this.pushNode(this.pagging.box);if(result.resultSize>pagging.resultsPerPage){this.pagging.reBuild(pagging);this.isPagging=true;}};SZN.Visual.RegionSearchResult.prototype.genericChangeState=function(num,obj,fakeE){var poi=this.resultData.poiItems[this.resultData.poiItems.length-(num%10)-1];var item=this.resultData.listItems[(num%10)];if(obj==poi){item.changeState(fakeE,null);}else{if(obj==item){poi.changeState(fakeE,null);}else{return;}}};SZN.Visual.RegionSearchResult.prototype.genericClick=function(num,obj){var x=this.resultData.data[num];this.owner.sendFromRegResult(x);};SZN.Visual.RegionSearchResult.prototype.goToPage=function(num){this.owner.sendFromPagging(num);};SZN.Visual.ListSearchResult=SZN.ClassMaker.makeClass({"NAME":"ListSearchResult","EXTEND":SZN.Visual.AbstractSearchResult,"VERSION":"2.0","CLASS":"class"});SZN.Visual.ListSearchResult.prototype.$constructor=function(data,owner){this.type="";this.activeListItem=null;this.callSuper("$constructor",arguments.callee)(data,owner);};SZN.Visual.ListSearchResult.prototype.$destructor=function(){this.callSuper("$destructor",arguments.callee)();if(this.pagging){this.pagging.$destructor();}if(this.box.parentNode){this.box.parentNode.removeChild(this.box);}for(var i=0;i<this.resultData.listItems.length;i++){this.resultData.listItems[i].$destructor();}};SZN.Visual.ListSearchResult.prototype.clearResult=function(){this.$destructor();};SZN.Visual.ListSearchResult.prototype._make=function(){var box=SZN.cEl("div");box.className="listResultBox";var result=this.data.searchResult;if(result.resultSize==0){return;}this.type=result.type;this.phrase=this.data.phrase;this.resultData=this._buildListResult(result);this.box=box;this.pushNode(this.resultData.resultBox);};SZN.Visual.ListSearchResult.prototype._buildListResult=function(inp,i){var out={};var box=SZN.cEl("div");box.className="listBox";var cnt=inp.items.length;var data=inp.items;out.listItems=new Array();out.data=new Array();out.resultBox=box;if(typeof this.data.mapSetup!="undefined"){this.data.mapSetup.direct={"zoom":this.data.mapSetup.zoom,"x":this.data.mapSetup.context.x,"y":this.data.mapSetup.context.y,"mark":{"x":this.data.mapSetup.mark.x,"y":this.data.mapSetup.mark.y}};}else{this.data.mapSetup={"direct":null};}for(var i=0;i<cnt;i++){var item=new SZN.Visual.SearchListItem(data[i],i);item.activate(this);out.listItems.push(item);out.data.push(data[i]);if(i==0){item.box.style.borderTop="1px solid #E8E8E8";}out.resultBox.appendChild(item.box);}return out;};SZN.Visual.ListSearchResult.prototype.getCardData=function(num,item){if(this.activeListItem==item){this.closeCard();return;}this.owner.getCard(this.resultData.data[num]);this.activeListItem=item;};SZN.Visual.ListSearchResult.prototype.closeCard=function(){this.owner.closeCard();};SZN.Visual.ListSearchResult.prototype.closeCardAction=function(){if(!this.activeListItem){return;}this.activeListItem.active=false;this.activeListItem.changeState({"type":"mouseout"},null);this.activeListItem=null;};SZN.Visual.SearchListItem=SZN.ClassMaker.makeClass({"NAME":"SearchListItem","IMPLEMENT":[SZN.Visual.BaseElement],"VERSION":"2.0","CLASS":"class"});SZN.Visual.SearchListItem.prototype.$constructor=function(data,num){this.actionFolder={};this.index=num;this.data=data;this.box=null;this._make();this.active=false;};SZN.Visual.SearchListItem.prototype.$destructor=function(){for(var i in this.actionFolder){if(this.actionFolder[i]){SZN.Events.removeListener(this.actionFolder[i]);this.actionFolder[i]=null;delete (this.actionFolder[i]);}}};SZN.Visual.SearchListItem.prototype._make=function(){var box=SZN.cEl("div");box.style.width="300px";box.className="rowList";var nb=SZN.cEl("div");nb.className="rowListName";nb.style.cssText="float:left;width:220px";nb.innerHTML="<span style=\"margin-left:5px;\">"+this.data.name+"</span>";var wb=SZN.cEl("div");wb.className="rowListData";wb.style.cssText="float:right;width:70px;text-align:right";if(SZN.Browser.klient=="ie"){var bg="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+SZN.Visual.WTH_IMG_PATH+"ico_small/"+this.data.weatherId+".png',sizingMethod='scale';";wb.innerHTML="<span "+(this.data.dayDesc?"title=\""+this.data.dayDesc+"\" ":"")+"style=\"display:block;width:20px;height:20px;overflow:hidden;float:left;"+bg+"\"></span>"+(this.data.temperature?"<span style=\"display:block;width:40px;float:right;\">"+this.data.temperature+" &deg;C</span>":"");}else{wb.innerHTML="<img "+(this.data.dayDesc?"title=\""+this.data.dayDesc+"\" ":"")+"style=\"display:block;width:20px;float:left;\" src=\""+SZN.Visual.WTH_IMG_PATH+"ico_small/"+this.data.weatherId+".png\" width=\"20\" height=\"20\" alt=\""+(this.data.dayDesc?this.data.dayDesc:"")+"\" /> "+(this.data.temperature?"<span style=\"display:block;width:40px;float:right;\">"+this.data.temperature+" &deg;C</span>":"");}box.appendChild(nb);box.appendChild(wb);box.appendChild(SZN.cEl("div",false,"clear"));box.style.cursor=SZN.Visual.ACTIVE_CURSOR;this.box=box;};SZN.Visual.SearchListItem.prototype.activate=function(obj){this.owner=obj;this.actionFolder.over=SZN.Events.addListener(this.box,"mouseover",this,"changeState",false,true);this.actionFolder.out=SZN.Events.addListener(this.box,"mouseout",this,"changeState",false,true);this.actionFolder.click=SZN.Events.addListener(this.box,"click",this,"clickAction",false,true);};SZN.Visual.SearchListItem.prototype.clickAction=function(e,elm){this.active=true;this.owner.getCardData(this.index,this);this.changeState({"type":"mouseover"},null);};SZN.Visual.SearchListItem.prototype.changeState=function(e,elm){if(!this.active){if(e.type=="mouseover"){this.box.style.backgroundColor="#FFFFCC";if(elm!=null){}}else{if(e.type=="mouseout"){this.box.style.backgroundColor="transparent";if(elm!=null){}}}}};SZN.Visual.SearchItem=SZN.ClassMaker.makeClass({"NAME":"SearchItem","IMPLEMENT":[SZN.Visual.BaseElement],"VERSION":"2.0","CLASS":"class"});SZN.Visual.SearchItem.prototype.SearchItem=function(data,num,owner,pageDrift){this.data=data;this.num=num;this.owner=owner;this.pageDrift=pageDrift;this.actionFolder={};this.active=false;this._make();this._itemActivate();};SZN.Visual.SearchItem.prototype.$destructor=function(){for(var i in this.actionFolder){SZN.Events.removeListener(this.actionFolder[i]);}this.box.parentNode.removeChild(this.box);};SZN.Visual.SearchItem.prototype._make=function(){var item=SZN.cEl("div");item.className="searchItem";var icoType=(this.data.type=="object")?"mi_obj":"mi_loc";item.dataFold={"cnt":this.num};var numIc="<div class=\"resultIcon "+icoType+"\"><strong>"+(this.pageDrift+this.num+1)+"</strong></div>";var title="<div class=\"itemContent\"><h3>"+this.data.listTitle+"</h3>";var addr="";var desc="<p>"+this.data.description+"</p></div><div class=\"clear\"></div>";item.innerHTML=numIc+title+addr+desc;this.box=item;};SZN.Visual.SearchItem.prototype._itemActivate=function(nd,num){this.actionFolder["over"]=SZN.Events.addListener(this.box,"mouseover",this,"changeState",false,true);this.actionFolder["out"]=SZN.Events.addListener(this.box,"mouseout",this,"changeState",false,true);this.actionFolder["click"]=SZN.Events.addListener(this.box,"click",this,"clickAction",false,true);};SZN.Visual.SearchItem.prototype.clickAction=function(e,elm){this.owner.genericClick(this.num,this);};SZN.Visual.SearchItem.prototype.setActive=function(){this.box.className="searchItem activeItem";this.active=true;};SZN.Visual.SearchItem.prototype.changeState=function(e,elm){if(!this.active){if(e.type=="mouseover"){this.box.className="searchItem activeItem";if(elm!==null){this.owner.genericChangeState(this.num,this,{"type":"mouseover"});}}else{if(e.type=="mouseout"){this.box.className="searchItem";if(elm!==null){this.owner.genericChangeState(this.num,this,{"type":"mouseout"});}}}}};SZN.Visual.SearchItem.prototype.getShowData=function(){return {"context":this.data.context,"detail":this.data.detail};};SZN.Visual.EmptySearchResult=SZN.ClassMaker.makeClass({"NAME":"EmptySearchResult","EXTEND":SZN.Visual.AbstractSearchResult,"VERSION":"1.0","CLASS":"class"});SZN.Visual.EmptySearchResult.prototype.$constructor=function(data,owner){this.type=data.searchResult.type;this.activeListItem=null;this.phrase=data.phrase;this.callSuper("$constructor",arguments.callee)(data,owner);};SZN.Visual.EmptySearchResult.prototype.$destructor=function(){this.callSuper("$destructor",arguments.callee)();if(this.box.parentNode){this.box.parentNode.removeChild(this.box);}};SZN.Visual.EmptySearchResult.prototype._make=function(){var box=SZN.cEl("div");var msg=SZN.cEl("p");msg.style.cssText="margin:3em 0;color:red;font-weight:bold";if(this.type=="regionSearch"){msg.innerHTML="Pro zadaný dotaz nebylo nic nalezeno";}else{msg.innerHTML="Pro zadaný dotaz nebyly nalezeny žádné údaje o počasí";}box.appendChild(msg);this.box=box;};SZN.Visual.ResultMark=SZN.ClassMaker.makeClass({"NAME":"ResultMark","EXTEND":SZN.Visual.BaseMark,"VERSION":"2.0","CLASS":"class"});SZN.Visual.ResultMark.prototype.$constructor=function(ppX,ppY,typeId,id,title,content,owner,resultDrift){this.typeId=typeId;this.num=content?parseInt(content):0;this.owner=this.actionObj=owner;this.ResultMark({"x":ppX,"y":ppY},"mark",id,owner,title,content,resultDrift);};SZN.Visual.ResultMark.prototype.top=36;SZN.Visual.ResultMark.prototype.left=16;SZN.Visual.ResultMark.prototype.source={"active":{"w":20,"h":29},"mark":{"w":32,"h":41},"cnt":{"w":15,"h":16},"drift":{"left":4,"top":4},"cntDrift":{"top":5,"left":6}};SZN.Visual.ResultMark.prototype.ACTIVE_BG="mapResultActive.png";SZN.Visual.ResultMark.prototype.LOCATION_BG="mapResult.png";SZN.Visual.ResultMark.prototype.OBJECT_BG="mapResult_blue.png";SZN.Visual.ResultMark.prototype.ResultMark=function(pos,type,id,owner,title,content,resultDrift){var c=content?content+resultDrift:"";this.actionMethod="genericClick";this.active=false;this.BaseMark(pos,type,id,owner,title,c);this.typeMark=(this.typeId=="object")?this.OBJECT_BG:this.LOCATION_BG;this._make();this.setContent(this.content);};SZN.Visual.ResultMark.prototype.clickAction=function(e,elm){this.owner.genericClick(this.content-1,this);if(e!==null){SZN.Events.stopEvent(e);}};SZN.Visual.ResultMark.prototype.changeState=function(e,elm){if(!this.active){if(e.type=="mouseover"){this.setActiveFace();this.setZindex("over");if(elm!==null){this.owner.genericChangeState(this.content-1,this,{"type":"mouseover"});}}else{if(e.type=="mouseout"){this.setFace();this.setZindex("out");if(elm!==null){this.owner.genericChangeState(this.content-1,this,{"type":"mouseout"});}}}}};SZN.Visual.ResultMark.prototype.setFace=function(){if(this.markContent){this.markContent.style.color="#fff";}this.setBackground(this.elms.mark.node,SZN.Visual.IMG_PATH+this.typeMark,false);};SZN.Visual.ResultMark.prototype.setActive=function(){this.setActiveFace();this.active=true;};SZN.Visual.NearMark=SZN.ClassMaker.makeClass({"NAME":"NearMark","EXTEND":SZN.Visual.BaseNearMark,"VERSION":"2.0","CLASS":"class"});SZN.Visual.NearMark.prototype.$constructor=function(poiData,owner,title,content){this.index=0;this.owner=this.actionObj=owner;this.actionMethod="genericClick";this.active=false;this.data=poiData;this.BaseNearMark(poiData,owner,title,content,"nearMark","mark");};SZN.Visual.NearMark.prototype.clickAction=function(e,elm){this.owner.genericClick();this.owner.setGPS(this.pos);};SZN.Visual.NearMark.prototype.changeState=function(e,elm){if(!this.owner.active){if(e.type=="mouseover"){this.setActiveFace();if(elm!==null){this.owner.genericChangeState(this,{"type":"mouseover"});}}else{if(e.type=="mouseout"){this.setFace();if(elm!==null){this.owner.genericChangeState(this,{"type":"mouseout"});}}}}};SZN.DayConvert=SZN.ClassMaker.makeClass({"NAME":"DayConvert","VERSION":"1.0","CLASS":"class"});SZN.DayConvert.prototype.$constructor=function(today,defaultTime){this.setToday(today);this.defaultTime=defaultTime?defaultTime:"today";this.dayInMs=24*60*60*1000;};SZN.DayConvert.prototype.$destructor=function(){};SZN.DayConvert.prototype.setToday=function(today){var date=!isNaN(today)?new Date(today):new Date(0);this.today=new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime();};SZN.DayConvert.prototype.getToday=function(){return this.today;};SZN.DayConvert.prototype.dateToString=function(timestamp){var cd=new Date(timestamp);var testDate=new Date(cd.getFullYear(),cd.getMonth(),cd.getDate()).getTime();if(testDate<this.today){return "today";}else{if(testDate==this.today){return "today";}else{if(testDate==(this.today+this.dayInMs)){return "tomorrow";}else{if(testDate==(this.today+(2*this.dayInMs))){return "aftertomorrow";}else{return this.defaultTime;}}}}};SZN.DayConvert.prototype.stringToDate=function(str){switch(str){case "today":return this.today;break;case "tomorrow":return this.today+this.dayInMs;break;case "aftertomorrow":return this.today+(2*this.dayInMs);default:return this.defaultTime?0:this.today;break;}};SZN.WeatherTimeManager=SZN.ClassMaker.makeClass({"NAME":"WeatherTimeManager","VERSION":"1.0","CLASS":"class"});SZN.WeatherTimeManager.dayCheck=0;SZN.WeatherTimeManager.offsetCheck=0;SZN.WeatherTimeManager.dayInMs=24*60*60*1000;SZN.WeatherTimeManager.request=null;SZN.WeatherTimeManager.preConfigure=function(setting){if(this.setting){return;}if(!SZN.WebSetting){return;}if(!setting){this.setting=SZN.WebSetting.timeSetting;}this.set(this.setting.serverTime,this.setting.timeOffset);this.init();};SZN.WeatherTimeManager.set=function(serverTime,timeOffset){this.serverTime=serverTime;this.timeOffset=timeOffset;this.toDayStart=(this.serverTime-this.timeOffset)%this.dayInMs;this.toDayEnd=this.dayInMs-this.toDayStart;this.today=this.serverTime-this.toDayStart;this.toNextHour=(1000*60*60)-(this.serverTime%(1000*60*60));};SZN.WeatherTimeManager.init=function(){this.request=new SZN.HTTPRequest("/time",this,"_answerProcessOffset");this.checkDay=SZN.bind(this,this.checkDayTmp);this.checkOffset=SZN.bind(this,this.checkOffsetTmp);this.dayCheck=window.setTimeout(this.checkDay,this.toEndDay);this.offsetCheck=window.setTimeout(this.checkOffset,this.toNextHour);};SZN.WeatherTimeManager.checkOffsetTmp=function(){var hr=1000*60*60;this.request.send();this.offsetCheck=window.setTimeout(this.checkOffset,hr);};SZN.WeatherTimeManager._answerProcessOffset=function(data,status){if(status!=200){return;}eval("var response = "+data);var tmOffset=-response.timeOffset*60*60*1000;if(tmOffset!=this.timeOffset){this.timeOffset=tmOffset;this.changeTimeData("offset");}};SZN.WeatherTimeManager.checkDayTmp=function(){var nowTime=new Date().getTime();if((nowTime-this.getToday())>=(this.dayInMs)){this.serverTime+=this.dayInMs;this.changeTimeData("day");}};SZN.WeatherTimeManager.changeTimeData=function(sender){window.clearTimeout(this.offsetCheck);window.clearTimeout(this.dayCheck);this.set(this.serverTime,this.timeOffset);this.dayCheck=window.setTimeout(this.checkDay,this.toEndDay);this.offsetCheck=window.setTimeout(this.checkOffset,this.toNextHour);this.changeState(sender);};SZN.WeatherTimeManager.changeState=function(sender){};SZN.WeatherTimeManager.getToday=function(){return this.today;};SZN.WeatherTimeManager.prototype.$constructor=function(defaultTime){this.defaultTime=defaultTime?defaultTime:"today";this.dayInMs=this.sConstructor.dayInMs;};SZN.WeatherTimeManager.prototype.$destructor=function(){for(var i in this){this[i]=null;}};SZN.WeatherTimeManager.prototype.setToday=function(){};SZN.WeatherTimeManager.prototype.getToday=function(){return this.sConstructor.getToday();};SZN.WeatherTimeManager.prototype.dateToString=function(timestamp,defaultTime){var def=defaultTime?defaultTime:this.defaultTime;if(timestamp<this.getToday()){return "today";}else{if(timestamp<(this.getToday()+this.dayInMs)){return "today";}else{if(timestamp<(this.getToday()+(2*this.dayInMs))){return "tomorrow";}else{if(timestamp<(this.getToday()+(3*this.dayInMs))){return "aftertomorrow";}else{return def;}}}}};SZN.WeatherTimeManager.prototype.stringToDate=function(str,defaultTime){switch(str){case "today":return this.getToday();break;case "tomorrow":return this.getToday()+this.dayInMs;break;case "aftertomorrow":return this.getToday()+(2*this.dayInMs);default:return defaultTime?defaultTime:this.getToday();break;}};SZN.WeatherTimeManager.preConfigure();SZN.timeManager=new SZN.WeatherTimeManager();SZN.Visual.WeatherButton=SZN.ClassMaker.makeClass({"NAME":"WeatherButton","VERSION":"1.0","CLASS":"class","IMPLEMENT":SZN.SigInterface});SZN.Visual.WeatherButton.prototype.$constructor=function(label,style){this.box=SZN.cEl("div",false,false,{"textAlign":"center","cursor":"pointer","position":"absolute"});for(var p in style){this.box.style[p]=style[p];}this.box.innerHTML=label;this.ec=[];this.state=null;this.styles={};};SZN.Visual.WeatherButton.prototype.$destructor=function(){this.ec.forEach(SZN.Events.removeListener,SZN.Events);this.ec=[];};SZN.Visual.WeatherButton.prototype.activate=function(){this.ec.push(SZN.Events.addListener(this.box,"click",this,"_click"));};SZN.Visual.WeatherButton.prototype.getSize=function(){return {"width":this.box.offsetWidth,"height":this.box.offsetHeight};};SZN.Visual.WeatherButton.prototype.addState=function(name,styles){this.styles[name]=styles;};SZN.Visual.WeatherButton.prototype.setState=function(name){if(name in this.styles){for(var p in this.styles[name]){this.box.style[p]=this.styles[name][p];}}};SZN.Visual.WeatherButton.prototype._click=function(e,elm){this.makeEvent("button-click");};SZN.Visual.Timeline=SZN.ClassMaker.makeClass({"NAME":"Timeline","VERSION":"1.0","CLASS":"class"});SZN.Visual.Timeline.prototype.$constructor=function(owner){this.owner=owner;this.ec=[];this.dom={};this._build();this.dragging=false;};SZN.Visual.Timeline.prototype.$destructor=function(){this.ec.forEach(SZN.Events.removeListener,SZN.Events);this.ec=[];};SZN.Visual.Timeline.prototype.getSize=function(){return {"width":this.dom.box.offsetWidth,"height":this.dom.box.offsetHeight};};SZN.Visual.Timeline.prototype.activate=function(){};SZN.Visual.Timeline.prototype.show=function(){this.box.style.display="";};SZN.Visual.Timeline.prototype.hide=function(){this.box.style.display="none";};SZN.Visual.Timeline.prototype.setIndex=function(index){var offset=this._index2offset(index);this.dom.bar.style.width=(2+offset)+"px";var date=AnimSource.index2date(index);var hour=date.format("G");if(hour==0){hour="00";}this.dom.time.innerHTML=hour+":00";this.dom.slider.style.left=offset+"px";};SZN.Visual.Timeline.prototype.setIcon=function(url){this.dom.icon.src=url;};SZN.Visual.Timeline.prototype._build=function(){this.dom.box=SZN.cEl("div",false,false,{"backgroundColor":"white","position":"absolute","border":"1px solid #ccc","padding":"3px","width":"308px","height":"25px"});var icon=SZN.cEl("img",false,false,{"cursor":"pointer"});this.dom.box.appendChild(icon);var bottom=3;if(SZN.Browser.client=="ie"&&SZN.Browser.version<7){bottom--;}var line=SZN.cEl("div",false,false,{"position":"absolute","left":"33px","bottom":bottom+"px","cursor":"pointer","height":"14px","width":"221px","backgroundImage":"url(/st/img/timeline-bg.gif)"});this.dom.box.appendChild(line);var dayNames=["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"];var max=this.owner.options.lastIndex/8;for(var i=0;i<max;i++){var name="";if(i==0){name="Dnes";}else{if(i==1){name="Zítra";}else{if(i==2){name="Pozítří";}else{var d=new Date();d.setHours(12);d.setTime(d.getTime()+1000*60*60*24*i);name=dayNames[d.getDay()];}}}var span=SZN.cEl("span",false,false,{"color":SZN.Visual.OFF_COLOR,"position":"absolute","fontSize":"11px","fontFamily":"arial, sans-serif"});span.innerHTML=name;this.dom.box.appendChild(span);var top=2;if(SZN.Browser.client=="ie"){top--;}span.style.top=top+"px";span.style.left=(35+i*72)+"px";}var barStyle={"backgroundImage":"url(/st/img/timeline-shade.gif)","position":"absolute","left":"2px","bottom":"3px","height":"3px","overflow":"hidden"};var bar=SZN.cEl("div",false,false,barStyle);line.appendChild(bar);var time=SZN.cEl("div",false,false,{"position":"absolute","textAlign":"center","width":"56px","right":"0px","top":"6px","fontSize":"17px","fontWeight":"bold"});this.dom.box.appendChild(time);var ghost=SZN.cEl("div",false,false,{"position":"absolute","bottom":"-2px","visibility":"hidden","width":"8px","height":"15px"});var url="/st/img/timeline-ghost.png";if(SZN.Browser.client=="ie"&&SZN.Browser.version<7){ghost.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='image')";}else{ghost.style.backgroundImage="url("+url+")";}line.appendChild(ghost);var slider=SZN.cEl("img",false,false,{"position":"absolute","bottom":"-2px"});line.appendChild(slider);slider.src="/st/img/timeline-slider.png";this.dom.bar=bar;this.dom.line=line;this.dom.icon=icon;this.dom.time=time;this.dom.slider=slider;this.dom.ghost=ghost;this.box=this.dom.box;this.ec.push(SZN.Events.addListener(icon,"click",this,"_icon"));this.ec.push(SZN.Events.addListener(line,"click",this,"_skip"));this.ec.push(SZN.Events.addListener(line,"mousemove",this,"_moveGhost"));this.ec.push(SZN.Events.addListener(line,"mouseout",this,"_hideGhost"));this.ec.push(SZN.Events.addListener(slider,"mousedown",this,"_startDrag"));this.ec.push(SZN.Events.addListener(document,"mousemove",this,"_drag"));this.ec.push(SZN.Events.addListener(document,"mouseup",this,"_stopDrag"));};SZN.Visual.Timeline.prototype._startDrag=function(e,elm){if(this.dragging){return;}this.dragging=true;this.wasRunning=this.owner.isRunning();if(this.wasRunning){this.owner.stopAnimation();}this.lastLeft=this._event2offset(e);};SZN.Visual.Timeline.prototype._stopDrag=function(e,elm){if(!this.dragging){return;}this.dragging=false;var index=this._offset2index(this.lastLeft);if(index>this.owner.options.lastIndex){return;}this.owner.setIndex(index);if(this.wasRunning){this.owner.startAnimation();}};SZN.Visual.Timeline.prototype._drag=function(e,elm){if(!this.dragging){return;}SZN.Events.cancelDef(e);var left=this._event2offset(e);left=Math.max(left,3);left=Math.min(left,this.dom.line.offsetWidth-2);this.lastLeft=left;left-=4;this.dom.slider.style.left=left+"px";};SZN.Visual.Timeline.prototype._skip=function(e,elm){var x=this._event2offset(e);var index=this._offset2index(x);if(index>this.owner.options.lastIndex){return;}this.owner.setIndex(index);};SZN.Visual.Timeline.prototype._icon=function(e,elm){if(this.owner.isRunning()){this.owner.stopAnimation();}else{this.owner.startAnimation();}};SZN.Visual.Timeline.prototype._moveGhost=function(e,elm){var x=this._event2offset(e);var index=this._offset2index(x);if(index>this.owner.options.lastIndex){return;}var date=AnimSource.index2date(index);var hour=date.format("G");if(hour=="0"){hour="00";}this.dom.ghost.title=hour+":00";var left=this._index2offset(index);this.dom.ghost.style.left=left+"px";this.dom.ghost.style.visibility="visible";};SZN.Visual.Timeline.prototype._hideGhost=function(e,elm){this.dom.ghost.style.visibility="hidden";};SZN.Visual.Timeline.prototype._index2offset=function(index){return 9*index-1;};SZN.Visual.Timeline.prototype._offset2index=function(x){return Math.round((x-1)/9);};SZN.Visual.Timeline.prototype._event2offset=function(e){var pos=SZN.Dom.getBoxPosition(this.dom.line);var scroll=SZN.Dom.getScrollPos();pos.left-=scroll.x;var x=e.clientX-pos.left;return x;};SZN.Visual.WeatherSwitch=SZN.ClassMaker.makeClass({"NAME":"WeatherSwitch","VERSION":"1.0","CLASS":"class","IMPLEMENT":SZN.SigInterface});SZN.Visual.WeatherSwitch.prototype.$constructor=function(mapa,options){this.mapa=mapa;this.options={"buttonWidth":61,"buttonHeight":14,"spacingX":8,"spacingY":6,"lastIndex":24,"interval":800};for(var p in options){this.options[p]=options[p];}this.sc=[];this.dom={};this.icoPlay="/st/img/timeline-play.gif";this.icoStop="/st/img/timeline-stop.gif";this.running=false;this.index=0;this.activeLayer=null;this.backgroundLayers=[];this.layers={};this.lb=mapa.createLayoutBox("top-left");this.lb.moveBy(10,0);this.legend=new SZN.Visual.Legend(mapa,220,46);this.timeline=new SZN.Visual.Timeline(this);this.timeline.setIcon(this.icoPlay);this.mapa.addControls(this.timeline,this.lb,0,this.options.buttonHeight+this.options.spacingY+10+8);this._intervalStep=SZN.bind(this,this._intervalStep);this.addListener("statusUpdate","_statusUpdate");};SZN.Visual.WeatherSwitch.prototype.$destructor=function(){this.sc.forEach(this.removeListener,this);};SZN.Visual.WeatherSwitch.prototype.setBackground=function(){for(var i=0;i<arguments.length;i++){this.backgroundLayers.push(arguments[i]);}};SZN.Visual.WeatherSwitch.prototype.addDefault=function(layer,name){this.addLayer(layer,name);this.layers[layer].def=true;this.mapa.enableLayer(layer);};SZN.Visual.WeatherSwitch.prototype.switchTo=function(layer){if(this.running){this.stopAnimation();this.setIndex(0);var wasRunning=true;}else{var wasRunning=false;}for(var p in this.layers){var item=this.layers[p];if(p!=layer){item.button.setState(0);this.mapa.disableLayer(p);}}this.layers[layer].button.setState(1);this.mapa.enableLayer(layer);var l=this.mapa.getLayer(layer);var c=l.getContainer()[0].element;if(this.layers[layer].def){this.mapa.enableLayer("weatherpoi");this.activeLayer=null;this.timeline.hide();this.backgroundLayers.forEach(this.mapa.disableLayer,this.mapa);this.legend.setImage(false);}else{var oldLayer=this.activeLayer;this.activeLayer=layer;this.mapa.disableLayer("weatherpoi");this.timeline.show();this.backgroundLayers.push(layer);this.mapa.switchLayer(this.backgroundLayers);this.backgroundLayers.pop();this.setIndex(this.index);this.legend.setImage("/st/img/"+layer+".png");if(!oldLayer||(oldLayer&&wasRunning)){this.startAnimation();}}};SZN.Visual.WeatherSwitch.prototype.setIndex=function(index){this.index=index;this.timeline.setIndex(index);if(this.activeLayer){var l=this.mapa.getLayer(this.activeLayer);l.setIndex(index);}};SZN.Visual.WeatherSwitch.prototype.getIndex=function(){return this.index;};SZN.Visual.WeatherSwitch.prototype.addLayer=function(layer,label,url,opacity){var style={"width":this.options.buttonWidth+"px","backgroundColor":"white","fontSize":"12px","padding":"3px 0px","fontFamily":"arial, sans-serif"};var offStyle={"color":SZN.Visual.OFF_COLOR,"height":this.options.buttonHeight+"px","padding":"3px 0px","borderLeft":"1px solid #a8a8ff","borderTop":"1px solid #a8a8ff","borderRight":"2px ridge #00f","borderBottom":"2px ridge #00f"};var onStyle={"color":SZN.Visual.ON_COLOR,"height":this.options.buttonHeight+"px","border":"1px solid #ccc"};if(url){onStyle.height=(this.options.buttonHeight+this.options.spacingY+2)+"px";onStyle.borderBottom="none";var copy=[];for(var i=0;i<20;i++){copy.push("PLANstudio, 2009");}var s=new AnimSource(url,copy,"alpha");var l=new AnimLayer(layer,s,false);this.mapa.addLayer(l);}var btn=new SZN.Visual.WeatherButton(label,style);btn.addState(0,offStyle);btn.addState(1,onStyle);btn.setState(0);var left=0;for(var p in this.layers){left+=this.options.spacingX+this.options.buttonWidth;}this.mapa.addControls(btn,this.lb,left,10);this.layers[layer]={"button":btn,"def":false,"opacity":opacity||1};this.sc.push(this.addListener("button-click","_buttonClick",btn));};SZN.Visual.WeatherSwitch.prototype._statusUpdate=function(){var def=false;for(var l in this.layers){if(this.layers[l].def){def=l;}}this.switchTo(def);};SZN.Visual.WeatherSwitch.prototype._buttonClick=function(e){var l=null;for(var p in this.layers){if(this.layers[p].button==e.target){l=p;}}if(l){this.switchTo(l);}};SZN.Visual.WeatherSwitch.prototype.startAnimation=function(){if(this.running){return;}this.running=true;this.timeline.setIcon(this.icoStop);this._step(true);this.interval=setInterval(this._intervalStep,this.options.interval);};SZN.Visual.WeatherSwitch.prototype.stopAnimation=function(){if(!this.running){return;}clearInterval(this.interval);this.timeline.setIcon(this.icoPlay);this.running=false;};SZN.Visual.WeatherSwitch.prototype._intervalStep=function(){this._step();};SZN.Visual.WeatherSwitch.prototype._step=function(dontStop){if(this.mapa.getSysMessage("zoomProcess")){return;}var index=this.index+1;if(index>this.options.lastIndex){index=0;if(!dontStop){this.stopAnimation();}}this.setIndex(index);};SZN.Visual.WeatherSwitch.prototype.isRunning=function(){return this.running;};SZN.Visual.Legend=SZN.ClassMaker.makeClass({"NAME":"Legend","VERSION":"1.0","CLASS":"class"});SZN.Visual.Legend.prototype.$constructor=function(mapa,width,height){this.box=SZN.cEl("div",false,false,{"position":"absolute","width":width+"px","height":height+"px","backgroundRepeat":"no-repeat","backgroundPosition":"0% 100%"});this.width=width;this.height=height;var lb=mapa.createLayoutBox("bottom-left");lb.moveBy(10,10);mapa.addControls(this,lb,0,0);};SZN.Visual.Legend.prototype.activate=function(){};SZN.Visual.Legend.prototype.getSize=function(){return {"width":this.width,"height":this.height};};SZN.Visual.Legend.prototype.setImage=function(url){if(SZN.Browser.client=="ie"){if(url){this.box.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='image')";}else{this.box.style.filter="";}}else{if(url){this.box.style.backgroundImage="url("+url+")";}else{this.box.style.backgroundImage="none";}}};var AnimLayer=SZN.ClassMaker.makeClass({"NAME":"AnimLayer","CLASS":"class","VERSION":"1.0","EXTEND":SZN.MapEngine.MapLayers.TileLayer});AnimLayer.prototype.setIndex=function(index){this.source.setIndex(index);for(var id in this.layerCache){var parts=id.split("-");var zoom=parts[1];var x=parts[2];var y=parts[3];this.source.updateUrl(this.layerCache[id],zoom,x,y);}};AnimLayer.prototype.preCache=function(callback,maxIndex,step){this._preCacheCallback=callback;var currentIndex=this.source.getIndex();var cachePipeline=4;this._cacheRemaining=[];this._cacheEvents=[];for(var id in this.layerCache){var parts=id.split("-");var zoom=parts[1];var x=parts[2];var y=parts[3];var index=currentIndex;while(index<=maxIndex){index++;var url=this.source._getTileUrl(x,y,zoom,index);this._cacheRemaining.push(url);}}for(var i=0;i<cachePipeline;i++){this._preCache();}};AnimLayer.prototype._cacheItemLoaded=function(e,elm){if(this._cacheRemaining.length){this._preCache();}else{for(var i=0;i<this._cacheEvents.length;i++){SZN.Events.removeListener(this._cacheEvents[i]);}this._cacheEvents=[];this._preCacheCallback();}};AnimLayer.prototype._preCache=function(){var url=this._cacheRemaining.shift();var img=SZN.cEl("img");this._cacheEvents.push(SZN.Events.addListener(img,"load",this,"_cacheItemLoaded"));img.src=url;};var AnimSource=SZN.ClassMaker.makeClass({"NAME":"AnimSource","CLASS":"class","VERSION":"1.0","EXTEND":SZN.MapEngine.TileSource});AnimSource.index2date=function(index){var d=new Date();d.setMilliseconds(0);d.setSeconds(0);d.setMinutes(0);d.setHours(0);var day=1000*60*60*24;var days=Math.floor(index/8);d.setTime(d.getTime()+days*day);var hrs=index%8;d.setHours(hrs*3);return d;};AnimSource.prototype.$constructor=function(){this.TileSource.apply(this,arguments);this._index=null;};AnimSource.prototype._getTileUrl=function(ppx,ppy,zoom,index){var i=index||this._index;d=this._formatDate(i);var url=this.callSuper("_getTileUrl",arguments.callee)(ppx,ppy,zoom);url=url.replace(/__date__/g,d);return url;};AnimSource.prototype.updateUrl=function(pic,zoom,x,y){var url=this._getTileUrl(x,y,zoom);if(pic.tagName.toLowerCase()=="img"){pic.src=url;}else{pic.style.filter=pic.style.filter.replace(/src=(.).*?\1/,"src=$1"+url+"$1");}};AnimSource.prototype._formatDate=function(index){return AnimSource.index2date(index).format("YmdH00");};AnimSource.prototype.setIndex=function(index){this._index=index;};AnimSource.prototype.getIndex=function(){return this._index;};}
