// ------------------------------------------------------
// | Titel: Show Image V1.3 (Mainfunction)              |
// | Autor: Berchtel Jürgen                             |
// | Datum: 2002-09-19                                  |
// | Datei: showimg.js                                  |
// ------------------------------------------------------

// Beschreibung: 
//  Diese Funktion ruft das Template in einem neuen Fenster auf
//  und übergibt ihm die Parameter im richtigen Format.
//
// Achtung:
//  Der Pfad (src) des Bildes muss relativ der Templatedatei 
//  angegeben werden.


function ShowImg(src, width, height)
{
  // Die Ränder des Fensters müssen auch berücksichtigt werden.
  WWidth = width + 20;  
  WHeight = height + 30;

  // Die Fensterposition soll Zentriert sein.
  WLeft = screen.width / 2 - WWidth / 2;
  WTop  = screen.height / 2 - WHeight / 2 - 20;

  // Alt und Title definieren
  alt = "Click to close the window";
  title = "Arabic Translator: Impressions";

  // Umlaute in eine HTTP-konforme Form umwandeln
  alt = ReplaceUmlauts(alt);
  title = ReplaceUmlauts(title);

  // Fenster mit dem Bild öffnen
  window.open("javascript/showimg.htm?src=" + src + ",alt=" + 
    alt + ",title=" + title + ",width=" + width +
    ",height=" + height,"_blank","width=" + WWidth + 
    ",height="+ WHeight + ",left=" + WLeft + ",top=" + WTop);
}


function ReplaceUmlauts(str)
{
  str = str.replace(/ä/g,"%E4");
  str = str.replace(/Ä/g,"%C4");
  str = str.replace(/ö/g,"%F6");
  str = str.replace(/Ö/g,"%D6");
  str = str.replace(/ü/g,"%FC");
  str = str.replace(/Ü/g,"%DC");
  str = str.replace(/ß/g,"%DF");
  str = str.replace(/ /g,"%20");
  return(str);
}
