/*********************************************************
DOM Library based upon dhtmlcentral.com dhtml library by
Thomas Brattli. DOM Library by David Schonztler. Free to
use. Please include comments. For latest version/updates:
[ www.stilleye.com | madhatter@pullman.com ]
Check for browsers that support the document object model
added support for Gecko/Mozilla checking - MD
*********************************************************/
function checkDom()
{
	this.ver=navigator.appVersion.toLowerCase()
	this.agent=navigator.userAgent.toLowerCase()
	this.opera=(this.agent.indexOf('opera')>-1)?1:0
	this.mac=(this.agent.indexOf('mac')>-1)?1:0
	this.dom=(document.getElementById)?1:0
	this.ie=(document.all&&!this.opera)?1:0
	this.ie6=(this.dom&&this.ie&&this.ver.indexOf('msie 6')>-1)?1:0
	this.ie5=(this.dom&&this.ie&&!this.ie6)?1:0
	this.fox=(this.agent.indexOf('firefox')>-1)?1:0
	this.ns4=(document.layers)?1:0
	this.ns6=(this.dom&&!this.fox&&!this.ie)?1:0
	this.ns=(this.ns4||this.ns6)?1:0
	this.cldom=(this.dom&&!this.opera&&!this.mac&&!this.ns)?1:0
	this.bw=(this.dom||this.ie||this.ns||this.opera)?1:0
	return this
}
bw = new checkDom()

function getPageSize()
{
	this.x = document.documentElement.offsetWidth||document.body.offsetWidth||innerWidth||0
	this.y = document.documentElement.offsetHeight||document.body.offsetHeight||innerHeight||0
	this.x2 = parseInt(this.x/2)||0
	this.y2 = parseInt(this.y/2)||0
	this.sx = document.documentElement.scrollWidth||0
	this.sy = document.documentElement.scrollHeight||0
}
var pg

function getCoords(e)
{
	if(bw.ie) e = event
	this.x = e.clientX
	this.y = e.clientY
}

// make dom object
function makeDom(name)
{
	if(!document.getElementById) return null
	this.name = name
	this.evnt = document.getElementById(name)
	this.css = this.evnt.style
	this.x = this.css.pixelLeft || this.evnt.offsetLeft
	this.y = this.css.pixelTop || this.evnt.offsetTop
	this.w = this.css.pixelWidth || this.evnt.offsetWidth
	this.h = this.css.pixelHeight || this.evnt.offsetHeight
	this.id = name
	this.obj = name + 'Object'; eval(this.obj + '=this')

	makeDom.prototype.moveTo = function(x,y)
	{
		x = parseInt(x); y = parseInt(y)
		this.css.left = x+'px'
		this.css.top = y+'px'
		this.x = x
		this.y = y
	}
	makeDom.prototype.moveBy = function(x,y)
	{
		x = parseInt(x); y = parseInt(y)
		this.moveTo(this.x+x,this.y+y)
	}
	makeDom.prototype.centerIt = function(x,y,toDiv)
	{
		pg = new getPageSize()
		bigX = toDiv ? document.getElementById(toDiv).offsetWidth : pg.x
		bigY = toDiv ? document.getElementById(toDiv).offsetHeight : pg.y
		this.moveTo(x?parseInt((bigX-this.w)/2):this.x,y?parseInt((bigY-this.h)/2):this.y)
	}
	makeDom.prototype.show = function()
	{
		this.css.visibility = 'visible'
	}
	makeDom.prototype.hide = function()
	{
		this.css.visibility = 'hidden'
	}
	makeDom.prototype.vis = function()
	{
		this.css.visibility!='visible' ? this.show() : this.hide()
	}
	makeDom.prototype.clipTo = function(t,r,b,l,sW,sH)
	{
		this.cT = t; this.cR = r; this.cB = b; this.cL = l
		a = arguments
		for(k=0;k<a.length;k++) a[k] = a[k]>=0 ? a[k]+'px' : a[k]
		this.css.clip = 'rect('+t+','+r+','+b+','+l+')'
		if(sW) this.size(r,this.h)
		if(sH) this.size(this.w,b)
	}
	makeDom.prototype.clipBy = function(t,r,b,l,sW,sH)
	{
		this.clipTo(t+this.cT,r+this.cR,b+this.cB,l+this.cL,sW,sH)
	}
	makeDom.prototype.bg = function(clr,img,attribs)
	{
		if(img) this.css.background = (clr ? clr : '') + (img ? ' url('+img+')' : ' ') + (attribs ? ' '+attribs : '')
		else this.css.backgroundColor = clr
	}
	// I know innerHTML is not standard, but there is no better way, and *hopefully* innerHTML becomes a standard
	makeDom.prototype.writ = function(txt,where)
	{
		this.evnt.innerHTML = where ? where>0 ? this.evnt.innerHTML + txt : txt + this.evnt.innerHTML : txt
	}
	makeDom.prototype.size = function(w,h)
	{
		this.css.width = this.w = w>-1 ? w : this.w
		this.css.height = this.h = h>-1 ? h : this.h
	}
	makeDom.prototype.sizeBy = function(w,h)
	{
		this.size(this.w+w,this.h+h)
	}
}