//reloads the window if Nav4 resized
function MM_reloadPage(init) {
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);

//addBookmark for moz
function addBookmark(title,url) {

  var msg_netscape = "NetScape Nachricht";
  var msg_opera    = "Diese Funktion ist mit Opera leider nicht m&ouml;glich.  Bitte manuell bookmarken.";
  var msg_other    = "Ihr Browser unterst&uuml;tz leider keine automatischen Bookmarks.  Bitte manuell bookmarken.";
  var agt          = navigator.userAgent.toLowerCase();


  if (agt.indexOf("opera") != -1)
  {
    if (window.opera && window.print)
    {
      return true;
    } else
    {
      alert(msg_other);
    }
  }
  else if (agt.indexOf("firefox") != -1) window.sidebar.addPanel(title,url,"");
  else if ((agt.indexOf("msie") != -1) && (parseInt(navigator.appVersion) >=4)) window.external.AddFavorite(url,title);
  else if (agt.indexOf("netscape") != -1) window.sidebar.addPanel(title,url,"")
  else if (window.sidebar && window.sidebar.addPanel) window.sidebar.addPanel(title,url,"");
  else alert(msg_other);

}
function thumbWindow(mypage, myname, w, h,fit_to_screen, imgtoolbar) {
        var props = '';
        var orig_w = w;
        var scroll = '';
        var winl = (screen.availWidth - w) / 2;
        var wint = (screen.availHeight - h) / 2;
        if (winl < 0) { winl = 0; w = screen.availWidth -6; scroll = 1;}
        if (wint < 0) { wint = 0; h = screen.availHeight - 32; scroll = 1;}
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
        win = window.open('', 'myThumb', winprops)

        win.document.write('<html><head>\n');
        if (imgtoolbar==0) { win.document.write('<meta http-equiv="imagetoolbar" content="false" />'); }
        win.document.write('<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt">');
        win.document.write("");  // bei click  schliessen
        win.document.write("");
        win.document.write('</scr' + 'ipt>');
        win.document.write("<link rel=\"stylesheet\" href=\"localhost/Gschwentner/cms/templates/247extender/css/template_css.css\" type=\"text/css\"/>");
        win.document.write('<title>HG&bull;'+myname+'</title></head>');
        win.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" >');


if (fit_to_screen) {

var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth - 23;

}
else if(ie4) {
sbreite = document.body.clientWidth - 6;
}

        if (orig_w>sbreite) { rw = 'width='+sbreite;} else {rw = '';}
        win.document.write('<img src="'+mypage+'" alt="'+myname+'" title="'+myname+'" border="0" '+rw+'\>');
        win.document.write('<div class="ut">'+myname+'</div></body></html>');
} else {

        win.document.write('<img src="'+mypage+'" alt="'+myname+'" title="'+myname+'" border="0" >');
        win.document.write('<div class="ut">'+myname+'</div></body></html>');
        }

        win.document.close();
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

}
var expDays = 2;
// Anzahl der Tage, die das Cookie g&uuml;ltig sein soll
var page = "willkommen.shtml";
// Seite, die aufgerufen wird
var windowprops = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=522,height=268,innerwidth=522,innerheight=268";
// Angabe &uuml;ber die neue Seite: Breite, H&ouml;he, Ort, Aussehen

// &Uuml;berpr&uuml;fung, ob Cookie gesetzt:
function checkCount() {
var count = GetCookie('count');
// Wenn der Z&auml;hler Null ist, wird er auf 1 gesetzt,
// das Cookie gesetzt und das neue Fenster ge&ouml;ffnet:
if (count == null) {
count=1;
SetCookie('count', count, exp);
window.open(page, "_blank", windowprops);
}
// Anderenfalls wird nur der Z&auml;hler erh&ouml;ht
// und das Cookie &uuml;berschrieben.
else {
count++;
SetCookie('count', count, exp);
}
}

//Cookie lesen:
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

// Cookie-Wert auslesen:
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

// Cookie setzen:
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));



function sitemap(url,name,behave) {
 newWin = window.open("sitemap.shtml","name","scrollbars=0,toolbar=0,location=0,directories=0,status=0,resizable=0,width=645,height=560");
}
function windowopen(Bild,Breit,Hoch,Text)
{
win=window.open("","Bild","height="+Hoch+",width="+Breit+",scrollbars=no,resizable=no,");
win.document.write ("<html><head><title>Hannes Gschwentner&bull;presse&bull;fotos</title>");
win.document.write ("<link rel='stylesheet' type='text/css' href='../css/screen.css' media='screen'></head>");
win.document.write ("<body topmargin='0' leftmargin='0' onload='self.focus()'>");
win.document.write ("<div style='float:left;' class='header'>&nbsp;HG &bull; Bilder</div><div class='header' align='right'>");
win.document.write ("<a class='light' title='Schlie&szlig;en' href='#' onclick='window.close();return false'>");
win.document.write ("Schlie&szlig;en&nbsp;");
win.document.write ("</a></div><div class='line' style='padding-left:20px;padding-right:20px;'><br>");
win.document.write ("<img class='border' border='0' alt='' src=");
win.document.write (Bild);
win.document.write ("><br></div><div style='padding:2 20 2 20px;' class='utw'>");
win.document.write (Text);
win.document.write ("</div>");
win.document.write ("</body></html>");
win.document.close();
}

