/* --------------------------------------------------------------------------   LayerManager   A basic layer manipulating object   Constructor:   LayerManager(String name [, LayerManager parent])   Public properties:   String id                   - the id of the layer   LayerManager childOf        - the parent layer   BrowserInfo browserInfo     - the BrowserInfo object   [browser dependent] element - the actual 'layer' or 'all' element   Public methods:   int  getPosLeft()   int  getPosTop()   int  getWidth()   int  getHeight()   void setSize(int width, int height)   void setPos(int left, int top)   void moveBy(int left, int top)   void show()   void hide()   void clip(int top, int right, int bottom, int left)   void setZIndex(int index)   int  getZIndex()   void setContent(String html)   Copyright 1999 Bengt J. Lindstrom   bli@bombit.se   http://www.bombit.se/   Updated 2000-09-14 - added support for NS6/Mozilla   --------------------------------------------------------------------------*/var browserInfoInstance = null;function LayerObject(name, parentLayer) {   if (browserInfoInstance == null) {     browserInfoInstance = new BrowserInfo();   }   if (browserInfoInstance.isDOM || browserInfoInstance.versionMajor >= 4) {     this.id = name;     this.childOf = parentLayer;     this.browserInfo = browserInfoInstance;     if (this.browserInfo.isDOM) {        // NS6, Mozilla and IE5         this.element = this.event = document.getElementById(name);        if (this.element.ownerDocument == null)          this.element.ownerDocument = document;        this.setPos     = DOMLayerManagerSetPos;        this.moveBy     = IELayerManagerMoveBy;        this.getPosLeft = DOMLayerManagerGetPosLeft;        this.getPosTop  = DOMLayerManagerGetPosTop;        this.getWidth   = DOMLayerManagerGetWidth;        this.getHeight  = DOMLayerManagerGetHeight;        this.setSize    = IELayerManagerSetSize;        this.show       = IELayerManagerShow;        this.hide       = IELayerManagerHide;        this.clip       = IELayerManagerClip;        this.setZIndex  = IELayerManagerSetZIndex;        this.getZIndex  = IELayerManagerGetZIndex;        this.setContent = DOMLayerManagerSetContent;     }     else if (this.browserInfo.isNS) {        // NS4       if (this.childOf)         this.element = this.childOf.element.document.layers[name];       else         this.element = document.layers[name];       this.getPosLeft  = NSLayerManagerGetPosLeft;       this.getPosTop   = NSLayerManagerGetPosTop;       this.getWidth    = NSLayerManagerGetWidth;       this.getHeight   = NSLayerManagerGetHeight;       this.setSize     = NSLayerManagerSetSize;       this.setPos      = NSLayerManagerSetPos;       this.moveBy      = NSLayerManagerMoveBy;       this.show        = NSLayerManagerShow;       this.hide        = NSLayerManagerHide;       this.clip        = NSLayerManagerClip;       this.setZIndex   = NSLayerManagerSetZIndex;       this.getZIndex   = NSLayerManagerGetZIndex;       this.setContent  = NSLayerManagerSetContent;     }     else if (this.browserInfo.isIE) {       // IE4       this.element = document.all[name];       this.getPosLeft  = IELayerManagerGetPosLeft;       this.getPosTop   = IELayerManagerGetPosTop;       this.getWidth    = IELayerManagerGetWidth;       this.getHeight   = IELayerManagerGetHeight;       this.setPos      = IELayerManagerSetPos;       this.moveBy      = IELayerManagerMoveBy;       this.show        = IELayerManagerShow;       this.hide        = IELayerManagerHide;       this.clip        = IELayerManagerClip;       this.setZIndex   = IELayerManagerSetZIndex;       this.getZIndex   = IELayerManagerGetZIndex;       this.setContent  = IELayerManagerSetContent;     }     return this;   }   return null;}function NSLayerManagerGetPosLeft() {  return this.element.left;}function NSLayerManagerGetPosTop() {  return this.element.top;}function NSLayerManagerGetWidth() {  return this.element.document.width;}function NSLayerManagerGetHeight() {  return this.element.document.height;}function NSLayerManagerSetSize(width, height) {  this.element.resizeTo(width, height);}function NSLayerManagerSetPos(x, y) {  this.element.left = x;  this.element.top = y;}function NSLayerManagerMoveBy(x, y) {  this.element.moveBy(x, y);}function NSLayerManagerHide() {  this.element.visibility = "hide";}function NSLayerManagerShow() {  this.element.visibility = "show";}function NSLayerManagerClip(top, right, bottom, left) {  this.element.clip.top = top;  this.element.clip.right = right;  this.element.clip.bottom = bottom;  this.element.clip.left = left;}function NSLayerManagerGetZIndex() {  return this.element.zIndex;}function NSLayerManagerSetZIndex(index) {  this.element.zIndex = index;}function NSLayerManagerSetContent(html) {    this.element.document.open();    this.element.document.write(html);    this.element.document.close();}function IELayerManagerGetPosLeft() {  return this.element.style.pixelLeft;}function IELayerManagerGetPosTop() {  return this.element.style.pixelTop;}function IELayerManagerGetWidth() {  return this.element.offsetWidth;}function IELayerManagerGetHeight() {  return this.element.offsetHeight;}function IELayerManagerSetSize(width, height) {  this.element.style.width = width;  this.element.style.height = height;}function IELayerManagerSetPos(x, y) {  this.element.style.pixelLeft = x;  this.element.style.pixelTop = y;}function IELayerManagerMoveBy(x, y) {  this.setPos(this.getPosLeft()+x, this.getPosTop()+y);}function IELayerManagerHide() {  this.element.style.visibility = "hidden";}function IELayerManagerShow() {  this.element.style.visibility = "visible";}function IELayerManagerClip(top, right, bottom, left) {  this.element.style.clip = "rect("+top+"px "+right+"px "+bottom+"px "+left+"px)";}function IELayerManagerGetZIndex() {  return this.element.style.zIndex;}function IELayerManagerSetZIndex(index) {  this.element.style.zIndex = index;}function IELayerManagerSetContent(html) {  this.element.innerHTML = html;}function DOMLayerManagerSetPos(x, y) {  this.element.style.left = ''+x+'px';  this.element.style.top = ''+y+'px';}function DOMLayerManagerGetPosLeft() {  return parseInt(this.element.offsetLeft);}function DOMLayerManagerGetPosTop() {  return parseInt(this.element.offsetTop);}function DOMLayerManagerGetWidth() {  return parseInt(this.element.offsetWidth);}function DOMLayerManagerGetHeight() {  return parseInt(this.element.offsetHeight);}function DOMLayerManagerSetContent(html) {  if (this.element.innerHTML) {    this.element.innerHTML = html; // Implemented in latest builds of Mozilla  } /*else {   var iframe = document.createElement('iframe');  iframe.style.visibility = 'hidden';  iframe.appendChild(html);  var r = this.element.ownerDocument.createRange();  r.selectNodeContents(this.element);  r.deleteContents();  var df = r.createContextualFragment(html);  this.element.appendChild(df);  }*/}/*--------------------------------------------------------------------------  BrowserInfo  An object containing version info on the browser  Constructor:  BrowserInfo();  Properties:  boolean isNS         - true if Netscape  boolean isIE         - true if Internet Explorer  boolean isDOM        - true if DOM 1.0 compatible  int     versionMajor - major version number  int     versionMinor - minor version number interpreted as a two digit                         number, 01 = 1, 5 = 50  int     screenHeight  int     screenWidth  int     clientHeight  int     clientWidth  int     colorDepth  Copyright Bengt J. Lindstrom 1999  bli@bombit.se  http://www.bombit.se/  ---------------------------------------------------------------------------*/function BrowserInfo() {  this.isNS = false;  this.isIE = false;  this.isDOM = false;
  this.versionMajor = -1;  this.versionMinor = -1;  this.screenHeight = -1;  this.screenWidth  = -1;  this.clientHeight = -1;  this.clientWidth  = -1;  this.colorDepth   = -1;  if (document.getElementById) {    this.isDOM = true;    this.versionMajor = 2;    this.versionMinor = 0;  }  if (navigator.appName == "Netscape") {    this.isNS = true;    this.versionMajor = parseInt(navigator.appVersion);    this.versionMinor = parseInt(navigator.appVersion.substring(2, 3), 10);    if (navigator.appVersion.charAt(2) != '0')      this.versionMinor *= 10;    if (this.versionMajor >= 4) {      this.clientHeight = window.innerHeight;      this.clientWidth = window.innerWidth;      this.screenHeight = screen.height;      this.screenWidth = screen.width;      this.colorDepth = screen.colorDepth;    }  }  else {    var i = navigator.userAgent.indexOf("MSIE ");    if (i != -1) {      this.isIE = true;      this.versionMajor = parseInt(navigator.userAgent.charAt(i+5));      this.versionMinor = parseInt(navigator.userAgent.substring(i+7, i+8), 10);      if (navigator.userAgent.charAt(i+7) != '0')        this.versionMinor *= 10;      if (this.versionMajor >= 4) {        this.clientHeight = window.document.body.clientHeight;        this.clientWidth = window.document.body.clientWidth;        this.screenHeight = screen.height;        this.screenWidth = screen.width;        this.colorDepth = screen.colorDepth;       }    }  }  return this;}/* ---------------------------------- END -----------------------------------*/