//functions

<!--
// Konstanten
var strHOMEPAGE = "http://tstc.de/";
var strBUTTONDIR = "../gfx/";
var strSCRIPTDIR = "../gfx/";
var intFRAMEWIDTH = 5;
var intZOOM = 10;
// Farben
var strDEF_BGCOLOR = "FFFFFF";
var strDEF_TEXTCOLOR = "000000";
var strDEF_FRAMECOLOR = "9999FF";
var strDEF_ACTIONCOLOR = "FFFF00";
// Globale Variablen
var objPicture = "";
var objTitle = "";
var objTools = "";
var objImage = "";
var intProgress = 0;
var intFrameVert = 0;
var intFrameHorz = 0;
var intOrgWidth;
var intOrgHeight;
var intWinHeight = 200;
var intWinWidth = 200;
var blnIntitialized = false;
var strFilename = "";

// Bild-Fenster
function showpicture(strurl)
  {
  var strContent = "";
  strFilename = "";

  if (document.all  && (navigator.appName == "Microsoft Internet Explorer"))
    {
    var intTop = 0;
    var intLeft = 0;
    var strParameter = "left=" + intLeft + ",top=" + intTop + ",width=" + intWinWidth + ",height=" + intWinHeight;
    strParameter += ",dependent=yes,resizeable=no,scrollbars=yes,status=no";
    try
      {
      // Fenster öffnen
      if(objPicture != "")
        {
        if(!objPicture.closed) objPicture.close();
        }
      objPicture = window.open("about:blank", "Picture", strParameter);
      if(objPicture.document.body.clientWidth > 0) throw "opended";
      }
    catch(e)
      {
      if(e != "opended")
        {
        // Fehler
        if(!objPicture.closed) objPicture.close();
        showpicture(strurl); 
    }
      // Resize
      objPicture.resizeTo(intWinWidth, intWinHeight);
      intFrameHorz = intWinFrameHorz();
      intFrameVert = intWinFrameVert();
      objPicture.focus();
      // HEAD
      strContent = '<html><head>';
      // - Titel
      strContent += '<title>TSTC Picture Viewer</title>';
      // - Stile
      strContent += '<link rel="stylesheet" type="text/css" href="../gfx/tstc.css">';
      // - Funktionen
      strContent += '<script language="JavaScript" fptype="picdisplay"><!--';
      strContent += ' function InitTools(intHFrame, intVFrame) {} ';
      strContent += ' function FitToScreen() {} ';
      strContent += ' function OriginalSize() {} ';
      strContent += ' function Shrink() {} ';
      strContent += ' function Enlarge() {} ';
      strContent += '//--></script><script language="JavaScript1.2" fptype="picdisplay" src="../gfx/zoom.js"></script></head>';
      // BODY
      strContent += '<body onload="InitTools(' + intFrameHorz + ', ' + intFrameVert + ')" bgcolor="#FFFFFF" text="#000000"';
      strContent += ' topmargin="' + intFRAMEWIDTH + 'px" leftmargin="' + intFRAMEWIDTH + 'px" BACKGROUND="../gfx/all.jpg" BGPROPERTIES=fixed>';
      // Tabelle
      strContent += '<table id="container" style="text-decoration:none; font-family:arial; font-size:12px" border="1" cellpadding="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#' + strDEF_FRAMECOLOR + '">';
      // - Infos
      strContent += '<tr><td id="element_title" align="left"><b><font color="#' + strDEF_FRAMECOLOR + '">'+ strurl + '</font></b></td></tr>';
      // - Toolbar
      strContent += '<tr><td id="element_tools" align="left">';
      var strInactive = strBUTTONDIR + 'button_exit_inactive.gif';
      var strActive = strBUTTONDIR + 'button_exit_active.gif';
      strContent += '<a href="javascript:window.close()"><img border="0" src="' + strInactive + '" height="24" width=24" alt="Fenster schliessen" onmouseover="this.src=\'' + strActive + '\'" onmouseout="this.src=\'' + strInactive + '\'"></a>';
      strContent += '</td></tr>';
      // - Bild
      strContent += '<tr><td align="center"><img id="element_image" border="0" src="' + strurl + '" alt="' + strurl + '"></td></tr>';
      // Tabellenende
      strContent += '</table></body></html>';
      // Schreiben
      objPicture.document.open();
      objPicture.document.write(strContent);
      objPicture.document.close();
      // Unterobjekte
      objTitle = objPicture.document.getElementById("element_title");
      objTools = objPicture.document.getElementById("element_tools");
      objImage = objPicture.document.getElementById("element_image");
      // Fenstergrösse
      FitWindow();
      // Fortschritt
      ShowProgress();
      }
    }
  else
    {
    strContent += 'Du verwendest leider einen Browser, der diese Funktion nicht unterstützt!\n\r';
    strContent += 'Bitte rufe eine Anzeige ohne Javascript auf.';
    alert(strContent);
    }
  }

