//adjusts page location on iOS to hide url bar
addEventListener("load", function(){
    setTimeout(updateLayout, 0);
}, false);

var currentWidth = 0;

function updateLayout(){
    if (window.innerWidth != currentWidth) {
        currentWidth = window.innerWidth;
        
        var orient = currentWidth == 320 ? "profile" : "landscape";
        document.body.setAttribute("orient", orient);
        setTimeout(function(){
            window.scrollTo(0, 1);
        }, 100);
    }
}

setInterval(updateLayout, 100);


//addtohome script shows bubble on iOS for adding to home screen
if ('standalone' in navigator && !navigator.standalone && (/iphone|ipod|ipad/gi).test(navigator.platform) && (/Safari/i).test(navigator.appVersion)) {
    document.write('<link rel="stylesheet" href="mobile/add2home.css">');
    document.write('<script type="application/javascript" src="mobile/add2home.js"><\/s' + 'cript>');
}

var addToHomeConfig = {
    animationIn: 'bubble',
    animationOut: 'drop',
    lifespan: 10000,
    expire: 10,
    touchIcon: true,
    message: 'You can add this site as an app on your <strong>%device</strong>. Press the %icon and choose "Add to Home Screen".'
};

