<!--
//  ////////////////////////////////////////////////////////////////////////////////
//  onload, onunload ///////////////////////////////////////////////////////////////

  w.onload = function(e){

    MM_preloadImages("/img/was1.gif","/img/wer1.gif","/img/wo1.gif");
    if(fileName_ == "was")
      MM_preloadImages("/img/was/details0.gif");
    if(fileName_ == "wer")
      MM_preloadImages("/img/wer/haftungshinweis0.gif","/img/wer/mail0.gif");
    if(fileName_ == "wo")
      MM_preloadImages("/img/wo/www-baugenius-de0.gif","/img/wo/www-bauwohnberatung-de0.gif",
                       "/img/wo/www-fotodienst-mitte-de0.gif","/img/wo/www-ikos-de0.gif",
                       "/img/wo/www-johannesfink-com0.gif",
                       "/img/wo/screenshots/bg-white.gif","/img/wo/screenshots/bg-white.png",
                       "/img/wo/screenshots/www.baugenius.de.gif","/img/wo/screenshots/www.bauwohnberatung.de.gif",
                       "/img/wo/screenshots/www.fotodienst-mitte.de.gif","/img/wo/screenshots/www.ikos.de.gif",
                       "/img/wo/screenshots/www.johannesfink.com.gif"
                       );

    //  set active css
    var cookie = readCookie("style");
    var title = (cookie)? cookie : getPreferredStyleSheet();
    if(!was_wer_wo)  //  IE quirks with img loading
      setActiveStyleSheet(title);

    set_menu_and_links();
    set_font_div();

    epaProtest();
    speedTest();
  }

  w.onunload = function(e){
    //  set active css
    var title = getActiveStyleSheet();
    createCookie("style", title, 365);
  }

//  ////////////////////////////////////////////////////////////////////////////////
//  check for ActiveX; if detected, load PNGs &  Alpha filters for IE55+  //////////

  //  check wether IE
  //  a) doesn't support ActiveX
  //  b) supports ActiveX, but has it disabled via
  //     custom security setting or third party plugin

    checkForActiveX();
  function checkForActiveX(){
    if(ie55up && w.name != "noActiveX"){
      //  try to write an object tag, dummy data/txt must be provided,
      //  (without &nbsp; quirks!)
      //  on failure, IE config-info popup..., can't help it
      d.write('<object data="/img/0.gif" width="0" height="0"'+
              'id="checkActiveX">&nbsp;</object>');

       //  d.write link to AlphaImageLoader.css on success
       //  it's content doesn't validate...
      if(obj("checkActiveX"))
        d.write('<link type="text/css" id="lax" rel="stylesheet"'+
                'href="/inc/css/AlphaImageLoader.css?'+fileName_+'">');
      else
        //  store status, so IE popup occurs only once
        //  doing it by w.name is not foolproof, using cookies neither, so...?
        w.name = "noActiveX";
    }
  }

