
////////////////////////////////////
//Start of div definition
////////////////////////////////////

function Div (parent) {

	var newDiv, parentObject;

	this.id = "div"+Div.instances++;

	if(browserSniffer.isDOM) {

		newDiv = document.createElement("div");

		with(newDiv) {

			id=this.id;
			style.left="0px";
			style.top="0px";
			style.position="absolute";
			style.visibility="hidden";
		}

		parentObject = parent ? parent.theDiv : document.body;
		parentObject.appendChild(newDiv);

	} else {

		if(browserSniffer.isNS4) {

			parentObject = parent ? parent.theDiv : window;	
			newDiv = new Layer(2000,parentObject);

			newDiv.name = this.id;
			newDiv.visibility="hide";
			newDiv.clip.width=2000;
			newDiv.clip.height=2000;

		} else {

			if(browserSniffer.isIE) {

				parentObject = parent ? parent.theDiv : document.body;

				parentObject.insertAdjacentHTML("BeforeEnd","<div style=\"position:absolute; width: 1px; visibility: hidden\" id=\""+this.id+"\"></div>");
				newDiv = document.all(this.id);
			}
		}
	}

	this.theDiv = newDiv;
}

//Instance members

Div.prototype.theDiv = null;
Div.prototype.id = "";


Div.prototype.write = function(text) {

	if(browserSniffer.isDOM || browserSniffer.isIE) {

		this.theDiv.innerHTML+=text;

	} else {

		this.theDiv.document.write(text);
		this.theDiv.document.close();
	}
}


Div.prototype.moveTo = function(x,y) {

	if(browserSniffer.isNS4) {

		this.theDiv.moveTo(x,y);

	} else {

    	this.theDiv.style.left = x + "px";
    	this.theDiv.style.top = y + "px";
	}
}


Div.prototype.offsetLeft = function() {

	if(browserSniffer.isDOM || browserSniffer.isIE) {

		return this.theDiv.offsetLeft;

	} else {

		if(browserSniffer.isNS4) {

			return this.theDiv.x;
		}
	}
}


Div.prototype.offsetTop = function() {

	if(browserSniffer.isDOM || browserSniffer.isIE) {

		return this.theDiv.offsetTop;

	} else {

		if(browserSniffer.isNS4) {

			return this.theDiv.y;
		}
	}
}


Div.prototype.show = function() {

	if(browserSniffer.isNS4) {

		this.theDiv.visibility = "show";

	} else {

		this.theDiv.style.visibility = "visible";
	}
}


Div.prototype.hide = function() {

	if(browserSniffer.isNS4) {

		this.theDiv.visibility = "hide";

	} else {

		this.theDiv.style.visibility = "hidden";
	}
}


//Static members

Div.instances=0;
