_PageInfo.resourceUrl=_PageInfo.resourceUrl.replace(/\&amp;/g,"&");YAHOO.namespace("SDC.BrowserDetect","SDC.util");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(e,b,a){if(!e||!b){return}YAHOO.lang.extend(e,b);if(a){var c=e.prototype;for(var d in a){c[d]=a[d]}}},createElement:function(a,b){var c=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,d,b){if(!(/^textarea|input$/).test(a)){return null}if(!b){var b={}}if(!d){var d=""}if((/^input$/).test(a)&&!b.type){b.type="text"}var c=YAHOO.SDC.util.createElement("div",{"class":"round"+d});c.appendChild(document.createElement("b"));c.lastChild.appendChild(document.createElement("b"));c.lastChild.lastChild.appendChild(document.createElement("b"));c.lastChild.lastChild.lastChild.appendChild(document.createElement("b"));c.lastChild.lastChild.lastChild.lastChild.appendChild(YAHOO.SDC.util.createElement(a,b));return c},createInput:function(b,a){return YAHOO.SDC.util.createRoundedFormField("input",b,a)},createTextarea:function(b,a){return YAHOO.SDC.util.createRoundedFormField("textarea",b,a)},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 callback_coupon_click(a){}var scWidgetManagerUtility=function(){this.yui=YAHOO.util;this.available={};this.queue=[];this.baseUrl=this.getResourceBaseUrl();this.prefix={css:"/styles/savings/widgets/",js:"/js/savings/widgets/"};this.suffixMinimized="_scmin"};scWidgetManagerUtility.prototype={invoke:function(c,d,f){if(!d){return true}if(c){this.yui.Event.stopEvent(c);if(this.busy){this.queue.push(c);return false}var a=this.yui.Event.getTarget(c);var b=c.type;if(b.indexOf("on")!=0){b="on"+b}a[b]=null}else{var a=null}if(!this.isAvailable(d)){this.busy=true;this.current={widget:d,catalyst:a,callback:f};this.yui.Get.css(this.buildResourceUrl(this.prefix.css+d+".css"));this.yui.Get.script(this.buildResourceUrl(this.prefix.js+d+".js"),{onSuccess:this.onLoaded,scope:this})}else{var e=this.available[d];if(typeof e=="function"&&a){e(a)}}},loadMoreCSS:function(d,b){if(!d||!b){return}var c=[];for(var a=0;a<b.length;a++){c.push(this.prefix.css+d+b[a]+".css")}this.yui.Get.css(this.buildResourceListUrl(c))},isAvailable:function(a){return this.available[a]},onLoaded:function(){if(this.current){var a=this.current.widget;var b=this.available[a];if(typeof b=="function"){b(this.current.catalyst)}if(typeof this.current.callback=="function"){this.current.callback()}this.busy=false;this.current=null;this.checkQueue()}},checkQueue:function(){if(this.queue.length>0){this.invoke(this.queue.pop())}},register:function(a,b){if(this.isAvailable(a)){if(console){console.log('WIDGET: "'+a+'" attempted to register more than once.')}return}if(!b){b=true}this.available[a]=b},getResourceBaseUrl:function(){var b=_PageInfo;try{if(!b.debug){return _PageInfo.resourceUrl}}catch(a){}return""},buildResourceListUrl:function(b){var a="";if(this.baseUrl!=""&&b&&b.length>0){var d=",";for(var c=0;c<b.length;c++){a+=this.utilResourceUrl(b[c]);if(c<b.length-1){a+=d}}a=this.baseUrl+a}return(a!="")?a:b},buildResourceUrl:function(a){if(!a){return null}if(this.baseUrl!=""){a=this.baseUrl+this.utilResourceUrl(a)}return a},utilResourceUrl:function(a){return escape(a).replace(/\//g,"%2F").replace(/(\.(?:js|css))$/gi,this.suffixMinimized+"$1")}};var scWidgetManager=new scWidgetManagerUtility();function scSubmit(b,a){var c=false;var d=document.forms[a];if(d){if(!d.target){d.target="_top"}if((/^(on)?keyup$/i).test(b.type)){if(b.keyCode==13){YAHOO.util.Event.stopEvent(b);c=true}}else{c=true}}if(c){d.submit()}}function scSearch(c,b,a){if(!c||!b){return true}var e=document.forms[c];if(!e){return true}var d=document.getElementById(b);if(d&&d.value==a){alert("Please type your search phrase in the adjacent field.");return false}e.submit();return false}function scCheckbox(c,d){if(!c||!d){return}var f=YAHOO.util;var a=f.Event.getTarget(c);if((/^i$/i).test(a.nodeName)){var b="checked";var e=d.getElementsByTagName("input")[0];if(f.Dom.hasClass(d,b)){f.Dom.removeClass(d,b);e.value="0"}else{f.Dom.addClass(d,b);e.value="1"}}}function scDisableForm(e){var c=YAHOO.util.Dom;var d=e?[e]:document.forms;for(var b=0;b<d.length;b++){if(c.hasClass(d[b],"disabled")){for(var a=0;a<d[b].elements.length;a++){d[b].elements[a].disabled=true}}}}function scClearField(a,b){if(a&&a.value==b){a.value=""}}var scMaxlength=function(b,c){if(!b||!c){return}this.counter=YAHOO.util.Dom.get(b);this.field=YAHOO.util.Dom.get(c);this.num=this.counter.getElementsByTagName("span")[0];this.yui=YAHOO;this.DOM=this.yui.util.Dom;var a=parseInt(this.num.innerHTML);this.limit=(a>0)?a:255;var d=Math.ceil(this.limit*0.15);this.warning_limit=d<25?25:d;this.yui.util.Event.on(this.field,"keyup",this.check,this,true);this.check()};scMaxlength.prototype={check:function(){var a=this.field.value.length;var b=this.limit-a;this.num.innerHTML=b;if(b<=0){this.DOM.replaceClass(this.counter,"warning","exceeded")}else{if(b<this.warning_limit){this.DOM.replaceClass(this.counter,"exceeded","warning")}else{this.counter.className=this.counter.className.replace(/(exceeded)|(warning)/g,"")}}}};function scPopup(e,d){if(!e||!e.href){return true}var b=h=600;var c=e.href;if(d){if(d.width&&d.width>50){b=d.width}if(d.height&&d.height>50){h=d.height}if(d.url){c=d.url}}var a="location=0,menubar=0,resizable=yes,scrollbars=yes,width="+b+",height="+h;window.open(c,"pop",a);return false}function scFormFocus(d){if(!d){if(document.forms[0]){d=document.forms[0]}else{return}}var b=d.elements;for(var c=0,a=b.length;c<a;c++){if((/^textarea$/i).test(b[c].nodeName)||((/^input$/i).test(b[c].nodeName)&&(/^(text)|(password)|(file)$/i).test(b[c].type))){if((/^\s*$/).test(b[c].value)){b[c].focus()}else{b[c].select()}break}}}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.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 c=document.getElementById(a);if(!c){return null}a=c}}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];this.popupData={isInsidePopup:this.DOM.hasClass(document.body,"popup"),height:700,width:480};var d=this.SELECT("div.desc",a);this.elements.descriptions={brief:d[0],full:d[1]};this.EVENT.on(d,"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 e=this.SELECT("ul li > a",a);if(!e||e.length<1){return}this.subpanels.comments=new this.yui.SDC.coupons.CouponComments(this,e[1]);this.elements.comments=e[1];this.subpanels.share=new this.yui.SDC.coupons.CouponShare(this,e[2]);this.elements.share=e[2];this.subpanels.problem=new this.yui.SDC.coupons.CouponProblem(this,e[3]);this.elements.problem=e[3];this.elements.button=this.SELECT("a.button",a,true);this.EVENT.on(this.elements.button,"click",this.buttonHandler,this,true);if(this.elements.button){this.hasCode=(/code/i).test(this.elements.button.innerHTML)}if(this.hasCode){var b=this.SELECT("a.title",a);this.EVENT.on(b,"click",this.buttonHandler,this,true)}this.referralUrl=document.getElementById("coupon-referral-"+this.couponId).value;this.initVoting(e[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");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"}},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(){var c=this.yui.SDC.widget.SimpleToolTip;this.tooltips={};if(this.elements.vote){this.tooltips.vote=new c(this.elements.vote,"consumer.coupons.tooltip.vote.stim")}var a=this.SELECT("p.votes",this.DOM_content,true);if(a){var b=a.getElementsByTagName("strong")[0].innerHTML;this.tooltips.counter=new c(a,"consumer.coupons.tooltip.vote.counter",{messageParams:[b]})}},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)}catch(d){window.resizeTo(screen.width,document.body.offsetHeight);scLogin(c,b)}}else{scLogin(c,b)}},buttonHandler:function(a){if(this.hasCode){this.EVENT.stopEvent(a);this.createPopup()}if(window.callback_coupon_click){callback_coupon_click(this.elements.button)}},createPopup:function(){window.top.location=this.referralUrl;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.tooltips;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.html";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(null,{name:"postBody"}));this.form_elements.comment=b.lastChild.getElementsByTagName("textarea")[0];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(b){if(b){this.EVENT.stopEvent(b)}var a=this.yui.SDC.util.url.addParam(location.href,"contextId",this.couponRef.couponId);if(this.EVENT.getTarget(b).rel=="register"){location.href="/account/memberlogin.html?familiar=false&refURL="+escape(a)}else{this.couponRef.triggerAuthentication(null,a,"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.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(e){if(e){this.EVENT.stopEvent(e)}var b=this.couponRef.SELECT("fieldset.share-links input",this.couponRef.root);var d=this.createElement;var h=this.couponRef.couponId;var g=d("div",{"class":"wrapper-share"});g.appendChild(d("div",{"class":"hr"}));var f=(d("div",{"class":"actions"}));f.appendChild(d("a",{"class":"email",href:"#",text:"Email to Friend(s)"}));this.ev_buildShareEmail=this.EVENT.on(f.lastChild,"click",this.buildShareEmail,this,true);for(var c=0,a=b.length;c<a;c++){f.appendChild(d("a",{"class":b[c].className,href:b[c].value,text:b[c].name}))}g.appendChild(f);if(!this.isInsidePopup){g.appendChild(d("div",{"class":"clear"}));g.appendChild(this.buildEmbedFields())}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},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 g=this.couponRef.couponId;var d=_PageInfo;var f=location.protocol+"//"+location.host;var i=f+"/detail/"+g+"-"+d.lang.coupon+".html";var e=f+"/ext/widget/dealsWidget.html?cid="+g;var b=c("div",{"class":"embed"});var l="embed_url_"+g;b.appendChild(c("label",{"for":l}));b.lastChild.innerHTML="URL";b.appendChild(c("input",{value:i}));b.lastChild.readOnly=true;this.EVENT.on(b.lastChild,"focus",function(){this.select()});l="embed_code_"+g;b.appendChild(c("label",{"for":l}));b.lastChild.innerHTML="Embed";var k=c("input",{"class":"last",value:'<script type="text/javascript" src="'+e+'"><\/script>'});b.appendChild(k);k.readOnly=true;this.EVENT.on(k,"focus",function(){this.select()});this.scriptField=k;var j=this.couponRef.getMerchantName();if(j){var h="/ajax/sdc/deals_widget_noscript.html?merchantName="+j;var a=this.couponRef.getMerchantUrl();if(a){h+="&merchantUrl="+a}this.UTIL.Connect.asyncRequest("GET",h,{success:function(m){this.scriptField.value+=m.responseText},scope:this})}return b},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");f.options[f.options.length]=new Option("Other","OTHER");d.appendChild(f);this.form_elements.select=f;d.appendChild(c("div",{"class":"clear"}));d.appendChild(YAHOO.SDC.util.createTextarea());var b=d.lastChild.getElementsByTagName("textarea")[0];b.value=this.otherDefaultText;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="/ajax/emailDeal.html";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 a=this.createElement;var d=this.couponRef.couponId;var c=a("div",{"class":"wrapper-share-email"});var b=a("form",{name:"coupon-share-form-"+d});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="Email To Friend(s)";b.appendChild(a("input",{type:"hidden",name:"id",value:d}));b.appendChild(a("div",{"class":"clear break"}));b.appendChild(a("div",{"class":"errors"}));this.form_elements.errors=b.lastChild;b.appendChild(document.createElement("fieldset"));b.lastChild.appendChild(document.createElement("label"));b.lastChild.lastChild.innerHTML="To*";b.lastChild.appendChild(this.yui.SDC.util.createInput(null,{name:"toEmail"}));this.form_elements.toEmail=b.lastChild.getElementsByTagName("input")[0];b.lastChild.appendChild(document.createElement("p"));b.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>.';b.appendChild(document.createElement("fieldset"));b.lastChild.appendChild(document.createElement("label"));b.lastChild.lastChild.innerHTML="From (your email)*";b.lastChild.appendChild(this.yui.SDC.util.createInput(null,{name:"fromEmail"}));this.form_elements.fromEmail=b.lastChild.getElementsByTagName("input")[0];b.appendChild(document.createElement("fieldset"));b.lastChild.appendChild(document.createElement("label"));b.lastChild.lastChild.innerHTML="Your Name*";b.lastChild.appendChild(this.yui.SDC.util.createInput(null,{name:"fromName"}));this.form_elements.fromName=b.lastChild.getElementsByTagName("input")[0];b.appendChild(this.yui.SDC.util.createButton("Send",{href:"#"}));this.form_elements.submit=b.lastChild;this.EVENT.on(this.form_elements.submit,"click",this.submit,this,true);b.appendChild(a("p",{"class":"required"}));b.lastChild.innerHTML="*Required Field";c.appendChild(b);this.parentContainer.appendChild(a("div",{"class":"clear"}));this.parentContainer.appendChild(c);this.wrapper=c},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);if(this.couponRef.tooltips.counter){this.tooltip=this.couponRef.tooltips.counter}};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(b.responseText=="unauthenticated"){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";this.updateToolTip(b.responseText)}this.catalyst.innerHTML+="d";this.alreadyVoted=true}}},callback_failure:function(a){},updateToolTip:function(a){if(this.tooltip){var b=this.tooltip.getText();var c=this.tooltip.getId();if(!b||!c){return}b=b.replace(/[\d,]+/,a);this.tooltip.destroy();delete this.tooltip;delete this.couponRef.tooltips.counter;new this.yui.widget.Tooltip(c+"a",{context:this.dom_counter,text:b,showDelay:300,visible:true})}},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)};if(_scLoginRef){e()}else{new d.SDC.widget.Loader("lightbox",e)}}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="/ajax/sdc/lbx_login.html?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})}};