$(document).ready(function() {
	
// Open rel=external in new window
	$('a[rel=external]').attr('target', '_blank'); 
	
// Homepage Slideshow
// lets try pulling the slides in dynamically

$.get("inc/homeslides.html", function(data) {
	var navtools = [
	'<p id="slide-ctrl"><a href="#" id="next" class="ir">Next</a> <a href="#" id="prev" class="ir">Previous</a></p>'
	].join("");
	
$('#slideshow')
		.append(data)
		
		.after(navtools)
	
		.cycle({ 
		fx:     'fade', 
		timeout: 0, 
        speed:   300,
        startingSlide: 0,
		next:   '#next', 
		prev:   '#prev' 
	});

// end featured recipe slideshow



//* Popups */
$('#inline').fancybox({
	'zoomSpeedIn':		400, 
	'zoomSpeedOut':		500,
	'overlayShow':		true,
	'zoomOpacity':		true,
	'frameHeight':		520,
	'frameWidth' :		281
	}); 
});
    		

// Wholesome Page will get some wholesome mouseovers
// Could prob do this with fewer functions but time is not on our side this fine evening

$('#js-cheese img').hover(
  function () {
    $('#js-cheese p').addClass('on');
  },
  function () {
    $('#js-cheese p').removeClass('on');
  }
);

$('#js-sauce img').hover(
  function () {
    $('#js-sauce p').addClass('on');
  },
  function () {
    $('#js-sauce p').removeClass('on');
  }
);

$('#js-dough img').hover(
  function () {
    $('#js-dough p').addClass('on');
  },
  function () {
    $('#js-dough p').removeClass('on');
  }
);


// let's compare some snacks!

   $('#compare-slides')
   .before('<ul id="compare-nav">')
   .cycle({ 
        timeout: 0, 
        speed:   300,
        startingSlide: 0,
   		pager:	'#compare-nav',
   		pagerAnchorBuilder: ids
    });
    
    function ids(ind, el)
	{
    return '<li id="cnav' + ind + '"><a href="#" class="ir"></a></li>';
	}
	
// Lets add a print button
$("#cooking-instructions").append('<a href="javascript:window.print()" id="print" class="ir">Print this page</a>');
		
});
