function openPopup(url,width,height) {
  top.name = "popup";
  var popup = window.open(url,"neuesFenster",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+width+',height='+height);
  if( navigator.appName.substring(0,8) == "Netscape" ) {
    popup.location = url;
    popup.opener = self;
  }
 }
 
 function showFAQ(type,id) {
   if (document.getElementById(type+id).style.display != "block") {
     document.getElementById(type+id).style.display = "block";
     if (type == "kategorie") {
       document.getElementById("h2"+id).style.backgroundImage = "url(upload/images/Layout/faq_open.gif)";
     }
     else {
       document.getElementById("frage"+id).style.backgroundImage = "url(upload/images/Layout/faq_open.gif)";
     }
   }
   else {
     document.getElementById(type+id).style.display = "none";
     if (type == "kategorie") {
       document.getElementById("h2"+id).style.backgroundImage = "url(upload/images/Layout/faq_h2.gif)";
     }
     else {
       document.getElementById("frage"+id).style.backgroundImage = "url(upload/images/Layout/faq_closed.gif)";
     }
   }
 }
 
function openWebcam(){
  var popup = window.open('http://62.206.10.222/local/viewer/cam_inner.html','webcam','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=930,height=700');
  if( navigator.appName.substring(0,8) == "Netscape" ) {
    popup.location = 'http://62.206.10.222/local/viewer/cam_inner.html';
    popup.opener = self;
  }
}

function number_format(number,laenge,sep,th_sep) {
  number = Math.round( number * Math.pow(10, laenge) ) / Math.pow(10, laenge);
  str_number = number+"";
  arr_int = str_number.split(".");
  if(!arr_int[0]) arr_int[0] = "0";
  if(!arr_int[1]) arr_int[1] = "";
  if(arr_int[1].length < laenge){
    nachkomma = arr_int[1];
    for(i=arr_int[1].length+1; i <= laenge; i++){  nachkomma += "0";  }
    arr_int[1] = nachkomma;
  }
  if(th_sep != "" && arr_int[0].length > 3){
    Begriff = arr_int[0];
    arr_int[0] = "";
    for(j = 3; j < Begriff.length ; j+=3){
      Extrakt = Begriff.slice(Begriff.length - j, Begriff.length - j + 3);
      arr_int[0] = th_sep + Extrakt +  arr_int[0] + "";
    }
    str_first = Begriff.substr(0, (Begriff.length % 3 == 0)?3:(Begriff.length % 3));
    arr_int[0] = str_first + arr_int[0];
  }
  return arr_int[0]+sep+arr_int[1];
}

function shopCalc() {
  var summe = 0;
  var preis = 0;
  for(var i = 0; i < shopids.length; i++) {
    preis = document.getElementById("preis"+shopids[i]).value * document.getElementById("anzahl"+shopids[i]).value;
    summe += preis;
    document.getElementById("summe"+shopids[i]).innerHTML = number_format(preis,2,",",".")+" &euro;";
  }
  document.getElementById("zwischensumme").innerHTML = number_format(summe,2,",",".")+" &euro;";
  document.getElementById("summe").innerHTML = number_format(summe + 3,2,",",".")+" &euro;";
}