function _UserAgent() {
	var b = navigator.appName;
	var v = this.version = navigator.appVersion;
	var ua = navigator.userAgent.toLowerCase();	
	this.v = parseInt(v);
	this.safari = ua.indexOf("safari")>-1;	// always check for safari & opera 
	this.opera = ua.indexOf("opera")>-1;	// before ns or ie
	this.ns = !this.opera && !this.safari && (b=="Netscape");
	this.ie = !this.opera && (b=="Microsoft Internet Explorer");
	this.gecko = ua.indexOf('gecko')>-1; // check for gecko engine
	this.firefox=(ua.indexOf("firefox/") != -1)?true:false;
	if (this.firefox) {
		this.b = "Firefox";
	}else if (this.ie) {
		this.ie4 = this.ie5 = this.ie55 = this.ie6 = false;
		if (v.indexOf('MSIE 4')>0) {this.ie4 = true; this.v = 4;}
		else if (v.indexOf('MSIE 5')>0) {this.ie5 = true; this.v = 5;}
		else if (v.indexOf('MSIE 5.5')>0) {this.ie55 = true; this.v = 5.5;}
		else if (v.indexOf('MSIE 6')>0) {this.ie6 = true; this.v = 6;}
		else if (v.indexOf('MSIE 7')>0) {this.ie6 = true; this.v = 7;}
		this.b = "MSIE";
	}else if (this.opera) {
		this.v=parseInt(ua.substr(ua.indexOf("opera")+6,1)); // set opera version
		this.opera6=(this.v>=6);
		this.opera7=(this.v>=7);
		this.b = "Opera";
	}else if (this.safari) {
		this.ns6 = (this.v>=5);	// ns6 compatible correct?
		this.b = "Safari";
	}else if (this.ns) {
		this.ns4 = (this.v==4);
		this.ns6 = (this.v>=5);
		this.b = "Netscape";
	}
	if (this.opera) {
		this.strict=!(document.compatMode=="QuerskMode");
	}else {
		this.strict=!(typeof(document.compatMode)=="undefined" || (document.compatMode=="BackCompat"));
	}
	this.dom = (document.createElement && document.appendChild && document.getElementsByTagName)? true : false;
	this.def = (this.ie||this.dom);
	this.win32 = ua.indexOf("win")>-1;
	this.mac = ua.indexOf("mac")>-1;
	this.other = (!this.win32 && !this.mac);
	this.supported = (this.def||this.ns4||this.ns6||this.opera)? true:false;
	this.broadband=false;
	this._bws=new Date; // bandwidth timer start 
};
is = new _UserAgent();

function DomWindow() {
	function AddEventListener(pEventName,pEventFunc) {
		if (window.addEventListener) {
			window.addEventListener(pEventName,pEventFunc,false);
		} else 
		if (window.attachEvent) {
			window.attachEvent("on"+pEventName,pEventFunc);
		} 
	}
	AddEventListener("load",DomWindow.Loader);
	AddEventListener("resize",DomWindow.dispatchEvent);
	this.observers=[];
}
DomWindow.EventFuncs=[];
DomWindow.Loader=function(e) {
	var l=DomWindow.EventFuncs.length;
	for (var i=0;i<l;i++) {
		DomWindow.EventFuncs[i]();
	}
	e.returnValue=false;
	return false;
}
DomWindow.dispatchEvent=function(e) {
	var evt=e.type;
	var w,observers;
	w=Window;
	if (w.observers[evt]) {
		observers=w.observers[evt];
		for (var i=0;i<observers.length;i++) {
			if (observers[i]["on"+evt]) 
				observers[i]["on"+evt](e);
		}
	}	
};
p=DomWindow.prototype;
p.addLoadFunc=function(func) {
	DomWindow.EventFuncs.push(func);
}
p.addObserver=function(observer,evt) {
	var a=arguments;
	var evts=evt.split(" ");
	for (var i=0;i< evts.length;i++) {
		if (!this.observers[evts[i]]) this.observers[evts[i]]=[];
		this.observers[evts[i]].push(observer)
	}
}
Window=new DomWindow(window);

/****************
DomEvent
****************/


function DomEvent(type,src) {
	this.className="DomEvent";
	this.type=type;
	this.src=src;
	this.bubble=false;
	this.propergate=true;
	this.returnValue=true;
	this.notify=true;
	this.beenHere={};
}
var p=DomEvent.prototype;
p.getSource=function() {
	return this.src;
}
p.cancelEvent=function() {
	this.bubble=false;
	this.notify=false;
}
p.stopPropagation=function() {
	this.propagate=false;
}
p.dontNotify=function() {
	this.notify=false;
}
p.addMember=function(name,value) {
	this[name]=value;
}


/****************
Object
****************/

function extending(p,vSuper) {		
	var oSuper,sProp,extended;
	oSuper = (typeof(vSuper) == 'string') ? eval('new '+vSuper+'()') : vSuper;
	for (sProp in oSuper){ 
		if (!p[sProp]) {
			p[sProp] = oSuper[sProp];
		}else {
			p["__"+oSuper.__className+"_"+sProp]=oSuper[sProp];
		}
	};
	p.__superClass = oSuper.__className;
	delete oSuper;
};

