// === GENERAL DHTML FUNCTIONS ===
var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

function getOnlyActualChilds(divId) {
	var allChilds = getElm(divId).childNodes
	var rc = new Array();
	var n = 0;
	for (var i = 0; i < allChilds.length; i++) {
		if (allChilds[i].nodeType == 1) {
			rc[n] = allChilds[i];
			n++;
		}
	}
	return rc;
}

function getElm(id) {
	// Netscape 4
	if(ns4){
		return document.layers[id];
	}
	// Explorer 4
	else if(ie4){
		return document.all[id];
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		return document.getElementById(id);
	}
}

function show(id){
	// Netscape 4
	if(ns4){
		document.layers[id].visibility = "show";
	}
	// Explorer 4
	else if(ie4){
		document.all[id].style.visibility = "visible";
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		document.getElementById(id).style.visibility = "visible";
	}
}

function hide(id){
	// Netscape 4
	if(ns4){
		document.layers[id].visibility = "hide";
	}
	// Explorer 4
	else if(ie4){
		document.all[id].style.visibility = "hidden";
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		document.getElementById(id).style.visibility = "hidden";
	}
}

function getPosition(oLink) {
	if(oLink.offsetParent) {
		for(var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent) {
			posX += oLink.offsetLeft;
			posY += oLink.offsetTop;
		}
	    return [ posX, posY ];
	} else {
		return [ oLink.x, oLink.y ];
	}
}

function getSize(oFrame) {
	if(!oFrame) {
		oFrame = window;
	}
	var myWidth = 0, myHeight = 0;
	if(typeof(oFrame.innerWidth) == 'number' ) {
		myWidth = oFrame.innerWidth;
		myHeight = oFrame.innerHeight;
	} else if (oFrame.document.documentElement && (oFrame.document.documentElement.clientWidth || oFrame.document.documentElement.clientHeight)) {
		myWidth = oFrame.document.documentElement.clientWidth;
		myHeight = oFrame.document.documentElement.clientHeight;
	} else if(oFrame.document.body && (oFrame.document.body.clientWidth || oFrame.document.body.clientHeight)) {
		myWidth = oFrame.document.body.clientWidth;
		myHeight = oFrame.document.body.clientHeight;
	}
	return [myWidth,myHeight];
}
