           function show_stream(vari, locat){
                var a = new Date().getTime();
                var akt_pic = document.getElementById('akt_pic');
                var last_pic = document.getElementById('lastpic');
                var last_vid = document.getElementById('lastvid');
                var temp_last_day = document.getElementById('temp_last_day');
                var temp_last_year = document.getElementById('temp_last_year');
                var rain_last_day = document.getElementById('rain_last_day');
                var rain_last_year = document.getElementById('rain_last_year');
                var wind_last_day = document.getElementById('wind_last_day');
                var luft_last_day = document.getElementById('luft_last_day');
                var feuchte_last_day = document.getElementById('feuchte_last_day');
                // Statistiken und Bildoptionen Links rot färben (inaktiv)
                last_vid.className = 'dlink';
                last_pic.className = 'dlink';
                temp_last_day.className = 'dlink';
                temp_last_year.className = 'dlink';
                rain_last_day.className = 'dlink';
                rain_last_year.className = 'dlink';
                wind_last_day.className = 'dlink';
                luft_last_day.className = 'dlink';
                feuchte_last_day.className = 'dlink';
                // Extremwerte
                var stat_t_day = document.getElementById('flex_info_t_day');
                var stat_t_year = document.getElementById('flex_info_t_year');
                var stat_n_month = document.getElementById('flex_info_n_month');
                var stat_n_year = document.getElementById('flex_info_n_year');
                var stat_w_day = document.getElementById('flex_info_w_day');
                var stat_l_day = document.getElementById('flex_info_l_day');
                var stat_f_day = document.getElementById('flex_info_f_day');
                var stat_info_cam = document.getElementById('flex_info_cam');
                // Kamerainfos und Extremwerte ausblenden
                stat_t_day.style.display = 'none';
                stat_t_year.style.display = 'none';
                stat_n_year.style.display = 'none';
                stat_n_month.style.display = 'none';
                stat_w_day.style.display = 'none';
                stat_l_day.style.display = 'none';
                stat_f_day.style.display = 'none';
                stat_info_cam.style.display = 'none';
                // Bilder ändern und Extremwerte anzeigen
                if(vari == 1){
                        akt_pic.innerHTML = '<embed src="WebCams/'+locat+'/Zeitraffer.avi" width="640" height="480"></embed>'
                        last_vid.className = 'alink';
                        stat_info_cam.style.display = 'block';
                }else if(vari == 0){
                        akt_pic.innerHTML = '<img src="WebCams/'+locat+'/current640x480.jpg?'+a+'" alt="" width="640" height="480" id="akt_show" />';
                        last_pic.className = 'alink';
                        stat_info_cam.style.display = 'block';
                }else if(vari == 2){
                        akt_pic.innerHTML = '<img src="WebCams/'+locat+'/Diagramm_T_Tag.jpg?'+a+'" alt="" width="640" height="480" id="akt_show" />';
                        temp_last_day.className = 'alink';
                        stat_t_day.style.display = 'block';
                }else if(vari == 3){
                        akt_pic.innerHTML = '<img src="WebCams/'+locat+'/Diagramm_T_Jahr.jpg?'+a+'" alt="" width="640" height="480" id="akt_show" />';
                        temp_last_year.className = 'alink';
                        stat_t_year.style.display = 'block';
                }else if(vari == 4){
                        akt_pic.innerHTML = '<img src="WebCams/'+locat+'/Diagramm_NS_Tag.jpg?'+a+'" alt="" width="640" height="480" id="akt_show" />';
                        rain_last_day.className = 'alink';
                        stat_n_month.style.display = 'block';
                }else if(vari == 5){
                        akt_pic.innerHTML = '<img src="WebCams/'+locat+'/Diagramm_NS_Jahr.jpg?'+a+'" alt="" width="640" height="480" id="akt_show" />';
                        rain_last_year.className = 'alink';
                        stat_n_year.style.display = 'block';
                }else if(vari == 6){
                        akt_pic.innerHTML = '<img src="WebCams/'+locat+'/Diagramm_W_Tag.jpg?'+a+'" alt="" width="640" height="480" id="akt_show" />';
                        wind_last_day.className = 'alink';
                        stat_w_day.style.display = 'block';
                }else if(vari == 7){
                        akt_pic.innerHTML = '<img src="WebCams/'+locat+'/Diagramm_D_Tag.jpg?'+a+'" alt="" width="640" height="480" id="akt_show" />';
                        luft_last_day.className = 'alink';
                        stat_l_day.style.display = 'block';
                }else if(vari == 8){
                        akt_pic.innerHTML = '<img src="WebCams/'+locat+'/Diagramm_F_Tag.jpg?'+a+'" alt="" width="640" height="480" id="akt_show" />';
                        feuchte_last_day.className = 'alink';
                        stat_f_day.style.display = 'block';
                }
        }

         function formatZahl(zahl, k, fix) {
             if(!k) k = 0;
             var neu = '';
             // Runden
             var f = Math.pow(10, k);
             zahl = '' + parseInt( zahl * f + (.5 * (zahl > 0 ? 1 : -1)) ) / f ;
             // Komma ermittlen
             var idx = zahl.indexOf('.');
             // fehlende Nullen einf?gen
             if(fix) {
                  zahl += (idx == -1 ? '.' : '' )
                  + f.toString().substring(1);
             }
             // Nachkommastellen ermittlen
             idx = zahl.indexOf('.');
             if( idx == -1) idx = zahl.length;
             else neu = ',' + zahl.substr(idx + 1, k);

             // Tausendertrennzeichen
             while(idx > 0)    {
                 if(idx - 3 > 0)
                 neu = '.' + zahl.substring( idx - 3, idx) + neu;
                 else
                 neu = zahl.substring(0, idx) + neu;
                 idx -= 3;
             }
             return neu;
        }
        function lade_bild(ID, newpath){
          img1 = new Image();
          img1.src = newpath;
          img1.onload=function(){
            document.getElementById(ID).src=newpath;
            img1.onload="";
            }
        }


         function sendRequest(url,callback,numb,postData) {
                 var req = createXMLHTTPObject();
                 if (!req) return;
                 var method = (postData) ? "POST" : "GET";
                 req.open(method,url,true);
                 req.setRequestHeader('User-Agent','XMLHTTP/1.0');
                 if (postData)
                         req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
                 req.onreadystatechange = function () {
                         if (req.readyState != 4) return;
                         if (req.status != 200 && req.status != 304) {
         //                        alert('HTTP error ' + req.status);
                                 return;
                         }
                         callback(req,numb);
                 }
                 if (req.readyState == 4) return;
                 req.send(postData);
         }

         var XMLHttpFactories = [
                 function () {return new XMLHttpRequest()},
                 function () {return new ActiveXObject("Msxml2.XMLHTTP")},
                 function () {return new ActiveXObject("Msxml3.XMLHTTP")},
                 function () {return new ActiveXObject("Microsoft.XMLHTTP")}
         ];

         function createXMLHTTPObject() {
                 var xmlhttp = false;
                 for (var i=0;i<XMLHttpFactories.length;i++) {
                         try {
                                 xmlhttp = XMLHttpFactories[i]();
                         }
                         catch (e) {
                                 continue;
                         }
                         break;
                 }
                 return xmlhttp;
         }



         function WeatherRequest(req,numb) {
             var a = new Date().getTime();
             var stats = null;
             stats = eval(req.responseText);
             for(i=0; i<stats.length; i++){
               if (stats[i].WebAktiv=='true')
               {
               document.getElementById("temp_"+stats[i].WebCamName).innerHTML = stats[i].Temperatur;
               lade_bild('thumb_'+stats[i].WebCamName,'WebCams/'+stats[i].WebCamName+'/preview_current.jpg?'+a);
               }
             }
             document.getElementById('temp').innerHTML = stats[numb].Temperatur;
             document.getElementById('locat').innerHTML = stats[numb].GPS;
             document.getElementById('height').innerHTML = stats[numb].Hoehe;
             document.getElementById('rain').innerHTML = stats[numb].Regen1Std;
             if (stats[numb].Protokoll=='ws2300') {document.getElementById('winddirection').innerHTML = '&nbsp;('+stats[numb].WindrichtungStr+')'}
             if (stats[numb].Protokoll=='ws444') {document.getElementById('winddirection').innerHTML = ''}

             document.getElementById('wind').innerHTML = stats[numb].Wind;
             document.getElementById('luft').innerHTML = stats[numb].Luftdruckabsolut;
             document.getElementById('feuchte').innerHTML = stats[numb].Feuchte;
             // Extremwerte eintragen
             document.getElementById('flex_tmax').innerHTML = stats[numb].MinMax_Max_Temp_24_Wert;
             document.getElementById('flex_tmin').innerHTML = stats[numb].MinMax_Min_Temp_24_Wert;
             document.getElementById('flex_tavg').innerHTML = stats[numb].MinMax_Dur_Temp_24_Wert;
             document.getElementById('flex_tmax_y').innerHTML = stats[numb].MinMax_Max_Temp_365_Wert;
             document.getElementById('flex_tmin_y').innerHTML = stats[numb].MinMax_Min_Temp_365_Wert;
             document.getElementById('flex_tavg_y').innerHTML = stats[numb].MinMax_Dur_Temp_365_Wert;
             document.getElementById('flex_nmax_m').innerHTML = stats[numb].MinMax_Max_Regen_30_Wert;
             document.getElementById('flex_nges_m').innerHTML = stats[numb].MinMax_Ges_Regen_30_Wert;
             document.getElementById('flex_nmax_y').innerHTML = stats[numb].MinMax_Max_Regen_365_Wert;
             document.getElementById('flex_nges_y').innerHTML = stats[numb].MinMax_Ges_Regen_365_Wert;
             document.getElementById('flex_wmax').innerHTML = stats[numb].MinMax_Max_Wind_24_Wert;
             document.getElementById('flex_wavg').innerHTML = stats[numb].MinMax_Dur_Wind_24_Wert;
             document.getElementById('flex_lmin').innerHTML = stats[numb].MinMax_Min_Druck_24_Wert;
             document.getElementById('flex_lmax').innerHTML = stats[numb].MinMax_Max_Druck_24_Wert;
             document.getElementById('flex_fmin').innerHTML = stats[numb].MinMax_Min_Feuchte_24_Wert;
             document.getElementById('flex_fmax').innerHTML = stats[numb].MinMax_Max_Feuchte_24_Wert;
             // Bild nachladen
//             document.getElementById('veryhighsol').href = "WebCams/"+stats[numb].WebCamName+"/current.jpg?"+a;
         }




         function CounterRequest(req,numb) {
             var a = new Date().getTime();
             var stats = null;
             stats = eval(req.responseText);
             document.getElementById('counter_heute').innerHTML = stats[0].counter;
             document.getElementById('counter_all').innerHTML = formatZahl(Number(stats[0].counter) + Number(stats[1].counter));
         }


        function get_stats(locat, numb){

                var a = new Date().getTime();
                if(document.getElementById('lastpic').className == 'alink'){
                lade_bild('akt_show','WebCams/'+locat+'/current640x480.jpg?'+a);
                document.getElementById('lastpic').className = 'alink';}
                sendRequest('get_stats_vari.php?abfrage=SELECT * FROM webcam_table_WeatherInfos&'+a,WeatherRequest,numb);
                sendRequest('get_stats_vari.php?abfrage=SELECT COUNT(*) as counter FROM onlinecounter_ipaccesstable_day UNION SELECT SUM(ipcount) from onlinecounter_history&'+a,CounterRequest,numb);
                var loop = setTimeout(function(){ get_stats(locat, numb);}, 60000);
        }