function CObject() {
	this.__className = "CObject";
}
p=CObject.prototype;
p.getClass=function() {
	return this.__className;
}
p.__superClass = null;
//p.__extended = null;

p.addProperty = function () {
	
	var a=arguments;
	var aL=a.length;
	var sName=a[0];
	var sType=a[1]||null;
	var sValue=a[2];
	var sAllowNull=a[3]||false;
	var sFuncName = sName.charAt(0).toUpperCase() + sName.substring(1, sName.length);
		
	this[sName]=sValue;
    this["get" + sFuncName] = function () { 
	    if (this[sName]===null)
	    	if (arguments.length>0)
	    		return arguments[0]; 
	    return this[sName];
	};
    this["set" + sFuncName] = function (vNewValue,noBubble) {
	    var oSpecificEvent,vType;
		var vOldValue=this[sName];
		if (this[sName+"_type"]){
			vType=(vNewValue==null)?"null":typeof(vNewValue);
			switch (vType) {
				case "string":
				case "number":
				case "function":
				case "object":
				case "boolean":
					if (sType===vType) {
						return true;
					}
				break;
				case "null":
				case "undefined":
					if (sAllowNull) {
						return true;
					}
				break;
			}
			alert("Property " + sName + " must be of type " + sType + ". (null: "+(!sAllowNull?"":"not ")+" allowed)");
			return false;
			
		}
		if (vOldValue!=vNewValue) {
			var oEvent = new DomEvent("propertychange",this);
			oEvent.addMember("oldValue",vOldValue);
			oEvent.addMember("newValue",vNewValue);
			oEvent.dontNotify();
			this.onpropertychange(oEvent);
			if (oEvent.returnValue) {
				this[sName]=oEvent.newValue;
				if (!noBubble && this["on"+sFuncName+"Changed"]) {
					oSpecificEvent=new DomEvent(sFuncName+"Changed",this);
					oSpecificEvent.addMember("oldValue",vOldValue);
					oSpecificEvent.addMember("newValue",oEvent.newValue);
					this["on"+sFuncName+"Changed"](oSpecificEvent);
				}
			}
	        return oEvent.returnValue;
		}
		return false;
    };
   
}

/****************
DomObject
****************/

function DomObject() {
	this.__className="DomObject";
	extending(this,new CObject());
	var a=arguments;
	var id=a[0]||'DomObject_'+(DomObject.counter++);
	var cssClassName=a[1];
	var content=a[2];
	var lElm,lElmExists;	
	var lPosition;
	var lTop=0,lLeft=0,lHeight=null,lWidth=null,lZIndex=null;
	lElm=document.getElementById(id);
	lElmExists=(lElm!=null);
	if (!lElmExists)	{
		lElm=document.createElement("div");
		lElm.setAttribute("id",id);
		if (cssClassName) lElm.className=cssClassName;
		if (content) lElm.innerHTML=content;
		this.elm=lElm;
		this.position="undefined";
		this.box=null;
	} else {
		if (content) lElm.innerHTML=content;
		if (cssClassName) lElm.className=cssClassName;
		this.elm=lElm;
		
		this.getBox(lElm);
		this.position=this.box.position;
		switch (this.position) {
			case "absolute":
				lTop=this.box.pageTop;
				lLeft=this.box.pageLeft;
				lWidth=this.box.width;
				lHeight=this.box.height;
			break;
			case "relative":
				lTop=this.box.top;
				lLeft=this.box.left;
				lWidth=this.box.width;
				lHeight=this.box.height;
			break;
		}			
	}
	// the real dom element (or null)
	//this.addProperty("elm","object",elm);
	
	// this.elm is added to the Dom
	this.addProperty("dominized","boolean",lElmExists);
	
	// this.elm is added to the Dom
	this.addProperty("registered","boolean",false);
	
	// this.elm is added to the Dom
	this.addProperty("mouseEvents","boolean",false);

	// this.elm was found in the document
	this.addProperty("inDom","boolean",lElmExists);
	
	// the parent DomObject of this (or null)
	this.addProperty("parent","object",null,true);
	
	
	this.addProperty("cssClassName","string",cssClassName);
	
	// the dom document this.elm is in (if inDom)
	this.addProperty("doc","object",lElmExists?document:null,true);
	
	this.addProperty("id","string",id,false);
	this.addProperty("content","string",content,true);
	
	this.addProperty("top","number",lTop);
	this.addProperty("left","number",lLeft);
	this.addProperty("width","number",lWidth,true);
	this.addProperty("height","number",lHeight,true);
	this.addProperty("zIndex","number",lZIndex,true);
	this.addProperty("minWidth","number",0);
	this.addProperty("minHeight","number",0);
	this.children=new CList();
	this.isDomObject=true;
	this.observers=[];
	this.eventHistory=new CList();
}
// static members
//DomObject.is=is;
DomObject.counter=0;
DomObject.all=[];
	
var p=DomObject.prototype;

p.addContentFirst=function (c,bNoClear) {
	this.elm.innerHTML=c+(!bNoClear?"":this.elm.innerHTML);
}

