function browser() {
	if(document.layers)
		return "ns4";
	else if(document.all)
		return "ie"
	else if(document.getElementById)
		return "ns6";
}

function getElement(id) {
	switch(browser()) {
		case "ns4":
			return null;
		case "ns6":
			return document.getElementById(id);
		case "ie":
			return document.all[id];
	}		
}

function getElementStyle(id) {
	switch(browser()) {
		case "ns4":
			return document.layers[id];
		case "ns6":
			//if(!document.getElementById(id))
			//	alert(id);
			return document.getElementById(id).style;
		case "ie":
			return document.all[id].style;
	}		
}

function showElement(id, visible) {
	var st = getElementStyle(id);
	if(st)
		st.visibility = (browser() != "ns4" ?
			(visible ? "visible" : "hidden") :
			(visible ? "show" : "hide")
		);
}

function setClassName(id, name) {
	var el = getElement(id);
	if(el)
		el.className = name;
}

function getWindowHeight() {
	switch(browser()) {
		case "ns4":
		case "ns6":
			return window.innerHeight;
		case "ie":
			if (document.body.clientHeight>170) // hack by plb 3.11.2003, ie6 does not work properly
				return document.body.clientHeight;
			else
				return document.documentElement.clientHeight;
	}
}

function getWindowWidth() {
        switch(browser()) {
                case "ns4":
                case "ns6":
                        return window.innerWidth;
                case "ie":
                        if (document.body.clientHeight>170) // hack by plb 3.11.2003, ie6 does not work properly
                                return document.body.clientWidth;
                        else
                                return document.documentElement.clientWidth;
        }
}

function getWindowWidthAllFrames() {
        switch(browser()) {
                case "ns4":
                case "ns6":
                        return window.outerWidth;
                case "ie":
                        if (document.body.clientHeight>170) // hack by plb 3.11.2003, ie6 does not work properly
                                return screen.width;
                        else
                                return screen.width;
        }
}

function setImageSource(id, src) {
	window.document.images[id].src = src;
}

function pixel(i) {
	return i+(browser() != "ns4" ? "px" : "");
}

