(function() {
var currentWidth = 0;

	function checkOrientAndLocation()
	{
		/* Let's scoll only if we are so high on the screen that the iPhone bar can be visible. */
		y = window.pageYOffset;
		if (window.innerWidth != currentWidth && y < 100)
		{
			currentWidth = window.innerWidth;
			var orient = currentWidth == 320 ? "profile" : "landscape";
			myHeight = window.innerHeight;
			document.body.setAttribute("orient", orient);
			setTimeout(scrollTo, 100, 0, 1);
		}
	}

	addEventListener("load", function(event)
	{
		setTimeout(checkOrientAndLocation, 0);
		checkTimer = setInterval(checkOrientAndLocation, 300);
	}, false);
})();