// set variables
  var is_mac = window.navigator.platform == "MacPPC";
  var mac_ns = window.navigator.platform == "MacPPC" && navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) > "4";

  var mac    = window.navigator.platform == "MacPPC" && navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == "4";
  var mac_ie = window.navigator.platform == "MacPPC" && navigator.userAgent.match(/MSIE/i);
  var safari = window.navigator.platform == "MacPPC" && navigator.userAgent.match(/Safari/i);
  var ie     = navigator.userAgent.match(/MSIE\s5.*/i);
        var ie6    = navigator.userAgent.match(/MSIE\s6.*/i);
        var ie4    = navigator.userAgent.match(/MSIE\s4.*/i);
		var ie7    = navigator.userAgent.match(/MSIE\s7.*/i);
  var op     = navigator.userAgent.indexOf('Opera') != -1;
        var ns4    = navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == "4";
        var moz    = navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) > "4";
        var ns6    = navigator.userAgent.match(/Netscape6/i);
        var konq   = navigator.userAgent.match(/Konqueror/i);
        var timer  = null;

// flags for adtags
        var halfpage = 0;
  var LeaderBoard;


// load stylesheet

      if (ie6 || ie || ie7) {
                document.write("<LINK REL=stylesheet HREF=\"css/menus_ie6.css\" TYPE=\"text/css\">");
                document.write("<LINK REL=stylesheet HREF=\"css/style.css\" TYPE=\"text/css\">");
                //alert('ie6');
        }

        else if (moz || konq) {
                document.write("<LINK REL=stylesheet HREF=\"css/menus_moz.css\" TYPE=\"text/css\">");
                document.write("<LINK REL=stylesheet HREF=\"css/style.css\" TYPE=\"text/css\">");
                //alert('moz');
        }


//detect flash 7 plugin or active-x
var usesActiveX = false;
var swf7 = false;

if (navigator.plugins.length != 0) {
  for (i=0; i<navigator.plugins.length; i++) {
    var plugDescr = navigator.plugins[i].description.toLowerCase();
    if ((plugDescr.indexOf('flash') != -1) && (plugDescr.indexOf('7.') != -1)) {
      swf7 = true;
    }
  }
} else {
  usesActiveX = true;
}


// function set targets
        function setTargets() {
          for (i=0; i < document.links.length; i++) {
            if (document.links[i].target == "XXbackXX") {
              document.links[i].target=opener.name;
            }
          }
        }


// popup functions

        function execSubmit(formular,fenstername,fsize) {
                var fenster = window.open("",fenstername,fsize);
                document [formular].submit();
        }

  function submitWindow(formular,fenster){
                if ((window.name == "_blank")||(window.name == "")||(window.name == "_new")) {
                  window.name = "blank_source";
                }
                if (window.name == fenster) {
                  window.name = fenster + "_suche";
                }
                document.forms[formular].elements["destination"].value = window.name;
                execSubmit(formular,fenster,"width=637,height=650,scrollbars=yes,resizable=yes,status=no,menubar=no,location=no,left=0,top=0");
        }

// various popup-functions

        function open_window(page,breite,hoehe,name){
                var popup = window.open(page,name,"width=" + breite + ",height=" + hoehe + ",scrollbars=no,resizable=yes,menubar=no,locationbar=no");
                popup.focus();
        }

        function open_audio(page,breite,hoehe,name){
                var popup = window.open(page,name,"width=" + breite + ",height=" + hoehe + ",scrollbars=no,resizable=no,menubar=no,locationbar=no,left=200,top=200");
                popup.focus();
        }

  function open_no_resize(page,breite,hoehe,name){
                var popup = window.open(page,name,"width=" + breite + ",height=" + hoehe + ",scrollbars=no,resizable=no,menubar=no,locationbar=no");
                popup.focus();
        }

  function open_search(page,breite,hoehe){
                var popup = window.open(page,"search","width=" + breite + ",height=" + hoehe + ",scrollbars=yes,resizable=no,menubar=no,locationbar=no,left=570,top=130");
                popup.focus();
        }

        function blank_window(url,name){
                var popup=window.open(url,name,"width=800,height=550,scrollbars=yes,resizable=yes,status=yes,menubar=yes,location=yes");
                popup.focus();
        }

        function open_catalogue(page,breite,hoehe,name){
                var popup = window.open(page,name,"width=" + breite + ",height=" + hoehe + ",scrollbars=yes,resizable=yes,menubar=no,locationbar=no,left=570,top=130");
                popup.focus();
        }

        function open_html(page){
                var popup = window.open(page,"html","width=550,height=550,scrollbars=yes,resizable=yes,menubar=yes,locationbar=no,toolbar=no,left=0,top=0");
                popup.focus();
        }

        function print_view(page){
                var popup = window.open(page,"print","width=620,height=600,scrollbars=yes,resizable=no,menubar=yes,locationbar=no,toolbar=no,left=0,top=0");
                popup.focus();
        }

        function related_popup(page){
                var popup = window.open(page,"related","width=600,height=550,scrollbars=yes,resizable=yes,menubar=no,locationbar=no,toolbar=no,left=0,top=0");
                popup.focus();
        }

        function open_ecard(page,name){
                popup = window.open(page,name,"width=678,height=720,scrollbars=yes,resizable=yes,menubar=no,locationbar=no,toolbar=no,left=0,top=0");
                popup.focus();
        }

        function open_fullsize(seite) {
          if (ie || ie6 || mac_ie) {
      window.open(seite,"diashow","fullscreen=yes,scrollbars=no");
    } else {
      window.open(seite,"diashow","width="+(screen.availWidth-9)+",height="+(screen.availHeight-25)+",top=0,left=0")
    }
  }

        function send_article(){
                var url  = window.location.href;
                var link = url.replace(/\?.*/,"");
                window.location.href = "mailto:peter@bastelpeter.de" + link + "?linkref=linktipp";
        }

