// globale Variablen
var intCounter;
    intCounter=0;
var intBrowsertyp;
    intBrowsertyp=-1;
var newWin
var intMaxAryElemente
var aryElemente;

// Javascript Funktionen

function openWindow1(url, wName, w, h, mStat) {
  alert("geht"); 
  x=(screen.availWidth/2) - w/2;
  y=(screen.availHeight/2) - h/2;
  var options = "width=" + w + ",height=" + h + ",screenX=100,screenY=50,";
  options += "resizable=no,scrollbars=no,status=no,";
  options += "menubar=" + mStat + ",toolbar=no,location=no,directories=no";

  var newWin = window.open('', wName, options);
  newWin.MoveTo(x,y);
  newWin.focus();
  
  newWin.document.write("<html><body bgcolor='#333333' text='#808080'>");
  newWin.document.write("<table border=0 width=100% height=100%><tr>");
  newWin.document.write("<td valign=middle align=center>Wird geladen...</td>");
  newWin.document.write("</tr></table>");
  newWin.document.write("</body></html>");
  newWin.document.close();
  if (url>'') newWin.document.location=url;
  }

function openWindow(url, wName, w, h, x, y) { 
  if (!x) x=(screen.availWidth/2) - w/2;
  if (!y) y=(screen.availHeight/2) - h/2;
  
  var options = "width=" + w + ",height=" + h + ",";
  options += "resizable='no',scrollbars='auto',status='no'";
  options += "menubar='no',toolbar='no',location='no',directories='no'";

  var newWin = window.open('', wName, options);

  newWin.moveTo(x,y)
  newWin.focus();
  newWin.document.write("<html><title><?echo TITEL;?></title><body bgcolor='#FFFFFF' text='#808080' style='margin:0px' marginwidth='0' marginheight='0'>");
  newWin.document.write("<table border=0 width=100% height=100%><tr>");
  newWin.document.write("<td valign=middle align=center colspan=2><a href='#' OnClick='self.close();'><img src='" + url + "' border=0 name='pics'></a></td>");
  newWin.document.write("</tr>");
  newWin.document.write("</table>");  
  newWin.document.write("</body></html>");
  newWin.document.close();
  //pos = url.indexOf("?");
  //url = url.substr(0,pos);
  //if (url>'') newWin.document.location=url;
  }  

function openWindowBild(url, strBeschreibung, wName, strCssDatei, w, h, x, y) {

  if (!x) x=(screen.availWidth/2) - w/2;
  if (!y) y=(screen.availHeight/2) - h/2;
  
  var options = "";
  options += "resizable='no',scrollbars='auto',status='no'";
  options += "menubar='no',toolbar='no',location='no',directories='no'";

  newWin = window.open('', 'newWin', options);
  newWin.resizeTo(w,h);
  newWin.moveTo(x,y)
  newWin.focus();
  newWin.document.write("<html><head><title>Werbeagentur Beck</title>");
  newWin.document.write("<link rel='stylesheet' type='text/css' href='/css/" + strCssDatei + "'>");
  newWin.document.write("</head>\n<body>");
  newWin.document.write("<div class='PopUpBild'>");
  newWin.document.write("\n<table class='PopUpBild' border=0 width=100% height=100%><tr>");
  newWin.document.write("<td valign=middle align=center><a href='#' OnClick='self.close();'><img src='" + url + "' border=0 name='pics'></a><br>" + strBeschreibung + "</td>");
  newWin.document.write("</tr>\n");
  newWin.document.write("</table>");
  newWin.document.write("</div>");
  newWin.document.write("</body></html>");
  newWin.document.close();
  //pos = url.indexOf("?");
  //url = url.substr(0,pos);
  //if (url>'') newWin.document.location=url;
  }


function openWindowGallerie(url, wName, w, h, x, y) {
  
  if (!x) x=(screen.availWidth/2) - w/2;
  if (!y) y=(screen.availHeight/2) - h/2;
  
  var options = "";
  options += "resizable='no',scrollbars='auto',status='no'";
  options += "menubar='no',toolbar='no',location='no',directories='no'";

  newWin = window.open('', 'newWin', options);
  newWin.resizeTo(w,h);
  newWin.moveTo(x,y)
  newWin.focus();
  newWin.document.write("<html><head><title>Werbeagentur Beck</title></head>\n<body bgcolor='#000000' text='#808080' style='margin:0px' marginwidth='0' marginheight='0'>");
  newWin.document.write("\n<table border=0 width=100% height=100%><tr>");
  newWin.document.write("<td valign=middle align=center colspan=2><a href='#' OnClick='self.close();'><img src='" + url + "' border=0 name='pics'></a></td>");
  newWin.document.write("</tr>\n");
  if (intMaxAryElemente > 1)
    {
    newWin.document.write("<tr><td align='right'><form><a onClick='opener.count(0)'><img src='/bilder/pfeil_links.jpg' border=0></a></form></td>");
    newWin.document.write("<td><form><a onClick='opener.count(1)'><img src='/bilder/pfeil_rechts.jpg' border=0></a></form></td></tr>");
    }
  newWin.document.write("\n</table>");  
  newWin.document.write("\n</body></html>");
  newWin.document.close();
  //pos = url.indexOf("?");
  //url = url.substr(0,pos);
  //if (url>'') newWin.document.location=url;
  }


function ZweiFramesLaden(URLFrame1,NameFrame1,URLFrame2,NameFrame2) {
  Frame1=eval("parent."+NameFrame1);
  Frame2=eval("parent."+NameFrame2);
  Frame1.location.href = URLFrame1;
  Frame2.location.href = URLFrame2;
}

function count(direction)
  {
  switch(direction)
    {
    // Dia ZURUECK
    case 0:
      if(intCounter==0)
        {
        // intCounter auf groessten index des arrays setzen
        intCounter=intMaxAryElemente-1;
        break;
        }
      else
        {
        // intCounter um 1 verringern
        intCounter=intCounter-1;
        break;
        }
    // Dia VOR
    case 1:
      if(intCounter==intMaxAryElemente-1)
        {
        // intCounter auf kleinsten Index des arrays (0) setzen
        intCounter=0;
        break;
        }
      else
        {
        // intCounter um 1 vergroessern
        intCounter=intCounter+1;
        break;
        }
    }
    
  newWin.resizeTo(aryElemente[intCounter][2],aryElemente[intCounter][3]);
  newWin.document.images["pics"].src = aryElemente[intCounter][0];

  } // Ende function count(direction)


function browserabfrage()
  {
  var strBrowserabfrageuserAgent="";
  var strBrowserabfrageappName="";
  var strBrowserabfrageErg="";

  strBrowserabfrageuserAgent=navigator.userAgent;
  strBrowserabfrageappName=navigator.appName;
  strBrowserabfrageErg=strBrowserabfrageuserAgent + strBrowserabfrageappName;
  if(strBrowserabfrageErg.indexOf("Explorer")>-1)
    {
    intBrowsertyp=0;
    }
  if(strBrowserabfrageErg.indexOf("Netscape")>-1)
    {
    intBrowsertyp=1;
    }
  if(strBrowserabfrageErg.indexOf("Opera")>-1)
    {
    intBrowsertyp=0;
    }
  if(strBrowserabfrageErg.indexOf("Mozilla")>-1)
    {
    intBrowsertyp=2;
    }    
  }