// Scripts by Ch. Wysseier, netstyle.ch, CROSS BROWSER
// browser check (IE 4/5 + Netscape 4 + Netscape 6)
// Please note:
// !!! browserCheck() has to be called within the HTML - File !!!
//***********************************************************************
var ns4,ns6,ie4;
function browserCheck() {
  var strBrowser = navigator.userAgent.toLowerCase();
  ns4 = (document.layers)? true:false;
  ns6 = (document.getElementById && strBrowser.indexOf('gecko') != -1) ? true:false;
  ie4 = (document.all && strBrowser.indexOf('msie') != -1)? true:false;
}

// Hides a layer
// argument: strLayer represents the ID of the Layer
function hideLayer(strLayer) {
  if (ie4) document.all[strLayer].style.visibility = "hidden";
  if (ns6) document.getElementById(strLayer).style.visibility = "hidden";
  if (ns4) document.layers[strLayer].visibility = "hide";
}
// Shows a layer
// argument: strLayer represents the ID of the Layer
function showLayer(strLayer) {
  if (ie4) document.all[strLayer].style.visibility = "visible";
  if (ns6) document.getElementById(strLayer).style.visibility = "visible";
  if (ns4) document.layers[strLayer].visibility = "show";
}
// SETS the position of the layer from the TOP
// argument: strLayer represents the ID of the Layer
function posLayerTop(strLayer,y) {
  if (ie4) document.all[strLayer].style.posTop = y;
  if (ns6) document.getElementById(strLayer).style.top = y;
  if (ns4) document.layers[strLayer].top = y;
}
// SETS the position of the layer from the LEFT
// argument: strLayer represents the ID of the Layer
function posLayerLeft(strLayer,x) {
  if (ie4) document.all[strLayer].style.posLeft = x;
  if (ns6) document.getElementById(strLayer).style.left = x;
  if (ns4) document.layers[strLayer].left = x;
}
// GETS the position of the layer from the LEFT
// argument: strLayer represents the ID of the Layer
function getLayerLeft(strLayer) {
  if (ie4) return parseInt(document.all[strLayer].style.posLeft);
  if (ns6) return parseInt(document.getElementById(strLayer).style.left);
  if (ns4) return parseInt(document.layers[strLayer].left);
  return 0;
}
// argument: strLayer represents the ID of the Layer
// returns: true if the layer is visible
function getLayersVisibility(strLayer) {
  if (ie4) return document.all[strLayer].style.visibility == "visible";
  if (ns6) return document.getElementById(strLayer).style.visibility == "visible";
  if (ns4) return document.layers[strLayer].visibility == "show";
}
// Get the width of the window (frame)
function getWidth() {
  var intWidth = 0;
  if (ie4) intWidth = document.body.offsetWidth;
  if (ns6 || ns4) intWidth = window.innerWidth;
  return intWidth;
}
// Get the height of the window (frame)
function getHeight() {
  var intHeight = 0;
  if (ie4) intHeight = document.body.offsetHeight;
  if (ns6 || ns4) intHeight = window.innerHeight;
  return intHeight;
}
// centers a layer in the window (horizontal)
function centerLayerHorizontal(strLayer,intLayerWidth) {
  var intWindowWidth = parseInt(getWidth()/2);
  intLayerWidth = parseInt(intLayerWidth/2);
  if (intWindowWidth > intLayerWidth) {
    posLayerLeft(strLayer,intWindowWidth-intLayerWidth);
    return true;
  }
  else {
    return false;
  }
}
// centers a layer in the window (vertical)
function centerLayerVertical(strLayer,intLayerHeight) {
  var intWindowHeight = parseInt(getHeight()/2);
  intLayerHeight = parseInt(intLayerHeight/2);
  if (intWindowHeight > intLayerHeight) {
    posLayerTop(strLayer,intWindowHeight-intLayerHeight);
    return true;
  }
  else {
    return false;
  }
}