// open menu x
        function OpenMenu(x) {
                if(ie || ie6 && !op){
                        if (window.navigator.platform == "MacPPC") {
                                showmenu  = document.all.menu[x];
        showmenu.style.visibility  = "visible";
        for (i = 0; i < document.all.menu.length; i++) {
                currentmenu  = document.all.menu[i];
                      if ( ((currentmenu.style.visibility == "visible")&&(currentmenu != showmenu)) ) {
                        currentmenu.style.visibility = "hidden";
                      }
                    }
                        }        else {
                    showmenu  = document.all.menu[x];
        showmenu.style.visibility  = "visible";
        for (i = 0; i < document.all.menu.length; i++) {
                currentmenu  = document.all.menu[i];
                      if ( (currentmenu.style.visibility == "visible")&&(currentmenu != showmenu) ) {
                        currentmenu.style.visibility = "hidden";
                      }
                    }
                  }
                }
                if(moz || op || konq) {
            showmenu = document.getElementsByName("menu")[x];
                        showmenu.style.visibility = "visible";

                  var menus = 8;
                        for (i = 0; i < menus; i++) {
                                currentmenu=document.getElementsByName("menu")[i];
                                if ((currentmenu.style.visibility = "visible")&&(currentmenu != showmenu)) currentmenu.style.visibility = "hidden";
      }
          }
                if(ie4){
                        showmenu = document.all.menu[x];
      showmenu.style.visibility = "visible";

      var menus = 8;
      for (i = 0; i < document.all.menu.length; i++) {
              currentmenu=document.all.menu[i];
                                if ( ((currentmenu.style.visibility == "visible")&&(currentmenu != showmenu)) ) {
                                         currentmenu.style.visibility = "hidden";
                                }
                        }
                }
                if(ns4) {
                  /*
                        if (timer!=null) clearTimeout(timer);
                        timer = setTimeout("Close()", 2700);
                        showmenu = document.layers[x];
                        showmenu.visibility = "visible";

                        var menus = 8;
                        for (i = 0; i < menus; i++) {
                                currentmenu=document.layers[i];
                                if ((currentmenu.visibility = "show")&&(currentmenu != showmenu)) currentmenu.visibility = "hide";
                        }
                        */
                }
  }



// hide all menus
        function Close() {
                if(mac || moz || konq || (window.navigator.platform == "MacPPC")) OpenMenu(8);
    var menus = 8;
    for (i = 0; i < menus; i++) {
            if(op)        { document.getElementsByName("menu")[i].style.visibility = "hidden"; }
            if(ie4)       { document.all.menu[i].style.visibility = "hidden"; }
            if(ie || ie6) { document.all.menu[i].style.visibility = "hidden"; }
            if(ns4)       { document.layers[i].visibility = "hide"; }
    }
        }

// close specific menu x
        function CloseMenu(i) {
                if(moz || konq || op) { document.getElementsByName("menu")[i].style.visibility = "hidden"; }
                if(ie || ie6 || ie4 && !op) {
                        if ((window.navigator.platform == "MacPPC") || (ie4)) {
                          document.all.menu[x].style.visibility = "hidden";
                  } else {
                          document.all.menu[x].style.visibility = "hidden"; }
                        }
    if(ns4) { document.layers[x].visibility = "hide"; }
        }


// hold specific menu x
        function StayAlive(x) {
          if(ie || ie6 || ie4 && !op) {
                  if ((window.navigator.platform == "MacPPC") || (ie4)) {
                          document.all.menu[x].style.visibility = "visible";
                  } else {
                    document.all.menu[x].style.visibility = "visible"; }
                  }
    if(ns4) { document.layers[x].visibility = "show"; }
    if(moz || konq || op) { document.getElementsByName("menu")[x].style.visibility = "visible"; }
        }
