function getBodyScrollTop()
{
	return (self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop));
}

function getBodyScrollLeft()
{
	return (self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft));
}

function getDocumentHeight()
{
	return (document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;
}

function getDocumentWidth()
{
	return (document.body.scrollWidth > document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;
}

function getClientCenterX()
{
	return parseInt(getClientWidth()/2)+getBodyScrollLeft();
}

function getClientCenterY()
{
	return parseInt(getClientHeight()/2)+getBodyScrollTop();
}

function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function getClientHeight()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}

function getElementPosition(elem)
{
	 var w = elem.offsetWidth;
	 var h = elem.offsetHeight;
	 var l = 0;
	 var t = 0;
	 while (elem)
	 {
		  l += elem.offsetLeft;
		  t += elem.offsetTop;
		  elem = elem.offsetParent;
	 }
	 return {"left":l, "top":t, "width": w, "height":h};
}

function getURIParameter(uri, name)	
{
	var reg = new RegExp('(\\\?|\\\&)'+name+'=(.+?)(\\\&|$)');
	reg = reg.exec(uri);
	return (reg != null ? reg[2] : 0);
}

function openWindow(src, width, height)
{
	var top=0, left=0;
	if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
	if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
	if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
	width = Math.min(width, screen.width-10);
	height = Math.min(height, screen.height-28);
	window.open(src,"","scrollbars=auto,resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
}

function fixPNG (element) {
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) {
		var src;
		if (element.tagName == 'IMG') {
			src = element.src;
			element.src = "/images/pix.gif";
		} else {
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
			if (src) {
				src = src[1];
				element.runtimeStyle.backgroundImage = "none";
			}
		}
		if (src) {
			element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
		}
	}
}

function trim(str) {
	return str.replace(/^\s/, '').replace(/\s$/, '');
}