//////////////////////////////////////////////////////////////////////////
//
// NetWerk dhtml Bibliothek
// Autor: Martin Machau
// Version: 1.1
// Datum: 03.05.2006
//
// In dieser Datei bitte keine Änderungen durchführen.
//
//////////////////////////////////////////////////////////////////////////
/// Update 1.1. (AG): getclass und setclass

//////////////////////////////////////////////////////////////////////////
function browserobj() {
	this.ns4=document.layers&&!document.getElementById;
	this.ns6=document.getElementById&&!document.all;
	this.ie4=document.all;
	this.opr=navigator.userAgent.indexOf("Opera")+1;
	
	this.ms = document.all;
	this.ns = document.layers;
	this.dom = document.getElementById;
}
browserobj.prototype.innerWidth = function () {
	if(this.ns || this.opr) return window.innerWidth;
	else return document.body.offsetWidth;
}

var browser = new browserobj();

//////////////////////////////////////////////////////////////////////////
function divobj(id,width,height) {
	this.id = id;
	this.width = width;
	this.height = height;
	this.xpos = 0;
	this.ypos = 0;
}

divobj.prototype.getobject = function () {
	if(browser.dom) {
		if(typeof document.getElementById(this.id) == "object")	return document.getElementById(this.id);
		else return void(0);
	} else if(browser.ms) {
		if (typeof document.all[p2] == "object") return document.all[this.id];
		else return void(0);
	} else if(browser.ns) {
		if (typeof document[p2] == "object") return document[this.id];
		else return void(0);
	} else return void(0);
}

divobj.prototype.setstyle = function (name,value) {
	if(this.getobject()) {
		//if(browser.dom || browser.ms) this.getobject().style.setAttribute(name,value);
		if(browser.dom || browser.ms) this.getobject().style[name] = value;
		else if(browser.ns) this.getobject()[name] = value;
	}
}
divobj.prototype.getstyle = function (name) {
	if(this.getobject()) {
//		if(browser.dom || browser.ms) return this.getobject().style.getAttribute(name);
		if(browser.dom || browser.ms) return this.getobject().style[name];
		else if(browser.ns) return this.getobject()[name];
	}
}
divobj.prototype.setclass = function (value) {
	if(this.getobject()) {
		if(browser.dom || browser.ms) this.getobject().className = value;
//		else if(browser.ns) this.getobject()[name] = value;
	}
}
divobj.prototype.getclass = function () {
	if(this.getobject()) {
		if(browser.dom || browser.ms) return this.getobject().className;
//		else if(browser.ns) return this.getobject()[name];
	}
}
divobj.prototype.show = function () {
	if(browser.ns && !browser.dom) this.setstyle("visibility","show");
	else this.setstyle("visibility","visible");
}
divobj.prototype.visible = function () {
	var value = this.getstyle("visibility");
	if(value=="show" || value=="visible") return true
	else return false;
}
divobj.prototype.hide = function () {
	if(browser.ns && !browser.dom) this.setstyle("visibility","hide");
	else this.setstyle("visibility","hidden");
}
divobj.prototype.hidden = function () {
	var value = this.getstyle("visibility");
	if(value=="hide" || value=="hidden") return true
	else return false;
}
divobj.prototype.moveto = function (x,y) {
	if(x>=0) this.setstyle("left",x+"px");
	if(y>=0) this.setstyle("top",y+"px");
}
divobj.prototype.moveby = function (x,y) {
	this.setstyle("left",this.posx()+x+"px");
	this.setstyle("top",this.posy()+y+"px");
}
divobj.prototype.clip = function (t,r,b,l) {
	this.setstyle("clip","rect("+t+"px,"+r+"px,"+b+"px,"+l+"px)");
}
divobj.prototype.resize = function (w,h) {
	if(w>=0) this.setstyle("width",w+"px");
	if(h>=0) this.setstyle("height",h+"px");
}
divobj.prototype.posx = function () { return parseInt(this.getstyle("left")) }
divobj.prototype.posy = function () { return parseInt(this.getstyle("top")) }
divobj.prototype.posw = function () { return parseInt(this.getstyle("width")) }
divobj.prototype.posh = function () { return parseInt(this.getstyle("height")) }

divobj.prototype.getcontent = function (text) {
	var obj = this.getobject();
	if(obj) {
		if(browser.dom && obj.firstChild) {
			return obj.firstChild.nodeValue;
		}
		if(browser.ms) {
			return obj.innerText;
		}
	}
	return false;
}

divobj.prototype.setcontent = function (text) {
	var obj = this.getobject();
	if(obj) {
		if(browser.dom && obj.firstChild) {
			obj.firstChild.nodeValue = text;
			return true;
		}
		if(browser.ms) {
			obj.innerText = text;
			return true;
		}
		if(browser.ns) {
			obj.document.open();
			obj.document.write(text);
			obj.document.close();
			return true;
		}
	}
	return false;
}

function divobj_help_posx(obj) {
	if(browser.dom) {
		if (obj.offsetParent) return (obj.offsetLeft + divobj_help_posx(obj.offsetParent));
		else return (obj.offsetLeft);
	} else {
		return obj.pageX;
	}
}
function divobj_help_posy(obj) {
	if(browser.dom) {
		if (obj.offsetParent) return (obj.offsetTop + divobj_help_posy(obj.offsetParent));
		else return (obj.offsetTop);
	} else {
		return obj.pageY;
	}
}
