//<![CDATA[
/**
 *  This function retrieves the correct coordinates
 *  of a DOM element using the provided element id, 
 *  then scrolls the window to the element's x and y
 *  position.
 */
function scrollToElement(elementId) {
	var elm = document.getElementById(elementId);
	var x = 0, y = 0;		
	
	if(elm.offsetParent) {
		while(elm.offsetParent) {
			x += elm.offsetLeft;
			y += elm.offsetTop;	
								
			elm = elm.offsetParent;
		}
	}
	else {
		x = elm.x;
		y = elm.y;
	}
						
	window.scrollTo(x, y);
}			
//]]>