// Anzeigen
function ShowProgress()
  {

  try   // Nur Schreiben, wenn Fenster noch vorhanden ist
    {
    if(!objImage.complete)
      {
      var strText = '<b><DIV ID="text1">' + strImgFilename() + '&nbsp;wird&nbsp;geladen&nbsp;';
      if(intProgress > 15) intProgress = 0;
      for (i=0; i< intProgress; i++)
        {
        strText = strText + '|';
        }
      intProgress++;
      strText = strText + '</DIV></b>';
      objTitle.innerHTML = strText;
      window.setTimeout("ShowProgress()", 10);
      }
    else
      {
      intOrgWidth = objImage.width;
      intOrgHeight = objImage.height;
      ShowImgInfo();
      ShowTools();
      OriginalSize();
      }
    }
  catch(e) {}
  }

function ShowTools()
  {
  var strInactive = "";
  var strActive = "";
  var strContent = ""
  // Button: An Bildschirm anpassen
  strInactive = '../gfx/button_fit_inactive.gif';
  strActive = '../gfx/button_fit_active.gif';
  strContent = strContent + '<a href="javascript:FitToScreen()"><img border="0" src="' + strInactive + '" height="24" width=24" alt="An Bildschirm anpassen" onmouseover="this.src=\'' + strActive + '\'" onmouseout="this.src=\'' + strInactive + '\'"></a>';
  // Button: Originalgrösse
  strInactive = '../gfx/button_original_inactive.gif';
  strActive = '../gfx/button_original_active.gif';
  strContent = strContent + '<a href="javascript:OriginalSize()"><img border="0" src="' + strInactive + '" height="24" width=24" alt="Originalgrösse" onmouseover="this.src=\'' + strActive + '\'" onmouseout="this.src=\'' + strInactive + '\'"></a>';
  // Button: Verkeinern
  strInactive = '../gfx/button_smaller_inactive.gif';
  strActive = '../gfx/button_smaller_active.gif';
  strContent = strContent + '<a href="javascript:Shrink()"><img border="0" src="' + strInactive + '" height="24" width=24" alt="Verkeinern um ' + intZOOM + '%" onmouseover="this.src=\'' + strActive + '\'" onmouseout="this.src=\'' + strInactive + '\'"></a>';
  // Button: Vergrössern
  strInactive = '../gfx/button_greater_inactive.gif';
  strActive = '../gfx/button_greater_active.gif';
  strContent = strContent + '<a href="javascript:Enlarge()"><img border="0" src="' + strInactive + '" height="24" width=24" alt="Vergrössern um ' + intZOOM + '%" onmouseover="this.src=\'' + strActive + '\'" onmouseout="this.src=\'' + strInactive + '\'"></a>';
  // Schreiben
  objTools.innerHTML = objTools.innerHTML + strContent;
  }

function ShowImgInfo()
  {
  var strText = "";

  strText = '<b><DIV ID="text1">' + strImgFilename() + '</b>&nbsp;';
  strText = strText + 'Breite:&nbsp;<font color="#' + strDEF_ACTIONCOLOR + '">' + objImage.width + '</font>/<font color="#' + strDEF_FRAMECOLOR + '">' + intOrgWidth + '</font>&nbsp;';
  strText = strText + 'H&ouml;he:&nbsp;<font color="#' + strDEF_ACTIONCOLOR + '">' + objImage.height + '</font>/<font color="#' + strDEF_FRAMECOLOR + '">' + intOrgHeight + '</font>';
  var intImgSize = intImgFilesize();
  if(intImgSize > 0)
    {
    strText = strText + '&nbsp;Gr&ouml;sse:&nbsp;<font color="#' + strDEF_FRAMECOLOR + '">' + intImgSize + '</font>kb</DIV>';
    }
  objTitle.innerHTML = strText;
  }

function strImgFilename()
  {
  if (strFilename != "") return strFilename;

  var strTest = "";
  for (i = objImage.src.length - 1; i >= 0; i--)
    {
    strTest = objImage.src.charAt(i);
    if((strTest == "\\") || (strTest == "/"))
      {
      return strFilename;
      }
    else
      {
      strFilename = objImage.src.substring(i, objImage.src.length);
      }
    }
  }