// Events
// a property is about to change
// if we set e.returnValue to false the properrty will not be allowed to change.
p.onpropertychange=function(e) {
	var res;
	var tmp;
	switch (e.propertyName)	{
	case "isDomObject":
		e.returnValue=false;
	break;
	case "width":
		if (e.newValue<this.minWidth) e.newValue=this.minWidth;
	break;
	case "height":
		if (e.newValue<this.minHeight) e.newValue=this.minHeight;
	break;
	case "inDom":
	// the dom document this.elm is in (if inDom)
	case "doc":

	
	case "tagType":
		
	}
	return true;
}

// property Changed
p.onCssClassNameChanged=function(e) {
	this.box=null;
}
p.onIdChanged= function(e) {
	e.dontNotify();
	if (e.oldValue && DomObject.all[e.oldValue]) {
		delete DomObject.all[e.oldValue];
	}
	DomObject.all[e.newValue]=this;
	this.setRegistered(true,false);
}
p.onMinWidthChanged= function(e) {
	var box=this.getBox();
	if (box.width<e.newValue) {
		this.setSize(e.newValue,null);
	}
}
p.onMinHeightChanged= function(e) {
	var box=this.getBox();
	if (box.height<e.newValue) {
		this.setSize(null,e.newValue);
	}
}

p.onMouseEventsChanged=function onMouseEventsChanged(e) {
	var o=e.getSource();
	var elm=o.elm;
	if (e.newValue) {	
		if (elm.addEventListener) { 
			elm.addEventListener("mousemove",DomObject.mouseEvent,false);
			elm.addEventListener("mousedown",DomObject.mouseEvent,false);
			elm.addEventListener("mouseup",DomObject.mouseEvent,false);
			elm.addEventListener("mouseover",DomObject.mouseEvent,false);
			elm.addEventListener("mouseout",DomObject.mouseEvent,false);
			elm.addEventListener("click",DomObject.mouseEvent,false);
			elm.addEventListener("dblclick",DomObject.mouseEvent,false);
		} else {
			elm.onmouseover = elm.onmouseout = elm.onmousedown = elm.onmouseup = elm.onclick = elm.ondblclick = elm.onmousemove = DomObject.mouseEvent;
		}
	} else {
		if (elm.removeEventListener) {
			elm.removeEventListener("mousemove",DomObject.mouseEvent,false);
			elm.removeEventListener("mousedown",DomObject.mouseEvent,false);
			elm.removeEventListener("mouseup",DomObject.mouseEvent,false);
			elm.removeEventListener("mouseover",DomObject.mouseEvent,false);
			elm.removeEventListener("mouseout",DomObject.mouseEvent,false);
			elm.removeEventListener("click",DomObject.mouseEvent,false);
			elm.removeEventListener("dblclick",DomObject.mouseEvent,false);
		} else {
			elm.onmouseover = elm.onmouseout = elm.onmousedown = elm.onmouseup = elm.onclick = elm.ondblclick = elm.onmousemove = null;
		}
	}
	e.dontNotify();

}

p.toString=function toString() {
	return "DomObject.all['"+this.getId()+"']";
}

p.getBox=function getBox(elm) {
	if (!elm) elm=this.elm;
	return this.box=DomObject.getBox(elm);
}
p.dominize=function dominize(noevt) {
	var lElm,lCss;
	var lParent;
	var l=this.children.getLength();
	var lTop,lLeft,lWidth,lHeight,lZIndex,lPosition;
	var coTop,coLeft,coWidth,coHeight,coZindex,coBox,coCoord;
	if (!this.getRegistered()){
		this.setRegistered(true,false);
		DomObject.all[this.getId()]=this;
	}
	if (this.getDominized()) return false;
	lElm=this.elm;
	lCss=lElm.style;
	lParent=this.getParent();
	
	if (!lParent) {
		// it does not matter what position is set in the stylesheet
		document.body.appendChild(lElm);
		this.setDoc(document);
				
	} else {
		lParent.elm.appendChild(lElm);
		this.setDoc(lParent.getDoc());
	}
	lPosition=this.getComputedStyle("position");
	if (lPosition=="" || lPosition=="undefined") {
		coCoord=this.getAbsoluteCoords();
		lTop=coCoord.top;
		lLeft=coCoord.left;
		lWidth=Math.max(lElm.scrollWidth,lElm.offsetWidth);
		lHeight=Math.max(lElm.offsetHeight,lElm.scrollHeight);
		lElm.style.position="absolute";
	} else {
		this.position=lPosition;
		coBox=this.getBox();
		lTop=coBox.top;
		lLeft=coBox.left;
		lWidth=coBox.width;
		lHeight=coBox.height;
	}
	this.setDominized(true);
	this.moveTo(lTop,lLeft);
	this.setSize(lWidth,lHeight);
	for (var i=0;i<l;i++) {
		this.children.getAt(i).dominize();
	}
	if (!noevt) this.invokeEvent("dominize");
	return true;

}

