The code is as follows:
Function Dynlayer (ID, Nestref, Frame) {
IF (! is.ns5 &&! Dynlayer.Set &&! frame) Dynlayerinit ()
this.frame = frame || Self
IF (is.ns) {
IF (is.ns4) {
IF (! frame) {
IF (! Nestref) VAR Nestref = Dynlayer.Nestrefarray [ID]
IF (! Dynlayrtest (ID, NestRef) Return
THIS.CSS = (NestRef)? Eval ("Document." Nestref ". Document." id): Document.Layers [ID]
}
Else this.css = (Nestref)? Eval ("frame.document." Nestref ". document." id): frame.document.layers [ID]
this.elm = this.event = this.css
THIS.DOC = this.css.document
}
ELSE IF (is.ns5) {
this.elm = Document.GtelementByid (ID)
this.css = this.elm.style
this.doc = document
}
this.x = this.css.Left
THIS.Y = this.css.top
THIS.W = this.css.clip.width
THIS.H = this.css.clip.height
}
ELSE IF (is.ie) {
this.elm = this.event = this.frame.document.all [id]
this.css = this.frame.document.all [id] .style
this.doc = document
this.x = this.elm.offsetleft
THIS.Y = this.elm.offsettop
THIS.W = (is.ie4)? this.css.pixelwidth: this.elm.offsetwidth
THIS.H = (is.ie4)? this.css.pixelheight: this.elm.offsetheight
}
this.id = ID
THIS.NESTREF = Nestref
this.obj = ID "Dynlayer"
Eval (this.obj "= this")
}
Function Dynlayermoveto (X, Y) {
IF (x! = null) {
this.x = x
IF (is.ns) this.css.Left = this.x
Else this.css.pixelleft = THIS.X
}
IF (y! = null) {
THIS.Y = Y
IF (is.ns) this.css.top = THIS.Y
Else this.css.pixeltop = THIS.Y
}
}
Function Dynlayermoveby (x, y) {
THIS.MOVETO (THIS.X X, THIS.Y Y)}
Function Dynlayershow () {
THIS.CSS.VISIBILITY = (is.ns4)? "show": "visible"
}
Function DynlayerHide () {
THIS.CSS.VISIBILITY = (is.ns4)? "hide": "hidden"
}
Dynlayer.Prototype.moveto = Dynlayermoveto
Dynlayer.Prototype.Moveby = Dynlayermoveby
Dynlayer.Prototype.show = Dynlayershow
Dynlayer.Prototype.hide = Dynlayerhide
Dynlayrtest = New function ('returntrue')
// Dynlayerinit Function
Function Dynlayerinit (NestRef) {
IF (! Dynlayer.set) Dynlayer.Set = TRUE
IF (is.ns) {
IF (Nestref) ref = EVAL ('Document.' Nestref '. Document')
Else {NestRef = '; ref = Document;
For (var i = 0; i Var Divname = ref.layers [i] .name Dynlayer.Nestrefarray [DivName] = Nestref Var index = Divname.indexof ("DIV") IF (INDEX> 0) { Eval (Divname.Substr (0, Index) '= New Dynlayer ("' Divname '", "' Nestref '")') } IF (ref.layers [i] .document.Layers.Length> 0) { Dynlayer.refarray [Dynlayer.refarray.Length] = (Nestref == '')? Ref.Layers [i] .name: Nestref '. Document.' Ref.layers [i] .name } } IF (Dynlayer.refarray.i Dynlayerinit (Dynlayer.refarray [Dynlayer.refarray.i ]) } } ELSE IF (is.ie) { For (VAR i = 0; I Var Divname = Document.all.tags ("div") [i] .id Var index = Divname.indexof ("DIV") IF (INDEX> 0) { Eval (Divname.Substr (0, Index) '= New Dynlayer ("' Divname '")')} } } Return True } Dynlayer.Nestrefarray = new arrright () Dynlayer.refarray = new arrival () Dynlayer.refarray.i = 0 Dynlayer.set = false // Slide Methods Function Dynlayerslideto (Endx, Endy, Inc, Speed, Fn) { IF (endx == null) endx = this.x IF (Endy == Null) endy = this.y Var distx = ENDX-THIS.X Var disty = endy-this.y this.slidestart (Endx, Endy, Distx, DISTY, Inc, Speed, Fn) } Function Dynlayerslideby (DISTX, DISTY, INC, SPEED, FN) { Var endx = this.x DISTX Var endy = THIS.Y DISTY this.slidestart (Endx, Endy, Distx, DISTY, Inc, Speed, Fn) } Function Dynlayerslidestart (Endx, Endy, Distx, DISTY, INC, SPEED, FN) { IF (this.slideActive) Return IF (! inc) INC = 10 IF (! speed) speed = 20 Var num = math.sqrt (Math.Pow (Distx, 2) Math.Pow (DISTY, 2)) / Inc IF (Num == 0) Return VAR DX = DISTX / NUM Var Dy = DISTY / NUM IF (! fn) fn = null this.slideActive = TRUE this.slide (DX, DY, ENDX, Endy, Num, 1, Speed, Fn) } Function Dynlayerslide (DX, DY, ENDX, ENDY, NUM, I, Speed, Fn) { IF (! this.slideactive) return IF (i THIS.MOVEBY (DX, DY) this.onslide () IF (this.slideactive) setTimeout (this.obj ". Slide (" DX "," "," "," "," "," "," SPEED ", / " fn " / ")", speed) Else this.onslidend () } Else { this.slideActive = false THIS.MOVETO (ENDX, ENDY) this.onslide () this.onslidend () Eval (fn) } } Function Dynlayerslideinit () {} Dynlayer.prototype.slideinit = DynlayerslideInitDynlayer.prototype.slideto = Dynlayerslideto = Dynlayerslideto Dynlayer.prototype.slideby = DynlayerslideBy Dynlayer.prototype.slidestart = DynlayerslideStart Dynlayer.Prototype.slide = Dynlayerslide Dynlayer.Prototype.OnSlide = new function () Dynlayer.Prototype.OnSlideEnd = new function () // Clip methods Function DynlayerClipinit (Cliptop, Clipright, Clipbottom, Clipleft) { IF (is.ie) { IF (Arguments.Length == 4) this.clipto (Cliptop, Clipright, Clipbottom, Clipleft) Else if (is.ie4) this.clipto (0, this.css.pixelwidth, this.css.pixelheight, 0) } } Function DynlayerClipTo (T, R, B, L) { IF (t == null) T = this.clipValues ('t') IF (r == null) r = this.clipValues ('R') IF (b == null) b = this.clipValues ('b') IF (l == null) l = this.clipValues ('L') IF (is.ns) { this.css.clip.top = T this.css.clip.right = r this.css.clip.bottom = B this.css.clip.Lip.LEFT = L } Else if (is.ie) this.css.clip = "RECT (" T "PX" R "PX" B "PX" L "PX)" } Function DynlayerClipBy (T, R, B, L) { THIS.CLIPTO (THIS.CLIPVALUES ('T') T, this.clipvalues ('R') R, this.clipvalues ('B') B, this.clipValues ('L') L) } Function DynlayerClipValues (Which) { IF (is.ie) var clipv = this.css.clip.split ("RECT (") [1] .split (")") [0] .split ("px") IF (Which == "T") RETURN (is.ns)? this.css.clip.top: Number (CLIPV [0]) IF (which == "r") RETURN (is.ns)? this.css.clip.right: Number (CLIPV [1]) IF (Which == "B") RETURN (IS.NS)? this.css.clip.bottom: Number (Clipv [2]) IF (Which == "L") RETURN (is.ns)? THIS.CSS .Clip.Left: Number (CLIPV [3]) } Dynlayer.Prototype.Clipinit = DynlayerClipinit Dynlayer.Prototype.clipto = DynlayerClipto Dynlayer.Prototype.clipby = DynlayerClipby Dynlayer.prototype.clipvalues = DynlayerClipValues // Write Method Function DynlayerWrite (HTML) { IF (is.ns) { this.doc.open () this.doc.write (HTML) THIS.DOC.Close () } ELSE IF (is.ie) { this.event.innerhtml = HTML } } Dynlayer.Prototype.write = Dynlayerwrite // BrowserCheck Object Function browserCheck () { VAR B = Navigator.Appname IF (b == "Netscape") this.b = "ns" Else IF (b == "Microsoft Internet Explorer" this.b = "ie" Else this.b = b this.version = Navigator.AppVersion THIS.V = PARSEINT (THIS.VERSION) THIS.NS = (this.b == "ns" && this.v> = 4) THIS.NS4 = (this.b == "ns" && this.v == 4) THIS.NS5 = (this.b == "ns" && this.v == 5) THIS.IE = (this.b == "IE" && this.v> = 4) THIS.IE4 = (this.version.indexof ('msie 4')> 0) THIS.IE5 = (this.version.indexof ('msie 5')> 0) THIS.MIN = (this.ns || this.ie) } IS = new browsercheck () // CSS Function Function CSS (ID, Left, Top, Width, Height, Color, VIS, Z, Other) { IF (id == "start") Return '