function getClientSize() {
	return (document.body.scrollHeight > document.body.offsetHeight) ? [document.body.scrollWidth, document.body.scrollHeight] : [document.body.offsetWidth, document.body.offsetHeight];
}

function getBodyHeight() {
	if (self.innerWidth) return self.innerHeight;
	else if (document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientHeight;
	else if (document.body) return document.body.clientHeight;
	return true;
}

function getRelLeft(el) {
	var pos = el.offsetLeft;
	while (el.offsetParent != null) { el = el.offsetParent; pos += el.offsetLeft; if (el.tagName == 'BODY') break; }
	return pos;
}

function getRelTop(el) {
	var pos = el.offsetTop;
	while (el.offsetParent != null) { el = el.offsetParent; if (el.id == 'bodyi') continue; pos += el.offsetTop; if (el.tagName == 'BODY') break; }
	return pos;
}


function showWindow(url, w, h, s, n) {
	if (!n) n = '_blank';
	attr = 'width=' + w + ',height=' + h + ',location=0,menubar=0,resizable=0,scrollbars=' + s + ',status=0,titlebar=0,toolbar=0,hotkeys=0'
	if (parseInt(navigator.appVersion) >= 4) {
		x = (screen.width - w) / 2
		y = (screen.height - h) / 2
		if(x < 0) x = 0
		if(y < 0) y = 0
		attr += ',xposition=' + x + ',left=' + x + ',yposition=' + y + ',top=' + y
	}
	window.open(url, n, attr)
}

// call gallery
function gallery(alias,id) { showWindow('gallery.php?alias='+alias+'&photo='+id, 800, 600, 0); return false; }