p.attachTo=function attachTo(oTarget,pVertical,pHorizontal,pTop,pLeft,dir) {
	var newTop=0,newLeft=0;
	var myBox=this.getBox();
	var sBox=oTarget.getBox();
	if (!pVertical) pVertical="Top";
	if (!pHorizontal) pHorizontal="Right";
	if (!dir) dir="right";
	if (!pTop) pTop=0;
	if (!pLeft) pLeft=0;

	switch (pVertical) {
		case "Top":
			newTop=sBox.pageTop;											// TOP
		break;
		case "TopInner":
			newTop=sBox.pageTop+sBox.innerTop;								// TOPINNER
		break;
		case "Center":
			newTop=sBox.pageTop+Math.round(sBox.outerHeight/2)+1;			// CENTER
		break;
		case "CenterInner":
			newTop=sBox.pageTop+sBox.innerTop+Math.round(sBox.height/2)+1;	// CENTERINNER
		break;
		case "Bottom":
			newTop=sBox.pageTop+sBox.outerHeight+1;							// BOTTOM
		break;
		case "BottomInner":
			newTop=sBox.pageTop+sBox.innerTop+sBox.height+1;				// BOTTOMINNER
		break;
	}
	switch (pHorizontal) {
		case "Left":
			newLeft=sBox.pageLeft;											// LEFT
			if (dir=="left") {
				newLeft-=myBox.outerWidth;
			}
		break;
		case "LeftInner":
			newLeft=sBox.pageLeft+sBox.innerLeft;							// LEFTINNER
			if (dir=="left") {
				newLeft-=myBox.outerWidth;
			}
		break;
		case "Center":
			newLeft=sBox.pageLeft+Math.round(sBox.outerWidth/2)+14;			// CENTER
			if (dir=="left") {
				newLeft-=(myBox.outerWidth+1);
			}
		break;
		case "CenterInner":
			newLeft=sBox.pageLeft+sBox.innerLeft+Math.round(sBox.width/2)+1;// CENTERINNER
			if (dir=="left") {
				newLeft-=(myBox.outerWidth+1);
			}
		break;
		case "Right":
			newLeft=sBox.pageLeft+sBox.outerWidth+1;						// RIGHT
			if (dir=="left") {
				newLeft-=(myBox.outerWidth+1);
			}
		break;
		case "RightInner":
			newLeft=sBox.pageLeft+sBox.innerLeft+sBox.width+1;			// RIGHTINNER
			if (dir=="left") {
				newLeft-=(myBox.outerWidth+1);
			}
		break;
	}
	return {'top':newTop+pTop, 'left': newLeft+pLeft};
}
p.follow=function() {
	
}

var evtHistory=new CList();
DomObject.mouseEvent=function mouseEvent(e) {
	var srcElm,src,type,aAll,origin;
	if (!e) {
		e=window.event;
		srcElm=e.srcElement;
	} else {
		srcElm=e.target;
	}
	aAll=DomObject.all;
	origin=srcElm;
	while (srcElm) {
		if (src=aAll[srcElm.id]) break;
		srcElm=srcElm.parentNode;
	}
	if (!src) {
		return false;
	}
	type=e.type;
	type=type.charAt(0).toUpperCase() + type.substring(1, type.length);
	var oEvt=new DomEvent(type,src);
	oEvt.addMember("origin",origin);
	switch (type) {
		case "Mouseover":
/*			if (e.relatedTarget) relTarg = e.relatedTarget;
			else if (e.fromElement) relTarg = e.fromElement;
*/			
		// we only send mouseover if we have not send it since last MouseOut on the object
		if (evtHistory.addUnique(src.getId())==-1){ // add unique returns the index that the object has or -1 if not found
			src.invokeEvent(type,oEvt)
		} else {
			oEvt.returnValue=false;
		}
		break;
		case "Mouseout":
/*			if (e.relatedTarget) relTarg = e.relatedTarget;
			else if (e.toElement) relTarg = e.toElement;
*/
		// we only send mouseout if we have sendt a mouse over
		if (evtHistory.removeUnique(src.getId())!=-1){ // remove unique returns the index that the object has or -1 if not found
			oEvt.addMember("origin",origin);
			src.invokeEvent(type,oEvt)
		} else {
			oEvt.returnValue=false;
		}
		break;
		default:
			src.invokeEvent(type,oEvt)
	}
	
	return true;
}


p.addChild=function addChild(pChild,noevt) {
	var lParent;
	lParent=pChild.getParent();	
	if (lParent==this) return;
	if (lParent) lParent.removeChild(pChild,false);
	
	pChild.setParent(this);
	this.children.addUnique(pChild);
	if (this.getDominized()) {
		pChild.dominize();
		
	}
	
}

p.remove=function remove(noevt) {
	var lParent=this.getParent();
	if (!lParent) {
		if (this.getDominized()) {
			this.parentNode.removeChild(this.elm);
			this.setDominized(false);
		} else {
			// DomObject.elm was created in constructor but never added to anywhere
		}
	} else {
		lParent.removeChild(this,noevt);
	}
	
}
p.removeChild=function removeChild(pChild,noevt) {
	if (!noevt) pChild.invokeEvent("beforeRemove");
	if (pChild.getDominized()) {
		this.elm.removeChild(pChild.elm);
		pChild.setDominized(false);
	}
	pChild.setParent(null);
	this.children.removeUnique(pChild);

	if (!noevt) pChild.invokeEvent("afterRemove");
}

