﻿//JQuery scripts
$(document).ready(function(){

    //this is the script that handles swapping lists in recipe finder module
    $('.recipe-finder .categories a').each(function(){
        
        $(this).click(function(){
	        $('.recipe-finder .categories a').removeClass('selected');
        	$(this).addClass('selected');
            
            var listname = $(this).attr('rel');
            
            //hide all tabs first
            $('.recipe-finder div').hide();
        
            $('div#' + listname + '-list').show();
    
        });
        
    });
    
        //this is the script that handles swapping lists in recipe toggle module
    $('#recipe-toggle .categories li').each(function(){
        
        $(this).click(function(){
	        $('#recipe-toggle .categories li').removeClass('selected');
        	$(this).addClass('selected');
            
            var listname = $(this).attr('rel');
            
            //hide all tabs first
            $('#recipe-toggle div').hide();
        
            $('div#' + listname + '-list').show();
    
        });
        
    });
	
	     //this is the script that handles swapping content on CYOM My Favorites display view
    $('.cyom .tabs a').each(function(){
        
        $(this).click(function(){
	        $('.cyom .tabs a').removeClass('selected');
        	$(this).addClass('selected');
            
            var listname = $(this).attr('rel');
            
            //hide all tabs first
            $('#menu-sections div#courses').hide();
			$('#menu-sections div#shopping-list').hide();
            $('#menu-sections div#instructions').hide();

            $('div#' + listname).show();
			//$('.cyom .print-type').html('<link rel="stylesheet" href="/styles/myfinecooking_shoplist_print.css" media="print" />');
    
        });
        
    });
   
});

/*not jquery but since this file is referenced on all pages its best to put these here*/
function roll(img_name1, img_src1)
   {
   document[img_name1].src = img_src1;
   }
   
function popitup(url) {
   newwindow=window.open(url,'name','height=272,width=400,top=50,left=50');
   if (window.focus) {newwindow.focus()}
   return false;
}