
	function getWindowCenterX(fx) {
		wx = document.body.clientWidth;
		return Math.round((wx - fx) / 2);
	}
	function getWindowCenterY(fy) {
		wy = document.body.clientHeight;
		return Math.round((wy - fy) / 2);
	}
	function divToCenter(dv) {
		dv.style.top  = getWindowCenterY(parseInt(dv.style.height));
		dv.style.left = getWindowCenterX(parseInt(dv.style.width));
	}
	function divShow(id, center) {
		if(center == null) center = true;
		id = getById(id)
		id.style.display = "block";
		if(center) divToCenter(id);
	}
	function divHide(id) {
		id = getById(id).style.display = "none";
	}
	function getById(id) {
		if(typeof(id) == "string") id = document.getElementById(id);
		return id;
	}
	function isDivVisible(dv) {
		if(dv.style.display == "none") return false;
		else return true;
	}
	function divToggle(id, center) {
		id = getById(id);
		if(isDivVisible(id)) {
			divHide(id);
		}
		else {
			divShow(id, center);
		}
	}

	// used in: /webmate/banners/control/
	function getTop(element) {
		var x = element.offsetTop;
		p = element.offsetParent;
		while(p != null) {
			x += p.offsetTop;
			p = p.offsetParent;
		}
		return x;
	}
	function getLeft(element) {
		var x = element.offsetLeft;
		p = element.offsetParent;
		while(p != null) {
			x += p.offsetLeft;
			p = p.offsetParent;
		}
		return x;
	}

