$(document).ready(function(){
	if( navigator.userAgent.match(/Android/i) ||
		navigator.userAgent.match(/webOS/i) ||
		navigator.userAgent.match(/iPhone/i) ||
		navigator.userAgent.match(/iPod/i)
		){
			window.location = "http://www.strength.org/apps/dineout/Google/DisplayMobileMap";
	}
	// Loading Animations
	//$('#hero > h2').css('top',-450).animate({'top':160},800);
	//$('#map').css('bottom',650).delay(550).animate({'bottom':-71},800);
	
	$('#mainvid a').live('click',function(e){
		e.preventDefault();
		$(this).hide();
		$('#video iframe').attr('src', 'http://www.youtube.com/embed/csEISuSg2J4?fs=1&autoplay=1');
		$('#video').show();
	});
	
	// Map ZIP box placeholder text
	$('#map input').focus(function(){
		if($(this).val() == 'Enter city/state or ZIP'){
			$(this).val('')
		}
	});
	$('#map input').blur(function(){
		if($(this).val() == ''){
			$(this).val('Enter city/state or ZIP')
		}
	});
	
	$('#map').submit(function(e){
		if($('#map input').val() == 'Enter city/state or ZIP'){
			e.preventDefault();
			return false;
		}
	});
	
	// Enter Zip Link
	$('.btn-find').live('click',function(e){
		e.preventDefault();
		$('#map input').focus();
	});

	
	// Sneak Peak Slider
	$('#sneakpeak .tab').each(function(i){
		i++;
		if(i > 1){
			$('#sp-nav ul').append('<li><a href="#">'+i+'</a></li>');
			$(this).attr('data-tab',i);
		}
	});
	$('#sp-nav li:first-child a').addClass('active');
	$('#sneakpeak .tab:not(":first")').hide();
	
	$('#sp-nav li a').live('click',function(e){
		e.preventDefault();
		if(!$(this).hasClass('active')){
			$('#sneakpeak .tab').hide();
			$('#sneakpeak .tab[data-tab="'+$(this).text()+'"]').fadeIn(500);
			/* Fade In Each Item
			$('#sneakpeak .tab[data-tab="'+$(this).text()+'"]').show().find('li').hide().each(function(i){
				$(this).delay(225*i).fadeIn(400);
			});*/
			$('#sp-nav li a').removeClass();
			$(this).addClass('active');
		}
	});
});