p.getPagePos=function getPagePos() {
	return this.getAbsoluteCoords();	
}

p.getPageTop=function getPageTop() {
	var a;
	a=this.getAbsoluteCoords();
	return a.top;
}
p.getPageLeft=function getPageLeft() {
	a=this.getAbsoluteCoords();
	return a.left;
}

// width (W)
p.setCssValue=function setCssValue(pProp,pValue) {
	var lCss=this.elm.style;
	lCss[pProp]=pValue;
	this.box=null;
	return lCss;
}

p._moveTo=function() {
	var lCss=this.setCssValue("left",this.getLeft()+"px");
	lCss.top=this.getTop()+"px";
}
p._setSize=function() {
	var lTmp;
	if (lTmp=this.getWidth()) this.setCssValue("width",lTmp+"px");
	if (lTmp=this.getHeight()) this.setCssValue("height",lTmp+"px");
}

p.moveTo=function(pTop,pLeft,noevt) {
	if (pTop!=null) this.setTop(pTop,false);
	if (pLeft!=null) this.setLeft(pLeft,false)
//	if (this.getDominized()) {
		this._moveTo();
		if (!noevt) this.invokeEvent('move');
//	}
};
	
p.moveBy=function(pTop,pLeft,noevt) {
	this.moveTo(pTop+this.getTop(),pLeft+this.getLeft(),noevt);
}
p.resizeBy=function(pWidth,pHeight,noevt) {
	this.setSize(pWidth+this.getWidth(),pHeight+this.getHeight(),noevt);
}
/*
p._setClip=function() {
	var w,h;
	if (this.css!=null) {
		w=parseInt(this.getW());
		w=isNaN(w)?'auto':w+'px';
		h=parseInt(this.getH());
		w=isNaN(h)?'auto':h+'px';
		this.css.clip = 'rect(0px '+w+' '+h+' 0px)';
	}
}
*/
p.setSize=function(pWidth,pHeight,noevt) {
	if (pWidth!=null) this.setWidth(pWidth,noevt);
	if (pHeight!=null) this.setHeight(pHeight,noevt);
	
	if (this.getDominized()) {
		//this._setSize();
		//this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)';
	    if (noevt!=false) this.invokeEvent('resize');
	}
}

p.opacity=function(opacity,noevt) {
	var elm=this.elm;
	var css=elm.style;
	if (document.all) {
		css.filter="alpha(opacity=100)";
		elm.filters.alpha.opacity  = opacity;
	} else {
		var opaci=""+(opacity/100)+"";
		css.opacity = opaci;
	}
}

