if (navigator.userAgent.indexOf('iP') != -1) {
        addEventListener("load", function() {
                setTimeout(hideURLbar, 0);
        }, false);
}
function hideURLbar() {
        window.scrollTo(0, 1);
}
addEventListener("load", function()
{
    setTimeout(updateLayout, 0);
}, false);
addEventListener("unload", function(e){}, false);
var currentWidth = 0;
function updateLayout()
{
    if (window.innerWidth != currentWidth)
    {
        currentWidth = window.innerWidth;

        var orient = currentWidth == 320 ? "width320" : "width480";
        document.body.setAttribute("orient", orient);
        setTimeout(function()
        {
            window.scrollTo(0, 1);
        }, 100);            
    }
}
setInterval(updateLayout, 400);
window.onload = function() {
  setTimeout(scrollTo, 100, 0, 1);
}
