var check_iPhone = navigator.userAgent.search('iPhone');
var check_iTouch = navigator.userAgent.search('iPod');

function sizePage()
{
	var f = $("footer");

	var fd = f.getCoordinates();
	
	var ph = fd.top+fd.height;
	var wh = window.getHeight() + 60;
	
	if(ph<wh) f.setStyle('height', fd.height + (wh-ph));
}

// have page resize on rotation
window.onorientationchange = sizePage;

window.addEvent('domready', function()
{
		// if no flash and on iPhone/iTouch
	if(true)//window.orientation !== undefined || (check_iPhone >= 0 || check_iTouch >= 0))
	{
		sizePage();
		
		var scrollChange = new Fx.Scroll($(window));
		scrollChange.set(0,1);
					
		var paddingChange = new Fx.Tween(document.body, {
		duration:500, 
		transition: Fx.Transitions.Sine.easeOut
		});
		paddingChange.start('padding-left',window.getWidth(), 0);

		var t=setTimeout(function()
		{
			$("loadMask").style.display = "none";
			clearTimeout(t);
		},25);
	}
	else
	{
		document.location = "../store_locator/";
	}
	
	// show hidden elements
	var elementsToShow = ["flashContent", "footer", "content", "tlNav", "loadmask", "masthead", "noflashcontent"];
	
	var elem;
	for(var i = 0; i < elementsToShow.length; i++){
		elem = elementsToShow[i];
		if($(elem) != null && $(elem) != undefined){
			$(elem).setStyle("visibility", "visible");
		}
	}
}
);