function warp(anchor)
{
	var id;
	
	if (anchor.href.match(/#(inav(\d{2}))/))
	{
		id = RegExp.$1;
	}
	else return;
	
	var parent = anchor.parentNode.parentNode.getAttribute('id');
	var s_position = getElementPosition(parent);
	
	var destination = document.getElementById(id);
	var d_position = getElementPosition(destination);
	
	var scrl = getScroll();
	
	var diffx = s_position.left-scrl.x;
	var diffy = s_position.top-scrl.y;
	
	window.scrollTo(d_position.left-diffx, d_position.top-diffy);
}

function getScroll()
{
	return {
		x: document.body.scrollLeft || document.documentElement.scrollLeft,
		y: document.body.scrollTop  || document.documentElement.scrollTop
	}
}

function getElementPosition(element)
{
	var offsetTrail	= (typeof element == 'string') ? document.getElementById(element) : element;
	var offsetLeft	= 0;
	var offsetTop	= 0;
	
	while (offsetTrail)
	{
		offsetLeft	+= offsetTrail.offsetLeft;
		offsetTop	+= offsetTrail.offsetTop;
		offsetTrail	= offsetTrail.offsetParent;
	}
	
	if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != "undefined")
	{
		offsetLeft	+= document.body.leftMargin;
		offsetTop	+= document.body.topMargin;
	}
	
	return ({left:offsetLeft, top:offsetTop});
}