// hide all menus delayed - unused
        function CloseDelay() {
                if (timer!=null) clearTimeout(timer);
                timer = setTimeout("Close()", 500);
                return timer;
        }


// Funktion zum Öffnen von pull-down-Menues
        function pull_down_open(menu_index) {
                //if (navigator.appName == "Microsoft Internet Explorer") {
                  //document.getElementsByName("pulldown_menu")[menu_index].style.top = topIE
                  //document.getElementsByName("pulldown_menu")[menu_index].style.left = left;
                  //document.getElementsByName("pulldown_menu")[menu_index].style.visibility = "visible";
                  //document.all.pulldown_menu.style.visibility = "visible";
                  document.getElementsByName("pulldown_menu")[menu_index].style.visibility = "visible";
                //}
                //else {
                  //document.getElementsByName("pulldown_menu")[menu_index].style.top = topmoz;
                  //document.getElementsByName("pulldown_menu")[menu_index].style.left = left;
                  //document.getElementsByName("pulldown_menu")[menu_index].style.visibility = "visible";
                //}
        }



// Funktion zum Schließen von pull-down-Menues
        function pull_down_close(menu_index) {
                document.getElementsByName("pulldown_menu")[menu_index].style.visibility = "hidden";
        }


/*function popup(URL,width,height){
 var x = (screen.width - width) / 2;
 var y = (screen.height - height) / 2;
 var win1 = window.open(URL,1,'width='+width+',height='+height+',toolbar=no,status=yes,scrollbars=yes,location=no,menubar=no,directories=no,resizable=no,screenX='+x+',screenY='+y+',left='+x+',top='+y+'');
 if (win1 != null) win1.window.focus();
}*/

function popup_test(page,breite,hoehe){
                var popup = window.open(page,1,"width=" + breite + ",height=" + hoehe + ",toolbar=no,status=yes,scrollbars=yes,location=no,menubar=no,directories=no,resizable=no");
                popup.focus();
        }

// zum Oeffnen des Pop-Ups fuer Marco-Polo-Gewinnspiel (kann ab 1.5.2003 geloescht werden)
WinAppearance="toolbar=no,location=no,directories=no,status=no,resizable=no,copyhistory=no";
function pnc_openWin(url,name,breite,hoehe,scroll) {
        moveWidth=breite/2;
        moveHeigh=hoehe/2;
        eval("pnc_"+name+"=window.open('"+url+"','"+name+"','"+WinAppearance+",scrollbars="+scroll+",width="+breite+",height="+hoehe+"');");
        eval("pnc_"+name+".moveTo(screen.width/2-"+moveWidth+",screen.height/2-"+moveHeigh+");"); eval("pnc_"+name+".focus()");
}



// setzt einen Cookie mit einer Laufzeit von 7 Tagen zur Feststellung der Bildschirmauflösung
function setResC() {


        //if(document.cookie.match(/users_res/g)) {
        if( document.cookie && document.cookie.match(/users_res/) ) {
    return false;
  } else {
          var winHeight;
    var winWidth;
    var winSize;

          if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
      winWidth  = window.innerWidth;
      winHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      winWidth  = document.documentElement.clientWidth;
      winHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      //IE 4 compatible
      winWidth  = document.body.clientWidth;
      winHeight = document.body.clientHeight;
    }

    winSize = winWidth + "x" + winHeight;

    var current_date = new Date();
    var week         = current_date.getTime() + (7 * 24 * 60 * 60 * 1000);
    current_date.setTime(week);
    var expires      = current_date.toGMTString();

    var cookie_values  = "screendata=users_res|:|" + screen.width + "x" + screen.height + "|:|users_winsize|:|" + winSize + ";expires=" + expires + ";path=/";
    document.cookie = cookie_values;
  }

  /*if(document.cookie && document.cookie.match(/users_res/g)) {
    return false;
  } else {
    var winHeight;
    var winWidth;
    var winSize;

    if(moz) {
      winHeight = window.innerHeight;
      winWidth  = window.innerWidth;
    } else {
      //winHeight = document.body.offsetHeight;
      //winWidth  = document.body.offsetWidth;
    }

    winSize = winWidth + "x" + winHeight;

    var current_date = new Date();
    var hour         = current_date.getTime() + (7 * 60 * 60 * 1000);
    current_date.setTime(hour);
    var expires      = current_date.toGMTString();

    var cookie_values  = "screendata=users_res|:|" + screen.width + "x" + screen.height + "|:|users_winsize|:|" + winSize + ";expires=" + expires;
    document.cookie = cookie_values;
  }*/
}


//setResC();
var nav_marker = 'default';


function openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
  }
