/**
 * @author Heyer
 */
var globalLeft = 0;

function gotoFrame(gotoID, currentBox, speed) {		
	if (gotoID.indexOf("page-") != -1) gotoID = gotoID.replace(/page-/, "");	
	/* set the hash in the url */
	//document.location.hash = "!" + gotoID;
		
	/* initialize these to the current, for when we aren't moving from its axis */
	var gotoLeftDist = $(currentBox).offset().left;
	var gotoTopDist = $(currentBox).offset().top;	
	var gotoParent = $("#" + gotoID).parent();	
	var currParent = $(currentBox).parent();
	
	var gridTop = $("#content-scroller").offset().top - $("#content-window").offset().top;
	var currTop = $(currentBox).offset().top;
	var gotoTop = $("#" + gotoID).offset().top;
	var gotoTopDist = (currTop - gotoTop) + gridTop;

	var currLeft = $(currentBox).offset().left;		
	var gotoLeft = $("#" + gotoID).offset().left;				
	var gotoLeftDist = (currLeft - gotoLeft) + globalLeft;						
	globalLeft = gotoLeftDist;
	
	$("#content-scroller").animate({ 
		top: gotoTopDist,
		left: gotoLeftDist
	}, {
		easing: "easeInOutQuint",
		duration: speed
	});		
}
