if(typeof YAHOO=="undefined"){var YAHOO={}}var _BrowserDetect={init: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){this.isPreIE8=(a[1]&&parseInt(a[1])<8);this.isPreIE7=(a[1]&&parseInt(a[1])<7);this.isPreIE6=(a[1]&&parseInt(a[1])<6);this.isPreIE55=(this.isPreIE7&&(parseInt(a[1])<=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}}.init();if(typeof Function.bind=="undefined"){Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a,arguments)}}}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.replace(/\&amp;/g,"&")}}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=""}}function scCreateElement(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}function scCreateButton(d,b){if((/^\s*$/.test(d))){return null}if(!b){var b={}}if(!b.href||(/^\s*$/).test(b.href)){b.href="javascript:void(0);"}var c=scCreateElement("a",b);YAHOO.util.Dom.addClass(c,"button");var a=document.createElement("b");a.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(a);return c}function scCreateInput(b,a){return scCreateRoundedFormField("input",b,a)}function scCreateTextarea(b,a){return scCreateRoundedFormField("textarea",b,a)}function scCreateRoundedFormField(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=scCreateElement("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(scCreateElement(a,b));return c}function scPopup(b){if(!b||!b.href){return true}var a="location=0,menubar=0,resizable=yes,scrollbars=yes,width=600,height=600";window.open(b.href,"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}}}String.prototype.scGetParam=function(d){var a=this;var c=new RegExp("(?:^|\\?|&)"+d+"=([^&#]*)&?","g");var b=c.exec(a);return(b&&b.length>1)?b[1]:null};String.prototype.scRemoveParam=function(c){var a=this;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};String.prototype.scAddParam=function(e,c){var a=this;a=a.scRemoveParam(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(){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.util.Event.onDOMReady(function(){_PageInfo.coupons=new CouponList()});var CouponList=function(){var a=YAHOO.util.Selector.query("div.coupon");YAHOO.util.Event.on(a,"mouseover",function(b){YAHOO.util.Event.stopPropagation(b);this.put(new Coupon(YAHOO.util.Event.getTarget(b)))},this,true);this.coupons=a;this.autoExpansion()};CouponList.prototype={autoExpansion:function(){var c=null;if((/^#?_?coupon-\d+$/i).test(location.hash)){var d=location.hash;if(d.charAt(0)=="#"){d=d.substring(1)}if(d.charAt(0)=="_"){d=d.substring(1)}c=d}else{if(!location.hash||(/^\s*$/).test(location.hash)){var a=location.href.scGetParam("contextId");if(!a){return}c="coupon-"+a;location.hash="_"+c}}if(c){var e=document.getElementById(c);if(!e){return}var b=new Coupon(e);b.submenus.comments.build();if(location.search.scGetParam("vote")=="true"){b.ev_initVoting();b.vote.send()}}},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}};var 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.yahoo=YAHOO;this.DOM=this.yahoo.util.Dom;this.EVENT=this.yahoo.util.Event;this.SELECT=this.yahoo.util.Selector.query;this.elements={};this.submenus={};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=scCreateElement("div",{"class":"insert"});this.DOM_content.insertBefore(this.DOM_insertHere,this.DOM.getLastChild(this.DOM_content));var e=this.SELECT("ul li > a",a);this.submenus.comments=new CouponComments(this,e[0]);this.elements.comments=e[0];this.submenus.share=new CouponShare(this,e[1]);this.elements.share=e[1];this.submenus.problem=new CouponProblem(this,e[2]);this.elements.problem=e[2];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();this.EVENT.on(window,"unload",this.cleanup,this,true)};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"}};Coupon.prototype.initVoting=function(){var a=this.SELECT("a.vote",this.DOM_content,true);if(!a){return}this.elements.vote=a;this.ev_vote=this.EVENT.on(a,"mouseover",this.ev_initVoting,this,true)};Coupon.prototype.ev_initVoting=function(){this.vote=new CouponVote(this,this.elements.vote)};Coupon.prototype.submenuManager=function(a){for(submenu in this.submenus){if(a!=this.submenus[submenu]){if(this.submenus[submenu].isVisible&&this.submenus[submenu].isVisible()){this.submenus[submenu].hide()}}}};Coupon.prototype.triggerAuthentication=function(b,a){if(this.popupData.isInsidePopup){try{opener.scLogin(b,a)}catch(c){window.resizeTo(screen.width,document.body.offsetHeight);scLogin(b,a)}}else{scLogin(b,a)}};Coupon.prototype.buttonHandler=function(a){if(this.hasCode){this.EVENT.stopEvent(a);this.createPopup()}if(window.callback_coupon_click){callback_coupon_click(this.elements.button)}};Coupon.prototype.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()};Coupon.prototype.cleanup=function(){try{for(submenu in this.submenus){delete this.submenus[submenu]}delete this.vote;delete this}catch(a){}};var CouponVote=function(b,a){if(!b||!a){return null}this.couponRef=b;this.catalyst=a;this.isInsidePopup=b.popupData.isInsidePopup;this.query="/coupons/rate/coupon-"+this.couponRef.couponId+".html?rating=5&filter="+_PageInfo.filter;this.callbacks={success:this.callback_success,scope:this};if(this.couponRef.ev_vote){this.couponRef.EVENT.removeListener(this.couponRef.elements.vote,"mouseover",this.couponRef.ev_vote);delete this.couponRef.ev_vote}this.couponRef.EVENT.on(a,"click",this.send,this,true);this.vote_counter=this.couponRef.SELECT("p.vote",this.couponRef.DOM_content,true)};CouponVote.prototype.send=function(a){if(a){this.couponRef.EVENT.stopEvent(a)}if(this.alreadyVoted){return}this.couponRef.yahoo.util.Connect.asyncRequest("GET",this.query,this.callbacks)};CouponVote.prototype.callback_success=function(a){if(a.responseText=="unauthenticated"){this.authenticate();this.callback_failure(a)}else{if((/\d+/).test(a.responseText)){if(this.isInsidePopup){this.vote_counter.innerHTML=a.responseText;this.catalyst.className=this.vote_counter.className="voted";this.catalyst.innerHTML="You Voted!"}else{this.vote_counter.innerHTML=a.responseText+"<br/><small>votes</small>";this.catalyst.className=this.vote_counter.className=this.catalyst.innerHTML="voted"}this.alreadyVoted=true}}};CouponVote.prototype.callback_failure=function(a){};CouponVote.prototype.authenticate=function(){var a=location.href.scAddParam("contextId",this.couponRef.couponId);a=a.scAddParam("vote","true");this.couponRef.triggerAuthentication(null,a)};var CouponComments=function(c,a){if(!c||!a){return null}this.couponRef=c;this.catalyst=a;this.isInsidePopup=c.popupData.isInsidePopup;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}};this.yahoo=c.yahoo;this.UTIL=this.yahoo.util;this.DOM=this.UTIL.Dom;this.EVENT=this.UTIL.Event;this.ANIM=this.UTIL.Anim;this.EASE_OUT=this.UTIL.Easing.easeOut;var b=(/\d+/).exec(a.innerHTML);this.numberOfComments=b?parseInt(b[0]):0;this.ev_build=this.EVENT.on(a,"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}};CouponComments.prototype.build=function(b){if(b){this.EVENT.stopEvent(b)}if(this.wrapper){this.toggle();return}this.logged_in=_PageInfo.loggedIn;var d=this.couponRef.couponId;var c=scCreateElement("div",{"class":"wrapper-comments"});c.appendChild(scCreateElement("div",{"class":"hr"}));var a=scCreateElement("form",{name:"coupon-comment-form-"+d});this.EVENT.on(a,"submit",this.submit,this,true);this.form_elements={root:a};a.appendChild(scCreateElement("a",{href:"#","class":"close"}));a.lastChild.innerHTML="- close comment";this.EVENT.on(a.lastChild,"click",this.toggle,this,true);a.appendChild(document.createElement("big"));a.lastChild.innerHTML="Comments";a.appendChild(scCreateElement("input",{type:"hidden",name:"id",value:d}));if(this.logged_in){a.appendChild(scCreateElement("div",{"class":"clear break"}));a.appendChild(scCreateRoundedFormField("textarea",null,{name:"postBody"}));this.form_elements.comment=a.lastChild.getElementsByTagName("textarea")[0];a.appendChild(scCreateButton("Add Comment",{href:"#"}));this.EVENT.on(a.lastChild,"click",this.submit,this,true)}else{a.appendChild(scCreateElement("div",{"class":"login"}));a.lastChild.appendChild(document.createElement("big"));a.lastChild.lastChild.innerHTML='<a href="#" onclick="return false">Sign-in</a> or <a href="#" onclick="return false">register</a> to comment!';a.lastChild.appendChild(document.createElement("p"));a.lastChild.lastChild.innerHTML="Or, sign-in super fast with your third party account...";a.lastChild.appendChild(scCreateElement("img",{src:"/images/savings/login/icons_big6_tiny.png",width:"154",height:"22",alt:"Sign-in"}));this.EVENT.on(a.lastChild,"click",this.authenticate,this,true)}c.appendChild(a);c.appendChild(scCreateElement("div",{"class":"clear"}));this.existing_comments=scCreateElement("div",{"class":"existing loading"});c.appendChild(this.existing_comments);if(this.numberOfComments>0){this.get()}else{this.existing_comments.style.display="none"}this.couponRef.DOM_insertHere.appendChild(c);this.wrapper=c;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}};CouponComments.prototype.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};CouponComments.prototype.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)};CouponComments.prototype.callback_submit_success=function(a){var b=this.yahoo.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()}}}};CouponComments.prototype.callback_submit_failure=function(a){if(this.yahoo.lang.JSON.isValid(a.responseText)){var b=this.yahoo.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()}}};CouponComments.prototype.get=function(){var a=this.query+"?id="+this.couponRef.couponId;this.UTIL.Connect.asyncRequest("GET",a,this.callbacks.get)};CouponComments.prototype.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()}};CouponComments.prototype.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()}};CouponComments.prototype.toggle=function(a){if(a){this.EVENT.stopEvent(a)}if(this.isVisible()){this.animations.hide.animate()}else{this.couponRef.submenuManager(this);this.setup_animation();this.animations.show.animate()}};CouponComments.prototype.hide=function(){this.wrapper.style.display="none";this.wrapper.style.height=""};CouponComments.prototype.isVisible=function(){return(this.wrapper&&this.wrapper.offsetHeight>0)};CouponComments.prototype.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))};CouponComments.prototype.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=window.location.href.scAddParam("contextId",e);window.location="/secure/login.user?_spring_security_remember_me=true&j_username="+a+"&j_password="+d+"&reurl="+c+b};CouponComments.prototype.authenticate=function(b){var a=location.href.scAddParam("contextId",this.couponRef.couponId);this.couponRef.triggerAuthentication(null,a)};var CouponShare=function(b,a){if(!b||!a){return}this.couponRef=b;this.catalyst=a;this.isInsidePopup=b.popupData.isInsidePopup;this.yahoo=b.yahoo;this.UTIL=this.yahoo.util;this.DOM=this.UTIL.Dom;this.EVENT=this.UTIL.Event;this.ANIM=this.UTIL.Anim;this.EASE_OUT=this.UTIL.Easing.easeOut;this.ev_build=this.EVENT.on(a,"click",this.build,this,true);this.animation_limits=this.isInsidePopup?{ACTIONS_LIST:65,EMAIL_TO_FRIEND:392,EMAIL_SUCCESS:115}:{ACTIONS_LIST:36,EMAIL_TO_FRIEND:360,EMAIL_SUCCESS:80}};CouponShare.prototype.build=function(d){this.EVENT.stopEvent(d);var b=this.couponRef.SELECT("fieldset.share-links input",this.couponRef.root);var g=this.couponRef.couponId;var f=scCreateElement("div",{"class":"wrapper-share"});f.appendChild(scCreateElement("div",{"class":"hr"}));var e=(scCreateElement("div",{"class":"actions"}));e.appendChild(scCreateElement("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,a=b.length;c<a;c++){e.appendChild(scCreateElement("a",{"class":b[c].className,href:b[c].value,text:b[c].name}))}f.appendChild(e);this.couponRef.DOM_insertHere.appendChild(f);this.wrapper=f;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};CouponShare.prototype.buildShareEmail=function(b){this.EVENT.stopEvent(b);var a=this.EVENT.getTarget(b);this.EVENT.removeListener(a,"click",this.ev_buildShareEmail);this.couponRef.submenus.shareEmail=new CouponShareEmail(this,a)};CouponShare.prototype.toggle=function(a){if(a){this.EVENT.stopEvent(a)}if(this.isVisible()){this.animations.hide.animate()}else{this.couponRef.submenuManager(this);this.setup_animation();this.animations.show.animate()}};CouponShare.prototype.hide=function(){this.wrapper.style.display="none";this.wrapper.style.height=""};CouponShare.prototype.isVisible=function(){return(this.wrapper&&this.wrapper.offsetHeight>0)};CouponShare.prototype.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))};var CouponShareEmail=function(b,a){if(!b||!a){return null}this.parentRef=b;this.catalyst=a;this.parentContainer=b.wrapper;this.query="/ajax/emailDeal.html";this.callbacks={success:this.callback_success,failure:this.callback_failure,scope:this,cache:false};this.yahoo=YAHOO;this.UTIL=this.yahoo.util;this.EVENT=this.UTIL.Event;this.ANIM=this.UTIL.Anim;this.EVENT.on(a,"click",this.toggle,this,true);this.build();this.toggle()};CouponShareEmail.prototype.build=function(){var c=this.parentRef.couponRef.couponId;var b=scCreateElement("div",{"class":"wrapper-share-email"});var a=scCreateElement("form",{name:"coupon-share-form-"+c});this.EVENT.on(a,"submit",this.submit,this,true);this.form_elements={root:a};a.appendChild(scCreateElement("a",{href:"#","class":"close"}));a.lastChild.innerHTML="- Hide";this.EVENT.on(a.lastChild,"click",this.toggle,this,true);a.appendChild(document.createElement("big"));a.lastChild.innerHTML="Email To Friend(s)";a.appendChild(scCreateElement("input",{type:"hidden",name:"id",value:c}));a.appendChild(scCreateElement("div",{"class":"clear break"}));a.appendChild(scCreateElement("div",{"class":"errors"}));this.form_elements.errors=a.lastChild;a.appendChild(document.createElement("fieldset"));a.lastChild.appendChild(document.createElement("label"));a.lastChild.lastChild.innerHTML="To*";a.lastChild.appendChild(scCreateRoundedFormField("input",null,{name:"toEmail"}));this.form_elements.toEmail=a.lastChild.getElementsByTagName("input")[0];a.lastChild.appendChild(document.createElement("p"));a.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>.';a.appendChild(document.createElement("fieldset"));a.lastChild.appendChild(document.createElement("label"));a.lastChild.lastChild.innerHTML="From (your email)*";a.lastChild.appendChild(scCreateRoundedFormField("input",null,{name:"fromEmail"}));this.form_elements.fromEmail=a.lastChild.getElementsByTagName("input")[0];a.appendChild(document.createElement("fieldset"));a.lastChild.appendChild(document.createElement("label"));a.lastChild.lastChild.innerHTML="Your Name*";a.lastChild.appendChild(scCreateRoundedFormField("input",null,{name:"fromName"}));this.form_elements.fromName=a.lastChild.getElementsByTagName("input")[0];a.appendChild(scCreateButton("Send",{href:"#"}));this.form_elements.submit=a.lastChild;this.EVENT.on(this.form_elements.submit,"click",this.submit,this,true);a.appendChild(scCreateElement("p",{"class":"required"}));a.lastChild.innerHTML="*Required Field";b.appendChild(a);this.parentContainer.appendChild(scCreateElement("div",{"class":"clear"}));this.parentContainer.appendChild(b);this.wrapper=b};CouponShareEmail.prototype.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)};CouponShareEmail.prototype.callback_success=function(a){var b=this.yahoo.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=scCreateElement("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)};CouponShareEmail.prototype.callback_failure=function(a){var b=this.yahoo.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)};CouponShareEmail.prototype.toggle=function(a){if(a){this.EVENT.stopEvent(a)}if(this.isVisible()){this.animations.hide.animate()}else{this.setup_animation();this.animations.show.animate()}};CouponShareEmail.prototype.hide=function(){this.wrapper.style.display="none"};CouponShareEmail.prototype.isVisible=function(){return(this.wrapper&&this.wrapper.style.display=="block")};CouponShareEmail.prototype.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))};var CouponProblem=function(b,a){if(!b||!a){return}this.couponRef=b;this.catalyst=a;this.isInsidePopup=b.popupData.isInsidePopup;this.query_problem="/coupons/problem/coupon-"+b.couponId+".html";this.query_bury="/coupons/rate/coupon-"+b.couponId+".html";this.callbacks={success:null,failure:null,scope:this};this.yahoo=b.yahoo;this.UTIL=this.yahoo.util;this.DOM=this.UTIL.Dom;this.EVENT=this.UTIL.Event;this.ANIM=this.UTIL.Anim;this.EASE_OUT=this.UTIL.Easing.easeOut;this.ev_build=this.EVENT.on(a,"click",this.build,this,true);this.animation_limits={ACTIONS_LIST:this.isInsidePopup?65:36}};CouponProblem.prototype.build=function(d){this.EVENT.stopEvent(d);var b=[{text:"Expired or Broken",type:"EXPIRED"},{text:"Duplicate",type:"DUPLICATE"},{text:"Spam/Not a Deal",type:"NOTADEAL"},{text:"Other",type:"OTHER"}];var g=this.couponRef.couponId;var f=scCreateElement("div",{"class":"wrapper-problem"});f.appendChild(scCreateElement("div",{"class":"hr"}));var e=(scCreateElement("div",{"class":"actions"}));this.EVENT.on(e,"click",this.flag,this,true);for(var c=0,a=b.length;c<a;c++){e.appendChild(scCreateElement("a",{href:"#",text:b[c].text,rel:b[c].type}))}f.appendChild(e);this.couponRef.DOM_insertHere.appendChild(f);this.wrapper=f;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};CouponProblem.prototype.flag=function(b){var a=this.EVENT.getTarget(b);if(a.nodeName.toLowerCase()!="a"){return}this.EVENT.stopEvent(b);this.createFlagOverlay(a.rel);var c="reason="+a.rel;this.UTIL.Connect.asyncRequest("POST",this.query_problem,this.callbacks,c);c="rating=0&filter="+_PageInfo.filter+"&ignoreWhenNotLoggedIn=true";this.UTIL.Connect.asyncRequest("POST",this.query_bury,this.callbacks,c)};CouponProblem.prototype.toggle=function(a){if(a){this.EVENT.stopEvent(a)}if(this.isVisible()){this.animations.hide.animate()}else{this.couponRef.submenuManager(this);this.setup_animation();this.animations.show.animate()}};CouponProblem.prototype.hide=function(){this.wrapper.style.display="none";this.wrapper.style.height=""};CouponProblem.prototype.isVisible=function(){return(this.wrapper&&this.wrapper.offsetHeight>0)};CouponProblem.prototype.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))};CouponProblem.prototype.createFlagOverlay=function(c){this.hide();var b=this.couponRef.root;this.DOM.addClass(b,"flagged");var a=scCreateElement("div",{"class":"flag"});a.appendChild(scCreateElement("div",{"class":"overlay"}));a.appendChild(scCreateElement("p"));a.lastChild.innerHTML="This deal has been flagged as broken.";b.insertBefore(a,b.firstChild)};YAHOO.util.Event.onDOMReady(function(){var b=document.getElementById("login-tabbed");if(b){var a=YAHOO.util.Selector.query("div.tabs a",b);YAHOO.util.Event.on(a,"click",function(c){scLoginTabs(c,b)})}});var _scLoginRef=null;function scLogin(b,a){var c="lightbox";var d=function(){scLoginExecute(a)};if(!scWidgetManager.isAvailable(c)){scWidgetManager.invoke(b,c,d)}else{if(b){YAHOO.util.Event.stopEvent(b)}d()}}function scLoginExecute(a){if(!a||(a&&(/^\s*$/).test(a))){a=top.location.href}var d=unescape(a);if(d.indexOf("#")!=-1){a=d.replace(/#(?:[^$|\\?|&]+)/g,"")}if(a.indexOf("%")<0){a=escape(a)}var c="/ajax/sdc/lbx_login.html?refURL="+a;if(_scLoginRef){var b=_scLoginRef;b.changeContent(c)}else{var g=["/styles/savings/ajax/login.css"];if(_BrowserDetect.isPreIE7){g.push("/styles/savings/ajax/login_ie6.css")}try{YAHOO.util.Get.css(scWidgetManager.buildResourceListUrl(g))}catch(f){YAHOO.util.Get.css(g)}_scLoginRef=new Lightbox(c)}}function scLoginTabs(d,e){var f=YAHOO.util;if(d){f.Event.stopEvent(d)}var a=f.Event.getTarget(d);var c=f.Dom.hasClass(a,"local");var b=c?f.Dom.addClass:f.Dom.removeClass;b(e,"alt");if(c){scFormFocus(document.forms.signInForm)}}function scLoginTabsLbx(a){scLoginTabs(a,document.getElementById("rpx-wrapper"));if(_BrowserDetect.isGecko){window.scroll(0,window.pageYOffset+1);window.scroll(0,window.pageYOffset-1)}return false};