// As seen on mediatemple account center. Thanks (mt)!

// The following code is courtesy of Joe Hewitt http://www.joehewitt.com
$(function() {
  updateLayout();

  window.scrollTo(0, 1);

  setInterval(updateLayout, 400);
});

var currentWidth = 0;
    
function updateLayout()
{  
  if (window.innerWidth != currentWidth)
  {
    currentWidth = window.innerWidth;

    var agent = navigator.userAgent.toLowerCase();
    var isIphone = agent.indexOf('iphone') != -1;

    if (isIphone) {
      var orient = currentWidth == 320 ? "profile" : (currentWidth > 1000 ? "profile" : "landscape");
      document.body.setAttribute("orient", orient);
    } else {
      document.body.setAttribute("orient", "profile");      
    }

    setTimeout(function()
    {
      window.scrollTo(0, 1);
    }, 100);            
  }
}
// end Joe Hewitt code. Thanks Joe!