TasteBook={BASE_HOST:"http://www.tastebook.com/",STATIC_HOST:"http://static0.tastebook.com/",ORIGIN_HOST:"http://www.tastebook.com"};if(window.STAGING_ENV){TasteBook.BASE_HOST="http://stage.tastebook.net/";TasteBook.STATIC_HOST="http://stage-static0.tastebook.net/";TasteBook.ORIGIN_HOST="http://stage.tastebook.net"}else{if(window.INTEG_ENV){TasteBook.BASE_HOST="http://integ.tastebook.net/";TasteBook.STATIC_HOST="http://integ.tastebook.net/";TasteBook.ORIGIN_HOST="http://integ.tastebook.net"}else{if(window.DEV_ENV){TasteBook.BASE_HOST="http://localhost:3000/";TasteBook.STATIC_HOST="http://localhost:3000/";TasteBook.ORIGIN_HOST="http://localhost:3000"}}}TasteBook.Utils={IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),imagePoweredTB:TasteBook.STATIC_HOST+"images/remote/powered_tb.gif",makeJSrequest:function(C){var A=window.document;var B=document.createElement("script");B.setAttribute("type","text/javascript");B.setAttribute("src",C);A.getElementsByTagName("head").item(0).appendChild(B)},makeCSSRequest:function(B){var A=window.document;var C=document.createElement("link");C.setAttribute("media","screen");C.setAttribute("type","text/css");C.setAttribute("rel","stylesheet");C.setAttribute("href",B);A.getElementsByTagName("head").item(0).appendChild(C)},getScrollOffsets:function(){return[window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop]},getViewportSize:function(){return[self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight]},removeClassName:function(A,B){A.className=A.className.replace(new RegExp("(^|\\s+)"+B+"(\\s+|$)")," ");return A},callReportingLink:function(A,D){var C=document.getElementById(A+"-reporting-iframe");if(!C){C=document.createElement("iframe");C.setAttribute("frameborder","0");C.setAttribute("width","0");C.setAttribute("height","0");C.setAttribute("src",D);C.setAttribute("style","display:none;");C.style.display="none";C.setAttribute("id",A+"-reporting-iframe");var B=document.getElementById(A);B.parentNode.insertBefore(C,B)}},showBrowserPopup:function(B,A){window.open(B,null,A||"status=1, height=700, width=800, resizable=1, scrollbars=1")},showPopup:function(A,B){if((window.postMessage&&(!TasteBook.Utils.IE||navigator.appVersion.indexOf("MSIE 8")!=-1))||B){TasteBook.LightWindow.show("<iframe id='tastebook-preview-iframe' frameborder='0' width='810' height='630' src='"+A+"'></iframe><img alt='Powered By TasteBook' src='"+TasteBook.Utils.imagePoweredTB+"' style='float:right;margin-top:15px;'/>",810,660)}else{TasteBook.Utils.showBrowserPopup(A)}}};TasteBook.AddRecipe={initLink:TasteBook.BASE_HOST+"remote_widget/init",addLink:TasteBook.BASE_HOST+"remote_widget/add",cssLink:TasteBook.STATIC_HOST+"stylesheets/tb_popup.css",reportingInitLink:TasteBook.BASE_HOST+"widgets/add_to_tb_init.html",reportingAddLink:TasteBook.BASE_HOST+"widgets/add_to_tb_add.html",infoPopup:null,_init:function(B,A){TasteBook.Utils.makeCSSRequest(TasteBook.AddRecipe.cssLink);TasteBook.Utils.makeJSrequest(A);TasteBook.Utils.callReportingLink(B,TasteBook.AddRecipe.reportingInitLink)},init:function(C,D,A){var B=TasteBook.AddRecipe.initLink+"?partner_name="+D+"&external_id="+A+"&html_element="+C;TasteBook.AddRecipe._init(C,B)},initUrl:function(C,D,B){if(!B){B=document.location.href}var A=TasteBook.AddRecipe.initLink+"?partner_name="+D+"&recipe_url="+B+"&html_element="+C;TasteBook.AddRecipe._init(C,A)},add:function(B,D,C){var A=TasteBook.AddRecipe.addLink+"?partner_name="+D+"&recipe_id="+C+"&html_element="+B.id;TasteBook.Utils.makeJSrequest(A);TasteBook.Utils.callReportingLink(B.id,TasteBook.AddRecipe.reportingAddLink);return false},showAddedLink:function(A,D){var C=document.getElementById(A);if(C){var B=document.createElement("span");if(C.id){B.setAttribute("id",C.id)}if(C.className){B.setAttribute("class",C.className)}TasteBook.Utils.removeClassName(C,"tastebook_add_tb_link");B.className+=(B.className?" ":"")+"tastebook_added_tb_link tastebook_"+D.toLowerCase()+"_added_link";B.innerHTML="Added to TasteBook";B.onclick=function(){return false};C.parentNode.insertBefore(B,C);C.parentNode.removeChild(C);C=document.getElementById("tastebook-add-to-tb-info-link");if(C){C.parentNode.removeChild(C)}}},showAddLink:function(C,F,E,G){var D=document.getElementById(C);if(D){D.className+=(D.className?" ":"")+"tastebook_add_tb_link tastebook_"+F.toLowerCase()+"_add_link";D.innerHTML=G?G:"Add to TasteBook";D.onclick=function(){return TasteBook.AddRecipe.add(D,F,E)};if(F.toLowerCase()!="myrecipes"){return }var A=document.createElement("img");A.src=TasteBook.STATIC_HOST+"images/icons/info.gif";A.alt="i";var B=document.createElement("a");B.id="tastebook-add-to-tb-info-link";B.appendChild(A);B.onclick=TasteBook.AddRecipe.showMyrecipesInfoLink;D.parentNode.insertBefore(B,D.nextSibling)}},hideAddLink:function(A){var B=document.getElementById(A);if(B){B.style.display="none"}},showMyrecipesInfoLink:function(){var A='<p class="tastebook_learn_more_text">MyRecipes has partnered with TasteBook- a service that allows you to create a personalized cookbook for a gift or your own collection. By selecting "Add to TasteBook" your recipes will be added to your recipe collection on TasteBook. <a href="http://www.myrecipes.com/tastebook">Learn More</a></p>';TasteBook.LightWindow.show(A,275,120,{title:'<img src="'+TasteBook.STATIC_HOST+'images/labels/learn_more_about_tastebook.gif" alt="Learn More About Tastebook"/>'})},showBetterRecipesInfoLink:function(){var A='<p class="tastebook_learn_more_text">Better Recipes has partnered with TasteBook- a service that allows you to create a personalized cookbook for a gift or your own collection. By selecting "Add to TasteBook" your recipes will be added to your recipe collection on TasteBook. <a href="http://www.betterrecipes.com/tastebook">Learn More</a></p>';TasteBook.LightWindow.show(A,275,120,{title:'<img src="'+TasteBook.STATIC_HOST+'images/labels/learn_more_about_tastebook.gif" alt="Learn More About Tastebook"/>'})},receiveMessages:function(B){if(B.origin!==TasteBook.ORIGIN_HOST){return }var A=B.data.split("::");var C=A.shift();if(C=="recipe_added"&&A[0]){TasteBook.AddRecipe.showAddedLink(A[0],A[1]);TasteBook.LightWindow.close();TasteBook.LightWindow.show(A[1],520,195)}}};if(window.postMessage){if(window.addEventListener){window.addEventListener("message",TasteBook.AddRecipe.receiveMessages,false)}else{if(window.attachEvent){window.attachEvent("onmessage",TasteBook.AddRecipe.receiveMessages)}}}TasteBook.RemotePreview={initLink:TasteBook.BASE_HOST+"remote_widget/preview_init",previewLink:TasteBook.BASE_HOST+"remote_widget/preview",reportingInitLink:TasteBook.BASE_HOST+"widgets/remote_preview_init.html",reportingPreviewLink:TasteBook.BASE_HOST+"widgets/remote_preview.html",init:function(C,D,A){var B=TasteBook.RemotePreview.initLink+"?partner_name="+(D?D:"")+"&book_id="+(A?A:"")+"&html_element="+C;TasteBook.Utils.makeJSrequest(B);TasteBook.Utils.callReportingLink(C,TasteBook.RemotePreview.reportingInitLink)},showLink:function(E,G,B,H){var F=document.getElementById(E);if(F){if(H){F.innerHTML=H;F.className+=(F.className?" ":"")+"tastebook_remote_preview_link tastebook_"+G.toLowerCase()+"_remote_preview_link"}F.onclick=function(){return TasteBook.RemotePreview.preview(E,G,B)};var C=F.getElementsByTagName("a");for(var D=0,A=C.length;D<A;D++){C[D].onclick=function(){return false}}}},preview:function(C,D,A){var B=TasteBook.RemotePreview.previewLink+"?partner_name="+D;if(A){B=B+"&book_id="+A}TasteBook.Utils.makeJSrequest(B);TasteBook.Utils.callReportingLink(C,TasteBook.RemotePreview.reportingPreviewLink);return false}};TasteBook.LightWindow={initialized:null,init:function(){if(TasteBook.LightWindow.initialized){return }TasteBook.LightWindow.initialized=true},show:function(I,D,M,N){var K=window.document;TasteBook.LightWindow.init();var A=K.getElementById("tastebook-lightwindow-container");if(!A){A=TasteBook.LightWindow.createWindow();K.body.appendChild(A)}var C=K.getElementById("tastebook-lightwindow");C.style.width=D+"px";C.style.height=M+"px";var H=K.getElementById("tastebook-lightwindow-body");H.innerHTML=I;var G=TasteBook.Utils.getViewportSize();var F=TasteBook.Utils.getScrollOffsets();var E=parseInt((G[0]-D)/2);if(E<1){E=1}E+=F[0];var J=parseInt((G[1]-M)/3);if(J<1){J=1}J+=F[1];A.style.left=E+"px";A.style.top=(1+J)+"px";var B=K.getElementById("tastebook-lightwindow-header");var L=B.getElementsByTagName("h2")[0];if(N&&N.title){L.innerHTML=N.title;B.classNames="clearfix"}else{L.innerHTML="";B.classNames=""}A.style.display=""},close:function(){var A=window.document;var B=A.getElementById("tastebook-lightwindow-container");B.style.display="none"},createWindow:function(){var E=document.createElement("div");E.setAttribute("id","tastebook-lightwindow-container");E.setAttribute("style","");E.style.display="none";var H=document.createElement("div");H.setAttribute("id","tastebook-lightwindow");E.appendChild(H);var F=document.createElement("div");F.setAttribute("id","tastebook-lightwindow-header");H.appendChild(F);var D=document.createElement("h2");F.appendChild(D);var C=document.createElement("img");C.setAttribute("src",TasteBook.STATIC_HOST+"images/icons/ajax-loader.gif");C.setAttribute("id","window-ajax-loader");C.style.display="none";F.appendChild(C);var G=document.createElement("a");G.appendChild(document.createTextNode("close "));G.setAttribute("style","color:#666666;float:right;text-align:right;cursor:pointer;");var B=document.createElement("img");B.setAttribute("src",TasteBook.STATIC_HOST+"images/del_inline.gif");B.setAttribute("style","border:none;vertical-align:middle;");G.appendChild(B);G.onclick=TasteBook.LightWindow.close;F.appendChild(G);var A=document.createElement("div");A.setAttribute("id","tastebook-lightwindow-body");H.appendChild(A);return E}};