/*
    main.js

    JavaScript fuer 'Friederike Bischoff'
    Albrecht Bischoff, 01.11.2004
*/

/* array of names of child nodes */
var Nodes = new Array(
  "welcome.html",
  "vita.html",
  "projects.html",
  "prices.html",
  "references.html",
  "foto.html",
  "teaching.html",
  "contact.html"
);

/* actual number of subnote */
var actNodeNo = 0;


/* shows link explanation (mouse over event) */
function show(x) {
  if (document.images) {
    document.images[x].src = 'img/tasten-hand.gif';
    document.getElementById("logo").style.visibility = 'hidden';
    var id = "expl" + x;
    document.getElementById(id).style.visibility = 'visible';
  }
}


/* hides link explanation (mouse out event) */
function hide(x) {
  if (document.images) {
  document.images[x].src = 'img/tasten.jpg';
    document.getElementById("logo").style.visibility = 'visible';
    var id = "expl" + x;
    document.getElementById(id).style.visibility = 'hidden';
  }
}


/* changes link of iframe to node */
function changeto(nodenumber) {
  /* hide previous header */
  var id = "header" + actNodeNo;
  document.getElementById(id).style.visibility = 'hidden';
  /* show new header */
  var id = "header" + nodenumber;
  document.getElementById(id).style.visibility = 'visible';
  actNodeNo = nodenumber;
  /* show content in box */
  parent.box.location.href = Nodes[nodenumber];
}


/* hides alert message on splash screen if CSS + JavaScript is activcated */
function hideAlert() {
  document.getElementById("alert").style.visibility = 'hidden';
}


/* opens main window */
function openMainWindow() {
  M = openWindow("start.html", "main", 800, 600);
}

/* opens bare window */
function openWindow(link, name, width, height) {
  M = window.open(link,
    name,
    "width=" + width + ",height=" + height 
        + ",top=10,left=10,resizable=no,toolbar=no,menubar=no,status=no,scrollbars=no,location=no"
  );
  M.focus();
  return M;
}

/* shows preview of fotos */
function showPreview(no, realm) {
  // no: number of image
  // realm: 1 foto, 2 references

  /* config */
  // realm foto
  var fwidth = new Array(
    0,
    400,
    593,
    400,
    595,
    400,
    703,
    533,
    400,
    600,
    523
  );
  var fheight = new Array(
    0,
    562,
    400,
    630,
    400,
    605,
    400,
    400,
    600,
    400,
    400
  );
  var ftitle = new Array(
    '',
    '',
    '',
    '',
    '',
    '',
    '',
    '',
    '',
    '',
    ''
  );
  // realm references
  var rwidth = new Array(
    0,
    369,
    449,
    585,
    491,
    462,
    585,
    585,
    208,
    585,
    585,
    562,
    342,
    585,
    585,
    585,
    416,
    259,
    585
  );
  var rheight = new Array(
    0,
    585,
    585,
    460,
    585,
    585,
    354,
    474,
    842,
    529,
    489,
    585,
    585,
    528,
    465,
    555,
    585,
    585,
    548
  );
  var rtitle = new Array(
    0,
    'Schwarzwälder Bote: Dienstag, 01.10.1998',
    'Zollern-Alb-Kurier: Freitag, 02.10.1998',
    'Zollern-Alb-Kurier: Mittwoch, 07.10.1998',
    'Zollern-Alb-Kurier: Dienstag, 01.12.1998',
    'Rheinpfalz: Dienstag, 19.01.1999',
    'Rhein-Neckar-Zeitung: Samstag, 23.01.1999',
    'Markgräfler Tagblatt: Freitag, 26.01.2001',
    'Rheinpfalz: Montag, 25.08.2003',
    'Heidenheimer Neue Presse: Dienstag, 18.02.2003',
    'Sindelfinger Zeitung: Mittwoch, 26.02.2003',
    'Lampertheimer Zeitung: Freitag, 12.09.2003',
    'Lampertheimer Zeitung: Donnerstag, 25.09.2003',
    'Südhessen Morgen: Donnerstag, 25.09.2003',
    'Südhessen Morgen: Montag, 24.11.2003',
    'Südhessen Morgen: Donnerstag, 08.04.2004',
    'Posten: Dienstag, 13.04.2004',
    'Bygdaposten for Hjemeland: Fredag, 16.04.2004',
    'Badische Zeitung: Mittwoch, 21.07.2004'
  );
  // set config
  var pwidth;
  var pheight;
  var ptitle;
  var prefix;
  if (realm == 2) {
      pwidth = rwidth;
      pheight = rheight;
      ptitle = rtitle;
      prefix = 'img/references/';
  }
  else {
      pwidth = fwidth;
      pheight = fheight;
      ptitle = ftitle;
      prefix = 'img/foto/friederike_bischoff_';
  }


  if (!(no < pwidth.length && no > 0)) {
    no = (no <= 0) ? pwidth.length-1 : 1;
  }

  wwidth = pwidth[no] + 55;
  wheight = pheight[no] + 155;
  back = eval(no - 1);
  next = eval(Number(no) + 1);

  M = openWindow('', realm + "prev" + no, wwidth, wheight);
  M.resizeTo(wwidth, wheight);

  M.document.open();
  M.document.write("<html><head>"
      + "<link rel=\"stylesheet\" href=\"box.css\" type=\"text/css\"/>"
      + "<script src=\"main.js\" type=\"text/javascript\"></script>"
      + "<title>Friederike Bischoff - Klavier</title>"
      + "</head><body style=\"width:" + pwidth[no] + "\">"
      + "<table width=\"" + pwidth[no] + "\" border=\"0\" style=\"margin-top:1em;\"><tr>"
      + "<td colspan=\"3\" align=\"center\">"
      + "<img src=\"" + prefix + (no>99?'':(no>9?'0':'00')) + no + ".jpg\" alt=\"" + no + "\" "
      + "width=\"" + pwidth[no] + "\" height=\"" + pheight[no] + "\" align=\"center\">"
      + "</td></tr><tr>"
      + "<td colspan=\"3\" align=\"center\">" + ptitle[no] + "</td></tr><tr>"
      + "<td width=\"30%\" align=\"left\"><a href=\"#\" onclick=\"window.close();showPreview(" + back + ", " + realm + ")\">&lt; zur&uuml;ck</a></td>"
      + "<td width=\"30%\" align=\"center\"><a href=\"#\" onclick=\"window.close()\">schlie&szlig;en</a></td>"
      + "<td width=\"30%\" align=\"right\"><a href=\"#\" onclick=\"window.close();showPreview(" + next + ", " + realm + ")\">weiter &gt;</a></td>"
      + "</tr></table>"
      + "</div></body></html>");
  M.document.close();
}

/* END */