//  ////////////////////////////////////////////////////////////////////////////////
//  set event handlers  ////////////////////////////////////////////////////////////
  function setBg(img,display){
    obj("screenshot0","innerHTML","<div id='screenshot1'></div>");
    var img = img.className.replace(/^(\w+)-([\w-]+)-(\w+)$/g,"$1.$2.$3");
        img = "url(/img/wo/screenshots/"+img+".gif) no-repeat";
    obj("screenshot1","background",img);
    obj("screenshot0","display",display);
  }

  function set_menu_and_links(){ //  triggered onload
    if(dom && l.search != "?plain"){

    //  #sitemap provisional here an further below...
    add_event(obj("aCloseSitemap"),"onclick",
      "obj('sitemap','display','none');set_bg(1);return false;");

      for(var i=0;i<obj("a").length;i++){
        //  add onclick=blur_dom(this) to all suitable links
        if(obj("a")[i].href && obj("a")[i].href.indexOf("#")==-1 && obj("a")[i].parentNode.className != "doc"){
          add_event(obj("a")[i],"onclick","blur_dom(this);");
          if(obj("a")[i].id == "map" && fileName_ != "was"){
            // not for /was to to keep good keyword density
            add_event(obj("a")[i],"onclick",
              "obj('sitemap','display','block');set_bg(0);blur_dom(this);return false;");
          }
        }

        //  #sitemap provisional...
        if(obj("a")[i].href && obj("a")[i].href.indexOf("#")!=-1 && obj("a")[i].className == "folder")
          add_event(obj("a")[i],"onclick","blur_dom(this); return false;");

        //  handle sreenshot fx on /wo
        if(obj("a")[i] && obj("a")[i].className.indexOf("www-")!=-1){
          add_event(obj("a")[i],"onmouseover","setBg(this,'block');");
          add_event(obj("a")[i],"onmouseout","setBg(this,'none');");
        }
      }

        var myName = new Array("was","wer","wo");
      //  set onmouseover/onmouseout menu fx for menu
      //  here, linux khtml(ver 3.1/3.2?) needs this for basic onmouseover/onmouseout too, dunno why
      if(was_wer_wo)
        for(var i=0;i<myName.length;i++)
          if(fileName_ != myName[i]){
            add_event(obj(myName[i]),"onmouseover",
                      "obj(fileName_,'background','none');");
            add_event(obj(myName[i]),"onmouseout",
                      "obj(fileName_,'background','url(/img/'+fileName_+'1.gif) no-repeat');");
          }

      if(formFile){  //  set onmousedown/onmouseout for input-text/textaerea
        var inputRequired =
        "/^[\\r\\n\\s\\t]*Eingabe notwendig - Input required[\\r\\n\\s\\t]*$/";
        for(var i=0;i<obj("input").length;i++){
          if(obj("input")[i].type=="text"){
            add_event(obj("input")[i],"onmousedown",
                      "if(this.value.search("+inputRequired+")!=-1)this.value='';");
            add_event(obj("input")[i],"onmouseout",
                      "if(this.value.search(/[a-zA-Z0-9]/)==-1)this.value='Eingabe notwendig - Input required';");
          }
        }

        for(var i=0;i<obj("textarea").length;i++){
          add_event(obj("textarea")[i],"onmousedown",
                    "if(this.value.search("+inputRequired+")!=-1)this.value='';");
          add_event(obj("textarea")[i],"onmouseout",
                    "if(this.value.search(/[a-zA-Z0-9]/)==-1)this.value='Eingabe notwendig - Input required';");
        }
      }
    }
  }

  function set_font_div(){ //  set div font visible,  triggered onload
    if((ie || (gecko && !nn6) || safari) && obj("font"))
      obj("font","display","block");

    var setFont =
      "setActiveStyleSheet(this.id);"+
      "blur_dom(this);"+
      "return false;"

    for(var i=0;i<obj("link").length;i++)  //  set onclick for div font links
      if(obj("link")[i].title == "font-11px"){
        add_event(obj("font-11px"),"onclick",setFont);
        add_event(obj("font-13px"),"onclick",setFont);
        add_event(obj("font-15px"),"onclick",setFont);
      break;
    }
  }

  function add_event(myObj,handler,addFunction){  //  add eventhandler onload to keep HTML clean
    addFunction = (ie)? new Function(addFunction) : addFunction;
    if(myObj)
      myObj.setAttribute(handler,addFunction);
  }

//  ////////////////////////////////////////////////////////////////////////////////
//  div  ///////////////////////////////////////////////////////////////////////////
  function set_bg(val){
    if(val){
      obj("body")[0].style.background = "url(/img/bg.gif) white";
      if(obj("iframe"))
        obj("iframe").style.background = "url(/img/_white.gif) white";
      if(obj("bg-bar0"))
        obj("bg-bar0").style.background = "url(/img/bg-bar0.gif) repeat";
    }
    else{
      obj("body")[0].style.background = "white";
        if(obj("bg-bar0"))
      obj("bg-bar0").style.background = "white";
    }
  }

  function epaProtest(){  //  iframe by JS to prevent google indexing trouble
    test      = 0;
    var date  = new Date;
    //  moz bug
    var year  = (date.getYear() > 999)? date.getYear() : date.getYear()+1900;
    var month = date.getMonth()+1;  //  counts from 0
    var day   = date.getDate();

    //  2004/04/09-15, 2004/05/09-14 and 2004/06/08-13.
    if(l.href=="http://www.byteshift.de/" && d.appendChild &&
      ((day>=9 && day<=14 && month==5 && year==2004)  ||
       (day>=8 && day<=13 && month==6 && year==2004)) ||
        test){
      set_bg(0)

      obj("body")[0].appendChild(d.createElement("iframe"));
      var myIframe = obj("iframe")[obj("iframe").length-1];
      myIframe.src = "/_eu-protest";
      myIframe.style.height = "417px";
      myIframe.style.width = "640px";
      myIframe.style.position = "absolute";
      myIframe.style.top = "100px";
      myIframe.style.left = "100px";
      myIframe.style.zIndex = "100";
      myIframe.style.border = "none";
      }
    }

    myDate  = new Date();
    start   = myDate.getTime();
  function speedTest(){
    myDate  = new Date();
    stop    = myDate.getTime();
    if(1) //  testing
      w.defaultStatus = ((stop-start)/1000);
  }
//  -->

