/* global defines */
IMG_ROOT='http://mitglied.lycos.de/knut2004/photos/';

/* Display menu item using a table row and TD CSS definition */
function menuItem(name, url)
{
  document.write('<li><a href="' + url + '" onclick="selectItem(\'' + name + '\');" target="main">' + name + '</a></li>');

}

function selectItem(name)
{
  for (i = 0; i < document.links.length; i++) {
    if (document.links[i].text == name) {
      document.links[i].style.fontWeight = 'bold';
    } else {
      document.links[i].style.fontWeight = 'normal';  
    }
  }
}

function drawShadowTitle(text)
{
  if (isIE()) {
    document.write('<h4>' + text + '</h4>');
  } else {
    document.write('<h4 class=\"shadowtitle1\">' + text + '<font color=\"#FFFFFF\" class=\"shadowtitle2\">' + text + '</font></h4>');
  }
}

function drawShadowText(text)
{
  if (isIE()) {
    document.write(text);
  } else {
    document.write('<font class=\"shadowtext1\">' + text + '<font color=\"#FFFFFF\" class=\"shadowtext2\">' + text + '</font></font>');
  }
}

/* check browser */
function isIE()
{
  var agent=navigator.userAgent.toLowerCase();
alert(agent);
  return ((agent.indexOf("msie") != -1) && (agent.indexOf("opera") == -1));
}

/* check if browser supports iframe */
function supportsIframe()
{
  var agent=navigator.userAgent.toLowerCase();
  return ((agent.indexOf("msie") != -1) || (agent.indexOf("gecko") != -1));
}

/* resize iframe */
function resizeIFrame(obj)
{
  docHeight = iframe.document.body.scrollHeight
  obj.style.height = docHeight + 50 + 'px'
}

/* get browser language, returns de/en */
function getLang()
{
  var lang;
  if (isIE())
    lang = navigator.userLanguage;
  else
    lang = navigator.language;
  if (lang.indexOf("en") >= 0)
    return "en";
  else
    return "de";
}

function copyrightDE(year) {
  document.write("Text und Fotos: Copyright &copy " + year + ", Knut Schalldach");
}

function popupWindow(url) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600');");
}

function popupImage(name, title) {
  document.write('<a href=\"' + IMG_ROOT + name + '.jpg\" target=_blank><img class=\"borderPink\" src=\"' + IMG_ROOT + name + '_small.jpg\" title=\"' + title + '\"><br>' + title + '</a>');
}

