/**
 * @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 = $("#grid").offset().top - $("#container").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;

	$("#cont_shadow").css("z-index", "1000");
	
	$("#grid").animate({ 
		top: gotoTopDist,
		left: gotoLeftDist
	}, {
		easing: "easeInOutQuint",
		duration: speed,
		complete: function() {
			$("#cont_shadow").css("z-index", "0");	
		}
	});		
}
