var currentRotation = null;
setTimeout(scrollTo,0,0,1);
setInterval(checkOrientAndLocation,1000);


function animateRight(){
  if($('body').attr('orient') == "landscape") {
    animLeft = 490;
  } else {
    animLeft = 330;
  }
  $('#main-secondary, .slider').css({ 
    '-webkit-transform': 'translate(-'+animLeft+'px,0px)', 
    '-webkit-transition': 'all 0.40s ease-in-out'
  });
  scroll(0,0);  
}


function checkOrientAndLocation(){
	if(currentRotation != window.orientation){
		setOrientation();
	}
}

function setOrientation(){
	switch(window.orientation){
		case 0:
			orient = 'portrait';
			break;
		case 90:
			orient = 'landscape';
			break;
		case -90:
			orient = 'landscape';
			break;
	}
	currentRotation = window.orientation;
	document.body.setAttribute("orient",orient);
	setTimeout(scrollTo,0,0,1);
}

if (navigator.userAgent.indexOf('iPhone') != -1) {
        addEventListener("load", function() {
                setTimeout(hideURLbar, 0);
        }, false);
}

function hideURLbar() {
        window.scrollTo(0, 1);
}

