/*
 * rain 0.31 - simple rain radar for iphone 
 *
 * Copyright (c) 2008-2010 Marcus Mattern, Matthias Tenhaeff (afterworkcoders.de)
 *
 */
if(window.location.href.indexOf(".afterworkcoders.de")>0){window.savedconsole=window.console;window.console=null}clearOldCookies(cookieVersion);function clearOldCookies(C){var A=jQuery.cookie();if(A){for(var B=0;B<A.length;B++){if(A[B].indexOf("cookie")===0){if(A[B].indexOf("cookie"+C)==-1){if(window.console&&window.console.debug){window.console.debug("delete cookie: "+A[B])}jQuery.cookie(A[B],"",{path:"/",expires:0})}else{jQuery.cookie(A[B],jQuery.cookie(A[B]),{path:"/",expires:cookieDuration})}}}}}function initActiveImage(){document.getElementById("activeImage").src=loadImg;document.getElementById("imageLoader").src=loadImg;document.getElementById("imageLoader").onload=null}function loadImage(A){clearTimer(isShowLoading);isShowLoading=setTimeout(function(){jQuery("#loading").show()},250);document.getElementById("imageLoader").onload=imageLoaded;document.getElementById("imageLoader").onerror=showError;document.getElementById("imageLoader").src=A;if(currentImage==0){jQuery("#idplay").addClass("inactive")}else{if(!loopVar){jQuery("#idplay").removeClass("inactive")}}}function imageLoaded(){document.getElementById("activeImage").src=document.getElementById("imageLoader").src;if(window.console&&window.console.debug){window.console.debug("img loaded: "+document.getElementById("imageLoader").src)}if(loopActive){loopVar=window.setTimeout("showNext()",SPEED_DELAY[getValue(getActivePluginPrefix()+"speed",true)])}isShowLoading=clearTimer(isShowLoading);jQuery("#loading").hide();var B=SLIDEMANAGER.activePlugin.getCurrentDateString(document.getElementById("activeImage").src);if(B==null||typeof (B)=="undefined"){var A=(imageArray.length-currentImage);B=""+((A<10)?"0"+A:A)+" / "+imageArray.length}jQuery("#currentTimestamp").html(B)}function showError(){document.getElementById("activeImage").src=loadImg;scrollAdressBarAway()}function showPrev(){if(!imageArray||imageArray.length<=1){return }currentImage=currentImage+1;if(currentImage>=imageArray.length){currentImage=0}loadImage(imageArray[currentImage])}function showNext(A){if(!imageArray||imageArray.length<=1){return }if(!A&&loopVar&&(currentImage==SLIDEMANAGER.activePlugin.getStartIndex())&&("false"==getValue(getActivePluginPrefix()+"loop",true))){stopLoop();loopVar=null;return }currentImage=currentImage-1;if(currentImage<0){currentImage=imageArray.length-1}loadImage(imageArray[currentImage])}function showStart(){if(!imageArray||imageArray.length<=1){return }currentImage=imageArray.length-1;loadImage(imageArray[currentImage])}function showCurrent(){if(!imageArray||imageArray.length<=1){return }currentImage=0;loadImage(imageArray[currentImage])}function startLoop(A){if(window.console&&window.console.debug){window.console.debug("startLoop")}if(!imageArray||imageArray.length<=1){return }loopActive=true;configureButtons();if(window.console&&window.console.debug){window.console.debug("startLoop with delay: "+getValue(getActivePluginPrefix()+"speed",true))}jQuery("#buttonplay").unbind("click",startLoop);if(window.console&&window.console.debug){window.console.debug("lvFromStart:"+(A===true)+" currentImage:"+currentImage)}if(currentImage==0){showStart()}else{showNext(true)}jQuery("#buttonplay").bind("click",stopLoop)}function stopLoop(){loopActive=false;if(window.console&&window.console.debug){window.console.debug("stopLoop")}jQuery("#buttonbar").fadeIn(400);jQuery("#buttonplay").unbind("click",stopLoop);clearTimer(loopVar);clearTimer(isShowLoading);configureButtons();jQuery("#buttonplay").bind("click",startLoop)}function initButtons(){jQuery("#buttonplay").bind("click",startLoop);jQuery("#activeImage").bind("click",function(){var A=jQuery("#buttonbar").css("display");if(A!="none"){jQuery("#buttonbar").fadeOut(400)}else{jQuery("#buttonbar").fadeIn(400)}});jQuery("#buttonreload").bind("click",function(){window.location.reload()})}function configureButtons(){if(loopActive){jQuery("#buttonplay").removeClass("sprite-buttonplay").addClass("sprite-buttonpause")}else{jQuery("#buttonplay").removeClass("sprite-buttonpause").addClass("sprite-buttonplay")}}function scrollAdressBarAway(){setTimeout(function(){window.scrollTo(0,1)},1000)}function clearTimer(A){if(A){if(window.console&&window.console.debug){window.console.debug("clearTimer: "+A)}window.clearTimeout(A)}return null}function getValue(D,A){if(cvCache[D]){return cvCache[D]}var C;var B;if(SLIDEMANAGER.activePlugin&&D.indexOf(SLIDEMANAGER.activePlugin.pluginName)==0){B=getPluginOptions()}else{B=getBaseOptions()}C=jQuery.cookie("cookie"+cookieVersion+"."+D);if(!C&&A){C=B[D]["vardefault"]}cvCache[D]=C;return C}function refreshOptions(){if(document.getElementById("home")){lvOptions=getPluginOptions();for(var A in lvOptions){if(window.console&&window.console.debug){window.console.debug("remove :"+A)}jQuery("#li"+toId(A)).remove();jQuery("#"+toId(A)).remove()}defineNewEntries(getPluginOptions());initNewEntries(getPluginOptions())}}function setValue(D,B,A){if(window.console&&window.console.debug){window.console.debug("setValue: "+D+" : "+B)}cvCache[D]=B;var C=true;if(SLIDEMANAGER.activePlugin&&D.indexOf(SLIDEMANAGER.activePlugin.pluginName)==0){C=false}if(C){if(A&&document.getElementById("home")){lvOptions=getBaseOptions();for(var E in lvOptions){if(window.console&&window.console.debug){window.console.debug("remove :"+E)}jQuery("#spacerdiv").remove();jQuery("#li"+toId(E)).remove();jQuery("#"+toId(E)).remove()}lvOptions=getPluginOptions();for(var E in lvOptions){if(window.console&&window.console.debug){window.console.debug("remove :"+E)}jQuery("#li"+toId(E)).remove();jQuery("#"+toId(E)).remove()}}jQuery.cookie("cookie"+cookieVersion+"."+D,B,{path:"/",expires:cookieDuration});if(A&&document.getElementById("home")){if(D=="submenu"){loadPlugin(B)}if(D=="language"){refreshLanguage()}defineBaseEntries(getBaseOptions());defineNewEntries(getPluginOptions());initNewEntries(getBaseOptions());initNewEntries(getPluginOptions())}}else{jQuery.cookie("cookie"+cookieVersion+"."+D,B,{path:"/",expires:cookieDuration})}}function setActivePlugin(A){activePlugin=A}function getActivePluginPrefix(){return(SLIDEMANAGER.activePlugin)?SLIDEMANAGER.activePlugin.pluginName+".":""}function defineBaseEntries(C){var B=false;for(var A in C){if(window.console&&window.console.debug){window.console.debug("define :"+A)}if(C[A]["visible"]){defineNewEntry(C[A],"#home");B=true}}if(B){jQuery("#home > :last-child").before("<div id=\"spacerdiv\" style='height:10px; width:10px;'></div>")}}function defineNewEntries(B){for(var A in B){if(window.console&&window.console.debug){window.console.debug("define :"+A)}if(B[A]["visible"]!==false){defineNewEntry(B[A],"#home")}}}function initNewEntries(B){for(var A in B){if(window.console&&window.console.debug){window.console.debug("init :"+A)}selectValue(A,getValue(A,true))}}function toId(A){return A.replace(/\./g,"_")}function renderHeadlines(A){var B=SLIDEMANAGER.activePlugin.getHeadline()||(A.headline||"");jQuery("#headlinecontent").text(B);document.title=B;var C=SLIDEMANAGER.activePlugin.getSubHeadline();jQuery("#subheadline").text(C)}function defineNewEntry(A,C){lvVarType=A.vartype;if(window.console&&window.console.debug){window.console.debug("defineNewEntry : "+A.varname+":"+lvVarType)}switch(lvVarType){case"select":if(jQuery("#li"+toId(A.varname)).length==0){if(jQuery(C+" > :last-child").length==1){jQuery(C+" > :last-child").before('<li id="li'+toId(A.varname)+'"><div id="current'+toId(A.varname)+'link" class="currentSetting"></div><a class="menulink" href="#'+toId(A.varname)+'">'+SLIDEMANAGER.getText(A.display)+"</a></li>")}else{jQuery(C).append('<li id="li'+toId(A.varname)+'"><div id="current'+toId(A.varname)+'link" class="currentSetting"></div><a class="menulink" href="#'+toId(A.varname)+'">'+SLIDEMANAGER.getText(A.display)+"</a></li>")}}if(jQuery("#"+toId(A.varname)).length==0){var G='<ul id="'+toId(A.varname)+'" title="'+SLIDEMANAGER.getText(A.display)+'">\r\n';for(var D in A.values){if(A.values[D].group){G=G+'<li class="group">'+SLIDEMANAGER.getText(A.values[D].group)+"</li>\n"}G=G+'<li><a class="selection" id="'+toId(A.varname+D)+'" target="_self" ';G=G+" href=\"javascript:selectValue('"+A.varname+"','"+D+"',true);\">"+SLIDEMANAGER.getText(A.values[D].display)+"</a></li>\r\n"}G=G+"</ul>\r\n"}if(window.console&&window.console.debug){window.console.debug("NewPage : "+G)}jQuery("body").append(G);break;case"text":if(jQuery("#li"+toId(A.varname)).length==0){var B=getValue(A.varname,false);var E=(B)?A.getCall(B,SLIDEMANAGER.activePlugin):(A.emptyMsg?SLIDEMANAGER.getText(A.emptyMsg):"");var F='<div id="li'+toId(A.varname)+'" class="listpanel"><fieldset>';F=F+'<div class="row"><label id="la'+toId(A.varname)+'">'+SLIDEMANAGER.getText(A.display)+'</label><input name="ip'+toId(A.varname)+'" id="ip'+toId(A.varname)+'" type="text" value="'+(E||"")+'"/></div>';F=F+"</fieldset></div>";if(jQuery(C+" > :last-child").length==1){jQuery(C+" > :last-child").before(F)}else{jQuery(C).append(F)}jQuery("#ip"+toId(A.varname)).focus(function(H){if(!getValue(A.varname)){jQuery(this).val("")}jQuery(this).select()}).blur(function(I){var H=jQuery(this).val();if(A.setCall){B=(A.setCall(H,SLIDEMANAGER.activePlugin))||"";setValue(A.varname,B);E=(B)?A.getCall(B,SLIDEMANAGER.activePlugin):(H)?SLIDEMANAGER.getText({de:"Kein Treffer gefunden",en:"No matches found"}):(A.emptyMsg?SLIDEMANAGER.getText(A.emptyMsg):"");jQuery(this).val(E)}else{E=(H.trim().length>0)?H:(A.emptyMsg?SLIDEMANAGER.getText(A.emptyMsg):"");jQuery(this).val(E);setValue(A.varname,H)}})}break;case"boolean":if(jQuery("#li"+toId(A.varname)).length==0){var F='<div id="li'+toId(A.varname)+'" class="listpanel"><fieldset>';F=F+'<div class="row"><label>'+SLIDEMANAGER.getText(A.display)+'</label><div class="toggle" id="'+toId(A.varname)+'" onclick="selectValue(\''+A.varname+'\',jQuery(this).attr(\'toggled\'));" toggled="false"><span class="thumb"></span><span class="toggleOn">I</span><span class="toggleOff">O</span></div></div>';F=F+"</fieldset></div>";if(jQuery(C+" > :last-child").length==1){jQuery(C+" > :last-child").before(F)}else{jQuery(C).append(F)}}break;default:break}}function selectValue(E,B,C){var D;if(E.indexOf(SLIDEMANAGER.activePlugin.pluginName)==0){D=getPluginOptions()}else{D=getBaseOptions()}var A=D[E]["vartype"];if(window.console&&window.console.debug){window.console.debug("SelectValue : "+E+"="+B+"  type:"+A)}switch(A){case"select":if(getValue(E)){jQuery("#"+toId(E+getValue(E))).removeClass("selectedValue")}setValue(E,B,C);jQuery("#"+toId(E+getValue(E))).addClass("selectedValue");jQuery("#current"+toId(E)+"link").text(jQuery("#"+toId(E+getValue(E))).text());if(C){if(E=="language"){refreshLanguage()}history.back()}break;case"boolean":if(window.console&&window.console.debug){window.console.debug("Toggle : "+E+"="+B)}setValue(E,B);jQuery("#"+toId(E)).attr("toggled",B);break;default:break}}function loadPlugin(A,C){if(window.console&&window.console.info){window.console.info('load plugin "'+A+'"')}var B="plugins/"+A+"/plugin"+(C?".min":"")+".js";loadScript(B)}function loadTextBundle(A,C,B){if(window.console&&window.console.info){window.console.info("load textbundle:"+C+' from "'+B+'"')}loadScript(B)}function loadScript(pvUrl){try{var lvLoadedScript=jQuery.ajax({type:"GET",url:pvUrl,processData:false,async:false}).responseText;eval(lvLoadedScript)}catch(e){if(window.console&&window.console.error){window.console.error("script "+pvUrl+" not loaded.  error:"+e)}return false}return true}function getBaseOptions(A){var B=allBaseDef;return B}function getPluginOptions(A){return SLIDEMANAGER.activePlugin.getConfigVariables()}function loadData(){var A={};var B=getPluginOptions();for(var C in B){if(window.console&&window.console.debug){window.console.debug("Parameter: "+C+" = "+getValue(C,true))}A[C]=getValue(C,true)}dataObject=SLIDEMANAGER.activePlugin.getData(A);imageArray=dataObject.imageArray;if(imageArray&&imageArray.length>0){initActiveImage();currentImage=SLIDEMANAGER.activePlugin.getStartIndex();loadImage(imageArray[currentImage])}else{}}function refreshLanguage(){var A=SLIDEMANAGER.getCurrLang();if(!SLIDEMANAGER.bundles||!SLIDEMANAGER.bundles[A]||!SLIDEMANAGER.bundles[A]["global"]){var B="langs/global_"+A+".js";loadTextBundle("global",A,B)}if(!SLIDEMANAGER.bundles||!SLIDEMANAGER.bundles[A]||!SLIDEMANAGER.bundles[A][SLIDEMANAGER.pluginName]){if(SLIDEMANAGER.pluginName){var B="plugins/"+SLIDEMANAGER.pluginName+"/langs/plugin_"+A+".js";loadTextBundle(SLIDEMANAGER.pluginName,A,B)}}jQuery("#home").attr("title",SLIDEMANAGER.getText("#headline_settings"));jQuery("#acceptButton").text(SLIDEMANAGER.getText("#button_accept"))}var SLIDEMANAGER;function SLIDEMANAGER_registerPlugin(B){B.init(this);this.activePlugin=B;this.pluginName=B.pluginName;this.defaultLang=(navigator.language.indexOf("-")>-1)?navigator.language.substr(0,navigator.language.indexOf("-")).toLowerCase():navigator.language.toLowerCase();this.defaultLang=(!arr_contains(this.activePlugin.getSupportedLanguages,this.defaultLang))?null:this.defaultLang;var A=(getValue("language",false)||this.defaultLang)||"en";setValue("language",A);refreshLanguage()}function SLIDEMANAGER_applyAll(){if(this.activePlugin.providerImgSrc){jQuery("#providerimage > a").attr("href",this.activePlugin.providerImgLink);jQuery("#providerimage > a > img").attr("src",this.baseDir+this.activePlugin.pluginName+"/"+this.activePlugin.providerImgSrc)}jQuery("#versiontag").text(this.activePlugin.getInfo().version);setTimeout(function(){SLIDEMANAGER.activePlugin.afterInit()},0)}function SLIDEMANAGER_registerTextBundle(C,B,A){if(!this.bundles){this.bundles={}}if(!this.bundles[C]){this.bundles[C]={}}this.bundles[C][B]=A}function SLIDEMANAGER_getText(B,A){if(typeof B=="string"){if(B.indexOf("#")==0){var D=B.substring(1);if(this.bundles&&this.bundles[this.getCurrLang()]){var E=this.bundles[this.getCurrLang()];if(E.global&&E.global[D]){return E.global[D]}if(E[this.pluginName]&&E[this.pluginName][D]){return E[this.pluginName][D]}}return D}return B}try{return B[this.getCurrLang()]}catch(C){}return A||""}function SLIDEMANAGER_currLang(){return getValue("language",false)}SLIDEMANAGER={bundles:null,registerTextBundle:SLIDEMANAGER_registerTextBundle,activePlugin:null,currLang:"en",registerPlugin:SLIDEMANAGER_registerPlugin,applyAll:SLIDEMANAGER_applyAll,pluginName:null,providerImgSrc:null,providerImgLink:null,getText:SLIDEMANAGER_getText,getCurrLang:SLIDEMANAGER_currLang,baseDir:"plugins/"};function arr_contains(C,B){for(var A=0;A<C.length;A++){if(C[A]==B){return true}}return false};