function intImgFilesize()
  {
  var intImgSize = 0;
  try {if (objImage.fileSize) throw "FileOk"}
  catch(e)
    {
    if (e == "FileOk")
      {
    	intImgSize = (objImage.fileSize) * 1;
    	intImgSize = Math.round(intImgSize / 1024);
    	}
    }
  return intImgSize;
  }

// Fenster
function FitWindow()
  {
  // Abmessungen
  var objContainer = objPicture.document.getElementsByName("container")[0];
  // - Fenster an Container anpassen
  intWinHeight = objContainer.offsetHeight + (2 * intFRAMEWIDTH) + intWinFrameVert();
  if(intWinHeight > (screen.availHeight - 1)) intWinHeight = screen.availHeight - 1;
  intWinWidth = objContainer.offsetWidth + (2 * intFRAMEWIDTH) + intWinFrameHorz();
  if(intWinWidth > screen.availWidth) intWinWidth = screen.availWidth;
  objPicture.resizeTo(intWinWidth, intWinHeight);
  }

function ResizeImage(intNewWidth, intNewHeight)
  {
  if(objImage.complete)
    {
    objImage.width = intNewWidth;
    objImage.height = intNewHeight;
    ShowImgInfo();
    FitWindow();
    }
  }

function intWinFrameHorz()
  {
  if(!intFrameHorz) intFrameHorz = intWinWidth - objPicture.document.body.clientWidth;
  return intFrameHorz;
  }

function intWinFrameVert()
  {
  if(!intFrameVert) intFrameVert = intWinHeight - objPicture.document.body.clientHeight;
  return intFrameVert;
  }

// Tools
function InitTools(intHFrame, intVFrame)
  {
  intFrameHorz = intHFrame;
  intFrameVert = intVFrame;
  objPicture = window;
  objTitle = objPicture.document.getElementById("element_title");
  objTools = objPicture.document.getElementById("element_tools");
  objImage = objPicture.document.getElementById("element_image");
  intOrgWidth = objImage.width;
  intOrgHeight = objImage.height;
  blnIntitialized = true;
  OriginalSize();
  }

function FitToScreen()
  {
  if(blnIntitialized)
    {
    var intNewWidth = screen.availWidth - intWinFrameHorz() - (2 * intFRAMEWIDTH) - 4;
    var intNewHeight = screen.availHeight - intWinFrameVert() - (2 * intFRAMEWIDTH) - objTools.offsetHeight - objTitle.offsetHeight - 8;
    if((objImage.width / objImage.height) > (intNewWidth / intNewHeight))
      {
      // Breite bestimmt Gesamtgrösse
      intNewHeight = Math.floor((intNewWidth / intOrgWidth) * intOrgHeight);
      }
    else
      {
      // Höhe bestimmt Gesamtgrösse
      intNewWidth = Math.floor((intNewHeight / intOrgHeight) * intOrgWidth);
      }
    ResizeImage(intNewWidth, intNewHeight);
    }
  }

function OriginalSize()
  {
  if(blnIntitialized)
    {
    ResizeImage(intOrgWidth, intOrgHeight);
    }
  }

function Shrink()
  {
  if(blnIntitialized)
    {
    var intNewWidth = Math.floor(intOrgWidth * (1 - (((1 - (objImage.width / intOrgWidth)) / (intZOOM / 100)) + 1) * (intZOOM / 100)));
    var intNewHeight = Math.floor((intNewWidth / intOrgWidth) * intOrgHeight);
    if((intNewWidth > 0) && (intNewHeight > 0)) ResizeImage(intNewWidth, intNewHeight);
    }
  }

function Enlarge()
  {
  if(blnIntitialized)
    {
    var intNewWidth = Math.ceil(intOrgWidth * (1 + ((((objImage.width / intOrgWidth) - 1) / (intZOOM / 100)) + 1) * (intZOOM / 100)));
    var intNewHeight = Math.ceil((intNewWidth / intOrgWidth) * intOrgHeight);
    ResizeImage(intNewWidth, intNewHeight);
    }
  }
//-->







