/* DynAPI Distribution DynDocument Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: dynapi.api.DynElement */ function DynDocument(frame) { this.DynElement = DynElement; this.DynElement(); this.frame = frame; this.doc = this.frame.document; this._dyndoc = this; this.x = 0; this.y = 0; this.w = 0; this.h = 0; this._topZIndex = 10000; var o = this; this.frame.onresize = function() {o._handleResize()}; this.onResizeNS4 = "reload"; // or "redraw" this._created = false; }; var p = dynapi.setPrototype('DynDocument','DynElement'); p._remove = function() { this.elm=null; this.doc=null; this.frame=null; }; p.getBgColor = function() { return this.bgColor; }; p.getX = p.getY = p.getPageX = p.getPageY = dynapi.functions.Zero; p.getWidth = function() { if (!this.w) this.findDimensions(); return this.w; }; p.getHeight = function() { if (!this.h) this.findDimensions(); return this.h; }; p.findDimensions = function() { this.w=(dynapi.ua.ns||dynapi.ua.opera)? this.frame.innerWidth : this.elm.clientWidth; this.h=(dynapi.ua.ns||dynapi.ua.opera)? this.frame.innerHeight : this.elm.clientHeight; }; p.setBgColor = function(color) { if (color == null) color=''; if (dynapi.ua.ns4 && color == '') color = '#ffffff'; this.bgColor = color; this.doc.bgColor = color; }; p.setFgColor = function(color) { if (color == null) color=''; if (dynapi.ua.ns4 && color == '') color='#ffffff'; this.fgColor = color; this.doc.fgColor = color; }; p.insertChild = function(c,pos,usebp) { // Blueprint Enabled if (c && !c.isInline && c.parent == this) { if(pos) c.setPosition(pos); DynElement._flagPreCreate(c); if(usebp) c.isInline=c._noInlineValues=true; else { this.doc.write(c.getOuterHTML()); c._inserted = true; } } }; p.insertAllChildren = function(usebp,bpSrc) { // Blueprint Enabled var i,c,str =['']; var ch=this.children; for(i=0;i<\/script>'); } else { this.doc.write(str.join('\n')); this.doc.close(); } }; p._create = function() { var ua=dynapi.ua; this._created = true; if (ua.ns4) { this.css = this.doc; this.elm = this.doc; } else { this.elm = this.frame.document.body; this.css = this.frame.document.body.style; if (ua.ie) { this._overflow = this.css.overflow || ''; } if (this._cursor) this.css.cursor = this._cursor; } this.elm._dynobj = this; this.doc._dynobj = this; // DynKeyEvent needs this! this.findDimensions(); this.fgColor = this.doc.fgColor||''; this.bgColor = this.doc.bgColor||''; var divs; // create divs object - speeds up DOM browsers on Win32. Linux & Mac? if (ua.ie||ua.dom) { divs={}; var dv,all=(ua.ie||ua.opera)? document.all.tags('div') : document.getElementsByTagName('div'); var i=0,l=all.length; // very important! while (i'; if(!this._created) hbuf[cnt]=html; else { elm=new Layer(0,this.frame); elm.left=elm.top=0; var doc=elm.document; elm.clip.width=dynapi.document.w; elm.clip.height=dynapi.document.h; doc.open();doc.write(html);doc.close(); elm.visibility = 'inherit'; } } else { var pelm=this.elm; if(!this._created) hbuf[cnt]=html; else { if(ua.ie){ pelm.insertAdjacentHTML("beforeEnd",html); elm = pelm.children[pelm.children.length-1]; } else{ var r = pelm.ownerDocument.createRange(); r.setStartBefore(pelm); var ptxt = r.createContextualFragment(html); pelm.appendChild(ptxt); elm = pelm.lastChild; } } } }; function main() { if (dynapi.document==null) { dynapi.document = new DynDocument(dynapi.frame); if (dynapi.loaded) dynapi.document._create(); else dynapi.onLoad(function() { dynapi.document._create(); }); } }; if (!dynapi.loaded) main();