var lmt_timeline;var lmt_timeselector;var lmt_map;var lmt_first;var lmt_previous;var lmt_play;var lmt_stop;var lmt_next;var lmt_last;var lmt_loop;var lmt_faster;var lmt_slower;var cnt=0;var maps=new Array();var imgs=new Array();var btns=new Array();btns.first="Eerste";btns.previous="Vorige";btns.play="Start";btns.stop="Stop";btns.next="Volgende";btns.last="Laatste";btns.loop="Loop mode";btns.faster="Sneller";btns.slower="Langzamer";var inverted=true;var ie=(window.addEventListener)?false:true;var cidx=0;maps[0]=["/appdata/binaries/weerkaarten/europe_tx_"+getDayOfMonth()+"_0.jpg",1,getCalendarDate(0),true,true];maps[1]=["/appdata/binaries/weerkaarten/europe_tx_"+getDayOfMonth()+"_1.jpg",1,getCalendarDate(1),true,true];maps[2]=["/appdata/binaries/weerkaarten/europe_tx_"+getDayOfMonth()+"_2.jpg",1,getCalendarDate(2),true,true];maps[3]=["/appdata/binaries/weerkaarten/europe_tx_"+getDayOfMonth()+"_3.jpg",1,getCalendarDate(3),true,true];function evtStep(b){var a;if(ie){a=b.srcElement.idx}else{a=b.target.idx}showFrame(a)}function evtStop(b){var a;if(ie){a=b.srcElement.idx}else{a=b.target.idx}setPlayerStop();showFrame(a)}function loadedFrame(b){var a=b.id;maps[a][3]=true;updateTimeline()}function clearMapPlayer(){for(i=lmt_timeline.childNodes.length-1;i>=0;i--){lmt_timeline.removeChild(lmt_timeline.childNodes[i])}lmt_timeselector.options.length=0}function initMapPlayer(){lmt_timeline=document.getElementById("timeline");lmt_timeselector=document.getElementById("timeselector");lmt_map=document.getElementById("map");cnt=maps.length;clearMapPlayer();var a=Math.floor((30-(cnt)*2)/cnt);lmt_timeselector.options.length=cnt;for(i=0;i<cnt;i++){idx=(inverted)?(cnt-1-i):i;var b=document.createElement("div");b.setAttribute("id","step");b.setAttribute(((ie)?"className":"class"),"disabled");b.setAttribute("title",maps[idx][2]);imgs[idx]=new Image();imgs[idx].id=idx;imgs[idx].onload=function(){loadedFrame(this)};imgs[idx].src=maps[idx][0];if(ie){b.attachEvent("onmouseover",evtStep);b.attachEvent("onclick",evtStop);b.idx=idx}else{b.addEventListener("mouseover",evtStep,false);b.addEventListener("click",evtStop,false);b.idx=idx}b.style.width=a+"px";lmt_timeline.appendChild(b);lmt_timeselector.options[i].text=maps[i][2]}initControls();updateControls();toggleControl("play")}function switchElement(a){imgs[0].src="/appdata/binaries/weerkaarten/europe_"+a+"_"+getDayOfMonth()+"_0.jpg";imgs[1].src="/appdata/binaries/weerkaarten/europe_"+a+"_"+getDayOfMonth()+"_1.jpg";imgs[2].src="/appdata/binaries/weerkaarten/europe_"+a+"_"+getDayOfMonth()+"_2.jpg";imgs[3].src="/appdata/binaries/weerkaarten/europe_"+a+"_"+getDayOfMonth()+"_3.jpg";if(a=="tx"||a=="tn"||a=="windchill"){document.getElementById("legend").src="/static/images/weerkaart/legenda_tt.png"}else{document.getElementById("legend").src="/static/images/weerkaart/legenda_"+a+".png"}moveFrame(0)}function showFrame(a){if(lmt_timeselector){cidx=a;lmt_timeselector.selectedIndex=cidx;lmt_map.src=imgs[cidx].src;updateTimeline();updateControls()}}function updateTimeline(){for(i=0;i<cnt;i++){var a="";if(i==cidx){a="active"}else{if(maps[i][3]){a=(maps[i][4])?"enabled_red":"enabled"}else{a="disabled"}}if(inverted){lmt_timeline.childNodes[(cnt-1-i)].setAttribute(((ie)?"className":"class"),a)}else{lmt_timeline.childNodes[i].setAttribute(((ie)?"className":"class"),a)}}}var playing=false;var direction=1;var loop=true;var speed=650;var cdirection=direction;function toggleControl(a){if(cnt>0){if(a=="first"){if(inverted){cidx=cnt-1;showFrame(cidx)}else{cidx=0;showFrame(cidx)}}else{if(a=="previous"){if(inverted){moveFrame(1)}else{moveFrame(-1)}}else{if(a=="play"&&playing){setPlayerStop()}else{if(a=="play"){setPlayerPlay()}else{if(a=="stop"){setPlayerStop()}else{if(a=="next"){if(inverted){moveFrame(-1)}else{moveFrame(1)}}else{if(a=="last"){if(inverted){cidx=0;showFrame(cidx)}else{cidx=cnt-1;showFrame(cidx)}}else{if(a=="loop"){loop=(loop)?false:true;cdirection=direction;showFrame(cidx)}else{if(a=="faster"){speed*=0.8;if(speed<25){speed=25}}else{if(a=="slower"){speed*=1.2;if(speed>5000){speed=5000}}}}}}}}}}}}}function highlightControl(b,a){}function initControls(){lmt_first=document.getElementById("first");lmt_previous=document.getElementById("previous");lmt_play=document.getElementById("play");lmt_stop=document.getElementById("stop");lmt_next=document.getElementById("next");lmt_last=document.getElementById("last");lmt_loop=document.getElementById("loop");lmt_faster=document.getElementById("faster");lmt_slower=document.getElementById("slower");lmt_first.setAttribute("title",btns.first);lmt_previous.setAttribute("title",btns.previous);lmt_play.setAttribute("title",btns.play);lmt_stop.setAttribute("title",btns.stop);lmt_next.setAttribute("title",btns.next);lmt_last.setAttribute("title",btns.last);lmt_loop.setAttribute("title",btns.loop);lmt_faster.setAttribute("title",btns.faster);lmt_slower.setAttribute("title",btns.slower)}function updateControls(){if(inverted){lmt_first.setAttribute(((ie)?"className":"class"),((cidx==(cnt-1)||cnt==0)?"disabled":"enabled"));lmt_previous.setAttribute(((ie)?"className":"class"),((cidx==(cnt-1)||cnt==0)?"disabled":"enabled"));lmt_next.setAttribute(((ie)?"className":"class"),((cidx==0||cnt==0)?"disabled":"enabled"));lmt_last.setAttribute(((ie)?"className":"class"),((cidx==0||cnt==0)?"disabled":"enabled"))}else{lmt_first.setAttribute(((ie)?"className":"class"),((cidx==0||cnt==0)?"disabled":"enabled"));lmt_previous.setAttribute(((ie)?"className":"class"),((cidx==0||cnt==0)?"disabled":"enabled"));lmt_next.setAttribute(((ie)?"className":"class"),((cidx==(cnt-1)||cnt==0)?"disabled":"enabled"));lmt_last.setAttribute(((ie)?"className":"class"),((cidx==(cnt-1)||cnt==0)?"disabled":"enabled"))}lmt_play.setAttribute(((ie)?"className":"class"),((cnt==0||playing||cnt==0)?"disabled":"enabled"));lmt_stop.setAttribute(((ie)?"className":"class"),((!playing||cnt==0)?"disabled":"enabled"));if(loop){lmt_loop.setAttribute(((ie)?"className":"class"),((cnt==0)?"disabled-loop":"enabled-loop"))}else{lmt_loop.setAttribute(((ie)?"className":"class"),((cnt==0)?"disabled-rock":"enabled-rock"))}lmt_faster.setAttribute(((ie)?"className":"class"),((cnt==0)?"disabled":"enabled"));lmt_slower.setAttribute(((ie)?"className":"class"),((cnt==0)?"disabled":"enabled"))}function setPlayerPlay(){playing=true;updateControls();setPlayerLoop()}function setPlayerStop(){playing=false;updateControls()}function findNext(){if(cdirection>0){cidx++;if(cidx>=cnt){if(loop){cidx=0}else{cdirection*=-1;cidx--}}}else{cidx--;if(cidx<0){if(loop){cidx=cnt-1}else{cdirection*=-1;cidx++}}}}function moveFrame(a){if(a>0){cidx++;if(cidx>=cnt){cidx=cnt-1}}else{cidx--;if(cidx<0){cidx=0}}showFrame(cidx)}function setPlayerLoop(){var a;findNext();if(maps[cidx][3]==false){a=25;updateTimeline();updateControls()}else{a=speed*maps[cidx][1];showFrame(cidx)}if(playing){window.setTimeout("setPlayerLoop()",a)}};
