(function(){var a=setInterval(function(){if(window.jQuery){clearInterval(a)}else{return}(function(c){var b=window.LensGifting=c.extend(window.LensGifting,{track:function(g,e,f){if(!window._gaq){if(window.console){window.console.error("Google Analytics is not loaded.")}}var d=function(){_gaq.push(["_trackEvent","Lens Gifting",g,e,f])};d()},showMessage:function(){c("#default_onion").show();c("#gift_message").show()},closeMessage:function(){c("#default_onion").hide();c("#gift_message").hide()},cancel:function(e,d){if(confirm("Really? Are you sure you don't want to give this lens as a gift? If you click OK this lens will just become a regular old lens in your stable, not a specially wrapped gift for a friend.")){c.post("/lensmaster/cancel_gift",{lens_id:e,lm:d,ajax:true},function(f){if(f){alert(f)}else{window.location.reload()}})}},resendInvitation:function(e,d){c.post("/lensmaster/resend_invitation",{lens_id:e},function(f){c(d).fadeOut(function(){c(d).replaceWith('<span id="invite_sent_'+e+'">Sent!</span>').show();setTimeout(function(){c("#invite_sent_"+e).replaceWith(f)},2000)})})},showMessageForm:function(){c("#default_onion").show();c("#gift_message_form").show();c("#gift_message_recipient_name").focus()},hideMessageForm:function(){c("#default_onion").hide();c("#gift_message_form").hide()},claimGift:function(e,d){c.post("/lensmaster/claim_gift",{gift_code:e},function(f){if(f=="success"){window.location="/lensmaster/workshop/"+d}else{alert(f)}})},register:function(){Squidoo.register(function(){LensGifting.claimGift(LensGifting.gift_code,LensGifting.lens_name)})},hideGifterIntro:function(d){c.post("/lensmaster/hide_gifter_intro",{lens_id:d},function(){c("#gifter_intro").hide()})},hideRecipientIntro:function(d){c.post("/lensmaster/hide_recipient_intro",{lens_id:d},function(){c("#recipient_intro").hide()})},showGifterIntro:function(d){c("#default_onion").show();c("#publish_result").addClass("overlay_wait").html("").fadeIn();c.post("/workshop/ajax_gift_giver_intro/"+d,function(e){c("#publish_result").removeClass("overlay_wait").html(e)})},showRecipientIntro:function(d){c("#default_onion").show();c("#publish_result").addClass("overlay_wait").html("").fadeIn();c.post("/workshop/ajax_gift_recipient_intro/"+d,function(e){c("#publish_result").removeClass("overlay_wait").html(e)})}})})(jQuery)},500)})();
