var layerNo=0; var layerObjects = new Array(); function xLayer(newLayer, x, y) { if(browser.ns4Layer) { if(typeof newLayer == "string") { if(x==null) {x=0;} if(y==null) {y=0;} this.layer=new Layer(2000); this.layer.document.open(); this.layer.document.write(newLayer); this.layer.document.close(); this.layer.moveTo(x,y); } else { this.layer=newLayer; } this.css = this.layer; this.images=this.layer.document.images; } else if(browser.ie4Layer) { var id; if(typeof newLayer == "string") { id = "layer" + layerNo++; var txt = "<" + "DIV ID='" + id + "' STYLE=\"position:absolute;" + "left:" + x + ";" + "top:" + y + ";" + "overflow:hidden;" + "visibility:hidden\">" + newLayer + "<" + "/DIV>"; document.body.insertAdjacentHTML("BeforeEnd",txt); } else { id = newLayer.id; } this.layer = document.all[id]; this.css = document.all[id].style; this.images = document.images; } else if (browser.dom) { var newDiv; if(typeof newLayer == "string") { var id="layer" + layerNo++; var txt = "" + "position:absolute;" + "left:" + x + "px;" + "top:" + y + "px;" + "visibility:hidden"; var newRange = document.createRange(); newDiv = document.createElement("DIV"); newDiv.setAttribute("style",txt); newDiv.setAttribute("id", id); document.body.appendChild(newDiv); newRange.setStartBefore(newDiv); strFrag = newRange.createContextualFragment(newLayer); newDiv.appendChild(strFrag); } else { newDiv = newLayer; } this.layer = newDiv; this.css = newDiv.style; this.images = document.images; } this.doc = (browser.dom || browser.ie4Layer) ? document : this.css.document; this._x = parseInt(this.css.left) || this.css.pixelLeft || this.layer.offsetLeft || 0; this._y = parseInt(this.css.top) || this.css.pixelTop || this.layer.offsetTop || 0; this._width = this.layer.offsetWidth || this.css.clip.width || this.doc.width || this.css.pixelWidth || 0; this._height = this.layer.offsetHeight || this.css.clip.height || this.doc.height || this.css.pixelHeight || 0; this.clipTo(0, 0, this._width, this._height); this.c=0; if((browser.dom || browser.ie4Layer) && this.css.clip) { this.c = this.css.clip; this.c = this.c.slice(5, this.c.length-1); this.c = this.c.split(' '); for(var i=0;i<4;i++) { this.c[i]=parseInt(this.c[i]); } } this.ct = this.css.clip.top || this.c[0] || 0; this.cr = this.css.clip.right || this.c[1] || this.w || 0; this.cb = this.css.clip.bottom || this.c[2] || this.h || 0; this.cl = this.css.clip.left || this.c[3] || 0; if(typeof newLayer == "string") { this.obj = "Object" + (layerNo); eval(this.obj + "=this"); } else { this.obj = newLayer.id + "Object"; eval(this.obj + "=this"); } return(this); }; function xLayerFromID(id) { if(layerObjects[id]) {return layerObjects[id];} var l; if(browser.ns4Layer) { l = new xLayer(document.layers[id]); } else if(browser.ie4Layer) { l = new xLayer(document.all[id]); } else if(browser.dom) { l = new xLayer(document.getElementById(id)); } layerObjects[id] = l; return (l); }; xLayer.prototype.moveTo = function(x,y) { this._x = x; this._y = y; this.css.left = x; this.css.top = y; }; xLayer.prototype.moveBy = function(dx,dy) { this.css.left = this._x += dx; this.css.top = this._y += dy; }; xLayer.prototype.show = function() { this.css.visibility = "visible"; }; xLayer.prototype.hide = function() { this.css.visibility = "hidden"; }; xLayer.prototype.getzIndex = function() { return this.css.zIndex; }; xLayer.prototype.setzIndex = function(z) { this.css.zIndex = z; }; xLayer.prototype.setBgColor = function(color) { if(browser.dom || browser.ie4Layer) {this.css.backgroundColor=color;} else if(browser.ns4Layer) {this.css.bgColor=color;} }; xLayer.prototype.setBgImage = function(image) { if(browser.dom || browser.ie4Layer) {this.css.backgroundImage = "url("+image+")";} else if(browser.ns4Layer) {this.css.background.src = image;} }; xLayer.prototype.isVisible = function() { if(browser.dom || browser.ie4Layer) {return this.css.visibility == "visible";} else if(browser.ns4Layer) {return this.layer.visibility == "show";} }; xLayer.prototype.setWidth = function(w) { this._width = w; if (browser.ns4Layer) {this.css.document.width = w;} else if (browser.ie4Layer || browser.dom) {this.css.width = w;} }; xLayer.prototype.setHeight = function(h) { this._height = h; if (browser.ns4Layer) {this.css.document.height = h;} else if (browser.ie4Layer || browser.dom) {this.css.height = h;} }; xLayer.prototype.setContent = function(html) { if(browser.ns4Layer) { this.doc.open("text/html"); this.doc.write(html); this.doc.close(); } else { this.layer.innerHTML = html; } }; xLayer.prototype.clipTo = function(x1,y1,x2,y2) { this.ct=y1; this.cr=x2; this.cb=y2; this.cl=x1; if(browser.ns4Layer) { this.css.clip.top = y1; this.css.clip.left = x1; this.css.clip.bottom = y2; this.css.clip.right = x2; } else if(browser.ie4Layer) { this.css.clip="rect("+y1+" "+x2+" "+y2+" "+x1+")"; this.css.pixelWidth = x2; this.css.pixelHeight = y2; this.css.overflow = "hidden"; } else if(browser.dom) { this.css.clip="rect("+y1+" "+x2+" "+y2+" "+x1+")"; this.css.width=x2 + "px"; this.css.height=y2+ "px"; this.css.overflow = "hidden"; } }; xLayer.prototype.clipBy = function(dx1,dy1,dx2,dy2) { this.clipTo(this.cl+dx1, this.ct+dy1, this.cr+dx2, this.cb+dy2); }; xLayer.prototype.swipeLayer = function(x1,y1,x2,y2,step,fn,wh){ tstep = Math.max(Math.max(Math.abs((y1-this.ct)/step),Math.abs((x2-this.cr)/step)),Math.max(Math.abs((y2-this.cb)/step),Math.abs((x1-this.cl)/step))); if(!this.clipactive) { this.clipactive=true; if(!wh) {wh=0;} if(!fn) {fn=0;} this.swipe(y1,x2,y2,x1,(y1-this.ct)/tstep,(x2-this.cr)/tstep,(y2-this.cb)/tstep,(x1-this.cl)/tstep,tstep,0,fn,wh); } }; xLayer.prototype.swipe = function(t,r,b,l,ts,rs,bs,ls,tstep,astep,fn,wh) { if(astep < tstep) { if(wh) {eval(wh);} astep++; this.clipBy(ls,ts,rs,bs); setTimeout(this.obj+".swipe("+t+","+r+","+b+","+l+","+ts+","+rs+","+bs+","+ls+","+tstep+","+astep+",'"+fn+"','"+wh+"')",50); } else { this.clipactive=false; this.clipTo(l,t,r,b); if(fn) {eval(fn);} } }; xLayer.prototype.scrollLayer = function(dx, dy) { if (this.cl + dx < 0) { dx = - this.cl; } else if (this.cr + dx > this._width) { dx = this._width - this.cr; } if (this.ct + dy < 0) { dy = - this.ct; } else if (this.cb + dy > this._height) { dy = this._height - this.cb; } this.clipTo(this.cl + dx, this.ct + dy, this.cr + dx, this.cb + dy); this.moveTo(parseInt(this._x) - dx, parseInt(this._y) - dy); }; xLayer.prototype.slideLayer = function(endx,endy,inc,speed,fn,wh) { if(!this.slideactive) { var distx = endx - this._x; var disty = endy - this._y; var num = Math.sqrt(Math.pow(distx,2)+Math.pow(disty,2))/inc; var dx = distx/num; var dy = disty/num; this.slideactive = 1; if(!wh) {wh=0;} if(!fn) {fn=0;} this.slide(dx,dy,endx,endy,speed,fn,wh); } }; xLayer.prototype.slide = function(dx,dy,endx,endy,speed,fn,wh) { if(this.slideactive && (Math.floor(Math.abs(dx)) < Math.floor(Math.abs(endx-this._x)) || Math.floor(Math.abs(dy)) < Math.floor(Math.abs(endy-this._y)))) { this.moveBy(dx,dy); if(wh) {eval(wh);} setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+speed+",'"+fn+"','"+wh+"')",speed); } else { this.slideactive = 0; this.moveTo(endx,endy); if(fn) {eval(fn);} } }; dd_is_active=0; dd_obj=0; dd_mobj=0; function lib_dd() { dd_is_active=1; if(browser.ns4up) { document.captureEvents(Event.MOUSEMOVE|Event.MOUSEDOWN|Event.MOUSEUP); } document.onmousemove=lib_dd_move; document.onmousedown=lib_dd_down; document.onmouseup=lib_dd_up; }; xLayer.prototype.dragdrop = function(obj) { if(!dd_is_active) {lib_dd();} this.layer.onmouseover = new Function("lib_dd_over("+this.obj+")"); this.layer.onmouseout = new Function("dd_mobj=0"); if(obj) {this.ddobj=obj;} }; xLayer.prototype.nodragdrop = function() { this.layer.onmouseover = ""; this.layer.onmouseout = ""; dd_obj=0; dd_mobj=0; }; function lib_dd_over(obj){dd_mobj=obj}; function lib_dd_up(e){dd_obj=0}; function lib_dd_down(e) { if(dd_mobj) { x = (browser.ns4up)?e.pageX:event.x||event.clientX; y = (browser.ns4up)?e.pageY:event.y||event.clientY; dd_obj = dd_mobj; dd_obj.clX = x-dd_obj._x; dd_obj.clY = y-dd_obj._y; } }; function lib_dd_move(e,y,rresize) { x = (browser.ns4up)?e.pageX:event.x||event.clientX; y = (browser.ns4up)?e.pageY:event.y||event.clientY; if(dd_obj) { nx = x-dd_obj.clX; ny = y-dd_obj.clY; if(dd_obj.ddobj) {dd_obj.ddobj.moveTo(nx,ny);} else dd_obj.moveTo(nx,ny); } if(!browser.ns4up) {return false;} }; function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }; function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }; function getAbsPos(elt,which) { iPos = 0; while (elt != null) { iPos += elt["offset" + which]; elt = elt.offsetParent; } return iPos; }; function setPosition(elt,positionername,dx,dy) { var positioner; if (browser.ie4Layer) { positioner = document.all[positionername]; } else { if (browser.dom) { positioner = document.getElementById(positionername); } else { positioner = document.images[positionername]; } } elt.left = getAbsX(positioner) + parseInt(dx); elt.top = getAbsY(positioner) + parseInt(dy); }; xLayer.prototype.fixPosition = function(imgname, dx, dy) { setPosition(this.css,imgname,dx,dy); this._x = this.css.left; this._y = this.css.top; }; function getLeft(id) { return (new xLayerFromID(id))._x; }; function getTop(id) { return (new xLayerFromID(id))._y; }; function moveTo(id, x, y) { (new xLayerFromID(id)).moveTo(x,y); }; function moveBy(id, x, y) { (new xLayerFromID(id)).moveBy(x,y); }; function show(id) { (new xLayerFromID(id)).show(); }; function hide(id) { (new xLayerFromID(id)).hide(); }; function getzIndex(id) { (new xLayerFromID(id)).getzIndex(); }; function setzIndex(id) { (new xLayerFromID(id)).setzIndex(); }; function setBgColor(id, color) { (new xLayerFromID(id)).setBgColor(color); }; function setBgImage(id, image) { (new xLayerFromID(id)).setBgImage(image); }; function isVisible(id) { (new xLayerFromID(id)).isVisible(); }; function getWidth(id) { return (new xLayerFromID(id))._width; }; function getHeight(id) { return (new xLayerFromID(id))._height; }; function setWidth(id, w) { (new xLayerFromID(id)).setWidth(w); }; function setHeight(id, h) { (new xLayerFromID(id)).setHeight(h); }; function setContent(id, html) { (new xLayerFromID(id)).setContent(html); }; function clipTo(id, x1, y1, x2, y2) { (new xLayerFromID(id)).clipTo(x1, y1, x2, y2); }; function clipBy(id, x1, y1, x2, y2) { (new xLayerFromID(id)).clipBy(x1, y1, x2, y2); }; function swipeLayer(id, x1,y1,x2,y2,step,fn,wh) { (new xLayerFromID(id)).swipeLayer(x1,y1,x2,y2,step,fn,wh); } ; function scrollLayer(id, dx, dy) { (new xLayerFromID(id)).scrollLayer(dx, dy); } ; function slideLayer(id, endx,endy,inc,speed,fn,wh) { (new xLayerFromID(id)).slideLayer(endx,endy,inc,speed,fn,wh); }; function dragdrop(id) { (new xLayerFromID(id)).dragdrop(); }; function nodragdrop(id) { (new xLayerFromID(id)).nodragdrop(); }; function fixPosition(id,imgname,dx,dy) { (new xLayerFromID(id)).fixPosition(imgname,dx,dy); }; 