jQuery(document).ready(function($){
	//messages below main images fade animation
	$('#feature-message').cycle();
	// EATERY TODAY TWITTER GRAB
	// search string for twitter and AND hashtag
	var twitterName = 'AmericanEatery'; //username
	var twitterHash = 'FOD';			//hashtag
	var twitterJSON = 'http://search.twitter.com/search.json?q=from%3A'+ twitterName+'+-%23'+twitterHash; //'callback=?' added by dataType
	$.ajax({
	  url: twitterJSON,
	  dataType: "jsonp",
	  statusCode: {
	    404: function() {
	      $('#tweet').prepend('Sorry, we can&rsquo;t access or specials list right now.');
	    }
	  },
	  success: function(data){
		if (jQuery.isEmptyObject(data.results)) {
			$('#tweet').prepend('Sorry, we couldn&rsquo;t find today&rsquo;s featured dish. Please check again later, or give us a ring.');
		} else {
			var tweet = data.results[0].text;
			//fod = fodRaw.replace("#FOD", "");
			$('#tweet').prepend(tweet);
		}
	  }
	});
	//PIG POPUP
	$('a[href="#pig-pop-trigger"]').click( function() { // click on "find the location"
		$('#feature-message').cycle('pause');
		$('#pig-pop').fadeIn(function() { // fade in the hot dog map
			$('body').click(function(event) { // fade it out when clicked outside the map
			    if (!$(event.target).closest('#pig-pop').length) { 
			    	$('#pig-pop').fadeOut(); 
			    	$('#feature-message').cycle('resume');
			    };
			});
		});
		return false;
	});	
});

