window.addEventListener("load", function() { setTimeout('updateOrientation()', 100) }, false);

window.onload = function initialLoad(){
    updateOrientation();
};

var contentType;
	
function updateOrientation(){
    contentType = "show_";
    switch(window.orientation){
        case 0:
        contentType += "normal";
        break;
        
        case -90:
        contentType += "right";
        break;
        
        case 90:
        contentType += "left";
        break;
        
        case 180:
        contentType += "flipped";
        break;
		
		case undefined:
		contentType += "normal";
        break;
    }
    document.getElementById("page_wrapper").setAttribute("class", contentType);
	document.getElementById("nav").setAttribute("class", contentType);
    setTimeout("updatePosition()", 10);
    return contentType;
};

function updatePosition() {
    document.getElementById("page_wrapper").style.visibility = "visible";
    window.scrollTo(0, 1); // pan to the bottom, hides the location bar
};