﻿var userAgent = navigator.userAgent;

if (userAgent.indexOf('iPhone') != -1 || userAgent.indexOf('iPod') != -1 || userAgent.indexOf('iPad') != -1) {
    var myScroll;
    window.addEventListener('load', loaded, true);

    //re-adjust height of wrapper if orientation changes
    window.onorientationchange = function () {
        var height = document.documentElement.clientHeight - ((document.getElementById('footer').offsetHeight) * 2);
        document.getElementById('wrapper').style.height = height + "px";
    }
}


function loaded()
{
    var height = document.documentElement.clientHeight - ((document.getElementById('footer').offsetHeight) * 2); //window height-(footer height * 2) since wrapper also has footer height as padding
    var wrapper = document.getElementById('wrapper');
    wrapper.style.height = height + "px";
    wrapper.style.position = "relative";

    setTimeout(function () {
        document.ontouchmove = function (e) { if (e.touches.length == 1) { e.preventDefault(); return false; } }
        myScroll = new iScroll(document.getElementById('scroller'));
    }, 100);
}
