function divObject(id,nestref) {
	if (ns) {
		if (ns4) {
			this.css = nestref ? eval("document."+nestref+".document."+id) : document.layers[id]
			this.ref = this.event = this.css
			this.doc = this.css.document
		}
		else if (ns5) {
			this.ref = document.getElementById(id)
			this.css = this.ref.style
			this.doc = document	
			this.x = window.getComputedStyle(this.ref,null).getPropertyValue("left")
			this.y =  window.getComputedStyle(this.ref,null).getPropertyValue("top")
			this.w = this.css.clip.width
			this.h = this.css.clip.height
		}
		if(!ns5)
		{
			this.x = this.css.left
			this.y = this.css.top
			this.w = this.css.clip.width
			this.h = this.css.clip.height
		}
		this.InnerObject("Img","images")
		this.InnerObject("Form","forms")
		this.InnerObject("Link","links")
	}
	else if (ie) {
		this.ref = this.event = document.all[id]
		this.css = document.all[id].style
		this.doc = document
		this.x = this.ref.offsetLeft
		this.y = this.ref.offsetTop
		this.w = ie4 ? this.css.pixelWidth : this.ref.offsetWidth
		this.h = ie4 ? this.css.pixelHeight : this.ref.offsetHeight
	}
	this.id = id
	this.nestref = nestref
	this.obj = id + "divObject"
	eval(this.obj + "=this")
}

function divObjectShow() {
	this.css.visibility = ns4 ? "show" : "visible"
}

function divObjectHide() {
	this.css.visibility = ns4 ? "hide" : "hidden"
}

function divObjectInherit() {
	this.css.visibility="inherit";
}

divObject.prototype.show = divObjectShow
divObject.prototype.hide = divObjectHide
divObject.prototype.inherit = divObjectInherit
divObjectTest = new Function('return true')

// divObjectInit Function
function divObjectInit(nestref) {
	if (ns&&(!ns5)) {
		if (nestref) docRef = eval('document.'+nestref+'.document')
		else {
			nestref = '';
			docRef = document;
			InnerObject("Img","images")
			InnerObject("Form","forms")
			InnerObject("Link","links")
		}
		var docLayLength=docRef.layers.length
		for (var i=0; i<docLayLength; i++) {
			var divname = docRef.layers[i].name
			nestRefArray[divname] = nestref
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new divObject("'+divname+'","'+nestref+'")')
			}
			if (docRef.layers[i].document.layers.length > 0) {
				refArray[refArray.length] = nestref==''? divname : nestref+'.document.'+divname
			}
		}
		if (refArrayI < refArray.length) {
			divObjectInit(refArray[refArrayI++])
		}
	}
	else if (ie||ns5) {
		var docDivs=ie ? document.all.tags("DIV") : document.getElementsByTagName("div");
		var docDivLength=docDivs.length
		for (var i=0; i<docDivLength; i++) {
			var divname = docDivs[i].id
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new divObject("'+divname+'")')
			}
		}
		InnerObject("Img","img")
		InnerObject("Form","form")
		InnerObject("Link","a")
	}
	return true
}
var nestRefArray = new Array()
var refArray = new Array()
var refArrayI = 0

// Write Method
function divObjectWrite(html) {
	if (ns) {
		this.doc.open()
		this.doc.write(html)
		this.doc.close()
	}
	else if (ie) {
		this.event.innerHTML = html
	}
}
divObject.prototype.write = divObjectWrite

// BrowserCheck
var bT = navigator.appName
var b;
if (bT=="Netscape") b = "ns"
else if (bT=="Microsoft Internet Explorer") b = "ie"
else b=bT
var version = navigator.appVersion
var v = parseInt(this.version)
var ns = b=="ns" && v>=4
var ns4 = b=="ns" && v==4
var ns5 = b=="ns" && v==5
var ie = b=="ie" && v>=4
var ie4 = version.indexOf('MSIE 4')>0
var ie5 = version.indexOf('MSIE 5')>0
var min = ns||ie



divObject.prototype.InnerObject=InnerObject;
function InnerObject(objName,objTag){
	if (ns5)var docElm=document.getElementsByTagName(objTag);
	else if(ns){
		var nestDiv=this.doc || document;
		var docElm=nestDiv[objTag];
	}
	else if(ie)var docElm=document.all.tags(objTag)
	loopObjectTag(docElm,docElm.length,objName,nestDiv);
}

function loopObjectTag(docElm,docElmLength,objName,nestDiv){
	for (var i=0; i<docElmLength; i++) {
		var elmName = docElm[i].name;
		if (elmName!='')eval(elmName+objName+'= new TypeObject(elmName,nestDiv)');
	}
}

function TypeObject(objName,nestDiv){
	this.name=objName;
	this.nestDiv=nestDiv || document.all;
	if (ie)this.ref=document.all[objName];
	else if(ns&&(!ns5))this.ref=nestDiv[objName];
	else if(ns5)this.ref=document.getElementById(objName);
}

function roll(imgObj,imgSrc){
	if (eval("typeof "+imgObj+"=='object'")){
		eval(imgObj+".ref.src = imgSrc.src");
	}
}