p.invokeEvent	= function(evt,e) {
	var id=this.getId();
	if (e && e.beenHere && e.beenHere[id]) return false;
	if (typeof(e) =="undefined") {
		e=new DomEvent(evt,this)
	}

	e.beenHere[id]=true;
	if (this["on"+evt]) {
		this["on"+evt](e);
	}
	if (e.notify) this.dispatchEvent(e);
}
p.dispatchEvent=function(e) {
	var evt=e.type;
	var bNotCyclic=(this.eventHistory.addUnique(evt)==-1); // add unique returns the index that the object already has or -1 if not found
	if (bNotCyclic && this.observers[evt]) {
		var observers=this.observers[evt];
		for (var i=0;i<observers.length;i++) {
			if (observers[i]["on"+evt]) {
				observers[i]["on"+evt](e);
			}
		}
	}
	this.eventHistory.removeUnique(evt);	
};
p.addObserver=function(observer,evt) {
	var a=arguments;
	var evts=evt.split(" ");
	for (var i=0;i< evts.length;i++) {
		if (!this.observers[evts[i]]) this.observers[evts[i]]=[];
		this.observers[evts[i]].push(observer)
	}
}
p.getComputedStyle= function(prop,bInt) {
	var elm=this.elm;
	if (!elm) return null;
	return DomObject.getComputedStyle(elm,prop,bInt);
}
p.getAbsoluteCoords= function() {
	var elm=this.elm;
	if (!elm) return null;
	return DomObject.getAbsoluteCoords(elm)
}
p.getAllInfo= function(bNLasBR) {
	var elm=this.elm;
	var NL=(!bNLasBR)?"\n":"<br>";
	if (!elm) return null;
	var box=this.getBox();
	var c= '----class--------' + NL +
	  'class: '+elm.className + NL +
	  '----color--------' + NL +
	  'color: '+this.getComputedStyle('color') + NL +
	  'backgroundcolor: '+this.getComputedStyle('background-color') + NL;
	var b='';
	for (var j in box) {
		b+=j+': '+ box[j]+ NL;
	}
	b+='========================'+ NL;
	var p='';
	if (this.parent) {
		p+=this.parent.getAllInfo(bNLasBR);
	}	  
	return c+b+p;
}
p.getAllComputedStyles= function(bNLasBR) {
	var elm=this.elm;
	var NL=(!bNLasBR)?"\n":"<br>";
	if (!elm) return null;
	  var p='';
	  var offsetLeft=elm.offsetLeft;
	  var offsetTop=elm.offsetTop;
	  var s = this.id+
	  	  NL+'--------------------'+NL+
	  	  'offsetLeft: ' + elm.offsetLeft + NL +
          'offsetTop: ' + elm.offsetTop + NL +
	  	  'offsetWidth: ' + elm.offsetWidth + NL +
          'offsetHeight: ' + elm.offsetHeight + NL +
	  	  'clientLeft: ' + elm.clientLeft + NL +
          'clientTop: ' + elm.clientTop + NL +
	  	  'clientWidth: ' + elm.clientWidth + NL +
          'clientHeight: ' + elm.clientHeight + NL;
      var a=this.getAbsoluteCoords();
	  var c= NL+'----computed--------' + NL +
  	  	  'position:'+ this.getComputedStyle('position') + NL +
  	  	  '    --- left  ---' + NL +
	  	  'offsetLeftTot:'+a.left + NL+
	  	  'pixelLeft:'+ this.getComputedStyle('pixelLeft', true) + NL +
          'left:'+ this.getComputedStyle('left', true) + NL +
          'border-left-width: ' + this.getComputedStyle('border-left-width', true) + NL +
          'padding-left: ' + this.getComputedStyle('padding-left', true) + NL +
          '    ---  top  ---' + NL +
	  	  'offsetTopTot:'+a.top + NL+
          'pixelTop:'+ this.getComputedStyle('pixelTop', true) + NL +
          'top:'+ this.getComputedStyle('top', true) + NL +
          'border-top-width: ' + this.getComputedStyle('border-top-width', true) + NL +
          'padding-top: ' + this.getComputedStyle('padding-top', true) + NL +
          '    --- other ---' + NL +
          'width: ' + this.getComputedStyle('width', true) + NL +
          'height: ' + this.getComputedStyle('height', true) + NL +
          'border-right-width: ' + this.getComputedStyle('border-right-width', true) + NL +
          'border-bottom-width: ' + this.getComputedStyle('border-bottom-width', true) + NL +
          'padding-right: ' + this.getComputedStyle('padding-right', true) + NL +
          'padding-bottom: ' + this.getComputedStyle('padding-bottom', true)+ NL;
	return s+p+c;
}
/* Static Methods */
DomObject.getAbsoluteCoords = function getAbsoluteCoords(elm) {
		var a={'top':0,'left':0};
		if (elm==null) return a;
		try {
			a = DomObject.getAbsoluteCoords(elm.offsetParent);
		}
		catch (e) {
		}
		return { 'top': a.top+elm.offsetTop, 'left': a.left+elm.offsetLeft };
		
	}
DomObject.getComputedStyle = function getComputedStyle(elm, prop, bInt) {
	var p = 'undefined';
		  			  
	if(document.defaultView && document.defaultView.getComputedStyle){
		p = document.defaultView.getComputedStyle(elm,'').getPropertyValue(prop);
	}
	else { 
		var a = prop.split('-');
		prop = a[0];
		for (var i=1; i<a.length; ++i) {
			c = a[i].charAt(0);
			prop += a[i].replace(c, c.toUpperCase());
		}
		if(elm.currentStyle) {
			// convert css property name to object property name for IE
			p = elm.currentStyle[prop];
		} else {
			if (elm.style[prop]) p=elm.style[prop];
		}			  
	}
  return bInt ? (parseInt(p) || 0) : p;
}

