/**
 * RecipeBox.js
 * - requires jQuery
 **/


/**
 * $(document).ready();	
 * - on DOM load, this function will remove the redirect portion of the HREF link, and will load the data in a mock-popup.
 * - only happends for js enabled users.
 **/
 $(document).ready(function(){
	RecipeBox_link();
 });
 
 /**
  *RecipeBox_link();	this function will remove the redirect 
  *portion of the HREF link, and will load the data in a mock-popup.
  **/
  function RecipeBox_link(){
	var link;
	$('.recipebox-link').each(function(){
		link = $(this).attr('href');
		link = link.split('&redirect')[0];
		$(this).attr('href',link+'&format=ajax');
	});
	$('.recipebox-link').click( function(e) {
		e.preventDefault();
		$.get($(this).attr('href'), function(data){
			$('#modalTemplate #modalContentArea').html(data);
			$('#modalTemplate').modal({
				opacity:48,
				overlayClose: false,
				zIndex: 2000
			});
		});
	});
  }
