//detect touch support
var supportsTouch = (typeof Touch == "object");

if(supportsTouch){
	//scroll to top of page for iphone
	setTimeout(function() { window.scrollTo(0, 1) }, 500);

	//fix selector position on orientation change
	var supportsOrientationChange = "onorientationchange" in window,
		orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
	window.addEventListener(orientationEvent, function() {
		if(SELECTED != -1){
			var q = $('div.tile')[SELECTED];
			var p = $(q).position();

			$('#selector').css({
					left: p.left-10
					,top: p.top-10
			});
		}
	}, false);
}