DomObject.getBox=function (elm) {
	var box,coord;
	var className=elm.className;
	var id=elm.id;
	coord=DomObject.getAbsoluteCoords(elm);
	var CPosition=DomObject.getComputedStyle(elm,"position");

	var CTop,CLeft,CWidth,CHeight,CLineHeight;
	    CTop    = DomObject.getComputedStyle(elm,"top");
	    CLeft   = DomObject.getComputedStyle(elm,"left");
	    CWidth  = DomObject.getComputedStyle(elm,"width");
	    CHeight = DomObject.getComputedStyle(elm,"height");
	    CLineHeight = DomObject.getComputedStyle(elm,"line-height");
		
	
	//border as string
	var CboTop="0px", CboLeft="0px", CboRight="0px", CboBottom="0px";
	var CpaTop="0px", CpaLeft="0px", CpaRight="0px", CpaBottom="0px";
	var CmaTop="0px", CmaLeft="0px", CmaRight="0px", CmaBottom="0px";
	if (DomObject.getComputedStyle(elm,"border-top-style")!="none") 
		CboTop    = DomObject.getComputedStyle(elm,"border-top-width");
	if (DomObject.getComputedStyle(elm,"border-left-style")!="none") 
		CboLeft   = DomObject.getComputedStyle(elm,"border-left-width");
	if (DomObject.getComputedStyle(elm,"border-right-style")!="none") 
		CboRight  = DomObject.getComputedStyle(elm,"border-right-width");
	if (DomObject.getComputedStyle(elm,"border-bottom-style")!="none") 
		CboBottom = DomObject.getComputedStyle(elm,"border-bottom-width");
	//padding as string
	CpaTop    = DomObject.getComputedStyle(elm,"padding-top");
	CpaLeft   = DomObject.getComputedStyle(elm,"padding-left");
	CpaRight  = DomObject.getComputedStyle(elm,"padding-right");
	CpaBottom = DomObject.getComputedStyle(elm,"padding-bottom");
	
	// margin as string
	CmaTop    = DomObject.getComputedStyle(elm,"margin-top");
	CmaLeft   = DomObject.getComputedStyle(elm,"margin-left");
	CmaRight  = DomObject.getComputedStyle(elm,"margin-right");
	CmaBottom = DomObject.getComputedStyle(elm,"margin-bottom");
	
	// offsets as Int
	var OTop,OLeft,OWidth,OHeight;
		OTop=elm.offsetTop;
		OLeft=elm.offsetLeft;
		OWidth=elm.offsetWidth;
		OHeight=elm.offsetHeight;
		
	// scrolls as Int
	var STop,SLeft,SWidth,SHeight;
		STop=elm.scrollTop;
		SLeft=elm.scrollLeft;
		SWidth=elm.scrollWidth;
		SHeight=elm.scrollHeight;
		
	var PTop = coord.top;
	var PLeft = coord.left;
	
	var CTopInt,CLeftInt,CWidthInt,CHeightInt;
		CTopInt    = (CTop    != "auto" && CTop    != "undefined") ? parseInt(CTop)    : OTop;
		CLeftInt   = (CLeft   != "auto" && CLeft   != "undefined") ? parseInt(CLeft)   : OLeft;
		CWidthInt  = (CWidth  != "auto" && CWidth  != "undefined") ? parseInt(CWidth)  : OWidth;
		CHeightInt = (CHeight != "auto" && CHeight != "undefined") ? parseInt(CHeight) : OHeight;

	var CboTopInt=0, CboLeftInt=0, CboRightInt=0,CboBottomInt=0;
	var CpaTopInt=0, CpaLeftInt=0, CpaRightInt=0,CpaBottomInt=0;
	var CmaTopInt=0, CmaLeftInt=0, CmaRightInt=0,CmaBottomInt=0;
	var w;
	if (!isNaN(w=parseInt(CboTop)))    CboTopInt=w;
	if (!isNaN(w=parseInt(CboLeft)))   CboLeftInt=w;
	if (!isNaN(w=parseInt(CboRight)))  CboRightInt=w;
	if (!isNaN(w=parseInt(CboBottom))) CboBottomInt=w;
	
	if (!isNaN(w=parseInt(CpaTop)))    CpaTopInt=w;
	if (!isNaN(w=parseInt(CpaLeft)))   CpaLeftInt=w;
	if (!isNaN(w=parseInt(CpaRight)))  CpaRightInt=w;
	if (!isNaN(w=parseInt(CpaBottom))) CpaBottomInt=w;
	
	if (!isNaN(w=parseInt(CmaTop)))    CmaTopInt=w;
	if (!isNaN(w=parseInt(CmaLeft)))   CmaLeftInt=w;
	if (!isNaN(w=parseInt(CmaRight)))  CmaRightInt=w;
	if (!isNaN(w=parseInt(CmaBottom))) CmaBottomInt=w;
	
	var InnerTop    = CmaTopInt    + CpaTopInt    + CboTopInt;
	var InnerRight  = CmaRightInt  + CpaRightInt  + CboRightInt;
	var InnerBottom = CmaBottomInt + CpaBottomInt + CboBottomInt;
	var InnerLeft   = CmaLeftInt   + CpaLeftInt   + CboLeftInt;

	
	var PageTop,PageLeft,Top,Left,Width,Height,InnerTop,InnerLeft,InnerWidth,InnerHeight
	var HeightOuter,WidthOuter,HeightInner,WidthInner;
	
	HeightOuter = CHeightInt + InnerTop  + InnerBottom;
	WidthOuter  = CWidthInt  + InnerLeft +InnerRight;
	
	
/*
1-- Document -------------------------------------------------------\
|                                                                   |
|	2-- ParentBox -----------------------------------------------\  |
|	|                                                            |  |
|	|  3-- Element ---------------------------------------\      |  |
|	|  |                                            Margin|      |  |
|	|  | 4---------------------------------------------\  |      |  |
|	|  | |                                       Border|  |      |  |
|	|  | | 5----------------------------------------\  |  |      |  |
|	|  | | | a-----------\                   Padding|  |  |      |  |
|	|  | | | |6----------+---------Content-\        |  |  |      |  |
|	|  | | | ||          |                 |        |  |  |      |  |
|	|  | | | ||          |                 |        |  |  |      |  |
|	|  | | | ||          |                 |        |  |  |      |  |
|	|  | | | |\----------+-----------------7        |  |  |      |  |
|	|  | | | \---------- b                          |  |  |      |  |
|	|  | | \----------------------------------------8  |  |      |  |
|	|  | |                                             |  |      |  |
|	|  | \---------------------------------------------9  |      |  |
|	|  |                                                  |      |  |
|	|  \-------------------------------------------------10      |  |
|	|                                                            |  |
|	\------------------------------------------------------------/  |
|                                                                   |
\-------------------------------------------------------------------/

         1 0,0
         2 position of parentContainer
         3 pageTop (vertical distance from 1 to 3)
         3 pageLeft (horizontal distance from 1 to 3)
         3 top (vertical distance from 2 to 3)
         3 left (horizontal distance from 2 to 3)
         3 innerTop (vertical distance from 3 to 6)
         3 innerLeft (horizontal distance from 3 to 6)
         3 outerHeight (vertical distance from 3 to 10)
         3 outerWidth (horizontal distance from 3 to 10)
         4 marginTop (vertical distance from 3 to 4)
         4 marginLeft (horizontal distance from 3 to 4)
         5 borderTop (vertical distance from 4 to 5)
         5 borderLeft (horizontal distance from 4 to 5)
         5 paddingTop (vertical distance from 5 to 6)
         5 paddingLeft (horizontal distance from 5 to 6)
         6 height (vertical distance from 6 to 7)
         6 width (horizontal distance from 6 to 7)
         7 paddingBottom (vertical distance from 7 to 8)
         7 paddingRight (horizontal distance from 7 to 8)
         3 innerBottom (vertical distance from 7 to 10)
         3 innerRight (horizontal distance from 7 to 10)
         8 borderBottom (vertical distance from 8 to 9)
         8 borderRight (horizontal distance from 8 to 9)
         9 marginBottom (vertical distance from 9 to 10)
         9 marginRight (horizontal distance from 9 to 10)
		 
         a scrollHeight (vertical distance from a to b)
         a scrollWidth (horisontal distance from a to b)
         a scrollTop (vertical distance from a to 6)
         a scrollLeft (horisontal distance from a to 6)

*/	
	
	
	
	
	box = {
		'elm'           : elm,
		'id'	        : elm.id,
		'position'      : CPosition,
		'pageTop'       : PTop,
		'pageLeft'      : PLeft,
		'top'           : CTopInt,
		'left'          : CLeftInt,
		'innerTop'      : InnerTop,
		'innerLeft'     : InnerLeft,
		'innerBottom'   : InnerBottom,
		'innerRight'    : InnerRight,
		'outerHeight'   : HeightOuter,
		'outerWidth'    : WidthOuter,
		'width'         : CWidthInt,
		'height'        : CHeightInt,
		
		'marginTop'     : CmaTopInt,
		'marginLeft'    : CmaLeftInt,
		'marginRight'   : CmaRightInt,
		'marginBottom'  : CmaBottomInt,
				
		'borderTop'     : CboTopInt,
		'borderLeft'    : CboLeftInt,
		'borderRight'   : CboRightInt,
		'borderBottom'  : CboBottomInt,
		
		'paddingTop'    : CpaTopInt,
		'paddingLeft'   : CpaLeftInt,
		'paddingRight'  : CpaRightInt,
		'paddingBottom' : CpaBottomInt,
		
		'scrollTop'     : STop,
		'scrollLeft'    : SLeft,
		'scrollWidth'   : SWidth,
		'scrollHeight'  : SHeight,
		
		'offsetTop'     : OTop,
		'offsetLeft'    : OLeft,
		'offsetWidth'   : OWidth,
		'offsetHeight'  : OHeight,
		
		'lineHeight'	: CLineHeight
		
	}
	return box;
}