function seitephp(filename, breite, hoehe) {
var myWin;
if(breite + 50 < screen.width)
{
 if(hoehe+75 < screen.height)
 {
  myWin =       window.open(filename,"Gallerie","fullscreen=0,locationbar=0,toolbar=,menubar=0,scrollbars=0,status=0,resizable=0, width=1, height=1");
  myWin.focus();
  myWin.resizeTo(breite + 35, hoehe + 75);
  myWin.innerHeight = hoehe + 40;
  myWin.innerWidth = breite + 20;
 }
 else
 {
  myWin =   window.open(filename,"Gallerie","fullscreen=0,locationbar=0,toolbar=,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
  myWin.focus();
  myWin.resizeTo(breite + 50, screen.height);
  myWin.innerHeight = screen.height-30;
  myWin.innerWidth = breite + 20;
 }
}
else
{
 if(hoehe + 75 < screen.height)
 {
  myWin =  window.open(filename,"Gallerie","fullscreen=0,locationbar=0,toolbar=,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
  myWin.focus();
  myWin.resizeTo(screen.width, hoehe + 100);
  myWin.innerHeight = hoehe + 40;
  myWin.innerWidth = screen.width - 20;
 }
 else
 {
  myWin =   window.open(filename,"Gallerie","fullscreen=0,locationbar=0,toolbar=,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
  myWin.focus();
  myWin.resizeTo(screen.width, screen.height);
  myWin.innerHeight = screen.height - 30;
  myWin.innerWidth = screen.width - 20;
 }
}
return;
}

function gallerjpg(bild, breite, hoehe) {
var wintext;
var myWin;
wintext = '<BODY TEXT="#298CDE" BGCOLOR="#000000"><CENTER>'
wintext+= '<img src="' + bild + '.jpg" border="0" width="' + breite + '", height="' + hoehe + '">';
wintext+= '<BR><A href="javascript:window.close()">schließen</A> - <a href="javascript:window.print()">drucken</a></CENTER>';
wintext+= '</BODY>';
if(breite + 50 < screen.width)
{
if(hoehe + 75 < screen.height)
{
myWin = window.open("","Gallerie","fullscreen=0,locationbar=0,toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0, width=1, height=1");
myWin.focus();
myWin.resizeTo(breite + 40, hoehe + 85);
myWin.innerHeight = hoehe + 40;
myWin.innerWidth = breite + 20;
myWin.document.write(wintext);
}
else
{
myWin = window.open("","Gallerie","fullscreen=0,locationbar=0,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
myWin.focus();
myWin.resizeTo(breite + 50, screen.height);
myWin.innerHeight = screen.height - 30;
myWin.innerWidth = breite + 20;
myWin.document.write(wintext);
}
}
else
{
if(hoehe + 75 < screen.height)
{
myWin = window.open("","Gallerie","fullscreen=0,locationbar=0,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
myWin.focus();
myWin.resizeTo(screen.width, hoehe + 125);
myWin.innerHeight = hoehe + 40;
myWin.innerWidth = screen.width - 20;
myWin.document.write(wintext);
}
else
{
myWin = window.open("","Gallerie","fullscreen=0,locationbar=0,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
myWin.focus();
myWin.resizeTo(screen.width, screen.height);
myWin.innerHeight = screen.height - 30;
myWin.innerWidth = screen.width - 20;
myWin.document.write(wintext);
}
}

return;
}

function gallerall(bild, breite, hoehe) {
var wintext;
var myWin;
wintext = '<BODY TEXT="#298CDE" BGCOLOR="#000000"><CENTER>'
wintext+= '<img src="' + bild + '" border="0" width="' + breite + '", height="' + hoehe + '">';
wintext+= '<BR><A href="javascript:window.close()">schließen</A> - <a href="javascript:window.print()">drucken</a></CENTER>';
wintext+= '</BODY>';
if(breite + 50 < screen.width)
{
if(hoehe + 75 < screen.height)
{
myWin = window.open("","Gallerie","fullscreen=0,locationbar=0,toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0, width=1, height=1");
myWin.focus();
myWin.resizeTo(breite + 40, hoehe + 85);
myWin.innerHeight = hoehe + 40;
myWin.innerWidth = breite + 20;
myWin.document.write(wintext);
}
else
{
myWin = window.open("","Gallerie","fullscreen=0,locationbar=0,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
myWin.focus();
myWin.resizeTo(breite + 50, screen.height);
myWin.innerHeight = screen.height - 30;
myWin.innerWidth = breite + 20;
myWin.document.write(wintext);
}
}
else
{
if(hoehe + 75 < screen.height)
{
myWin = window.open("","Gallerie","fullscreen=0,locationbar=0,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
myWin.focus();
myWin.resizeTo(screen.width, hoehe + 125);
myWin.innerHeight = hoehe + 40;
myWin.innerWidth = screen.width - 20;
myWin.document.write(wintext);
}
else
{
myWin = window.open("","Gallerie","fullscreen=0,locationbar=0,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=0, width=1, height=1");
myWin.focus();
myWin.resizeTo(screen.width, screen.height);
myWin.innerHeight = screen.height - 30;
myWin.innerWidth = screen.width - 20;
myWin.document.write(wintext);
}
}

return;
}

