YAHOO.namespace("SDC","SDC.BrowserDetect","SDC.util");YAHOO.SDC.CommonProperties=function(){this.yui=YAHOO;this.UTIL=this.yui.util;this.DOM=this.UTIL.Dom;this.EVENT=this.UTIL.Event;this.SELECT=this.UTIL.Selector.query;this.createElement=this.yui.SDC.util.createElement};YAHOO.SDC.BrowserDetect={initialize:function(){this.isMacOS=(navigator.platform.toLowerCase().indexOf("mac")!=-1);var b=navigator.userAgent.toLowerCase();this.isIE=((b.indexOf("msie")!=-1)&&(b.indexOf("opera")==-1)&&(b.indexOf("webtv")==-1));var a=b.match(/MSIE\s(\d)\.(\d)/i);if(this.isIE){var d=parseInt(a[1]);this.isPreIE9=(d<9);this.isPreIE8=(d<8);this.isPreIE7=(d<7);this.isPreIE6=(d<6);this.isPreIE55=(this.isPreIE7&&d<=5&&a[2]&&(parseInt(a[2])<5))}this.isWebKit=(/webkit/i).test(b);this.isGecko=(b.indexOf("gecko")!=-1&&!this.isWebKit);if(this.isGecko){var c=parseInt((/firefox\/([0-9])\./i).exec(b)[1]);this.isFF4=c==4;this.isFF3=c==3;this.isFF2=c<=2}if(this.isWebKit){if((/chrome/i).test(b)){this.isChrome=true}else{if((/safari/i).test(b)){this.isSafari=true;this.isSafari_new=(parseInt((/AppleWebKit\/(\d+)/i).exec(b)[1])>=500);this.isSafari_old=!this.isSafari_new}}}this.isKonqueror=(b.indexOf("konqueror")!=-1);return this}}.initialize();YAHOO.SDC.util={extend:function(b,c,a){if(!b||!c){return}YAHOO.lang.extend(b,c);if(a){var d=b.prototype;for(var e in a){d[e]=a[e]}}},applyCommonProperties:function(a){YAHOO.lang.augmentObject(a,new YAHOO.SDC.CommonProperties())},createElement:function(a,b,e){var d=e?e:window;var c=d.document.createElement(a);a=a.toLowerCase();for(attr in b){attr=attr.toLowerCase();if(attr=="class"){c.className=b[attr]}else{if(attr=="text"&&a=="a"){c.innerHTML=b[attr]}else{c.setAttribute(attr,b[attr])}}}return c},createButton:function(d,a){if((/^\s*$/.test(d))){return null}if(!a){var a={}}if(!a.href||(/^\s*$/).test(a.href)){a.href="javascript:void(0);"}var c=YAHOO.SDC.util.createElement("a",a);YAHOO.util.Dom.addClass(c,"button");var b=document.createElement("b");b.innerHTML=d;c.appendChild(document.createElement("b"));c.lastChild.appendChild(document.createElement("b"));c.lastChild.lastChild.appendChild(document.createElement("b"));c.lastChild.lastChild.lastChild.appendChild(b);return c},createRoundedFormField:function(a,b){if(!(/^textarea|input$/).test(a)){return null}if(!b){var b={}}if((/^input$/).test(a)&&!b.type){b.type="text"}var d=YAHOO;var c=d.SDC.util.createElement(a,b);d.util.Dom.addClass(c,"rnd");return c},createInput:function(a){return YAHOO.SDC.util.createRoundedFormField("input",a)},createTextarea:function(a){return YAHOO.SDC.util.createRoundedFormField("textarea",a)},json:{getObject:function(b){var a=YAHOO.lang.JSON;return a.isValid(b)?a.parse(b):null},getMessage:function(b){var a=YAHOO.lang.JSON;if(a.isValid(b)){var c=a.parse(b);if(c.valid||c.status){return c.message}}return null}},url:{getParam:function(a,d){var c=new RegExp("(?:^|\\?|&)"+d+"=([^&#]*)&?","g");var b=c.exec(a);return(b&&b.length>1)?b[1]:null},removeParam:function(a,c){var b=new RegExp("\\?"+c+"=[^&]*&?","gi");a=a.replace(b,"?");b=new RegExp("\\&"+c+"=[^&]*&?","gi");a=a.replace(b,"&");a=a.replace(/(\?|&)$/,"");b=null;return a},addParam:function(a,e,c){a=YAHOO.SDC.util.url.removeParam(a,e);if(a.indexOf("#")!=-1){var b=(/#(?:[^$|\\?|&]+)/).exec(a);if(b&&b.length>0){var d=b[0];a=a.replace(d,"");if(d.length==1){d=null}}}a+="&"+e+"="+c;if(!(/\?/.test(a))){a=a.replace(/&/,"?")}if(d){a+=d}return a}}};function scPopup(f,e){if(!f||!f.href){return true}var c="pop";var b=h=600;var d=f.href;if(e){if(e.width&&e.width>50){b=e.width}if(e.height&&e.height>50){h=e.height}if(e.url){d=e.url}if(e.name){c=e.name}}var a="width="+b+",height="+h+",location=0,menubar=0,resizable=yes,scrollbars=yes";window.open(d,c,a);return false}function scMessagesExit(a){if(!a){return}var d=YAHOO;var b=d.util.Dom.getAncestorByClassName(a,"messages");var c=new d.util.Anim(b,{opacity:{to:0}},0.5,d.util.Easing.easeOut);c.onComplete.subscribe(function(){b.parentNode.removeChild(b)});c.animate()}function scAutoJump(a,c){if(a.charAt(0)=="#"){a=a.substring(1)}var b=YAHOO;b.util.Event.onDOMReady(function(){location.hash=a;if(c){var d=document.getElementById(a);if(d){b.util.Dom.addClass(d,c)}}})}function scLoadScript(b,a){a=(typeof a=="string")?a.toLowerCase():null;var c=function(){var e=document.createElement("script");e.src=b;e.async=true;var d=document.getElementById("deferred-resources");if(!d){d=document.getElementsByTagName("head")[0]}d.appendChild(e)};if(a=="window"){YAHOO.util.Event.on(window,"load",c)}else{if(a=="dom"){YAHOO.util.Event.onDOMReady(c)}else{c()}}}if(typeof Function.bind=="undefined"){Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a,arguments)}}};(function(){var b="/";var d=document.getElementById("css-primary");if(d&&d.href){var f=(/^http(?:s)?\:\/\/[\w\:\.]+\//).exec(d.href);if(f&&f.length>0){b=f[0]}}var e=b+"images/savings/";var g=["buttons/gray-hover.gif","buttons/gray-corners-hover.gif","buttons/beige/gray-hover.gif","buttons/beige/gray-corners-hover.gif","buttons/blue-hover.gif","buttons/blue-corners-hover.gif","buttons/orange-hover.gif","buttons/orange-corners-hover.gif"];for(var c=0,a=g.length;c<a;c++){new Image().src=e+g[c]}})();YAHOO.SDC.Fetch=function(b,a){if(!b){return this.throwError()}this.files=b;this.veloBridge=_PageInfo;this.globalDebugMode=this.veloBridge&&this.veloBridge.debug;this.targetWindow=window;this.type="js";if(a){if(a.type&&(/^css$/i).test(a.type)){this.type="css"}if(a.targetWindow){this.targetWindow=a.targetWindow}}this.prefix=((this.type=="css")?"/styles":"/js")+"/savings/";this.suffix="."+this.type;this.baseUrl="/fetch/get-"+this.type.toLowerCase()+".url?resources=";this.include();return this};YAHOO.SDC.Fetch.prototype={include:function(){var d=0,a=0;var e=this.files;var g=[];var f=this.generateComboResourceUrl(e);if(!this.globalDebugMode&&f&&f!=""){g.push(f)}else{for(d=0,a=e.length;d<a;d++){g.push(this.createRelativeFilePath(e[d]))}}if(g.length>0){var c=this.targetWindow.document.getElementsByTagName("head")[0];var b=YAHOO.SDC.util.createElement;if(this.type=="css"){for(d=0,a=g.length;d<a;d++){c.appendChild(b("link",{type:"text/css",rel:"stylesheet",href:g[d]}))}}else{for(d=0,a=g.length;d<a;d++){c.appendChild(b("script",{src:g[d]}))}}}else{this.throwError()}},generateComboResourceUrl:function(c){var a="";if(!this.globalDebugMode&&c&&c.length>0){var d=",";for(var b=0;b<c.length;b++){a+=this.formatRelativeFilePath(this.createRelativeFilePath(c[b]));if(b<c.length-1){a+=d}}a=this.baseUrl+a}return a},createRelativeFilePath:function(a){return this.prefix+a+this.suffix},formatRelativeFilePath:function(a){return escape(a).replace(/\//g,"%2F")},throwError:function(){if(console){console.log("DEBUG: Additional JS resources were not loaded.")}}};(function(){var a=_PageInfo;if(a&&a.fetch&&a.fetch.length>0){new YAHOO.SDC.Fetch(a.fetch)}})();YAHOO.namespace("SDC.coupons");YAHOO.util.Event.onDOMReady(function(){_PageInfo.coupons=new YAHOO.SDC.coupons.CouponList()});YAHOO.util.Event.on(window,"load",function(){try{var a=document.getElementById("coupon-page-description");if(a){document.getElementById("wrapper-content").appendChild(a);a.className=""}}catch(b){}});YAHOO.SDC.coupons.CouponList=function(){var a=YAHOO.util;var b=a.Selector.query("div.coupon");a.Event.on(b,"mouseover",function(c){a.Event.stopPropagation(c);this.put(new YAHOO.SDC.coupons.Coupon(a.Event.getTarget(c)))},this,true);this.coupons=b;this.autoExpansion()};YAHOO.SDC.coupons.CouponList.prototype={autoExpansion:function(){var b=YAHOO.SDC;var d=null;if((/^#?_?coupon-\d+$/i).test(location.hash)){var e=location.hash;if(e.charAt(0)=="#"){e=e.substring(1)}if(e.charAt(0)=="_"){e=e.substring(1)}d=e}else{if(!location.hash||(/^\s*$/).test(location.hash)){var a=b.util.url.getParam(location.href,"contextId");if(!a){return}d="coupon-"+a;location.hash="_"+d}}if(d){var f=document.getElementById(d);if(!f){return}var c=new b.coupons.Coupon(f);c.subpanels.comments.build();if(_PageInfo.loggedIn===true&&b.util.url.getParam(location.search,"vote")=="true"){c.ev_initVoting();c.vote.recordVote()}}},get:function(a){return this.instances&&this.instances[a]?this.instances[a]:null},put:function(a){if(!this.instances){this.instances=[]}this.instances[a.couponId]=a}};YAHOO.SDC.coupons.Coupon=function(a){if(typeof a=="undefined"){return null}else{if(typeof a=="string"){var d=document.getElementById(a);if(!d){return null}a=d}}this.className="coupon";this.yui=YAHOO;this.DOM=this.yui.util.Dom;this.EVENT=this.yui.util.Event;this.SELECT=this.yui.util.Selector.query;this.createElement=this.yui.SDC.util.createElement;this.elements={};this.subpanels={};if(a.nodeName.toLowerCase()!="div"||!this.DOM.hasClass(a,this.className)){a=this.DOM.getAncestorByClassName(a,this.className)}this.root=a;this.EVENT.removeListener(a,"mouseover");if(this.DOM.hasClass(a,"simple")){return null}this.couponId=(/\d+/).exec(a.id)[0];var b=document.getElementById("coupon-referral-"+this.couponId);this.referralUrl=b.value;this.hasPopup=b.title&&(/pop/i).test(b.title);this.popupData={isInsidePopup:this.DOM.hasClass(document.body,"popup"),height:700,width:480};var e=this.SELECT("div.desc",a);this.elements.descriptions={brief:e[0],full:e[1]};this.EVENT.on(e,"click",this.toggleDescription,this,true);this.DOM_content=this.SELECT("div.content",a,true);this.DOM_insertHere=this.createElement("div",{"class":"insert"});this.DOM_content.insertBefore(this.DOM_insertHere,this.DOM.getLastChild(this.DOM_content));var g=this.SELECT("ul li > a",a);if(!g||g.length<1){return}this.subpanels.comments=new this.yui.SDC.coupons.CouponComments(this,g[1]);this.elements.comments=g[1];this.subpanels.share=new this.yui.SDC.coupons.CouponShare(this,g[2]);this.elements.share=g[2];this.subpanels.problem=new this.yui.SDC.coupons.CouponProblem(this,g[3]);this.elements.problem=g[3];this.elements.button=this.SELECT("a.button",a,true);this.applyButtonHandler(this.elements.button);var c=document.getElementById("coupon-affiliate-"+this.couponId);this.affiliateUrl=c?c.value:null;var f=this.SELECT("a.title",a);if(f){this.applyButtonHandler(f[0]);this.elements.title=f[0];if(f.length>1){this.applyButtonHandler(f[1])}}this.initVoting(g[0]);this.initToolTips();this.EVENT.on(window,"unload",this.cleanup,this,true)};YAHOO.SDC.coupons.Coupon.prototype={toggleDescription:function(d){var c=this.EVENT.getTarget(d);if((c.nodeName.toLowerCase()=="a")&&this.DOM.hasClass(c,"toggle")){this.EVENT.stopEvent(d);var b=d.currentTarget?d.currentTarget:this.DOM.getAncestorByClassName(c,"desc");this.createDuplicateTitleElement();var a=this.DOM.hasClass(b,"brief");this.elements.descriptions.brief.style.display=a?"none":"block";this.elements.descriptions.full.style.display=a?"block":"none"}},applyButtonHandler:function(a){if(a){this.EVENT.on(a,"click",this.buttonHandler,this,true)}},createDuplicateTitleElement:function(){if(!this.isFullDescriptionTitleCreated){var b=this.SELECT("a.title",this.root);if(!b||(b&&b.length<2)){var a=this.elements.descriptions.full;var c=this.elements.title.cloneNode(true);a.insertBefore(c,a.firstChild);this.applyButtonHandler(c)}this.isFullDescriptionTitleCreated=true}},initVoting:function(a){if(!a){return}if(this.popupData.isInsidePopup){a=this.SELECT(".meta a.vote",this.DOM_content,true)}else{if(!this.yui.util.Selector.test(a,".vote a")){return}}this.elements.vote=a;this.ev_vote=this.EVENT.on(a,"mouseover",this.ev_initVoting,this,true)},ev_initVoting:function(){this.vote=new YAHOO.SDC.coupons.CouponVote(this,this.elements.vote)},initToolTips:function(){if(this.elements.vote){new this.yui.SDC.widget.HoverCard(this.elements.vote,null,{dataType:"title"})}var a=this.SELECT("p.votes",this.DOM_content,true);if(a){new this.yui.SDC.widget.HoverCard(a,null,{dataType:"title"})}},getMerchantName:function(){if(!this.merchantName){var a=this.SELECT(".logo em",this.DOM_content,true);this.merchantName=a.innerHTML}return this.merchantName},getMerchantUrl:function(){if(!this.merchantUrl){var a=this.SELECT(".logo",this.DOM_content,true);if(a.nodeName.toLowerCase()=="div"){this.merchantUrl=a.getElementsByTagName("input")[0].value}else{this.merchantUrl=a.href}}return this.merchantUrl},subpanelManager:function(a){for(subpanel in this.subpanels){if(a!=this.subpanels[subpanel]){if(this.subpanels[subpanel].isVisible&&this.subpanels[subpanel].isVisible()){this.subpanels[subpanel].hide()}}}},triggerAuthentication:function(c,b,a){if(this.popupData.isInsidePopup){try{opener.scLogin(c,b,a)}catch(d){window.resizeTo(screen.width,document.body.offsetHeight);scLogin(c,b,a)}}else{scLogin(c,b,a)}},buttonHandler:function(c){if(this.hasPopup){this.EVENT.stopEvent(c);this.createPopup()}var a=_PageInfo;if(a){var b=a.refs;if(!b){b=0}a.refs=b+1}},createPopup:function(){window.top.location=this.yui.SDC.util.url.addParam(this.referralUrl,"context","deal_button_code");var a="location=0,menubar=0,resizable=yes,scrollbars=yes,width="+this.popupData.width+",height="+this.popupData.height;this.popupRef=window.open(this.elements.button.href,"couponPopup",a);this.popupRef.focus()},cleanup:function(){try{for(subpanel in this.subpanels){delete this.subpanels[subpanel]}delete this.vote;delete this}catch(a){}}};YAHOO.SDC.coupons.CouponSubpanel=function(b,a){if(!b||!a){return null}this.couponRef=b;this.catalyst=a;this.isInsidePopup=b.popupData.isInsidePopup;this.yui=b.yui;this.UTIL=this.yui.util;this.DOM=this.UTIL.Dom;this.EVENT=this.UTIL.Event;this.ANIM=this.UTIL.Anim;this.EASE_OUT=this.UTIL.Easing.easeOut;this.createElement=this.yui.SDC.util.createElement};YAHOO.SDC.coupons.CouponSubpanel.prototype={initialize:function(){},setup_animation:function(){},hide:function(){this.wrapper.style.display="none";this.wrapper.style.height=""},isVisible:function(){return(this.wrapper&&this.wrapper.offsetHeight>0)},toggle:function(a){if(a){this.EVENT.stopEvent(a)}if(this.isVisible()){this.animations.hide.animate()}else{this.callSubpanelManager();this.setup_animation();this.animations.show.animate()}},callSubpanelManager:function(){this.couponRef.subpanelManager(this)}};YAHOO.SDC.coupons.CouponComments=function(b,a){YAHOO.SDC.coupons.CouponComments.superclass.constructor.call(this,b,a);this.initialize()};YAHOO.SDC.util.extend(YAHOO.SDC.coupons.CouponComments,YAHOO.SDC.coupons.CouponSubpanel,{initialize:function(){this.query="/indexComments.ajax";this.callbacks={get:{success:this.callback_get_success,failure:this.callback_get_failure,scope:this,cache:false},submit:{success:this.callback_submit_success,failure:this.callback_submit_failure,scope:this,cache:false}};var a=(/\d+/).exec(this.catalyst.innerHTML);this.numberOfComments=a?parseInt(a[0]):0;this.ev_build=this.EVENT.on(this.catalyst,"click",this.build,this,true);this.animation_limits=this.isInsidePopup?{MEMBER_COMMENTS:375,MEMBER_NO_COMMENTS:195,ANON_COMMENTS:325,ANON_NO_COMMENTS:150}:{MEMBER_COMMENTS:360,MEMBER_NO_COMMENTS:155,ANON_COMMENTS:335,ANON_NO_COMMENTS:130}},build:function(c){if(c){this.EVENT.stopEvent(c)}if(this.wrapper){this.toggle();return}this.logged_in=_PageInfo.loggedIn;var a=this.createElement;var e=this.couponRef.couponId;var d=a("div",{"class":"wrapper-comments"});d.appendChild(a("div",{"class":"hr"}));var b=a("form",{name:"coupon-comment-form-"+e});this.EVENT.on(b,"submit",this.submit,this,true);this.form_elements={root:b};b.appendChild(a("a",{href:"#","class":"close"}));b.lastChild.innerHTML="Close";this.EVENT.on(b.lastChild,"click",this.toggle,this,true);b.appendChild(document.createElement("big"));b.lastChild.innerHTML="Comments";b.appendChild(a("input",{type:"hidden",name:"id",value:e}));if(this.logged_in){b.appendChild(a("div",{"class":"clear break"}));b.appendChild(this.yui.SDC.util.createTextarea({name:"postBody"}));this.form_elements.comment=b.lastChild;b.appendChild(this.yui.SDC.util.createButton("Add Comment",{href:"#"}));this.EVENT.on(b.lastChild,"click",this.submit,this,true)}else{b.appendChild(a("div",{"class":"login"}));b.lastChild.appendChild(document.createElement("big"));b.lastChild.lastChild.innerHTML='<a href="#" onclick="return false">Sign-in</a> or <a rel="register" href="#" onclick="return false">register</a> to comment!';b.lastChild.appendChild(document.createElement("p"));b.lastChild.lastChild.innerHTML="Or, sign-in super fast with your third party account...";b.lastChild.appendChild(a("img",{src:"/images/savings/login/icons_big6_tiny.png",width:"154",height:"22",alt:"Sign-in"}));this.EVENT.on(b.lastChild,"click",this.authenticate,this,true)}d.appendChild(b);d.appendChild(a("div",{"class":"clear"}));this.existing_comments=a("div",{"class":"existing loading"});d.appendChild(this.existing_comments);if(this.numberOfComments>0){this.get()}else{this.existing_comments.style.display="none"}this.couponRef.DOM_insertHere.appendChild(d);this.wrapper=d;if(this.ev_build){this.EVENT.removeListener(this.catalyst,"click",this.ev_build)}this.EVENT.on(this.catalyst,"click",this.toggle,this,true);this.toggle();if(this.ev_build){delete this.ev_build}},validate:function(){var a=this.form_elements;var d=/^\s*$/;var b="Your comment has not been submitted.\nPlease correct the following errors:\n\n";var c="";if(d.test(a.comment.value)){c+="Comment field cannot be empty.\n"}if(a.email&&d.test(a.email.value)){c+="Email field cannot be empty.\n"}if(a.password&&d.test(a.password.value)){c+="Password field cannot be empty.\n"}if(c!=""){alert(b+c);return false}return true},submit:function(a){if(a){this.EVENT.stopEvent(a)}if(!this.validate()){return}this.UTIL.Connect.setForm(this.form_elements.root);this.UTIL.Connect.asyncRequest("POST",this.query,this.callbacks.submit,null)},callback_submit_success:function(a){var b=this.yui.lang.JSON;if(b.isValid(a.responseText)){var c=b.parse(a.responseText);if(c.status&&c.status=="failure"){this.callback_submit_failure(a)}}else{if((/^\s*$/).test(a.responseText)){this.callback_submit_failure(a)}else{if(this.logged_in){this.form_elements.comment.value="";this.callback_get_success(a)}else{this.loginRefresh()}}}},callback_submit_failure:function(a){if(this.yui.lang.JSON.isValid(a.responseText)){var b=this.yui.lang.JSON.parse(a.responseText);var c="Your comment has not been submitted.\nPlease correct the following errors:\n\n"+b.message.replace(/\.\s/g,".\n");alert(c)}else{var c="There has been an error while attempting to retrieve the comments.\n\nWould you like to try again?";if(confirm(c)){this.get()}}},get:function(){var a=this.query+"?id="+this.couponRef.couponId;this.UTIL.Connect.asyncRequest("GET",a,this.callbacks.get)},callback_get_success:function(b){var a=this.existing_comments;this.DOM.removeClass(a,"loading");a.innerHTML=b.responseText;var c=a.getElementsByTagName("li").length;if(c>0){var d=c+" Comment";if(c>1){d+="s"}this.couponRef.elements.comments.innerHTML=d;this.numberOfComments=c}if(this.numberOfComments===1){this.existing_comments.style.display="";delete this.animations;delete this.ready_animation;this.setup_animation();this.animations.show.animate()}},callback_get_failure:function(a){var c="There has been an error while attempting to retrieve the comments.\n\nWould you like to try again?";if(confirm(c)){this.get()}else{var b=0-this.existing_comments.offsetHeight;new this.ANIM(this.wrapper,{height:{by:b}},0.5,this.EASE_OUT).animate()}},setup_animation:function(){if(this.ready_animation){return}this.ready_animation=true;var b=this.animation_limits;if(this.numberOfComments>0){var a=this.logged_in?b.MEMBER_COMMENTS:b.ANON_COMMENTS}else{var a=this.logged_in?b.MEMBER_NO_COMMENTS:b.ANON_NO_COMMENTS}this.animations={show:new this.ANIM(this.wrapper,{height:{to:a}},0.5,this.EASE_OUT),hide:new this.ANIM(this.wrapper,{height:{to:0}},0.5,this.EASE_OUT)};this.animations.show.onStart.subscribe(function(){this.wrapper.style.display=""}.bind(this));this.animations.hide.onComplete.subscribe(function(){this.wrapper.style.display="none"}.bind(this))},loginRefresh:function(){var e=this.couponRef.couponId;var b="#_"+this.couponRef.root.id;var a=escape(this.form_elements.email.value);var d=escape(this.form_elements.password.value);var c=this.yui.SDC.util.url.addParam(location.href,"contextId",e);window.location="/secure/login.user?_spring_security_remember_me=true&j_username="+a+"&j_password="+d+"&reurl="+c+b},authenticate:function(c){if(c){this.EVENT.stopEvent(c)}var b=this.yui.SDC.util.url.addParam(location.href,"contextId",this.couponRef.couponId);var a=this.EVENT.getTarget(c);if(a.rel=="register"){new this.yui.SDC.tracking.Event("register_link","click",a,{context:"coupon comments subpanel",after:function(){location.href="/account/memberlogin.html?familiar=false&refURL="+escape(b)}}).fire()}else{this.couponRef.triggerAuthentication(null,b,"comment")}}});YAHOO.SDC.coupons.CouponShare=function(b,a){YAHOO.SDC.coupons.CouponShare.superclass.constructor.call(this,b,a);this.initialize()};YAHOO.SDC.util.extend(YAHOO.SDC.coupons.CouponShare,YAHOO.SDC.coupons.CouponSubpanel,{initialize:function(){this.elements={};this.ev_build=this.EVENT.on(this.catalyst,"click",this.build,this,true);this.animation_limits=this.isInsidePopup?{ACTIONS_LIST:65,EMAIL_TO_FRIEND:392,EMAIL_SUCCESS:115}:{ACTIONS_LIST:68,EMAIL_TO_FRIEND:392,EMAIL_SUCCESS:112}},build:function(h){if(h){this.EVENT.stopEvent(h)}var j=this.couponRef.SELECT("fieldset.share-links input",this.couponRef.root);var b=this.createElement;var f=this.couponRef.couponId;var a=b("div",{"class":"wrapper-share"});a.appendChild(b("div",{"class":"hr"}));var e=(b("div",{"class":"actions"}));e.appendChild(b("a",{"class":"email",href:"#",text:"Email to Friend(s)"}));this.ev_buildShareEmail=this.EVENT.on(e.lastChild,"click",this.buildShareEmail,this,true);for(var c=0,d=j.length;c<d;c++){e.appendChild(b("a",{"class":j[c].className,href:j[c].value,text:j[c].name,target:"_blank"}))}a.appendChild(e);if(!this.isInsidePopup){a.appendChild(b("div",{"class":"clear"}));a.appendChild(this.buildEmbedFields());var g=this.buildAffiliateFields();if(g){a.appendChild(g)}}this.couponRef.DOM_insertHere.appendChild(a);this.wrapper=a;this.EVENT.removeListener(this.catalyst,"click",this.ev_build);this.EVENT.on(this.catalyst,"click",this.toggle,this,true);this.toggle();delete this.ev_build;new this.yui.SDC.tracking.Event("coupon_share","click",this.catalyst,{context:f,after:function(k){if(!k){return}var i=this.elements.urlField;if(i&&!(/(\?|&)eid=/).test(i.value)){var l=k.getId();if(l){i.value=this.yui.SDC.util.url.addParam(i.value,"eid",l)}}}.bind(this)}).fire()},buildShareEmail:function(b){this.EVENT.stopEvent(b);var a=this.EVENT.getTarget(b);this.EVENT.removeListener(a,"click",this.ev_buildShareEmail);this.couponRef.subpanels.shareEmail=new YAHOO.SDC.coupons.CouponShareEmail(this.couponRef,a)},buildEmbedFields:function(){var c=this.createElement;var h=this.couponRef.couponId;var d=_PageInfo;var g=location.protocol+"//"+location.host;var j=g+"/detail/"+h+"-"+d.lang.coupon+".html";var e=g+"/ext/widget/dealsWidget.html?cid="+h;var b=c("div",{"class":"embed"});var m="embed_url_"+h;b.appendChild(c("label",{"for":m}));b.lastChild.innerHTML="URL";var f=c("input",{value:j});b.appendChild(f);f.readOnly=true;this.EVENT.on(f,"focus",function(){new YAHOO.SDC.tracking.Event("coupon_share_url_focus",null,null,{queryParams:{deal_id:h},enableCaching:true}).fire()});this.elements.urlField=f;m="embed_code_"+h;b.appendChild(c("label",{"for":m}));b.lastChild.innerHTML="Embed";var l=c("input",{"class":"last",value:'<script type="text/javascript" src="'+e+'"><\/script>'});b.appendChild(l);l.readOnly=true;this.EVENT.on(l,"focus",function(){new YAHOO.SDC.tracking.Event("coupon_share_embed_focus",null,null,{queryParams:{deal_id:h},enableCaching:true}).fire()});this.scriptField=l;var k=this.couponRef.getMerchantName();if(k){var i="/sdc/consumer_ext_coupon_noscript.ajax?merchantName="+k;var a=this.couponRef.getMerchantUrl();if(a){i+="&merchantUrl="+a}this.UTIL.Connect.asyncRequest("GET",i,{success:function(n){this.scriptField.value+=n.responseText},scope:this})}return b},buildAffiliateFields:function(){var b=this.couponRef.affiliateUrl;if(typeof b=="string"){var h=this.couponRef.couponId;var e=this.createElement;var d=e("div",{"class":"affiliate"});if(!(/^\s*$/).test(b)){var c="affiliate_url_"+h;d.appendChild(e("label",{"for":c}));d.lastChild.innerHTML="Affiliate URL";d.appendChild(e("input",{value:b}));d.lastChild.readOnly=true;this.EVENT.on(d.lastChild,"focus",function(){this.select()});d.appendChild(e("div",{"class":"code"}));d.lastChild.appendChild(e("label",{"for":c}));d.lastChild.lastChild.innerHTML="Coupon Code";var a=e("input");d.lastChild.appendChild(a);a.readOnly=true;this.EVENT.on(a,"focus",function(){this.select()});this.UTIL.Connect.asyncRequest("GET","/util/json/getCoupon.ajax?id="+h,{success:function(i){var j=this.yui.SDC.util.json.getObject(i.responseText);if(j&&j.deal&&j.deal.code){a.value=j.deal.code}else{a.parentNode.style.display="none"}}.bind(this),failure:function(){a.parentNode.style.display="none"},scope:this,timeout:3000})}else{this.affiliateContainer=d;this.UTIL.Connect.asyncRequest("GET","/lang/getMessage.ajax?key=consumer.coupons.affiliate.none",{success:function(i){var j=this.yui.lang.JSON;if(j.isValid(i.responseText)){var l=j.parse(i.responseText);if(l.valid){var k=this.affiliateContainer;k.appendChild(e("label"));k.lastChild.innerHTML=l.message;k.appendChild(e("div",{"class":"icon-help"}));new this.yui.SDC.widget.HoverCard(k.lastChild,"consumer.coupons.tooltip.affiliate",{orientation:"right"})}}},scope:this})}var g=this.animation_limits;for(var f in g){g[f]+=60}return d}},setup_animation:function(){if(this.ready_animation){return}this.ready_animation=true;var a=this.animation_limits;this.animations={show:new this.ANIM(this.wrapper,{height:{to:a.ACTIONS_LIST}},0.5,this.EASE_OUT),hide:new this.ANIM(this.wrapper,{height:{to:0}},0.5,this.EASE_OUT)};this.animations.show.onStart.subscribe(function(){this.wrapper.style.display=""}.bind(this));this.animations.hide.onComplete.subscribe(function(){this.wrapper.style.display="none"}.bind(this))}});YAHOO.SDC.coupons.CouponProblem=function(b,a){YAHOO.SDC.coupons.CouponProblem.superclass.constructor.call(this,b,a);this.initialize()};YAHOO.SDC.util.extend(YAHOO.SDC.coupons.CouponProblem,YAHOO.SDC.coupons.CouponSubpanel,{initialize:function(){this.otherDefaultText="(Optional) Tell us more...really, we want to know.";this.query_problem="/coupons/problem/coupon-"+this.couponRef.couponId+".html";this.query_bury="/coupons/rate/coupon-"+this.couponRef.couponId+".html";this.callbacks={success:null,failure:null,scope:this};this.ev_build=this.EVENT.on(this.catalyst,"click",this.build,this,true);this.animation_limits={ACTIONS_LIST:this.isInsidePopup?215:170}},build:function(e){if(e){this.EVENT.stopEvent(e)}var c=this.createElement;var h=this.couponRef.couponId;var g=c("div",{"class":"wrapper-problem"});g.appendChild(c("div",{"class":"hr"}));var d=(c("form",{name:"coupon-problem-form-"+h}));this.EVENT.on(d,"submit",this.report,this,true);this.form_elements={root:d};d.appendChild(c("a",{href:"#","class":"close"}));d.lastChild.innerHTML="Close";this.EVENT.on(d.lastChild,"click",this.toggle,this,true);d.appendChild(c("big"));d.lastChild.innerHTML="Is there a problem with this deal?";d.appendChild(c("br"));d.appendChild(c("small"));d.lastChild.innerHTML="Your feedback will go directly to our team for review.";var f=c("select");f.options[f.options.length]=new Option("What's the issue?","");f.options[f.options.length]=new Option("Expired/Broken","EXPIRED");f.options[f.options.length]=new Option("Spam/Not a Deal","NOTADEAL");f.options[f.options.length]=new Option("Duplicate","DUPLICATE");d.appendChild(f);this.form_elements.select=f;d.appendChild(c("div",{"class":"clear"}));var b=YAHOO.SDC.util.createTextarea();b.value=this.otherDefaultText;d.appendChild(b);this.form_elements.textarea=b;this.EVENT.on(b,"focus",this.clearField,this,true);var a=YAHOO.SDC.util.createButton("Leave Feedback");this.EVENT.on(a,"click",this.report,this,true);d.appendChild(a);g.appendChild(d);this.couponRef.DOM_insertHere.appendChild(g);this.wrapper=g;this.EVENT.removeListener(this.catalyst,"click",this.ev_build);this.EVENT.on(this.catalyst,"click",this.toggle,this,true);this.toggle();delete this.ev_build},report:function(a){this.EVENT.stopEvent(a);var f=new RegExp("^s*$");var c=this.form_elements.select;var b=this.form_elements.textarea.value;var d=c.options[c.selectedIndex].value;if(f.test(d)){return alert("Please select an issue from the list.")}this.createOverlay();var e="reason="+d;if(!f.test(b)&&b!=this.otherDefaultText){e+="&otherText="+escape(b)}this.UTIL.Connect.asyncRequest("POST",this.query_problem,this.callbacks,e);e="rating=0&filter="+_PageInfo.filter+"&ignoreWhenNotLoggedIn=true";this.UTIL.Connect.asyncRequest("POST",this.query_bury,this.callbacks,e)},clearField:function(){scClearField(this.form_elements.textarea,this.otherDefaultText)},createOverlay:function(){this.hide();var b=this.couponRef.root;this.DOM.addClass(b,"flagged");var c=this.createElement;var a=c("div",{"class":"flag"});a.appendChild(c("div",{"class":"overlay"}));a.appendChild(c("p"));a.lastChild.innerHTML="This deal has been flagged as broken.";b.insertBefore(a,b.firstChild)},setup_animation:function(){if(this.ready_animation){return}this.ready_animation=true;var a=this.animation_limits;this.animations={show:new this.ANIM(this.wrapper,{height:{to:a.ACTIONS_LIST}},0.5,this.EASE_OUT),hide:new this.ANIM(this.wrapper,{height:{to:0}},0.5,this.EASE_OUT)};this.animations.show.onStart.subscribe(function(){this.wrapper.style.display=""}.bind(this));this.animations.hide.onComplete.subscribe(function(){this.wrapper.style.display="none"}.bind(this))}});YAHOO.SDC.coupons.CouponShareEmail=function(b,a){YAHOO.SDC.coupons.CouponShareEmail.superclass.constructor.call(this,b,a);this.initialize()};YAHOO.SDC.util.extend(YAHOO.SDC.coupons.CouponShareEmail,YAHOO.SDC.coupons.CouponSubpanel,{initialize:function(){this.parentRef=this.couponRef.subpanels.share;this.parentContainer=this.parentRef.wrapper;this.query="/emailDeal.ajax";this.callbacks={success:this.callback_success,failure:this.callback_failure,scope:this,cache:false};this.EVENT.on(this.catalyst,"click",this.toggle,this,true);this.build();this.toggle()},build:function(){var b=this.createElement;var e=this.couponRef.couponId;var a=new Date().getTime().toString();a=parseInt(a.substring(a.length-4));var d=b("div",{"class":"wrapper-share-email"});var c=b("form",{name:"coupon-share-form-"+e});this.EVENT.on(c,"submit",this.submit,this,true);this.form_elements={root:c};c.appendChild(b("a",{href:"#","class":"close"}));c.lastChild.innerHTML="Close";this.EVENT.on(c.lastChild,"click",this.toggle,this,true);c.appendChild(document.createElement("big"));c.lastChild.innerHTML="Email To Friend(s)";c.appendChild(b("input",{type:"hidden",name:"id",value:e}));c.appendChild(b("div",{"class":"clear break"}));c.appendChild(b("div",{"class":"errors"}));this.form_elements.errors=c.lastChild;c.appendChild(document.createElement("fieldset"));c.lastChild.appendChild(document.createElement("label"));c.lastChild.lastChild.innerHTML="To*";c.lastChild.appendChild(this.yui.SDC.util.createInput({name:"toEmail",tabindex:a++}));this.form_elements.toEmail=c.lastChild;c.lastChild.appendChild(document.createElement("p"));c.lastChild.lastChild.innerHTML='Separate multiple addresses with a comma.<br/>We will not use email addresses for anything else. Our <a href="/corporate/articles/privacy.html" target="_blank">Privacy Policy</a>.';c.appendChild(document.createElement("fieldset"));c.lastChild.appendChild(document.createElement("label"));c.lastChild.lastChild.innerHTML="From (your email)*";c.lastChild.appendChild(this.yui.SDC.util.createInput({name:"fromEmail",tabindex:a++}));this.form_elements.fromEmail=c.lastChild;c.appendChild(document.createElement("fieldset"));c.lastChild.appendChild(document.createElement("label"));c.lastChild.lastChild.innerHTML="Your Name*";c.lastChild.appendChild(this.yui.SDC.util.createInput({name:"fromName",tabindex:a}));this.form_elements.fromName=c.lastChild;c.appendChild(this.yui.SDC.util.createButton("Send",{href:"#"}));this.form_elements.submit=c.lastChild;this.EVENT.on(this.form_elements.submit,"click",this.submit,this,true);c.appendChild(b("p",{"class":"required"}));c.lastChild.innerHTML="*Required Field";d.appendChild(c);this.parentContainer.appendChild(b("div",{"class":"clear"}));this.parentContainer.appendChild(d);this.wrapper=d},submit:function(a){if(a){this.EVENT.stopEvent(a)}this.UTIL.Connect.setForm(this.form_elements.root);this.UTIL.Connect.asyncRequest("POST",this.query,this.callbacks,null)},callback_success:function(a){var b=this.yui.lang.JSON;if(b.isValid(a.responseText)){var d=b.parse(a.responseText);if(d.status&&d.status=="failure"){this.callback_failure(a);return}}this.animations.success_hide.animate();var c=this.createElement("div",{"class":"success"});c.appendChild(document.createElement("h1"));c.lastChild.innerHTML="Thank you, your message has been sent!";this.parentContainer.insertBefore(c,this.wrapper);this.DOM_success=c;if(!this.animations.success_fade){this.animations.success_fade=new this.ANIM(this.DOM_success,{opacity:{to:0}},0.5);this.animations.success_fade.onComplete.subscribe(function(){this.wrapper.style.display="";this.DOM_success.parentNode.removeChild(this.DOM_success);this.animations.hide.animate()}.bind(this))}setTimeout(function(){this.animations.success_fade.animate()}.bind(this),2000)},callback_failure:function(a){var b=this.yui.lang.JSON.parse(a.responseText);var c=(b.message&&!(/^\s*$/).test(b.message))?b.message:"There has been an error while attempting to send your email.<br/>Please try again.";c="Your email has not been sent.\nPlease correct the following errors:\n\n"+c.replace(/\.\s/g,".\n");alert(c)},callSubpanelManager:function(){},hide:function(){this.wrapper.style.display="none"},isVisible:function(){return(this.wrapper&&this.wrapper.style.display=="block")},setup_animation:function(){if(this.ready_animation){return}this.ready_animation=true;var a=this.parentRef.animation_limits;this.animations={show:new this.ANIM(this.parentContainer,{height:{to:a.EMAIL_TO_FRIEND}},0.5,this.EASE_OUT),hide:new this.ANIM(this.parentContainer,{height:{to:a.ACTIONS_LIST}},0.5,this.EASE_OUT),success_hide:new this.ANIM(this.parentContainer,{height:{to:a.EMAIL_SUCCESS}},0.5,this.EASE_OUT)};this.animations.show.onStart.subscribe(function(){this.wrapper.style.display="block"}.bind(this));this.animations.hide.onComplete.subscribe(function(){this.hide()}.bind(this))}});YAHOO.SDC.coupons.CouponVote=function(b,a){if(!b||!a){return null}this.couponRef=b;this.catalyst=a;this.isInsidePopup=b.popupData.isInsidePopup;this.yui=b.yui;this.query="/coupons/rate/coupon-"+this.couponRef.couponId+".html?rating=5&filter="+_PageInfo.filter;this.callbacks={success:this.callback_success,scope:this,cache:false};if(this.couponRef.ev_vote){this.couponRef.EVENT.removeListener(this.couponRef.elements.vote,"mouseover",this.couponRef.ev_initVoting)}this.setCounterDomReference();this.couponRef.EVENT.on(a,"click",this.recordVote,this,true)};YAHOO.SDC.coupons.CouponVote.prototype={recordVote:function(a){if(a){this.couponRef.EVENT.stopEvent(a)}if(this.alreadyVoted){return}this.yui.util.Connect.asyncRequest("GET",this.query,this.callbacks)},callback_success:function(b){if((/^\s*unauthenticated\s*$/i).test(b.responseText)){this.authenticate();this.callback_failure(b)}else{if((/\d+/).test(b.responseText)){var a=this.dom_counter;if(this.isInsidePopup){a.innerHTML=b.responseText;this.catalyst.className=a.className="voted"}else{a.getElementsByTagName("strong")[0].innerHTML=b.responseText;this.catalyst.parentNode.className="voted"}if(a.title){a.title=a.title.replace(/\d+/,b.responseText)}this.catalyst.innerHTML+="d";this.alreadyVoted=true}}},callback_failure:function(a){},setCounterDomReference:function(){var a=this.isInsidePopup?"p.vote":"p.votes";this.dom_counter=this.couponRef.SELECT(a,this.couponRef.DOM_content,true)},authenticate:function(){var b=this.yui.SDC.util.url.addParam;var a=b(location.href,"contextId",this.couponRef.couponId);a=b(a,"vote","true");this.couponRef.triggerAuthentication(null,a,"vote")}};var _scLoginRef=null;function scLogin(c,a,b){var d=YAHOO;if(c){d.util.Event.stopEvent(c)}var e=function(){scLoginExecute(a);var f=b?{context:b}:null;new d.SDC.tracking.Event("lbx_login",null,null,f).fire()};if(_scLoginRef){e()}else{new d.SDC.widget.Loader("lightbox",e)}}function scLoginAd(c,a,b){if(!_PageInfo.loggedIn){scLogin(c,a,b)}}function scLoginExecute(a){var b=YAHOO.SDC;if(!a||(a&&(/^\s*$/).test(a))){a=top.location.href}var e=unescape(a);if(e.indexOf("#")!=-1){a=e.replace(/#(?:[^$|\\?|&]+)/g,"")}if(a.indexOf("%")<0){a=escape(a)}var d="/member/lbxLogin.ajax?refURL="+a;if(_scLoginRef){var c=_scLoginRef;c.changeContent(d)}else{var f=["ajax/login"];if(b.BrowserDetect.isPreIE7){f.push("ajax/login_ie6")}new b.Fetch(f,{type:"css"});_scLoginRef=new b.widget.Lightbox(d,{width:650})}};YAHOO.namespace("SDC.widget");YAHOO.SDC.widget.Loader=function(b,g,i){if(!b){return}var d=_PageInfo;var a=b.toLowerCase();var h=[];var c=".js";var e="/fetch/get-js.url?resources=";if(i){if(i.filename){a=i.filename;a=a.replace(new RegExp(c,"gi"),"")}if(i.requires&&i.requires.length>0){h=i.requires}}var f=new YAHOO.util.YUILoader({onSuccess:g});f.addModule({fullpath:e+escape("/js/savings/widgets/"+a+c),type:"js",name:b,varName:b,requires:h});f.require(b);f.insert();return f};(function(){var a=YAHOO;a.util.Event.on(window,"load",function(){var c=a.SDC.widget;var g=["lightbox","autocomplete"],e=c.Loader,f=null;for(var d=0,b=g.length;d<b;d++){f=g[d];if(!c[f]){new e(f)}}})})();YAHOO.SDC.widget.DisplayManager={};(function(){var b=new Date();var d=YAHOO;var g=d.util.Cookie;var f="widgets";var c=new Date(b.setMonth(b.getMonth()+1));var e="1";var a={check:function(h,i){return e==g.getSub(f,h+"-"+i)},mark:function(h,i){g.setSub(f,h+"-"+i,e,{expires:c})}};d.SDC.widget.DisplayManager=a})();function scWidgetFilename(a){return"widgets/"+a}function scCreateFileUploadWidget(a){var b=YAHOO;var c=function(){new b.SDC.widget.FileUpload(a)};if(b.SDC.widget.FileUpload){c()}else{new b.SDC.widget.Loader("uploader",c)}}function scCreateSelectionWidget(a){if(a){a.onmouseover=function(){}}var b=YAHOO;var c=function(){new b.SDC.widget.FauxDropDown(a)};if(b.SDC.widget.FauxDropDown){c()}else{new b.SDC.widget.Loader("fauxdropdown",c)}};YAHOO.SDC.widget.SimpleToolTip=function(a){if(!a){return}this.catalyst=a;this.yui=YAHOO;this.messageText=null;this.yui_tooltip_id="tooltip_"+Math.random().toString().substring(2)};YAHOO.SDC.widget.SimpleToolTip.prototype={initialize:function(){this.loadYUI()},create:function(){if(!this.instance){this.instance=new this.yui.widget.Tooltip(this.yui_tooltip_id,{context:this.catalyst,text:this.messageText,showDelay:300,visible:true})}},loadYUI:function(){if(!this.yui.widget.Tooltip){var a=new this.yui.util.YUILoader({base:"",require:["container"],loadOptional:false,combine:true,allowRollup:true,onFailure:this.error,onSuccess:this.callback_yui_success,scope:this});a.insert()}else{this.callback_yui_success()}},callback_yui_success:function(){this.yui.util.Dom.addClass(document.body,"yui-skin-sam");this.create()},error:function(){},getText:function(){return this.instance?this.instance.cfg.config.text.value:null},getId:function(){return this.instance?this.instance.cfg.owner.id:null},destroy:function(){if(this.instance){this.instance.destroy()}}};YAHOO.SDC.widget.SimpleAjaxToolTip=function(a,c,b){YAHOO.SDC.widget.SimpleAjaxToolTip.superclass.constructor.call(this,a,b);if(!a||!c){return}this.message=c;this.msgQuery="/lang/getMessage.ajax";this.ready={yui:false,message:false};if(b){if(b.messageParams&&b.messageParams.length>0){this.messageParams=b.messageParams}if(b.commonId){this.yui_tooltip_id=b.commonId}}};YAHOO.SDC.util.extend(YAHOO.SDC.widget.SimpleAjaxToolTip,YAHOO.SDC.widget.SimpleToolTip,{initialize:function(){this.loadYUI();this.getMessage()},getMessage:function(){var c=this.msgQuery+"?key="+this.message;if(this.messageParams){var d="&args=";for(var b=0,a=this.messageParams.length;b<a;b++){c+=d+escape(this.messageParams[b])}}this.yui.util.Connect.asyncRequest("GET",c,{success:this.callback_msg_success,failure:this.error,scope:this},null)},callback_msg_success:function(a){var c=this.yui.lang.JSON;if(c.isValid(a.responseText)){var b=c.parse(a.responseText);if(b.valid){this.messageText=b.message;this.ready.message=true;this.coordinateRequests();return}}this.error()},callback_yui_success:function(){this.yui.util.Dom.addClass(document.body,"yui-skin-sam");this.ready.yui=true;this.coordinateRequests()},coordinateRequests:function(){clearTimeout(this.listener);if(this.ready.yui&&this.ready.message){this.create()}else{this.listener=setTimeout(this.coordinateRequests.bind(this),150)}}});