DomObject.getDomObjectByElm = function getDomObjectByElm(elm) {
		var id=elm.id;
		var o;
		if (!id) return null;
		if (o=DomObject.all[id]) return o;
		return null;
	}

DomObject.getAll = function getAll(id) {
		var o;
		if (!id) {
			o=DomObject.all;
		}else {
			o=DomObject.all[id];
		}
		return o;
	}
DomObject.repeat= function repeat() {
		var c=arguments[0]||0;
		var ch=arguments[1]||" ";
		var s='';
		for (var i=0;i<c;i++) {
			s+=ch;
		}
		return s;
		
	}
DomObject.describe =function describe() {
		var s=''
		var a=arguments;
		var indent=a[3]||0;
		var maxInd=a[0];
		var pre=DomObject.repeat(indent);
		var o=a[2];
		var n=a[1];
		if (indent>maxInd) return "";
		switch (typeof o) {
			case "string":
				s+=pre+n+":s:{"+o+"}<br> ";
			break;
			case "number":
				s+=pre+n+":n:{"+o+"}<br> ";
			break;
			case "function":
				s+=pre+n+":f:{"+o+"}<br> ";
			break;
			case "boolean":
				s+=pre+n+":b:{"+o+"}<br> ";
			break;
			case "object":
				s+=pre+n+":o:{<br>";
				for (var prop in o) {
					try {
						s+=DomObject.describe(maxInd,prop,o[prop],indent+1);
					}
					catch(e) {
					}
				}
				s+="}<br>";
			break;
			case "undefined":
				s+=pre+n+":u:{}<br> ";
			break;
		}
		return s;
	}
