if(GTD==undefined){var GTD={}}GTD.scrollToElement=function(B){var A=0;var C=0;while(B!=null){A+=B.offsetLeft;C+=B.offsetTop;B=B.offsetParent}window.scrollTo(A,C)};GTD.Vote={};GTD.Vote.add=function(E,A,B){if(B){B.parentNode.style.display="none"}var C=document.getElementById("vote_title_"+E);if(C){C.innerHTML="Thank you for your vote!"}else{B.parentNode.style.display="";B.style.display="none";C=document.createElement("span");C.innerHTML="Thank you for your vote!";B.parentNode.appendChild(C)}var D={success:GTD.Vote.onAddSuccess};YAHOO.util.Connect.asyncRequest("POST","/_vote",D,"id="+E+"&worked="+A)};GTD.Vote.onAddSuccess=function(D){var E=D.responseXML;if(E){var B=E.getElementsByTagName("coupon").item(0);if(B){var A=null;var J=null;var M=null;var I=null;var F=null;for(var G=0;G<B.attributes.length;G++){if(B.attributes[G].name=="id"){A=B.attributes[G].value}else{if(B.attributes[G].name=="type"){J=B.attributes[G].value}else{if(B.attributes[G].name=="worked"){M=parseInt(B.attributes[G].value)}else{if(B.attributes[G].name=="notworked"){I=parseInt(B.attributes[G].value)}else{if(B.attributes[G].name=="status"){F=B.attributes[G].value}}}}}}if(A!=null&&J!=null&&M!=null&&I!=null&&F!=null){if(J=="deal"){var L=document.getElementById("point_"+A);if(L){L.innerHTML=(M>1)?M:"1"}}else{if(F=="deferred"){alert('Thanks for your vote!\nYour rating is valuable to us. Our staff will make every effort to review your vote and remove the promotion or coupon as appropriate. Any "Does Not Work" rating for promotion or "redeemable" coupon with the status "Valid Anytime" will need to be reviewed before it can be displayed.')}else{if(M>0){var K=M+I;var H=Math.ceil(100*M/K);var C=document.getElementById("coupon_rating_"+A);if(C){if(H<60){C.innerHTML='<div class="rate less"><img src="/images/blank.gif" width="'+H+'" height="7" /></div><div><span class="work59">'+H+"% found this "+((J=="deal")?"deal":"coupon")+" worked</span></div>"}else{C.innerHTML='<div class="rate"><img src="/images/blank.gif" width="'+H+'" height="7" /></div><div><span class="work60">'+H+"% found this "+((J=="deal")?"deal":"coupon")+" worked</span></div>"}}}else{if(I>0){var C=document.getElementById("coupon_rating_"+A);if(C){C.innerHTML='<div class="rate"><img src="/images/blank.gif" width="1" style="visibility:hidden" height="7" /></div><div>0% success rate</div>'}}}}}}}}};GTD.Favorite={};GTD.Favorite.add=function(A,C){var B={success:GTD.Favorite.onAddSuccess};YAHOO.util.Connect.asyncRequest("POST","/my_favorite_"+A+"s/add_"+C,B,"")};GTD.Favorite.onAddSuccess=function(B){var E=B.responseXML;if(E){var A=E.getElementsByTagName("favorite").item(0);if(A){var F=null;var D=null;for(var C=0;C<A.attributes.length;C++){if(A.attributes[C].name=="id"){F=A.attributes[C].value}else{if(A.attributes[C].name=="source"){D=A.attributes[C].value}}}if(F!=null){if(D=="coupon"){document.getElementById("add_favorite_coupon_"+F).innerHTML="Added"}else{if(D=="store"){document.getElementById("add_favorite_store_"+F).innerHTML='<img class="favorite" src="/images/blank.gif" /> This store has been added to your favorites'}else{if(D=="list"){document.getElementById("add_favorite_list_"+F).innerHTML='<img class="favorite" src="/images/blank.gif" /> This list has been added to your favorites'}}}}}}};GTD.Rating={};GTD.Rating.rate=function(G,C,A){var E=(C=="list_item")?"item_rating_":"photo_rating_";var B=document.getElementById(E+G);if(B){var D=B.getElementsByTagName("ul");if(D.length>0){D[0].style.display="none"}}var F={success:GTD.Rating.onRateSuccess};YAHOO.util.Connect.asyncRequest("POST","/_rate",F,"id="+G+"&source="+C+"&stars="+A)};GTD.Rating.onRateSuccess=function(E){var F=E.responseXML;if(F){var I=F.getElementsByTagName("rate").item(0);if(I){var B=null;var A=null;var C=null;for(var G=0;G<I.attributes.length;G++){if(I.attributes[G].name=="id"){B=I.attributes[G].value}else{if(I.attributes[G].name=="source"){A=I.attributes[G].value}else{if(I.attributes[G].name=="stars"){C=parseFloat(I.attributes[G].value)}}}}var H=(A=="list_item")?"item_rating_":"photo_rating_";var D=document.getElementById(H+B);if(D){var J=D.getElementsByTagName("img");if(J.length>0){J[0].setAttribute("width",Math.ceil(14*C))}}}}};GTD.ShareCoupon={};GTD.ShareCoupon.share=function(A){GTD.ShareCoupon.dialog=dhtmlmodal.open("dhtmlmodal","iframe","/_share_coupon?id="+A,"Share Coupon with your friend","width=570px,height=430px,resize=1,scrolling=1,center=1",null)};GTD.ShareCoupon.cancel=function(){GTD.ShareCoupon.dialog.hide()};GTD.goTo=function(A){window.location=A;return false};GTD.Popup={panel:null};GTD.Popup.show=function(C,B,D,F){var E=B-10;var A=D-10;if(GTD.Popup.panel!=null){GTD.Popup.panel.destroy()}GTD.Popup.panel=new YAHOO.widget.Panel("gtd_popup",{width:B+"px",height:D+"px",fixedcenter:true,constraintoviewport:true,underlay:"shadow",shadow:true,close:false,visible:true,modal:F,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.75}});GTD.Popup.panel.setBody('<iframe src="'+C+'" width="'+E+'" height="'+A+'" frameborder="0" />');GTD.Popup.panel.cfg.setProperty("underlay","matte");GTD.Popup.panel.render(document.body);YAHOO.util.Dom.setStyle(YAHOO.util.Dom.getElementsByClassName("hd",GTD.Popup.panel.element),"display","none");YAHOO.util.Dom.setStyle("gtd_popup","border","none")};GTD.Popup.hide=function(){GTD.Popup.panel.hide()};GTD.Comment={};GTD.Comment.anim=Array();GTD.Comment.show=function(D){var C=document.getElementById("comm_"+D).style.height;var A=(C==""||C=="0px")?true:false;if(A){var B=document.getElementById("cmt_"+D).clientHeight;GTD.Comment.anim[D].attributes.height={to:(B+55)};GTD.Comment.anim[D].duration=0.5;GTD.Comment.anim[D].animate()}else{GTD.Comment.hide(D)}};GTD.Comment.hide=function(A){GTD.Comment.anim[A].attributes.height={to:0};GTD.Comment.anim[A].duration=0.5;GTD.Comment.anim[A].animate()};