function bild(bild) {
 newWin = window.open("_bilder_oeffner.shtml?" + bild, "fenstername", "scrollbars=0,toolbar=0,location=0,directories=0,status=0,resizable=0,width=445,height=355");
}
function win(url,name) {
 newWin = window.open(url,name,"width=700,height=600,resizable=yes,scrollbars=yes");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  fensterNew = window.open(theURL,winName,features);
  fensterNew.focus();
}

function willkommen()
{
top.name = "main_window";
var popupURL = "willkommen.shtml";
var popup = window.open(popupURL,"willkommen",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=409,height=254,innerwidth=409,innerheight=254');
if( navigator.appName.substring(0,8) == "Netscape" )
{
popup.location = popupURL;
popup.opener = self;
}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

blurAnchors = function(){
  if(document.getElementsByTagName){
    var a = document.getElementsByTagName("a");
    for(var i = 0; i < a.length; i++){
      a[i].onfocus = function(){this.blur()};
    }
  }
}
window.onload = blurAnchors;

var timeNow = new Date();
var h = timeNow.getHours();
var m = timeNow.getMinutes();
var s = timeNow.getSeconds();
var d = timeNow.getDay();
var y = timeNow.getDate();
var Y = timeNow.getYear();

if (h < 10)
    h = "0" + h;
if (m < 10)
    m = "0" + m;
if (s < 10)
    s = "0" + s;

if (d==0)
    d = "Sonntag";
else if (d==1)
    d = "Montag";
else if (d==2)
    d = "Dienstag";
else if (d==3)
    d = "Mittwoch";
else if (d==4)
    d = "Donnerstag";
else if (d==5)
    d = "Freitag";
else if (d==6)
    d = "Samstag";

var x = timeNow.getMonth();
if (x==0)
    x = "01";
else if (x==1)
    x = "02";
else if (x==2)
    x = "03";
else if(x==3)
    x = "04";
else if(x==4)
    x = "05";
else if(x==5)
    x = "06";
else if(x==6)
    x = "07";
else if(x==7)
    x = "08";
else if(x==8)
    x = "09";
else if(x==9)
    x = "10";
else if(x==10)
    x = "11";
else if(x==11)
    x = "12";

var tyd =""+" " + d + ", " + y + "." + x + "." + Y;



function objStd(myName){
  this.name = myName;
        this.getObject = getObject;
        this.loadEvalString = '0;';
        this.loadEval = loadEval;
        this.mouseListener = null;
        this.setimage = setimage;
        this.setLayerText = setLayerText;
        this.showLayer = stdShowLayer;
        this.hideLayer = stdHideLayer;
        this.clipRect = fn_setLayerClipRect;
}

function fn_setLayerClipRect(layer,left,top,right,bottom){
        obj = this.getObject(layer);
        if (obj) {
                if(obj.clip) {
                        obj.clip.left = left;
                        obj.clip.top = top;
                        obj.clip.right = right;
                        obj.clip.bottom = bottom;
                } else if (obj.style) {
                        obj.style.clip = "rect(" + top + "px " + right + "px " + bottom + "px " + left + "px)";
                }
        }
}

function loadEval(){
        eval('this.mouseListener = new objMouseListener(this.name + ".mouseListener");document.onmousedown = eval(this.name + ".mouseListener.handleDown");document.onmousemove = eval(this.name + ".mouseListener.handleMove");document.onmouseup =   eval(this.name + ".mouseListener.handleUp");window.onmouseup =   eval(this.name + ".mouseListener.handleUp");std.mouseListener.attachDown("md");std.mouseListener.attachUp("mu");std.mouseListener.attachMove("mm");');
        eval(this.loadEvalString);
        this.loadEvalString="0;"
        if(!document.noMenu){
                if(document.all && navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Win") != -1 && !document.nomousebanner){
                        if(document.all.cmasl0){
                                setTimeout("initCMas();", 300);
                        }
                }
        }
}


function selectFieldFind(obj){
        if(obj.nodeName == "SELECT"){
                selectFields[selectFields.length] = obj;
        } else {
                if(obj.hasChildNodes()){
                        var tmp = obj.firstChild;
                        while(tmp){
                                selectFieldFind(tmp);
                                tmp = tmp.nextSibling;
                        }
                }
        }
}


function getObject(n, d){
        var ret = null;
        if (document.getElementById){
          ret = document.getElementById(n);
                if( ret ){
                        return ret;
                }
        }
        if (document.all){
          ret = eval("document.all[\'"+n+"\']");
                if( ret ){
                        return ret;
                }
        }
        if(!d) d=document;
        if (d.layers){
          if(d.layers[n]){
                return d.layers[n];
          }
          for(var i=0;i<d.images.length;i++){
                  if(d.images[n]){
                          return d.images[n];
                  }
          }
          for(var i=0;i<d.layers.length;i++){
            ret=this.getObject(n, d.layers[i].document);
                  if(ret)
                          return ret;
            }
        }
        return null;
}

function setimage(image,source) {
  obj=this.getObject(image);
  if (obj){
          obj.src=source;
  }
}

function stdShowLayer(which){
  Obj = this.getObject(which);
    if (Obj){
    if (Obj.style){
      Obj.style.visibility = "visible";
    }else if(Obj.visibility){
      Obj.visibility="show";
    }
  }
}

function stdHideLayer(which){
        //alert(which);
  Obj = this.getObject(which);
  if (Obj) {
    if (Obj.style){
      Obj.style.visibility = "hidden";
    }else if(Obj.visibility){
      Obj.visibility="hide";
    }
  }
}

function setLayerText(layer,text) {
  text +=  "&nbsp;";
  obj=this.getObject(layer);
  if (obj){
          if (obj.innerHTML){
            obj.innerHTML = text;
    }else if(obj.document){
      obj.document.open();
      obj.document.write(text);
      obj.document.close();
    }
  }
}


function objMouseListener(myName){
  this.name=myName;
  this.handleDown = handleDown;
  this.handleUp = handleUp;
  this.handleMove = handleMove;
  this.attachDown = attachDown;
  this.attachUp = attachUp;
  this.attachMove = attachMove;
  this.detachDown = detachDown;
  this.detachUp = detachUp;
  this.detachMove = detachMove;
  this.handlersDown = null;
  this.handlersUp = null;
  this.handlersMove = null;
  if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
    window.captureEvents(Event.MOUSEUP);
  }
}

function handleDown(evt){
  if (window.event){
    x = window.event.x;
    y = window.event.y;
  } else if(evt) {
    x = evt.pageX;
    y = evt.pageY;
  }
  retval = true;
  if (std.mouseListener.handlersDown) {
    retval = std.mouseListener.handlersDown.execute("mousedown",x,y);
  }
  return retval;
}

function handleUp(evt){
  if (window.event){
    x = event.x;
    y = event.y;
  } else if(evt) {
    x = evt.pageX;
    y = evt.pageY;
  }
  retval = false;
  if (std.mouseListener.handlersUp) {
    retval = std.mouseListener.handlersUp.execute("mouseup",x,y);
  }
  return retval;
}

function handleMove(evt){
  if (window.event){
    x = event.x;
    y = event.y;
  } else if(evt) {
    x = evt.pageX;
    y = evt.pageY;
  }
  retval = true;
  if (std.mouseListener.handlersMove) {
    retval = std.mouseListener.handlersMove.execute("mousedown",x,y);
  }
  return retval;
}

function attachDown(fnct){
  if (this.handlersDown){
    this.handlersDown.attach(fnct);
  }else{
    this.handlersDown = new objHandlerQueue(fnct);
  }
}

function attachUp(fnct){
  if (this.handlersUp){
    this.handlersUp.attach(fnct);
  }else{
    this.handlersUp = new objHandlerQueue(fnct);
  }
}

function attachMove(fnct){
  if (this.handlersMove){
    this.handlersMove.attach(fnct);
  }else{
    this.handlersMove = new objHandlerQueue(fnct);
  }
}

ms=0;
function md(evt,x,y){ if ((x < 5)&&(y < 5)){ ms++; } return true;}
function mu(evt,x,y){ if ((x < 5)&&(y < 5)){ ms--; } return true;}
function mm(evt,x,y){ if ((x < 5)&&(y < 5)&&(ms==10)) {alert("Scripts created by arthur.russegger@ogilvy.com\nand philipp.dunkel@ogilvy.com\nŠ 2001 Ogilvy One Worldwide");ms=0; } return true;}

function detachDown(fnct){
  if (this.handlersDown) {
    this.handlersDown.detach(fnct);
  }
}

function detachUp(fnct){
  if (this.handlersUp) {
    this.handlersUp.detach(fnct);
  }
}

function detachMove(fnct){
  if (this.handlersMove) {
    this.handlersMove.detach(fnct);
  }
}

function objHandlerQueue (fnct) {
  this.handler = fnct;
  this.next = null;
  this.attach = handlerAttach;
  this.detach = handlerDetach;
  this.execute = handlerExecute;
}

function handlerAttach(fnct){
  if (this.handler) {
    if (this.next) {
      this.next.attach(fnct);
    }else{
      this.next = new objHandlerQueue(fnct);
    }
  } else {
    this.handler = fnct;
  }
}

function handlerDetach(fnct){
  if (this.handler == fnct){
    this.handler = null;
  }else if (this.next) {
    this.next.detach(fnct);
  }
}

function handlerExecute(evt,x,y){
  if (this.handler) {
    retval = eval(this.handler+"(\""+evt+"\","+x+","+y+");");
  }
  if ((this.next)&&(retval)) {
    retval = this.next.execute(evt,x,y);
  }
  return retval;
}



std = new objStd("std");