function popUp(popURL, popName, popLeft, popTop, popWidth, popHeight) {
	screenWidth = screen.width - 16;
	screenHeight = screen.height - 96;
	if (popWidth > screenWidth) popWidth = screenWidth;
	if (popHeight > screenHeight) popHeight = screenHeight;
//	alert(screenWidth + ' x ' + screenHeight);
	if ((popLeft == 0)&&(popTop == 0)) {
	 	popLeft = (screenWidth) ? (screenWidth-popWidth)/2 : 0;
		popTop = (screenHeight) ? (screenHeight-popHeight)/2 : 0;
		if ((popWidth == 0)&&(popHeight == 0)) {
			popWidth = screenWidth;
			popHeight = screenHeight;
		}
	}
	newWindow = window.open(popURL, popName, "width=" + (popWidth+16) + ",height=" + (popHeight+32) + ",left=" + popLeft + ",top=" + popTop + ", scrollbars=yes,resizable=yes");
//	alert(popLeft + ' x ' + popTop + ' x ' + popWidth + ' x ' + popHeight);
}

function getOffsetTop(elm) {
	var mOffsetTop = elm.offsetTop;
	var mOffsetParent = elm.offsetParent;
	
	while(mOffsetParent){
		mOffsetTop += mOffsetParent.offsetTop;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	
	return mOffsetTop;
}

function getOffsetLeft(elm) {
	var mOffsetLeft = elm.offsetLeft;
	var mOffsetParent = elm.offsetParent;
	
	while(mOffsetParent) {
		mOffsetLeft += mOffsetParent.offsetLeft;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	
	return mOffsetLeft;
}