function hide(_id, _st) {
  try {
    if (typeof(_id) == "string") { var _obj = document.getElementById(_id); } else { var _obj = _id; }
    if (_obj) {
      if (_st.toString() == "") { return ((_obj.style.display == "none") ? true : false); }
      else {
        _st = (_st ? "none" : "");
       if (_obj.style.display != _st) { _obj.style.display = _st; }
        return (_st ? false : true);
      }
    }
  } catch(e) { return; }
}

function homepage() {
  try {
    var _man = ("\r\n\r\nYou need to add manualy '" + location.protocol + "//" + location.host + "' in your browser options.");
    var _ua = navigator.userAgent.toUpperCase();
    if ((_ua.indexOf("MSIE") > 0) && (_ua.indexOf("OPERA") <= 0) && (_ua.indexOf("GECKO") <= 0) && (_ua.indexOf("WEBTV") <= 0)) {
      return true;
    } else if ((_ua.indexOf("OPERA") != -1) || (_ua.indexOf("GECKO") != -1)) {
      alert(unescape("Your Browser not support a custom Home-Page by Javascript code!" + _man));
    } else {
      alert(unescape("Home-Page with Javascript not possible with your Browser '" + navigator.userAgent + "'." + _man));
    }
    return false;
  } catch(e) { return false; }
}

function favorites() {
  try {
    if ((window.sidebar) && (window.sidebar.addPanel)) {
      if (navigator.userAgent.lastIndexOf("Netscape") != -1) {
        window.sidebar.addPanel(document.title, (location.protocol + "//" + location.host), "");
      } else {
        window.sidebar.addPanel(document.title, (location.protocol + "//" + location.host), "");
      }
    }
    if ((window.external) && ((navigator.platform == "Win32") || ((window.ScriptEngine) && (ScriptEngine().indexOf('InScript') + 1)))) {
      window.external.AddFavorite(location.href.replace(/#.*/, ""), document.title);
    }
    return false;
  } catch(e) { return false; }
}

function toTarget(_ev) {
  try {
    return ((_ev.relatedTarget) ? _ev.relatedTarget : _ev.toElement);
  } catch(e) { return true; }
}

var _tmphotomenu = 0;
function photomenu(_event, _obj) {
  //try {
    var _menu = document.getElementById("div_menu"); var _inputimg = document.getElementById("input_img"); var _inputdesc = document.getElementById("input_desc"); var _event = (_event || event);
    if (typeof(_obj) == "string") { var _obj = document.getElementById(_obj); }
    if (_event && _obj && _menu && _inputimg && _inputdesc) {
      _menu.style.top = (_event.clientY || _event.offsetY); _menu.style.left = (_event.clientX || _event.offsetX); hide(_menu, false);
      _inputimg.value = _obj.alt; _inputdesc.value = _obj.title; document.getElementById("input_scrolltop").value = document.getElementById("div_body").scrollTop;
      window.clearTimeout(_tmphotomenu); _tmphotomenu = window.setTimeout(("hide('" + _menu.id + "', true); _tmphotomenu = 0;"), 3000);
    }
  //} catch(e) { return; }
}

function preview(_url, _title) {
  try {
    var _table = document.getElementById("table_loading"); var _div = document.getElementById("div_loading");
    if (_url && _table && _div) {
      if (_title != "") { var _title = new String(_title); _title = _title.replace(" - ", "<BR>"); }
      opacity("table_layout", 20); hide(_table, false); _div.parentNode.className = "CURSOR"; _table.onclick = function hidepreview(e) { opacity('table_layout', 100); hide('table_loading', true); };
      _div.style.width = "500"; _div.style.height = "500"; _div.style.textAlign = "center"; _div.innerHTML = ("<B>" + document.title + "</B><BR>\r\n<BR>" + _title + "<BR>\r\n");
     _div.style.backgroundImage = ("url('" + _url + "')"); _div.style.backgroundPosition = "center"; _div.style.backgroundRepeat = "no-repeat";
    }
  } catch(e) { return; }
}

function opacity(_obj, _n) {
 try {
    return; // Function Stopped (IE sux!)
    if (typeof(_obj) == "string") { var _obj = document.getElementById(_obj); }
    if (_obj) { _n = ((_n > 100) ? 100 : ((_n < 0) ? 0 : _n)); _obj.style.opacity = ((_n < 100) ? ("0." + _n) : "1.0"); _obj.style.filter =  ("alpha(Opacity=" + _n + ");"); }
  } catch(e) { return; }
}

function loaded() {
  try {
    var _obj = document.getElementById("img_loading"); var _table = document.getElementById("table_loading");
    if (_obj && _table) {
      if (_obj.complete && _tm_loading) { _table.style.display = "none"; opacity("table_layout", 100); /* window.clearInterval(_tm_loading); _tm_loading = 0; */ }
    }
  } catch(e) { return false; }
}

function init(_ev) {
  try {
    var inputs = document.getElementsByTagName("input");
    var selects = document.getElementsByTagName("select");
    var textareas = document.getElementsByTagName("textarea");
    var images = document.getElementsByTagName("img");
    for (var _i = 0; (_i < inputs.length); _i++) { inputs[_i].align = "absmiddle"; }
    for (var _i = 0; (_i < selects.length); _i++) { selects[_i].align = "absmiddle"; }
    for (var _i = 0; (_i < textareas.length); _i++) { textareas[_i].align = "absmiddle"; }
    for (var _i = 0; (_i < images.length); _i++) {
      if ((images[_i].align != "left") && (images[_i].align != "top") && (images[_i].align != "right") && (images[_i].align != "bottom")) { images[_i].align = "absmiddle"; }
    }
  } catch(e) { return false; }
}

try {
  window.onload = function(e) { init(e); }
  document.oncontextmenu = new Function("return false;");
  document.onselectstart = new Function("return true;");
  document.ondragstart = new Function("return false;");
  var _tm_loading = window.setInterval("loaded();", 100);
} catch(e) { }
