<!--

var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav5 = (is_nav && (is_major == 5));
var is_nav5up = (is_nav && (is_major >= 5));
var is_ie = (agt.indexOf("msie") != -1);
var is_ie3 = (is_ie && (is_major < 4));
var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")==-1) );
var is_ie4up = (is_ie  && (is_major >= 4));
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie55 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1) );
var is_ie5up = (is_ie && !is_ie3 && !is_ie4 || is_ie55);
var is_opera = (agt.indexOf("opera") != -1);
var is_mac = (agt.indexOf("mac")!=-1);

if (is_ie5up || is_nav5up || is_opera) {
  Layer.prototype.moveTo          = DOM_MoveLayerTo;
}
else {
  Layer.prototype.moveTo          = moveLayerTo;
}
if (is_nav4) {
  Layer.prototype.clip            = NS4_ClipLayer;
}
else {
  Layer.prototype.clip            = DOM_ClipLayer;
}
Layer.prototype.moveBy            = moveLayerBy;
Layer.prototype.getYPosition      = getLayerYPosition;
Layer.prototype.clipBy            = clipLayerBy;
Layer.prototype.hide              = hideLayer;
Layer.prototype.show              = showLayer;

Layer.parentIdArray = new Array();
Layer.idArray = new Array();
Layer.idArray.i = 0;
Layer.isSet = false;
LayerTest = new Function("return true");

function Layer(id,parent_id) {
  var parent = parent_id;
  if (!Layer.isSet) initLayer(parent);
  if (is_nav4) {
    if (!parent_id) var parent_id = Layer.parentIdArray[id];
    if (!LayerTest(id,parent_id)) return;
    this.css = (parent_id) ? eval("document."+parent_id+".document."+id) : document.layers[id];
    this.elm = this.event = this.css;
    this.doc = this.css.document;
    this.x = this.css.left;
    this.y = this.css.top;
    this.w = this.css.clip.width;
    this.h = this.css.clip.height; 		
    this.relativeX = this.css.pageX;
    this.relativeY = this.css.pageY;

		if (!parent_id) {
      this.parentTop = true;
      this.theparent = window;
      this.theparent.w = this.theparent.innerWidth;
      this.theparent.h = this.theparent.innerHeight;
    }
    else {
      this.parentTop = false;
      var layerref = "t."+parent_id;
			if (parent_id.lastIndexOf("ID") != -1)
        this.theparent = eval(layerref.substring(layerref.lastIndexOf("t.")+2,layerref.lastIndexOf("ID")));
		}
  }
  else if (is_ie4up || is_nav5up || is_opera) {
    if (is_ie5up || is_nav5up || is_opera) {
      this.elm = document.getElementById(id);
      this.css = this.elm.style;
      this.w = this.elm.offsetWidth;
      this.h = this.elm.offsetHeight;
      pnode = this.elm.parentNode;
    }
    else if (is_ie4) {
      this.elm = this.event = document.all[id];
      this.css = document.all[id].style;
      this.w = this.css.pixelWidth;
      this.h = this.css.pixelHeight;
      pnode = this.elm.parentElement;
    }
    this.doc = document;
    this.x = this.elm.offsetLeft;
    this.y = this.elm.offsetTop;
    this.relativeX = this.elm.offsetLeft;
    this.relativeY = this.elm.offsetTop;

    if (pnode.id == "") {
      this.parentTop = true;
      this.theparent = document;
      this.theparent.w = this.theparent.body.clientWidth;
      this.theparent.h = this.theparent.body.clientHeight;
    }
    else {
      this.parentTop = false;
      this.theparent = eval(pnode.id.replace("ID",""));
    }
  }
  this.id = id
  this.parent_id = parent_id;
}

function initLayer(parent_id) {
  if (!Layer.isSet) Layer.isSet = true;
  if (is_nav4) {
    if (parent_id) ref = eval("document."+parent_id+".document");
    else {
      parent_id = "";
      ref = document;
    }
    for (var i=0; i<ref.layers.length; i++) {
      var divname = ref.layers[i].name;
      Layer.parentIdArray[divname] = parent_id;
      var index = divname.indexOf("ID");
      if (index > 0) {
        eval(divname.substr(0,index) + ' = new Layer("'+divname+'","'+parent_id+'")');
      }
      if (ref.layers[i].document.layers.length > 0) {
        Layer.idArray[Layer.idArray.length] = (parent_id == "") ? ref.layers[i].name : parent_id+".document."+ref.layers[i].name;
      }
    }
    if (Layer.idArray.i < Layer.idArray.length) {
      initLayer(Layer.idArray[Layer.idArray.i++])
    }
  }
  else if (is_ie4up || is_nav5up || is_opera) {
    var tags;
    if (is_ie5up || is_nav5up || is_opera) tags = document.body.getElementsByTagName("DIV");
    else if (is_ie4) tags = document.all.tags("DIV");
    for (var i=0; i<tags.length; i++) {
      var divname = tags[i].id;
      var index = divname.indexOf("ID");
      if (index > 0) {
        eval(divname.substr(0,index)+' = new Layer("'+divname+'")');
      }
    }
  }
  return true;
}

function moveLayerTo(x,y) {
  if (x != null)
    this.x = this.css.left = x;
  if (y != null)
    this.y = this.css.top = y;
}

function DOM_MoveLayerTo(x,y) {
  if (x != null)
    this.css.left = (this.x = x)+"px";
  if (y != null)
    this.css.top = (this.y = y)+"px";
}

function moveLayerBy(x,y) {
  this.moveTo(this.x+x,this.y+y);
}

function getLayerYPosition() {
  return this.y;
}

function NS4_ClipLayer(left,top,right,bottom) {
	if (left == null) left = this.clipLeft;
	if (top == null) top = this.clipTop;
	if (right == null) right = this.clipRight;
	if (bottom == null) bottom = this.clipBottom;
  this.clipLeft = this.css.clip.left = left;
  this.clipTop = this.css.clip.top = top;
  this.clipRight = this.css.clip.right = right;
  this.clipBottom = this.css.clip.bottom = bottom;
}

function DOM_ClipLayer(left,top,right,bottom) {
	if (left == null) left = this.clipLeft;
	if (top == null) top = this.clipTop;
	if (right == null) right = this.clipRight;
	if (bottom == null) bottom = this.clipBottom;
  this.css.clip = "rect("+top+" "+right+" "+bottom+" "+left+")";
  this.clipLeft = left;
  this.clipTop = top;
	this.clipRight = right;
	this.clipBottom =  bottom;
}

function clipLayerBy(left,top,right,bottom) {
	this.clip(this.clipLeft+left,this.clipTop+top,this.clipRight+right,this.clipBottom+bottom);
}

function hideLayer() {
	this.css.visibility = "hidden";
}

function showLayer() {
	this.css.visibility = "visible";
}
//-->
