$(document).ready(function() {
	$('#nav').localScroll();
	$('#logo').localScroll();
	
	if(isiPhone()) {
	
		$('#theStartingLine').css("background-attachment", 'scroll');
		$('#theStartingLine').css("background-size", '195%');
		$('#classSchedule').css("background-attachment", 'scroll');
		$('#classSchedule .bg').css("background-attachment", 'scroll');
		$('#classSchedule .bg').css("background-size", '195%');
		$('#aboutAllie').css("background-attachment", 'scroll');
		$('#aboutAllie').css("background-size", '195%');
		$('#aboutAllie .bg').css("background-attachment", 'scroll');
		$('#aboutAllie').css("background-size", '195%');
		$('#personalTraining').css("background-attachment", 'scroll');
		$('#personalTraining').css("background-size", '195%');
		$('#gallery').css("background-attachment", 'scroll');
		$('#gallery').css("background-size", '205%');
		$('#gallery .bg1').css("background-attachment", 'scroll');
		$('#gallery .bg2').css("background-attachment", 'scroll');
		$('#testimonials').css("background-attachment", 'scroll');
		$('#testimonials').css("background-size", '195%');		
		
	} else {
		
		$('#theStartingLine').parallax("50%", 1400, 0.1, true);
		$('#classSchedule').parallax("50%", 4400, 0.1, true);
		$('#classSchedule .bg').parallax("50%", 800, 0.2, true);
		$('#aboutAllie').parallax("50%", 4000, 0.4, true); //5700
		$('#aboutAllie .bg').parallax("50%", 4800, 0.4, true);
		$('#personalTraining').parallax("50%", 6275, 0.6, true);
		$('#gallery').parallax("50%", 7900, 0.3, true);
		$('#gallery .bg1').parallax("50%", 7550, 0.4, true);
		$('#gallery .bg2').parallax("50%", 7700, 0.8, true);
		$('#testimonials').parallax("50%", 7700, 0.1, true);
		
	}
	
	if(window.location.hash.length > 1) {
		var hash = window.location.hash.substr(1);
		$('#header ul li').each(function(i, li) { $(li).removeClass('here') });
		$('#header ul li a').each(function(i, a) {
			if($(a).attr('href').substr(1) == hash) $(a).parent().addClass('here');
		});
	}
	
	$('#header ul li a').each(function(i, a) {
		$(a).click(function() {
			var linkname = $(this).text();
			_gaq.push(['_trackEvent', 'Pages', 'Click', linkname]);
			$('#header ul li').each(function(i, li) { $(li).removeClass('here') });
			$(a).parent().addClass('here');
		});
	});
	
});


function isiPhone(){
    return (
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPod") != -1)
    );
}
