var safari = (navigator.appVersion.indexOf("Safari")!=-1) ? true : false;
var moz = (navigator.appName.indexOf("Netscape")!=-1) ? true : false;
var isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
var opera = (navigator.userAgent.indexOf("Opera")!=-1) ? true : false;
var IE = ((document.all)&&(navigator.appVersion.indexOf("MSIE")!=-1)) ? true : false;
var ie55 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.5")!=-1)) ? true : false;
var IEmac = ((document.all)&&(isMac)) ? true : false;
var NS4 = (document.layers) ? true : false;
var ie7plus = ((document.all)&&(navigator.appVersion.indexOf("MSIE")!=-1)&&(navigator.appVersion.charAt(navigator.appVersion.indexOf('MSIE')+5)>=7)) ? true : false;


var d = document;

function openWindow(theURL,winName,features) {
    myWin = window.open(theURL,winName,features);
    myWin.focus();
}

function preloadImages() {    // Arguments are images
      if (d.images) {
          if(!d.preload) d.preload = new Array();
          var a = this.arguments; 
          for (i=0; i<a.length; i++) {
               d.preload[i] = new Image;
               d.MM_p[i].src = a[i];
        }
    }
}

var orgHeight = "";

function divHeight(where) {
    var dheader = d.getElementById('header').clientHeight;
    var dmain = d.getElementById('content').clientHeight;
    var dfooter = d.getElementById('footer').clientHeight;
    if (!IE && where==1) dfooter+=34;
    if (orgHeight=="") orgHeight = d.getElementById('content').clientHeight;
    var myHeight = d.documentElement.clientHeight-dheader-dfooter - (IE? 50 : 63) ;

    if (IE && !ie7plus) {
            if (myHeight>=orgHeight) d.getElementById('content').style.height= myHeight+'px';
            else d.getElementById('content').style.height= orgHeight+'px';   
         }
       else{
            if (myHeight>=orgHeight) d.getElementById('content').style.minHeight= myHeight+'px';
            else d.getElementById('content').style.minHeight= orgHeight+'px';
}

/*
    var myHeight = d.documentElement.clientHeight-dheader-dfooter;        //Abstand zw. mainnav und content
    if (myHeight>=orgHeight) d.getElementById('footer').style.marginTop = myHeight+'px';
    else d.getElementById('footer').style.marginTop = '20px';
*/    
}

function highlightTR( id , doHighlight ) {
    var el1 = d.getElementById('tr1_'+id);
    var el2 = d.getElementById('tr2_'+id);
    if (doHighlight) {
        el1.className="highlight";
        el2.className="highlight";
    } else {
        el1.className="normal";
        el2.className="normal";
    }
}

function switchFaq(fid){

   var faqAntwort = document.getElementById("faq_" + fid);
   /* var switchLink = document.getElementById("faqSwitch_" + fid); */
   var faqFrage   = document.getElementById("faqQ_" + fid);
   var faqNr   = document.getElementById("faqNr_" + fid);
   if(faqAntwort.style.display == "none"){
      faqFrage.style.color = "#A62B1F";
      faqNr.style.color = "#A62B1F";
      faqAntwort.style.display = "";
     /* 
      switchLink.innerHTML = "Zuklappen";
      switchLink.title = "Zuklappen";
      switchLink.className = "faqClose";
     */
   }else{
      faqFrage.style.color = "";
      faqNr.style.color = "";
      faqAntwort.style.display = "none";
     /*
      switchLink.innerHTML = "Mehr...";
      switchLink.title = "Mehr";
      switchLink.className = "faqOpen";
     */
   }
}

function switchFaq2(fid){

   var faqAntwort = document.getElementById("faq_" + fid);
   var switchLink = document.getElementById("faqSwitch_" + fid);
   var faqFrage   = document.getElementById("faqQ_" + fid);
   if(faqAntwort.style.display == "none"){
      faqFrage.style.color = "#A62B1F";
      faqAntwort.style.display = "";
      switchLink.innerHTML = "Zuklappen";
      switchLink.title = "Zuklappen";
      switchLink.className = "faqClose";
   }else{
      faqFrage.style.color = "";
      faqAntwort.style.display = "none";
      switchLink.innerHTML = "Mehr...";
      switchLink.title = "Mehr";
      switchLink.className = "faqOpen";
   }
}