var isMinNS4=(navigator.appName.indexOf("Netscape")>=0&&parseFloat(navigator.appVersion)>=4)?1:0;
var isMinIE4=(document.all)?1:0;
var isMinIE5=(isMinIE4 && navigator.appVersion.indexOf("MSIE 5.")>= 0||isMinIE4&& navigator.appVersion.indexOf("MSIE 6.")>=0)?1:0;


//-----------------------------------------------------------------------------
// Layer positioning.
//-----------------------------------------------------------------------------

function moveLayerTo(layer, x, y) {

  if (isMinNS4)
    layer.moveTo(x, y);
  if (isMinIE4) {
    layer.style.left = x;
    layer.style.top  = y;
  }
}

function moveLayerBy(layer, dx, dy) {

  if (isMinNS4)
    layer.moveBy(dx, dy);
  if (isMinIE4) {
    layer.style.pixelLeft += dx;
    layer.style.pixelTop  += dy;
  }
}

function getLeft(layer) {

  if (isMinNS4)
    return layer.left;
  if (isMinIE4)
    return layer.style.pixelLeft;
  return -1;
}

function getTop(layer) {

  if (isMinNS4)
    return layer.top;
  if (isMinIE4)
    return layer.style.pixelTop;
  return -1;
}

function getRight(layer) {

  if (isMinNS4)
    return layer.left + getWidth(layer);
  if (isMinIE4)
    return layer.style.pixelLeft + getWidth(layer);
  return -1;
}

function getBottom(layer) {

  if (isMinNS4)
    return layer.top + getHeight(layer);
  if (isMinIE4)
    return layer.style.pixelTop + getHeight(layer);
  return -1;
}

function getPageLeft(layer) {

  var x;

  if (isMinNS4)
    return layer.pageX;
  if (isMinIE4) {
    x = 0;
    while (layer.offsetParent != null) {
      x += layer.offsetLeft;
      layer = layer.offsetParent;
    }
    x += layer.offsetLeft;
    return x;
  }
  return -1;
}

function getPageTop(layer) {

  var y;

  if (isMinNS4)
    return layer.pageY;
  if (isMinIE4) {
    y = 0;
    while (layer.offsetParent != null) {
      y += layer.offsetTop;
      layer = layer.offsetParent;
    }
    y += layer.offsetTop;
    return y;
  }
  return -1;
}

function getWidth(layer) {

  if (isMinNS4) {
    if (layer.document.width)
      return layer.document.width;
    else
      return layer.clip.right - layer.clip.left;
  }
  if (isMinIE4) {
    if (layer.style.pixelWidth)
      return layer.style.pixelWidth;
    else
      return layer.clientWidth;
  }
  return -1;
}

function getHeight(layer) {

  if (isMinNS4) {
    if (layer.document.height)
      return layer.document.height;
    else
      return layer.clip.bottom - layer.clip.top;
  }
  if (isMinIE4) {
    if (layer.style.pixelHeight)
      return layer.style.pixelHeight;
    else
      return layer.clientHeight;
  }
  return -1;
}

function getzIndex(layer) {

  if (isMinNS4)
    return layer.zIndex;
  if (isMinIE4)
    return layer.style.zIndex;

  return -1;
}

function setzIndex(layer, z) {

  if (isMinNS4)
    layer.zIndex = z;
  if (isMinIE4)
    layer.style.zIndex = z;
}

function getPageHeight() {

  if (isMinNS4)
    return document.height;
  if (isMinIE4)
    return document.body.scrollHeight;
  return -1;
}

function getWindowWidth() {

  if (isMinNS4)
    return window.innerWidth;
  if (isMinIE4)
    return document.body.clientWidth;
  return -1;
}

function getWindowHeight() {

  if (isMinNS4)
    return window.innerHeight;
  if (isMinIE4)
    return document.body.clientHeight;
  return -1;
}

var fullWidth;
var newWidth;
var tmpLayer;
var NStmpsapce;
  function init() {
	//alert(fullWidth);

  // Get width of window, need to account for scrollbar width in Netscape.

	fullWidth = getWindowWidth()- (isMinNS4 && getWindowHeight() < getPageHeight() ? 16 : 0);

	//alert(fullWidth);
	if (fullWidth > 776) {
   		newWidth = (fullWidth - 776)/2;
 	}else{
   		newWidth = 5;
 	}
	if (isMinNS4) {
		if (newWidth==5) {
			NStmpsapce = 0;
		}else{
			NStmpsapce = 9.5;
		}
		tmpLayer=MM_findObj("Layer1");
		tmpLayer.left = newWidth - NStmpsapce;
		tmpLayer=MM_findObj("Layer2")
		tmpLayer.left = newWidth - NStmpsapce;
		tmpLayer=MM_findObj("Layer3")
		tmpLayer.left = newWidth - NStmpsapce;
		tmpLayer=MM_findObj("Layer4")
		tmpLayer.left = newWidth - NStmpsapce;
		tmpLayer=MM_findObj("Layer5")
		tmpLayer.left = newWidth - NStmpsapce;
		tmpLayer=MM_findObj("Layer6")
		tmpLayer.left = newWidth - NStmpsapce;
		tmpLayer=MM_findObj("Layer7")
		tmpLayer.left = newWidth - NStmpsapce;
		tmpLayer=MM_findObj("Layer8")
		tmpLayer.left = newWidth - NStmpsapce;
	}else{
		Layer1.style.left = newWidth;
		Layer2.style.left = newWidth;
		Layer3.style.left = newWidth;
		Layer4.style.left = newWidth;
		Layer5.style.left = newWidth;
		Layer6.style.left = newWidth;
		Layer7.style.left = newWidth;
		Layer8.style.left = newWidth;
	}
}
