jQuery(window).bind("main.js",function(){jQuery("a#link_print_chef").bind("click",function(){window.print();return false});jQuery("a.link-chefs-comments").bind("click",function(){jQuery("ul.auto-tabs-nav").tabs("select",2);document.location.href=jQuery(this).attr("href");return false});jQuery("form#chef_send_to_friends_form").bind("submit",function(){chef_sendToFriends(jQuery(this));return false});chef_initRecipeList()});
var chef_sendToFriends=function(a){jQuery.ajax({type:"GET",dataType:"json",url:a.attr("action"),data:a.serialize(),success:function(b){if(b.hasErrors){jQuery("div.send-popup-error").show();jQuery("div.send-popup-success").hide();for(var d in b.errors)jQuery("#send_to_friends_"+d).addClass("error")}else{jQuery("div.send-popup-error").hide();jQuery("div.send-popup-success").show();jQuery(":input",a).each(function(){var c=this.id;if(this.type=="checkbox")this.checked=false;if(c!="send_to_friends_your_email"&&
c!="send_to_friends_object_id"&&c!="send_to_friends_object_class")this.value=""})}}})},chef_updateRecipeView=function(){var a=jQuery("form#change_recipe_view_mode");jQuery.ajax({type:"POST",processData:true,url:a.attr("action"),data:a.serialize(),dataType:"html",success:function(b){$("div#chef-recipes").html(b)}})},chef_initRecipeList=function(){jQuery("a.recipe-view").bind("click",function(){var a="image";if(jQuery("#recipe_view_mode_view_mode").attr("value")=="image")a="list";jQuery("#recipe_view_mode_view_mode").attr("value",
a);chef_updateRecipeView();return false});chef_initRecipePager()},chef_initRecipePager=function(){jQuery("div.chef-recipes-pager table td.page-numbers div.active-link a").bind("click",function(){var a=jQuery(this).html();jQuery("#recipe_view_mode_recipe_page").attr("value",a);chef_updateRecipeView();return false});jQuery("div.chef-recipes-pager table td.next-page").bind("click",function(){var a=jQuery("div.chef-recipes-pager table td.page-numbers div.inactive-link").html();a=parseInt(a)+1;jQuery("#recipe_view_mode_recipe_page").attr("value",
a);chef_updateRecipeView();return false});jQuery("div.chef-recipes-pager table td.previous-page").bind("click",function(){var a=jQuery("div.chef-recipes-pager table td.page-numbers div.inactive-link").html();a=parseInt(a)-1;jQuery("#recipe_view_mode_recipe_page").attr("value",a);chef_updateRecipeView();return false})};