window.onload=function() {
	setTimeout(hideBar,100);
	setTimeout(initialOrient,100);
};
	
function hideBar() {
	window.scrollTo(0, 1);
}
	
function updateOrientation()
{
	/*window.orientation returns a value that indicates whether iPhone is in portrait mode, landscape mode with the screen turned to the
	  left, or landscape mode with the screen turned to the right. */
	var orientation=window.orientation;
	switch(orientation)
	{

		case 0:
				/* If in portrait mode, sets the body's class attribute to portrait. Consequently, all style definitions matching the body[class="portrait"] declaration
				   in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */
				document.body.setAttribute("orient", "portrait");
				break;

		case 90:
				/* If in landscape mode with the screen turned to the left, sets the body's class attribute to landscapeLeft. In this case, all style definitions matching the
				   body[class="landscapeLeft"] declaration in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */
				document.body.setAttribute("orient","landscapeL");
				break;

		case -90:	
				/* If in landscape mode with the screen turned to the right, sets the body's class attribute to landscapeRight. Here, all style definitions matching the 
				   body[class="landscapeRight"] declaration in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */
				document.body.setAttribute("orient","landscapeR");
				break;
	}
	window.scrollTo(0, 1);
}

function initialOrient()
{
	/*window.orientation returns a value that indicates whether iPhone is in portrait mode, landscape mode with the screen turned to the
	  left, or landscape mode with the screen turned to the right. */
	var orientation=window.orientation;
	switch(orientation)
	{

		case 0:
			document.body.setAttribute("orient", "portrait");
			break;

		case 90:
			document.body.setAttribute("orient","landscapeL");
			break;

		case -90:	
			document.body.setAttribute("orient","landscapeR");
			break;
	}
	window.scrollTo(0, 1);
}

// Point to the updateOrientation function when iPhone switches between portrait and landscape modes.
window.onorientationchange=updateOrientation;
