var currentIndex=null;var previousIndex=null;var animation=null;$(document).ready(function(){for(var b=0;
b<times.length;b++){var e=times[b];var g=Math.floor(e.min/15);var f=33+(e.hour-5)*16+g*4;
var d=(b==0)?33:f;heightMouseOver=348-d;var c=$("<div class='time-available'></div>").css("top",f);
var a=$("<div></div>").css({"z-index":5,width:"100%",top:d+"px",height:heightMouseOver+"px",position:"absolute"}).bind("mouseover",{index:b},function(h){setSelectTimePosition(h.data.index);
}).bind("click",{index:b},function(h){setCurrentTimePosition(h.data.index);});$("#time-scale").append(c);
$("#time-scale").append(a);}$("#time-play").bind("click",function(h){play();});$("#time-left").bind("click",function(h){showPrevious();
});$("#time-right").bind("click",function(h){showNext();});$("#time-current").bind("click",function(h){setCurrentTimePosition(null);
});$("#time-scale").bind("mouseout",function(h){$("#time-selector").hide();});if(day==0){setCurrentTimePosition(null);
}else{if(times.length>0){setCurrentTimePosition(Math.floor(times.length/2));}}$("#webcam-filetime").fadeTo(1000,0.6);
});function setCurrentTimePosition(a){if(a==null){$("#time-marker").hide();$("#time-current").addClass("time-current-selected");
}else{var b=times[a];$("#time-marker").show();var c=Math.floor(b.min/15);$("#time-marker").css("top",27+(b.hour-5)*16+c*4);
$("#time-marker > .time-container > .time-min15").css("background-position","-15px -"+c*10+"px");
$("#time-marker > .time-container > .time-hours").css("background-position","left -"+b.hour*10+"px");
$("#time-current").removeClass("time-current-selected");}showTimeLayer(a);}function setSelectTimePosition(a){var b=times[a];
$("#time-selector").show();var c=Math.floor(b.min/15);$("#time-selector").css("top",27+(b.hour-5)*16+c*4);
$("#time-selector > .time-container > .time-min15").css("background-position","-15px -"+c*10+"px");
$("#time-selector > .time-container > .time-hours").css("background-position","left -"+b.hour*10+"px");
}function loadTimeLayer(a){if(a!=null){var b=times[a];if(!$("#webcamimage"+a).length){$("#webcam-image").append("<img src='"+b.url+"' id='webcamimage"+a+"'>");
}}}function showNext(){var a=(currentIndex==null)?0:currentIndex+1;if(a<=times.length){setCurrentTimePosition(a);
if(a<times.length){loadTimeLayer(a+1);}}}function showPrevious(){var a=(currentIndex==null)?times.length-1:currentIndex-1;
if(a>=0){setCurrentTimePosition(a);if(a>0){loadTimeLayer(a-1);}}}function showCurrent(){setCurrentTimePosition(null);
}function play(){if(animation!=null){$("#time-play").removeClass("time-stop").addClass("time-play");
window.clearTimeout(animation);animation=null;}else{$("#time-play").removeClass("time-play").addClass("time-stop");
var b=(currentIndex==null)?0:currentIndex;for(var a=b;a<times.length;a++){loadTimeLayer(a);
}setCurrentTimePosition(b);animation=window.setTimeout("playNext()",1200);}}function playNext(){if(currentIndex<times.length-1){setCurrentTimePosition(currentIndex+1);
animation=window.setTimeout("playNext()",500);}else{animation=null;$("#time-play").removeClass("time-stop").addClass("time-play");
}}function showTimeLayer(c){if(c==currentIndex){return;}var a="webcamimage";a+=(currentIndex==null)?"":currentIndex;
var d="webcamimage";d+=(c==null)?"":c;loadTimeLayer(c);$("#"+d).css("z-index",3).fadeIn(350,function(f){$("#"+d).css("z-index",2);
$("#"+a).css("z-index",1).hide();});var b=(c!=null)?times[c].sfiletime:"aktuelles Kamerabild";
$("#webcam-filetime").text(b);previousIndex=currentIndex;currentIndex=c;}
