YAHOO.namespace("hcw");function init(){var A={success:function(AK){try{YAHOO.hcw.userdict=YAHOO.lang.JSON.parse(AK.responseText);YAHOO.hcw.datasource=new Object;YAHOO.hcw.datatable=new Object;YAHOO.widget.DataTable.MSG_EMPTY="No coupons found - try broadening your search criteria.";YAHOO.hcw.refreshListTab=function(x){sortedby=YAHOO.hcw.datatable[x].get("sortedBy");var o={success:YAHOO.hcw.datatable[x].onDataReturnInitializeTable,failure:YAHOO.hcw.datatable[x].onDataReturnInitializeTable,scope:YAHOO.hcw.datatable[x],argument:{sorting:sortedby}};dir=(sortedby.dir===YAHOO.widget.DataTable.CLASS_ASC)?"ASC":"DESC";YAHOO.hcw.datasource[x].sendRequest("do=getuserlist&type="+x+"&sortby="+sortedby.key+"&sortdir="+dir,o)};YAHOO.hcw.refreshTradeTab=function(x){var o={success:YAHOO.hcw.datatable[x].onDataReturnInitializeTable,failure:YAHOO.hcw.datatable[x].onDataReturnInitializeTable,scope:YAHOO.hcw.datatable[x]};if(x=="tradehist"){YAHOO.hcw.datasource[x].sendRequest("do=gettradehistory",o)}else{YAHOO.hcw.datasource[x].sendRequest("do=gettrades&type="+x,o)}};function AI(o){if(o.newValue.get("label")=="Search"){YAHOO.widget.DataTable.MSG_EMPTY="No coupons found - try broadening your search criteria.";YAHOO.hcw.getSearchResults(false)}else{if(o.newValue.get("label")=="Have List"){YAHOO.widget.DataTable.MSG_EMPTY="Use the 'Have List' action on the Search tab to add coupons to this list.";document.getElementById("havetab").style.visibility="";YAHOO.hcw.refreshListTab("have")}else{if(o.newValue.get("label")=="Keep List"){YAHOO.widget.DataTable.MSG_EMPTY="Use the 'Keep List' action on the Search tab to add coupons to this list.";document.getElementById("keeptab").style.visibility="";YAHOO.hcw.refreshListTab("keep")}else{if(o.newValue.get("label")=="Wish List"){YAHOO.widget.DataTable.MSG_EMPTY="Use the 'Wish List' action on the Search tab to add coupons to this list.";document.getElementById("wishtab").style.visibility="";YAHOO.hcw.refreshListTab("wish")}else{if(o.newValue.get("label")=="Trades (Actual and Potential)"){document.getElementById("tradetab").style.visibility="";if(YAHOO.hcw.tradeTabView.get("activeTab").get("label")=="Incoming"){YAHOO.widget.DataTable.MSG_EMPTY="No one currently has any of the items in your Wish List in their Have List.  Please check again soon.";YAHOO.hcw.refreshTradeTab("incoming")}else{YAHOO.widget.DataTable.MSG_EMPTY="No one currently has any of the items in your Have List in their Wish List.  Please check again soon.";YAHOO.hcw.refreshTradeTab("outgoing")}}}}}}}YAHOO.hcw.tabView=new YAHOO.widget.TabView("mainview");YAHOO.hcw.tabView.on("activeTabChange",AI);if((!YAHOO.hcw.userdict.istrader)&&(!YAHOO.hcw.userdict.isadmin)){tabs=YAHOO.hcw.tabView.get("tabs");YAHOO.hcw.tabView.removeTab(tabs[4]);YAHOO.hcw.tabView.removeTab(tabs[3]);YAHOO.hcw.tabView.removeTab(tabs[2]);YAHOO.hcw.tabView.removeTab(tabs[1])}if(!YAHOO.hcw.userdict.isauth){document.getElementById("addcouponbut").disabled=true;document.getElementById("searchmessage").innerHTML='The default view you see below shows the 10 newest coupons entered.  To narrow your search, choose from Source, Store, Category, Expired, or simply begin typing a description (i.e. kraft cheese) or type (i.e. $0.50/2, B1G1, 20%, or FREE).  Login or <a href="register.php">Register</a> to search the <b>whole</b> database and add coupons.'}else{if((!YAHOO.hcw.userdict.istrader)||(!YAHOO.hcw.userdict.isadmin)){document.getElementById("searchmessage").innerHTML="The default view you see below shows the newest coupons entered.  To narrow your search, choose from Source, Store, Category, Expired, or simply begin typing a description (i.e. kraft cheese) or type (i.e. $0.50/2, B1G1, 20%, or FREE) to see if the coupon you have has already been entered.  If the coupon you have isn't already listed, please click the Add button.  Select an action from the Actions menu to report problems with a coupon."}}YAHOO.widget.Column.prototype.minWidth=0;YAHOO.hcw.loadCombo=function(AZ,Ab,AX,AY){var x=document.getElementById(AZ);var Aa=0;if(AX){x.options.length=0}if((AZ.indexOf("category")>-1)||(AZ=="bulkstatusto")){Aa=1}for(i=Aa;i<Ab.length;i++){var o=document.createElement("OPTION");o.setAttribute("value",Ab[i]["value"]);if(AY){for(j=0;j<AY.length;j++){if(AY[j]==Ab[i]["value"]){o.setAttribute("selected","true")}}}if((i==0)&&(AZ=="dasource")){text=document.createTextNode("Pick One")}else{text=document.createTextNode(Ab[i]["text"].replace("&amp;","&"))}o.appendChild(text);x.appendChild(o)}};function AQ(AX,x,o){YAHOO.hcw.sourceMenu.set("label",o.cfg.getProperty("text"));YAHOO.hcw.getSearchResults(true)}function AW(AX,x,o){YAHOO.hcw.storeMenu.set("label",o.cfg.getProperty("text"));YAHOO.hcw.getSearchResults(true)}function AA(AX,x,o){YAHOO.hcw.categoryMenu.set("label",o.cfg.getProperty("text"));YAHOO.hcw.getSearchResults(true)}function AL(AX,x,o){YAHOO.hcw.expiredMenu.set("label",o.cfg.getProperty("text"));YAHOO.hcw.getSearchResults(true)}function AN(AX,x,o){YAHOO.hcw.statusMenu.set("label",o.cfg.getProperty("text"));YAHOO.hcw.getSearchResults(true)}for(key in YAHOO.hcw.userdict.source){YAHOO.hcw.userdict.source[key]["onclick"]={fn:AQ}}for(key in YAHOO.hcw.userdict.store){YAHOO.hcw.userdict.store[key]["onclick"]={fn:AW}}for(key in YAHOO.hcw.userdict.category){YAHOO.hcw.userdict.category[key]["onclick"]={fn:AA}}for(key in YAHOO.hcw.userdict.status){YAHOO.hcw.userdict.status[key]["onclick"]={fn:AN}}YAHOO.hcw.userdict.expired=[{text:"Not",value:"not",onclick:{fn:AL}},{text:"Is",value:"is",onclick:{fn:AL}},{text:"Any",value:"any",onclick:{fn:AL}},{text:"1 Month",value:"1mo",onclick:{fn:AL}},{text:"3 Month",value:"3mo",onclick:{fn:AL}},{text:"6 Month",value:"6mo",onclick:{fn:AL}}];YAHOO.hcw.userdict.type=[{text:"Pick One",value:"pickone"},{text:"Amount Off",value:"amount"},{text:"Percent Off",value:"percent"},{text:"Buy X Get Y",value:"bxgy"},{text:"FREE",value:"free"}];YAHOO.hcw.userdict.level=[{text:"None",value:1},{text:"Low",value:2},{text:"Medium",value:3},{text:"High",value:4}];YAHOO.hcw.sourceMenu=new YAHOO.widget.Button({type:"menu",label:"Any",name:"bysourcemenu",menu:YAHOO.hcw.userdict.source,container:"searchbysource"});YAHOO.hcw.storeMenu=new YAHOO.widget.Button({type:"menu",label:"Any",name:"bystoremenu",menu:YAHOO.hcw.userdict.store,container:"searchbystore"});YAHOO.hcw.categoryMenu=new YAHOO.widget.Button({type:"menu",label:"Any",name:"bycategorymenu",menu:YAHOO.hcw.userdict.category,container:"searchbycategory"});YAHOO.hcw.expiredMenu=new YAHOO.widget.Button({type:"menu",label:"Not",name:"byexpiredmenu",menu:YAHOO.hcw.userdict.expired,container:"searchbyexpired"});function AU(AZ){var x=YAHOO.hcw.datatable.search.getRecordSet().getRecords();var AY=new Array();for(i=0;i<x.length;i++){if(x[i].getData("flag")==true){AY.push(x[i].getData("couponid"))}}if(AY.length>0){var o=document.getElementById("bulkstatusto").value;var AX="do=bulkstatus&status="+o+"&coupons="+AY.toString();YAHOO.util.Connect.asyncRequest("POST","coupon.php",{success:function(Aa){YAHOO.hcw.getSearchResults(false)}},AX)}else{alert("No coupons are currently checked!  Please check\none or more coupons then try again.")}}String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.trimzero=function(){return this.replace(/^0+/g,"")};String.prototype.splittrim=function(o){return this.trim().split(new RegExp("\\s*"+o+"\\s*"))};function s(o){records=YAHOO.hcw.datatable.search.getRecordSet().getRecords();checked=new Array();for(i=0;i<records.length;i++){if(records[i].getData("flag")==true){checked.push(records[i].getData("couponid"))}}if(checked.length>0){catstr=document.getElementById("bulkcategoryto").value;catnamearr=catstr.splittrim(",");catidarr=new Array();for(i=0;i<catnamearr.length;i++){if(catnamearr[i]==""){catnamearr.splice(i,1)}}for(i=0;i<catnamearr.length;i++){for(j=0;j<YAHOO.hcw.userdict.category.length;j++){if(catnamearr[i]==YAHOO.hcw.userdict.category[j].text){catidarr.push(YAHOO.hcw.userdict.category[j].value);break}}}if(catidarr.length>0){post="do=bulkcategory&categories="+catidarr.toString()+"&coupons="+checked.toString();YAHOO.util.Connect.asyncRequest("POST","coupon.php",{success:function(x){YAHOO.hcw.getSearchResults(false)}},post)}else{alert("Please select on or more Category(s) and try again.")}}else{alert("No coupons are currently checked!  Please check\none or more coupons then try again.")}}function b(x){YAHOO.hcw.dialogimport.show()}if(YAHOO.hcw.userdict.isadmin){document.getElementById("statusfs").innerHTML='<fieldset id="searchbystatus"><legend>Status</legend></fieldset>';YAHOO.hcw.statusMenu=new YAHOO.widget.Button({type:"menu",label:"Any",name:"bystatusmenu",menu:YAHOO.hcw.userdict.status,container:"searchbystatus"})}else{YAHOO.hcw.statusMenu=null}function z(x){var AX=new Array();for(var o=0;o<x.length;o++){if(x[o].selected){AX.push(x[o].value)}}return AX}YAHOO.hcw.updateStatusMessage=function(o){document.getElementById("statusmsg").innerHTML=o};var AC=function(){this.submit()};var a=function(){this.cancel();document.addcoupon.reset()};var I=function(x){if(document.addcoupon["do"].value=="addcoupon"){YAHOO.hcw.updateStatusMessage("Thanks for your contribution!");setTimeout("YAHOO.hcw.updateStatusMessage('');",5000);YAHOO.hcw.getSearchResults(true)}else{YAHOO.hcw.getSearchResults(false)}document.addcoupon.reset()};var g=function(x){alert("We were unable to add your coupon due to an internal error.  Please try again later or contact an admin.");document.addcoupon.reset()};var Z=function(){this.submit()};var D=function(){this.cancel();document.addlist.reset()};var AG=function(x){YAHOO.hcw.getSearchResults(false);if(document.addlist["do"].value=="editlist"){YAHOO.hcw.refreshListTab(document.addlist.listtype.value)}else{YAHOO.hcw.updateStatusMessage("The item was added to your list.");setTimeout("YAHOO.hcw.updateStatusMessage('');",5000)}document.addlist.reset()};var E=function(x){alert("We were unable to update your list due to an internal error.  Please try again later or contact an admin.");document.addlist.reset()};var y=function(){this.submit()};var U=function(){this.cancel();document.tradeaction.reset()};var v=function(x){YAHOO.hcw.refreshTradeTab(document.tradeaction.listtype.value);document.tradeaction.reset()};var AS=function(x){alert("We were unable to update your trade due to an internal error.  Please try again later or contact an admin.");document.tradeaction.reset()};var AO=function(){this.submit()};var p=function(){this.cancel();document.importcoupon.reset()};var w=function(x){alert(x.responseText);YAHOO.hcw.getSearchResults(true);document.importcoupon.reset()};var AR=function(x){alert("We were unable to import your coupons due to an internal error.  Please try again later or contact an admin.");document.importcoupon.reset()};var AJ=function(){this.submit()};var e=function(){this.cancel();document.forumpost.reset()};var AF=function(x){window.open(x.responseText,"_blank");YAHOO.hcw.userdict.prefs[0][document.forumpost.type.value+"intro"]=document.forumpost.intro.value;document.forumpost.reset()};var C=function(x){alert("We were unable to create your forum post due to an\ninternal error.  Please try again later or contact an admin.");document.forumpost.reset()};YAHOO.hcw.dialogadd=new YAHOO.widget.Dialog("dialogadd",{width:"500px",fixedcenter:true,visible:false,constraintoviewport:true,buttons:[{text:"Submit",handler:AC,isDefault:true},{text:"Cancel",handler:a}]});YAHOO.hcw.dialogadd.validate=function(){var AZ=this.getData();var AX=AZ["category[]"];var AY=AZ["listtype[]"];var Aa=parseInt(document.getElementById("dahaveqty").value);var Ab=parseInt(document.getElementById("dakeepqty").value);if(AZ.description==""){alert("Please specify a coupon description.");return false}else{if((AZ.description.length<10)||(AZ.description.length>500)){alert("The coupon description must be between 10 and 500 characters.");return false}else{if(AZ.typecombo[0]=="pickone"){alert("Please specify a coupon value.");return false}else{if((AZ.typecombo[0]=="amount")&&(!AZ.type.match(/^\$\d+\.\d\d\/\d+$/))){alert("Please specify a valid currency amount and quantity,\nlike $0.50/2.");return false}else{if((AZ.typecombo[0]=="percent")&&(!AZ.type.match(/^\d+\%$/))){alert("Please specify a valid percentage off,\nlike 25%.");return false}else{if((AZ.typecombo[0]=="bxgy")&&(!AZ.type.match(/^B\d+G\d+$/))){alert("Please specify a valid deal type,\nlike B2G1.");return false}else{if(AZ.source[0]=="0"){alert("Please specify a coupon source.");return false}else{if(((AZ.source[0]=="5")||(AZ.source[0]=="9")||(AZ.source[0]=="10")||(AZ.source[0]=="13")||(AZ.source[0]=="15"))&&(AZ.linkurl.length>0)&&(!AZ.linkurl.match(/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/))){alert("Please leave blank or specify a valid URL.");return false}else{if((AZ.source[0]=="12")&&(!AZ.linkurl.match(/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/))){alert("Please specify a valid URL.");return false}else{if((AZ.source[0]=="6")&&(document.getElementById("dalinkurl").style.visibility=="")&&(!AZ.linkurl.match(/^\d\d\-\d\d\-\d\d\s\w+$/))){alert("Please specify a valid insert date\nand issue (MM-DD-YY Issue).");return false}else{if((AZ.source[0]=="11")&&(document.getElementById("dalinkurl").style.visibility=="")&&(!AZ.linkurl.match(/^\w+/))){alert("Please specify the product this Peelie is found on.");return false}else{if((AZ.source[0]=="8")&&(document.getElementById("dalinkurl").style.visibility=="")&&(!AZ.linkurl.match(/^\w+,\s(January)|(February)|(March)|(April)|(May)|(June)|(July)|(August)|(September)|(October)|(November)|(December)\s20\d\d$/))){alert("Please specify Magazine Name, Month Year\n(All You, September 2008).");return false}else{if((document.getElementById("datypeuptovalue").style.visibility=="")&&(AZ.upto.length>0)&&(!AZ.upto.match(/^\$\d+\.\d\d$/))){alert("Please leave blank or specify an 'up to' amount (e.g. $5.00).");return false}else{if(AX.length==0){alert("Please assign one or more categories to your coupon.");return false}else{if((document.getElementById("dahavecheck").checked)&&((isNaN(Aa))||(Aa<1)||(Aa>100))){alert("You must specify the quantity of the coupon you have\navailable (between 1 and 100).");document.getElementById("dahaveqty").focus();return false}else{if((document.getElementById("dakeepcheck").checked)&&((isNaN(Ab))||(Ab<1)||(Ab>100))){alert("You must specify the quantity of coupons you want\nto keep (between 1 and 100).");document.getElementById("dakeepqty").focus();return false}else{if((document.getElementById("dastatusnote").style.visibility=="")&&(AZ.statusnote.length==0)&&(AZ.status[0]!="1")){document.getElementById("dastatusnote").focus();alert("Please specify why you changed the Status.");return false}else{try{if(AZ.expiration==""){throw"Empty date"}else{if((AZ.expiration=="Rolling")||(AZ.expiration=="NED")){return true}else{if(matches=AZ.expiration.match(/^\d{1,2}\/\d{1,2}\/\d{4}$/)){parts=AZ.expiration.split("/");testdate=new Date(AZ.expiration);nd=new Date();nowdate=new Date(nd.getFullYear(),nd.getMonth(),nd.getDate());if((testdate.getFullYear()!=parseInt(parts[2],10))||(testdate.getMonth()!=(parseInt(parts[0],10)-1))||(testdate.getDate()!=parseInt(parts[1],10))){throw"Invalid date specified."}if((AZ["do"]=="addcoupon")&&(testdate-nowdate<0)){throw"The coupon date has expired."}}else{throw"Invalid date specified."}}}}catch(o){alert("Expiration needs to be a valid non-expired MM/DD/YYYY style date,\nRolling, or NED.");document.addcoupon.expiration.focus();return false}}}}}}}}}}}}}}}}}}return true};YAHOO.hcw.dialogadd.callback={success:I,failure:g};YAHOO.hcw.refreshCouponHistoryTab=function(){var o={success:YAHOO.hcw.datatable.history.onDataReturnInitializeTable,failure:YAHOO.hcw.datatable.history.onDataReturnInitializeTable,scope:YAHOO.hcw.datatable.history};var x=document.addcoupon.couponid.value;YAHOO.hcw.datasource.history.sendRequest("do=getcouponhistory&couponid="+x,o)};function Q(o){if(o.newValue.get("label")=="History"){YAHOO.hcw.refreshCouponHistoryTab()}}if(YAHOO.hcw.userdict.isadmin){cc=document.getElementById("couponcontent");ul=document.createElement("ul");ul.innerHTML='<li class="selected"><a href="#detailstab"><em>Details</em></a></li><li><a href="#historytab"><em>History</em></a></li>';ul=cc.parentNode.insertBefore(ul,cc);ul.className="yui-nav";YAHOO.hcw.couponView=new YAHOO.widget.TabView("couponview");YAHOO.hcw.couponView.on("activeTabChange",Q);YAHOO.hcw.datasource.history=new YAHOO.util.DataSource("coupon.php?");YAHOO.hcw.datasource.history.responseType=YAHOO.util.DataSource.TYPE_JSON;YAHOO.hcw.datasource.history.connXhrMode="queueRequests";YAHOO.hcw.datasource.history.responseSchema={resultsList:"results",fields:[{key:"action"},{key:"username"},{key:"modedon"},{key:"note"}]};YAHOO.hcw.datatable.history=new YAHOO.widget.DataTable("historytable",[{key:"action",label:"Action"},{key:"username",label:"User Name"},{key:"modedon",label:"Time"},{key:"note",label:"Note"}],YAHOO.hcw.datasource.history,{initialLoad:false,scrollable:true,width:"460px",height:"460px"})}YAHOO.hcw.dialogadd.render();function J(o){document.getElementById("dahaveqty").disabled=true;document.getElementById("dahavenote").disabled=true;document.getElementById("dakeepqty").disabled=true;document.getElementById("dakeepnote").disabled=true;document.getElementById("dawishcombo").disabled=true;document.getElementById("dawishnote").disabled=true;document.getElementById("datypevalue").style.visibility="hidden";document.getElementById("datypeuptovalue").style.visibility="hidden";document.getElementById("datypeuptovalue").value="";document.getElementById("datypeuptolabel").style.visibility="hidden";document.getElementById("dalinkurl").style.visibility="hidden";document.getElementById("dalinkmsg").style.visibility="hidden";document.getElementById("dastatusnote").style.visibility="hidden";document.getElementById("datitle").innerHTML="Please enter your new coupon.";document.getElementById("dalisttd").style.visibility="";document.getElementById("dastatus").style.visibility="hidden";document.getElementById("statusTT").style.visibility="hidden";document.addcoupon["do"].value="addcoupon";YAHOO.hcw.loadCombo("datypecombo",YAHOO.hcw.userdict.type,true,null);YAHOO.hcw.loadCombo("dasource",YAHOO.hcw.userdict.source,true,null);YAHOO.hcw.loadCombo("dastore",YAHOO.hcw.userdict.store,true,null);YAHOO.hcw.loadCombo("dacategory",YAHOO.hcw.userdict.category,true,null);YAHOO.hcw.loadCombo("dawishcombo",YAHOO.hcw.userdict.level,true,new Array("3"));if(YAHOO.hcw.userdict.isadmin){YAHOO.hcw.couponView.set("activeTab",YAHOO.hcw.couponView.getTab(0));YAHOO.hcw.couponView.getTab(1).set("disabled",true)}YAHOO.hcw.dialogadd.show()}function h(o){document.getElementById("searchbydescription").value="";document.getElementById("searchbytype").value="Any";YAHOO.hcw.sourceMenu.set("label","Any");YAHOO.hcw.sourceMenu.getMenu().clearActiveItem(false);YAHOO.hcw.storeMenu.set("label","Any");YAHOO.hcw.storeMenu.getMenu().clearActiveItem(false);YAHOO.hcw.categoryMenu.set("label","Any");YAHOO.hcw.categoryMenu.getMenu().clearActiveItem(false);YAHOO.hcw.expiredMenu.set("label","Not");YAHOO.hcw.expiredMenu.getMenu().clearActiveItem(false);if(YAHOO.hcw.userdict.isadmin){document.getElementById("searchbyurl").value="";YAHOO.hcw.statusMenu.set("label","Any");YAHOO.hcw.statusMenu.getMenu().clearActiveItem(false)}YAHOO.hcw.getSearchResults(true)}YAHOO.util.Event.addListener("addcouponbut","click",J);YAHOO.util.Event.addListener("resetfilterbut","click",h);YAHOO.hcw.dialoglist=new YAHOO.widget.Dialog("dialoglist",{width:"400px",fixedcenter:true,visible:false,constraintoviewport:true,buttons:[{text:"Submit",handler:Z,isDefault:true},{text:"Cancel",handler:D}]});YAHOO.hcw.dialoglist.validate=function(){var AX=this.getData();var x=AX["category[]"];var o=parseInt(AX.quantity);if((isNaN(o))||(o<1)||(o>100)){alert("You must specify the quantity of the coupon you have\navailable (between 1 and 100).");return false}else{return true}};YAHOO.hcw.dialoglist.callback={success:AG,failure:E};YAHOO.hcw.dialoglist.render();YAHOO.hcw.dialogimport=new YAHOO.widget.Dialog("dialogimport",{width:"400px",fixedcenter:true,visible:false,constraintoviewport:true,buttons:[{text:"Submit",handler:AO,isDefault:true},{text:"Cancel",handler:p}]});YAHOO.hcw.dialogimport.validate=function(){var o=this.getData();var x=o.csvfile;if(x.length==0){alert("Please click Browse... and select a CSV file for uploading.");return false}else{return true}};YAHOO.hcw.dialogimport.callback={upload:w,failure:AR};YAHOO.hcw.dialogimport.render();YAHOO.hcw.dialogpost=new YAHOO.widget.Dialog("dialogpost",{width:"500px",fixedcenter:true,visible:false,constraintoviewport:true,buttons:[{text:"Submit",handler:AJ,isDefault:true},{text:"Cancel",handler:e}]});YAHOO.hcw.dialogpost.validate=function(){var x=this.getData();var o=x.intro;if(o.length==0){alert("Please provide a little introductory text for the\nbeginning of your post.");return false}else{return true}};YAHOO.hcw.dialogpost.callback={success:AF,failure:C};YAHOO.hcw.dialogpost.render();YAHOO.hcw.dialogtrade=new YAHOO.widget.Dialog("dialogtrade",{width:"500px",fixedcenter:true,visible:false,constraintoviewport:true,buttons:[{text:"Submit",handler:y,isDefault:true},{text:"Cancel",handler:U}]});YAHOO.hcw.dialogtrade.validate=function(){var x=this.getData();var o=parseInt(x.quantity);if((document.getElementById("dtqtyvalue").style.visibility=="")&&((isNaN(o))||(o<1)||(o>x.maxqty))){alert("You must specify the quantity of coupons you want (between 1 and "+x.maxqty+").");return false}else{return true}};YAHOO.hcw.dialogtrade.callback={success:v,failure:AS};YAHOO.hcw.dialogtrade.render();YAHOO.hcw.descriptionTT=new YAHOO.widget.Panel("descriptionTTText",{xy:[150,70],visible:false,width:"300px"});YAHOO.hcw.descriptionTT.render();YAHOO.util.Event.addListener("descriptionTT","click",YAHOO.hcw.descriptionTT.show,YAHOO.hcw.descriptionTT,true);YAHOO.hcw.typeTT=new YAHOO.widget.Panel("typeTTText",{xy:[150,70],visible:false,width:"300px"});YAHOO.hcw.typeTT.render();YAHOO.util.Event.addListener("typeTT","click",YAHOO.hcw.typeTT.show,YAHOO.hcw.typeTT,true);YAHOO.hcw.expirationTT=new YAHOO.widget.Panel("expirationTTText",{xy:[150,70],visible:false,width:"300px"});YAHOO.hcw.expirationTT.render();YAHOO.util.Event.addListener("expirationTT","click",YAHOO.hcw.expirationTT.show,YAHOO.hcw.expirationTT,true);YAHOO.hcw.sourceTT=new YAHOO.widget.Panel("sourceTTText",{xy:[150,70],visible:false,width:"500px"});YAHOO.hcw.sourceTT.render();YAHOO.util.Event.addListener("sourceTT","click",YAHOO.hcw.sourceTT.show,YAHOO.hcw.sourceTT,true);YAHOO.hcw.storeTT=new YAHOO.widget.Panel("storeTTText",{xy:[150,70],visible:false,width:"300px"});YAHOO.hcw.storeTT.render();YAHOO.util.Event.addListener("storeTT","click",YAHOO.hcw.storeTT.show,YAHOO.hcw.storeTT,true);YAHOO.hcw.categoryTT=new YAHOO.widget.Panel("categoryTTText",{xy:[150,70],visible:false,width:"300px"});YAHOO.hcw.categoryTT.render();YAHOO.util.Event.addListener("categoryTT","click",YAHOO.hcw.categoryTT.show,YAHOO.hcw.categoryTT,true);YAHOO.hcw.statusTT=new YAHOO.widget.Panel("statusTTText",{xy:[150,70],visible:false,width:"300px"});YAHOO.hcw.statusTT.render();YAHOO.util.Event.addListener("statusTT","click",YAHOO.hcw.statusTT.show,YAHOO.hcw.statusTT,true);function n(AY,x,AX){if(AY!=null){if(AY.createTextRange){var o=AY.createTextRange();if(x==AX){o.move("character",AX)}else{o.moveStart("character",x);o.moveEnd("character",AX)}o.select()}else{if(AY.selectionStart){AY.focus();AY.setSelectionRange(x,AX)}else{AY.focus()}}}}function M(x){var o=x.target?x.target:window.event.srcElement;if(o.value=="pickone"){document.getElementById("datypevalue").style.visibility="hidden";document.getElementById("datypeuptolabel").style.visibility="hidden";document.getElementById("datypeuptovalue").style.visibility="hidden"}if(o.value=="amount"){document.getElementById("datypevalue").style.visibility="";document.getElementById("datypevalue").value="$";n(document.getElementById("datypevalue"),1,1);document.getElementById("datypeuptolabel").style.visibility="hidden";document.getElementById("datypeuptovalue").style.visibility="hidden";document.getElementById("datypeuptovalue").value=""}else{if(o.value=="percent"){document.getElementById("datypevalue").style.visibility="";document.getElementById("datypevalue").value="%";n(document.getElementById("datypevalue"),0,0);document.getElementById("datypeuptolabel").style.visibility="hidden";document.getElementById("datypeuptovalue").style.visibility="hidden";document.getElementById("datypeuptovalue").value=""}else{if(o.value=="bxgy"){document.getElementById("datypevalue").style.visibility="";document.getElementById("datypevalue").value="B";n(document.getElementById("datypevalue"),1,1);document.getElementById("datypeuptolabel").style.visibility="";document.getElementById("datypeuptovalue").style.visibility="";document.getElementById("datypeuptovalue").value="$"}else{if(o.value=="free"){document.getElementById("datypevalue").style.visibility="hidden";document.getElementById("datypevalue").value="FREE";document.getElementById("datypeuptolabel").style.visibility="";document.getElementById("datypeuptovalue").style.visibility="";document.getElementById("datypeuptovalue").value="$"}}}}}YAHOO.util.Event.addListener("datypecombo","change",M);function AT(x){var o=x.target?x.target:window.event.srcElement;if((o.value=="5")||(o.value=="9")||(o.value=="10")||(o.value=="12")||(o.value=="13")||(o.value=="15")){document.getElementById("dalinkurl").style.visibility="";document.getElementById("dalinkmsg").style.visibility="";if(o.value=="12"){document.getElementById("dalinkurl").value="http://";n(document.getElementById("dalinkurl"),0,10);document.getElementById("dalinkmsg").innerHTML="Please specify a valid URL."}else{document.getElementById("dalinkurl").value="";document.getElementById("dalinkmsg").innerHTML="Please specify an optional URL."}}else{if((o.value=="2")||(o.value=="3")||(o.value=="6")||(o.value=="8")||(o.value=="11")){document.getElementById("dalinkurl").style.visibility="";document.getElementById("dalinkurl").value="";document.getElementById("dalinkmsg").style.visibility="";if(o.value=="2"){document.getElementById("dalinkmsg").innerHTML="Please specify Booklet Name if you have it."}else{if(o.value=="3"){document.getElementById("dalinkmsg").innerHTML="Please specify a Discussion Link if there is one."}else{if(o.value=="6"){document.getElementById("dalinkmsg").innerHTML="Please specify Insert date and issue (MM-DD-YY Issue)."}else{if(o.value=="8"){document.getElementById("dalinkmsg").innerHTML="Please specify Magazine name w/ issue month and year (All You, September 2008)."}else{if(o.value=="11"){document.getElementById("dalinkmsg").innerHTML="Please specify the product this Peelie is found on. (Campbell's Soup)"}}}}}}else{document.getElementById("dalinkurl").style.visibility="hidden";document.getElementById("dalinkurl").value="";document.getElementById("dalinkmsg").style.visibility="hidden"}}}function H(o){document.getElementById("dastatusnote").style.visibility=""}YAHOO.util.Event.addListener("dasource","change",AT);YAHOO.util.Event.addListener("dastatus","change",H);function X(x){var o=x.target?x.target:window.event.srcElement;if(o==document.getElementById("dahavecheck")){if(o.checked){document.getElementById("dahaveqty").disabled=false;document.getElementById("dahavenote").disabled=false}else{document.getElementById("dahaveqty").disabled=true;document.getElementById("dahavenote").disabled=true}}else{if(o==document.getElementById("dakeepcheck")){if(o.checked){document.getElementById("dakeepqty").disabled=false;document.getElementById("dakeepnote").disabled=false}else{document.getElementById("dakeepqty").disabled=true;document.getElementById("dakeepnote").disabled=true}}else{if(o==document.getElementById("dawishcheck")){if(o.checked){document.getElementById("dawishcombo").disabled=false;document.getElementById("dawishnote").disabled=false}else{document.getElementById("dawishcombo").disabled=true;document.getElementById("dawishnote").disabled=true}}}}}YAHOO.util.Event.addListener("dahavecheck","click",X);YAHOO.util.Event.addListener("dakeepcheck","click",X);YAHOO.util.Event.addListener("dawishcheck","click",X);YAHOO.widget.DataTable.Formatter.description=function(x,o,AX,AY){linkurl=o.getData("linkurl");status=o.getData("status");if((linkurl)&&(linkurl.length)){if((status=="2")&&(!YAHOO.hcw.userdict.isadmin)){x.innerHTML=AY+" (link supressed until approved)"}else{x.innerHTML='<a href="'+linkurl+'" target="_blank">'+AY+"</a>"}}else{x.innerHTML=AY}};YAHOO.widget.DataTable.Formatter.status=function(AX,AZ,x,AY){var o="Unknown";for(key in YAHOO.hcw.userdict.status){if(YAHOO.hcw.userdict.status[key]["value"]==AY){o=YAHOO.hcw.userdict.status[key]["text"];break}}AX.innerHTML=o};YAHOO.hcw.neddate=new Date(2099,11,30);YAHOO.hcw.rollingdate=new Date(2099,11,31);YAHOO.widget.DataTable.Formatter.expires=function(x,o,AX,AY){if(YAHOO.hcw.neddate-AY==0){x.innerHTML="NED"}else{if(YAHOO.hcw.rollingdate-AY==0){x.innerHTML="Rolling"}else{x.innerHTML=AY.getMonth()+1+"/"+AY.getDate()+"/"+AY.getFullYear()}}};YAHOO.widget.DataTable.Formatter.addedon=function(AX,x,AY,AZ){var o=AZ.substr(0,10).split("-");AX.innerHTML=o[1]+"/"+o[2]+"/"+o[0]+" "+AZ.substr(11,8)};YAHOO.widget.DataTable.Formatter.source=function(x,o,AX,AY){for(key in YAHOO.hcw.userdict.source){if(YAHOO.hcw.userdict.source[key]["value"]==AY){x.innerHTML=YAHOO.hcw.userdict.source[key]["text"];break}}};YAHOO.widget.DataTable.Formatter.store=function(x,o,AX,AY){if((AY=="0")||(AY=="")){x.innerHTML=""}else{for(key in YAHOO.hcw.userdict.store){if(YAHOO.hcw.userdict.store[key]["value"]==AY){x.innerHTML=YAHOO.hcw.userdict.store[key]["text"];break}}}};YAHOO.widget.DataTable.Formatter.priority=function(x,o,AX,AY){if(AY=="4"){x.innerHTML="High"}else{if(AY=="3"){x.innerHTML="Medium"}else{if(AY=="2"){x.innerHTML="Low"}else{if(AY=="1"){x.innerHTML="None"}}}}};YAHOO.widget.DataTable.Formatter.category=function(AX,x,AY,Aa){var AZ=Aa.split(",");var o=[];for(id in AZ){for(key in YAHOO.hcw.userdict.category){if(YAHOO.hcw.userdict.category[key]["value"]==AZ[id].trimzero()){o.push(YAHOO.hcw.userdict.category[key]["text"]);break}}}AX.innerHTML=o.toString()};YAHOO.hcw.getTerm=function(o){YAHOO.hcw.getSearchResults(true)};YAHOO.hcw.handlePagination=function(AY,AX){var AZ={startIndex:AY.recordOffset,sorting:{key:"addedon",dir:YAHOO.widget.DataTable.CLASS_DESC},pagination:{recordOffset:AY.recordOffset,rowsPerPage:AY.rowsPerPage}};var o={success:AX.onDataReturnSetRows,failure:AX.onDataReturnSetRows,scope:AX,argument:AZ};var x=YAHOO.hcw.buildQueryString(AZ);AX.getDataSource().sendRequest(x,o)};YAHOO.hcw.getSearchResults=function(o){if(o){YAHOO.hcw.handlePagination({recordOffset:0,rowsPerPage:YAHOO.hcw.paginator.getRowsPerPage()},YAHOO.hcw.datatable.search)}else{YAHOO.hcw.handlePagination({recordOffset:YAHOO.hcw.paginator.getStartIndex(),rowsPerPage:YAHOO.hcw.paginator.getRowsPerPage()},YAHOO.hcw.datatable.search)}};YAHOO.hcw.buildQueryString=function(AX,x){var o="do=getrecords";o+="&startrec="+AX.pagination.recordOffset;o+="&numrecs="+AX.pagination.rowsPerPage;o+="&description="+escape(YAHOO.util.Dom.get("searchbydescription").value);o+="&type="+YAHOO.util.Dom.get("searchbytype").value;if(YAHOO.hcw.sourceMenu.getMenu().activeItem){o+="&sourceid="+YAHOO.hcw.sourceMenu.getMenu().activeItem.value}else{o+="&sourceid=0"}if(YAHOO.hcw.storeMenu.getMenu().activeItem){o+="&storeid="+YAHOO.hcw.storeMenu.getMenu().activeItem.value}else{o+="&storeid=0"}if(YAHOO.hcw.categoryMenu.getMenu().activeItem){o+="&categoryid="+YAHOO.hcw.categoryMenu.getMenu().activeItem.value}else{o+="&categoryid=0"}if(YAHOO.hcw.expiredMenu.getMenu().activeItem){o+="&expired="+YAHOO.hcw.expiredMenu.getMenu().activeItem.value}else{o+="&expired=not"}if((YAHOO.hcw.statusMenu)&&(YAHOO.hcw.statusMenu.getMenu().activeItem)){o+="&status="+YAHOO.hcw.statusMenu.getMenu().activeItem.value}else{o+="&status=0"}if(YAHOO.hcw.userdict.isadmin){url=document.getElementById("searchbyurl").value;o+="&url="+url}return o};var q=new YAHOO.widget.DS_JSFunction(YAHOO.hcw.getTerm);q.queryMatchContains=true;var F=new YAHOO.widget.AutoComplete("searchbydescription","searchbydescriptionauto",q);F.minQueryLength=0;var AH=new YAHOO.widget.DS_JSArray(YAHOO.hcw.userdict.typelist);var N=new YAHOO.widget.AutoComplete("searchbytype","searchbytypecont",AH);N.prehighlightClassName="yui-ac-prehighlight";N.useShadow=true;N.minQueryLength=0;N.maxResultsDisplayed=20;N.textboxFocusEvent.subscribe(function(){var x=YAHOO.util.Dom.get("searchbytype").value;if((x.length===0)||(x=="Any")){var o=this;setTimeout(function(){o.sendQuery("")},0)}});N.itemSelectEvent.subscribe(function(){YAHOO.hcw.getSearchResults(true)});N.unmatchedItemSelectEvent.subscribe(function(){YAHOO.hcw.getSearchResults(true)});actionopts=new Array("Pick One","Report");if((YAHOO.hcw.userdict.istrader)||(YAHOO.hcw.userdict.isadmin)){actionopts.push("Have List");actionopts.push("Keep List");actionopts.push("Wish List")}if(YAHOO.hcw.userdict.isadmin){actionopts.push("PM Author");actionopts.push("Merge");actionopts.push("Edit")}var f=new Array();YAHOO.hcw.onFlagSelectAll=function(AY){var x=null,AX=null;if(AY.id=="searchSelectAll"){AX="search"}else{if(AY.id=="haveSelectAll"){AX="have"}else{if(AY.id=="keepSelectAll"){AX="keep"}else{if(AY.id=="wishSelectAll"){AX="wish"}}}}x=YAHOO.hcw.datatable[AX].getRecordSet().getRecords();for(i=0;i<x.length;i++){x[i]._oData.flag=AY.checked}YAHOO.hcw.datatable[AX].refreshView()};if(YAHOO.hcw.userdict.isadmin){f.push({key:"flag",label:'<input id="searchSelectAll" type="checkbox" onclick="YAHOO.hcw.onFlagSelectAll(this);"/>',formatter:"checkbox"})}f.push({key:"action",label:"Action",formatter:"dropdown",dropdownOptions:actionopts});if(YAHOO.hcw.userdict.isadmin){f.push({key:"status",label:"Status",formatter:"status"})}f.push({key:"description",label:"Description",formatter:"description"});f.push({key:"type",label:"Value"});f.push({key:"expiration",label:"Expires",formatter:"expires"});f.push({key:"sourceid",label:"Source",formatter:"source"});f.push({key:"storeid",label:"Store",formatter:"store"});f.push({key:"categories",label:"Category(s)",formatter:"category"});f.push({key:"addedon",label:"Added",formatter:"addedon"});YAHOO.util.DataSource.parseDate=function(Aa){var AY=Aa.split("-");if(AY.length>1){var x=parseInt(AY[0],10);var AX=parseInt(AY[1],10)-1;var o=parseInt(AY[2],10);var AZ=new Date(x,AX,o);return AZ}else{return new Date(0)}};if(!YAHOO.hcw.userdict.isauth){f=f.slice(1)}YAHOO.hcw.datasource.search=new YAHOO.util.DataSource("coupon.php?");YAHOO.hcw.datasource.search.responseType=YAHOO.util.DataSource.TYPE_JSON;YAHOO.hcw.datasource.search.connXhrMode="queueRequests";YAHOO.hcw.datasource.search.responseSchema={resultsList:"results",fields:[{key:"flag"},{key:"couponid"},{key:"siteid"},{key:"type"},{key:"description"},{key:"linkurl"},{key:"sourceid"},{key:"storeid"},{key:"expiration",parser:YAHOO.util.DataSource.parseDate},{key:"addedon"},{key:"addedby"},{key:"categories"},{key:"status"}],metaFields:{totalRecords:"totalRecords"}};YAHOO.hcw.paginator=new YAHOO.widget.Paginator({containers:["searchpager"],pageLinks:5,rowsPerPage:10,rowsPerPageOptions:[10,25,50,100],template:'<strong>{CurrentPageReport}</strong> {PreviousPageLink} {PageLinks} {NextPageLink} {RowsPerPageDropdown}per page&nbsp;&nbsp;&nbsp;&nbsp;<span id="statusmsg" style="color: #FE4800"></span>'});var d={initialRequest:"do=getrecords&startrec=0&numrecs=10",sortedBy:{key:"addedon",dir:YAHOO.widget.DataTable.CLASS_DESC},paginationEventHandler:YAHOO.hcw.handlePagination,generateRequest:YAHOO.hcw.buildQueryString,paginator:YAHOO.hcw.paginator};YAHOO.hcw.datatable.search=new YAHOO.widget.DataTable("searchtable",f,YAHOO.hcw.datasource.search,d);YAHOO.hcw.datatable.search.initializeTable=function(){this.get("paginator").set("totalRecords",0);YAHOO.widget.DataTable.prototype.initializeTable.call(this)};YAHOO.widget.DataTable.prototype.onDataReturnSetRows=function(AY,AX,Aa){this.fireEvent("dataReturnEvent",{request:AY,response:AX,payload:Aa});var x=this.doBeforeLoadData(AY,AX,Aa);if(x&&AX&&!AX.error&&YAHOO.lang.isArray(AX.results)){var o=this.get("paginator");if(!(o instanceof YAHOO.widget.Paginator)){o=null}var AZ=this._mergeResponseMeta({recordStartIndex:Aa?Aa.startIndex:null},Aa,AX.meta);if(!YAHOO.lang.isNumber(AZ.recordStartIndex)){AZ.recordStartIndex=o&&AZ.pagination?AZ.pagination.recordOffset||0:0}if((o)&&(AX.results.length<o.getRowsPerPage())){this._oRecordSet.reset()}this._oRecordSet.setRecords(AX.results,AZ.recordStartIndex);this._handleDataReturnPayload(AY,AX,AZ);if(o&&o.get("totalRecords")<this._oRecordSet.getLength()){o.set("totalRecords",this._oRecordSet.getLength())}this.render()}else{if(x&&AX.error){this.showTableMessage(YAHOO.widget.DataTable.MSG_ERROR,YAHOO.widget.DataTable.CLASS_ERROR)}}};YAHOO.hcw.datatable.search.subscribe("checkboxClickEvent",function(o){if(o.target.checked){this.getRecord(o.target)._oData.flag=true}else{this.getRecord(o.target)._oData.flag=false}});YAHOO.hcw.datatable.search.subscribe("dropdownChangeEvent",function(AX){var Ah=this.getRecord(AX.target);var Aa=Ah._oData.couponid;var Ab=Ah._oData.addedby;var Ad=Ah._oData.type;var Ac=Ah._oData.categories.split(",");var Af=AX.target.value;var AZ=false;var x=Af.replace(" ","").toLowerCase().substr(0,4);var o=Ah._oData.expiration,AY=new Array();var Ae=new Array(o.getFullYear(),o.getMonth()+1,o.getDate());for(i=0;i<Ac.length;i++){AY.push(Ac[i].trimzero())}if(x=="pmau"){var Ag=Ah._oData.siteid;for(i=0;i<YAHOO.hcw.userdict.sites.length;i++){if(YAHOO.hcw.userdict.sites[i].siteid==Ag){url=YAHOO.hcw.userdict.sites[i].baseurl;url+=YAHOO.hcw.userdict.sites[i].pmpage;url=url.replace("%userid%",Ab);window.open(url,"_blank");break}}}else{if((x=="have")||(x=="keep")||(x=="wish")){records=YAHOO.hcw.datatable[x].getRecordSet().getRecords();for(i=0;i<records.length;i++){if(records[i].getData("couponid")==Aa){AZ=true;break}}if(AZ==true){alert("That coupon is already in your "+Af+".")}else{document.addlist["do"].value="addtolist";document.addlist.listtype.value=x;document.addlist.couponid.value=Aa;if((x=="have")||(x=="keep")){document.getElementById("dltitle").innerHTML="Please enter how many coupons you have.";document.getElementById("dllabel").innerHTML="Quantity:";document.getElementById("dlquantity").innerHTML='<input type="text" name="quantity" size="3"/>'}else{if(x=="wish"){document.getElementById("dltitle").innerHTML="Please specify your interest level in this coupon.";document.getElementById("dllabel").innerHTML="Level:";document.getElementById("dlquantity").innerHTML='<select id="dllevel" name="quantity" size="1"></select>';YAHOO.hcw.loadCombo("dllevel",YAHOO.hcw.userdict.level,true,new Array("2"))}}YAHOO.hcw.dialoglist.show()}}else{if(x=="merg"){records=YAHOO.hcw.datatable.search.getRecordSet().getRecords();checked=new Array();for(i=0;i<records.length;i++){if(records[i].getData("flag")==true){if(records[i].getData("couponid")!=Aa){checked.push(records[i].getData("couponid"))}}}if(checked.length==0){alert("To merge coupons, please check one or more rows to merge.")}else{if(confirm("Are you sure you want to merge the "+checked.length+"\nselected coupon(s) into this coupon?")){post="do=mergecoupon&into="+Aa+"&merge="+checked.toString();YAHOO.util.Connect.asyncRequest("POST","coupon.php",{success:function(Ai){YAHOO.hcw.getSearchResults(true)}},post)}}}else{if((x=="edit")||(x=="repo")){document.getElementById("dalisttd").style.visibility="hidden";document.getElementById("dastatusnote").style.visibility="hidden";document.getElementById("datypeuptolabel").style.visibility="hidden";document.getElementById("datypeuptovalue").style.visibility="hidden";if(x=="repo"){document.addcoupon["do"].value="reportcoupon";document.getElementById("statusTT").style.visibility="hidden";document.getElementById("dastatus").style.visibility="hidden";document.getElementById("datitle").innerHTML="Report Coupon - Please fix it like it needs to be"}else{document.addcoupon["do"].value="editcoupon";document.getElementById("statusTT").style.visibility="";document.getElementById("dastatus").style.visibility="";document.getElementById("datitle").innerHTML="Edit Coupon "+Aa}document.addcoupon.description.value=Ah._oData.description;document.addcoupon.type.value=Ad;document.addcoupon.couponid.value=Aa;document.addcoupon.dahavecheck.value="off";if(YAHOO.hcw.neddate-Ah._oData.expiration==0){document.addcoupon.expiration.value="NED"}else{if(YAHOO.hcw.rollingdate-Ah._oData.expiration==0){document.addcoupon.expiration.value="Rolling"}else{document.addcoupon.expiration.value=Ae[1]+"/"+Ae[2]+"/"+Ae[0]}}document.addcoupon.linkurl.value=Ah._oData.linkurl;YAHOO.hcw.loadCombo("dasource",YAHOO.hcw.userdict.source,true,new Array(Ah._oData.sourceid));YAHOO.hcw.loadCombo("dastore",YAHOO.hcw.userdict.store,true,new Array(Ah._oData.storeid));YAHOO.hcw.loadCombo("dacategory",YAHOO.hcw.userdict.category,true,AY);YAHOO.hcw.loadCombo("dastatus",YAHOO.hcw.userdict.status,true,new Array(Ah._oData.status));if(Ad.match(/^\$\d+\.\d\d\/\d+$/)){document.getElementById("datypevalue").style.visibility="";YAHOO.hcw.loadCombo("datypecombo",YAHOO.hcw.userdict.type,true,new Array("amount"))}else{if(Ad.match(/^\d+\%$/)){document.getElementById("datypevalue").style.visibility="";YAHOO.hcw.loadCombo("datypecombo",YAHOO.hcw.userdict.type,true,new Array("percent"))}else{if(Ad.match(/^B\d+G\d+$/)){document.getElementById("datypevalue").style.visibility="";YAHOO.hcw.loadCombo("datypecombo",YAHOO.hcw.userdict.type,true,new Array("bxgy"))}else{if(Ad=="FREE"){document.getElementById("datypevalue").style.visibility="hidden";YAHOO.hcw.loadCombo("datypecombo",YAHOO.hcw.userdict.type,true,new Array("free"))}else{document.getElementById("datypevalue").style.visibility=""}}}}if(Ah._oData.linkurl.length>0){document.getElementById("dalinkurl").style.visibility="";document.getElementById("dalinkmsg").style.visibility=""}else{document.getElementById("dalinkurl").style.visibility="hidden";document.getElementById("dalinkmsg").style.visibility="hidden"}if(x=="edit"){YAHOO.hcw.couponView.set("activeTab",YAHOO.hcw.couponView.getTab(0));YAHOO.hcw.couponView.getTab(1).set("disabled",false)}else{if((x=="repo")&&(YAHOO.hcw.userdict.isadmin)){YAHOO.hcw.couponView.set("activeTab",YAHOO.hcw.couponView.getTab(0));YAHOO.hcw.couponView.getTab(1).set("disabled",true)}}YAHOO.hcw.dialogadd.show()}}}}AX.target.selectedIndex=0});function m(AX){var x=AX.target?AX.target:window.event.srcElement;var o="";if(x==document.getElementById("updateHaveListForumPost")){records=YAHOO.hcw.datatable.have.getRecordSet().getRecords();o="have";document.getElementById("postwarning").innerHTML="Clicking Submit will replace any current post(s) you have in the 'Haves Lists: Have Coupons or Actuals for Trade' forum with a new post based on the items configured here."}else{records=YAHOO.hcw.datatable.wish.getRecordSet().getRecords();o="wish";document.getElementById("postwarning").innerHTML="Clicking Submit will replace any current post(s) you have in the 'Wish Lists: Seeking Coupons or Actuals for Trade' forum with a new post based on the items configured here."}if(records.length==0){alert("Please add some items to your list before trying to post to the forum!")}else{document.forumpost.type.value=o;document.forumpost.intro.value=YAHOO.hcw.userdict.prefs[0][o+"intro"];YAHOO.hcw.dialogpost.show()}}function P(AY){var AX=AY.target?AY.target:window.event.srcElement;var Aa="",AZ="",o=null,x=new Array();if(AX==document.getElementById("moveHaveListItems")){AZ="have";Aa=document.getElementById("moveHaveListTo").value;o=YAHOO.hcw.datatable.have.getRecordSet().getRecords()}else{if(AX==document.getElementById("moveKeepListItems")){AZ="keep";Aa=document.getElementById("moveKeepListTo").value;o=YAHOO.hcw.datatable.keep.getRecordSet().getRecords()}else{if(AX==document.getElementById("moveWishListItems")){AZ="wish";Aa=document.getElementById("moveWishListTo").value;o=YAHOO.hcw.datatable.wish.getRecordSet().getRecords()}}}for(i=0;i<o.length;i++){if(o[i].getData("flag")==true){x.push(o[i].getData("couponid"))}}if(x.length>0){post="do=movelistitem&coupons="+x.toString()+"&to="+Aa;YAHOO.util.Connect.asyncRequest("POST","coupon.php",{argument:AZ,success:function(Ab){YAHOO.hcw.refreshListTab(Ab.argument)}},post)}else{alert("No items are currently checked.  Please check\none or more rows then try again.")}}function Y(AZ){var AY=AZ.target?AZ.target:window.event.srcElement;var o=null,AX=null,x=new Array();if(AY==document.getElementById("deleteHaveListItems")){AX="have";o=YAHOO.hcw.datatable.have.getRecordSet().getRecords()}else{if(AY==document.getElementById("deleteKeepListItems")){AX="keep";o=YAHOO.hcw.datatable.keep.getRecordSet().getRecords()}else{if(AY==document.getElementById("deleteWishListItems")){AX="wish";o=YAHOO.hcw.datatable.wish.getRecordSet().getRecords()}}}for(i=0;i<o.length;i++){if(o[i].getData("flag")==true){x.push(o[i].getData("couponid"))}}if(x.length>0){post="do=deletelistitem&type="+AX+"&coupons="+x.toString();YAHOO.util.Connect.asyncRequest("POST","coupon.php",{argument:AX,success:function(Aa){YAHOO.hcw.refreshListTab(Aa.argument)}},post)}else{alert("No items are currently checked.  Please check\none or more rows then try again.")}}function AD(o){YAHOO.hcw.getSearchResults(true)}if((YAHOO.hcw.userdict.istrader)||(YAHOO.hcw.userdict.isadmin)){YAHOO.util.Event.addListener("updateHaveListForumPost","click",m);YAHOO.util.Event.addListener("updateWishListForumPost","click",m);YAHOO.util.Event.addListener("moveHaveListItems","click",P);YAHOO.util.Event.addListener("moveKeepListItems","click",P);YAHOO.util.Event.addListener("moveWishListItems","click",P);YAHOO.util.Event.addListener("deleteHaveListItems","click",Y);YAHOO.util.Event.addListener("deleteKeepListItems","click",Y);YAHOO.util.Event.addListener("deleteWishListItems","click",Y);if(YAHOO.hcw.userdict.isadmin){document.getElementById("searchbulkactions").innerHTML='<table><tr><td><fieldset><legend>Bulk Status Update</legend><table><tr><td><input id="bulkstatus" type="button" value="Set Flagged"/></td><td>to</td><td><select id="bulkstatusto"></select></td></tr></table></fieldset></td><td><fieldset><legend>Bulk Category Update</legend><table><tr><td><input id="bulkcategory" type="button" value="Set Flagged"/></td><td>to</td><td><div><input id="bulkcategoryto" type="text" style="width:175px;position:relative"/><div id="bulkcategorytocont"/></div></td></tr></table></fieldset></td><td><fieldset><legend>Bulk Import</legend><table><tr><td><input id="bulkimport" type="button" value="CSV File..."/></td></tr></table></fieldset></td><td><fieldset><legend>Search by Link URL</legend><table><tr><td><input id="searchbyurl" type="text" style="width:175px;position:relative"/></td><td><input id="searchbyurlgo" type="button" value="Go"/></td></tr></table></fieldset></td></tr></table>';YAHOO.hcw.loadCombo("bulkstatusto",YAHOO.hcw.userdict.status,false,null);var l=new Array();for(i=1;i<YAHOO.hcw.userdict.category.length;i++){l.push(YAHOO.hcw.userdict.category[i].text)}var L=new YAHOO.widget.DS_JSArray(l);var W=new YAHOO.widget.AutoComplete("bulkcategoryto","bulkcategorytocont",L);W.prehighlightClassName="yui-ac-prehighlight";W.delimChar=",";W.useShadow=true;W.minQueryLength=0;W.maxResultsDisplayed=25;W.textboxFocusEvent.subscribe(function(){var x=YAHOO.util.Dom.get("bulkcategoryto").value;if(x.length===0){var o=this;setTimeout(function(){o.sendQuery("")},0)}});YAHOO.util.Event.addListener("bulkstatus","click",AU);YAHOO.util.Event.addListener("bulkcategory","click",s);YAHOO.util.Event.addListener("bulkimport","click",b);YAHOO.util.Event.addListener("searchbyurlgo","click",AD)}var S=[{key:"flag",label:'<input id="haveSelectAll" type="checkbox" onclick="YAHOO.hcw.onFlagSelectAll(this);"/>',formatter:"checkbox"},{key:"action",label:"Action",formatter:"dropdown",dropdownOptions:["Pick One","Edit"]},{key:"quantity",label:"Qty",sortable:true},{key:"description",label:"Description",formatter:"description",sortable:true},{key:"type",label:"Value",sortable:true},{key:"expiration",label:"Expiration",formatter:"expires",sortable:true},{key:"sourceid",label:"Source",formatter:"source",sortable:true},{key:"storeid",label:"Store",formatter:"store",sortable:true},{key:"categories",label:"Categories",formatter:"category",sortable:true},{key:"note",label:"Note"}];var G=[{key:"flag",label:'<input id="keepSelectAll" type="checkbox" onclick="YAHOO.hcw.onFlagSelectAll(this);"/>',formatter:"checkbox"},{key:"action",label:"Action",formatter:"dropdown",dropdownOptions:["Pick One","Edit"]},{key:"quantity",label:"Qty",sortable:true},{key:"description",label:"Description",formatter:"description",sortable:true},{key:"type",label:"Value",sortable:true},{key:"expiration",label:"Expiration",formatter:"expires",sortable:true},{key:"sourceid",label:"Source",formatter:"source",sortable:true},{key:"storeid",label:"Store",formatter:"store",sortable:true},{key:"categories",label:"Categories",formatter:"category",sortable:true},{key:"note",label:"Note"}];var k=[{key:"flag",label:'<input id="wishSelectAll" type="checkbox" onclick="YAHOO.hcw.onFlagSelectAll(this);"/>',formatter:"checkbox"},{key:"action",label:"Action",formatter:"dropdown",dropdownOptions:["Pick One","Edit"]},{key:"quantity",label:"Interest",formatter:"priority",sortable:true},{key:"description",label:"Description",formatter:"description",sortable:true},{key:"type",label:"Value",sortable:true},{key:"expiration",label:"Expiration",formatter:"expires",sortable:true},{key:"sourceid",label:"Source",formatter:"source",sortable:true},{key:"storeid",label:"Store",formatter:"store",sortable:true},{key:"categories",label:"Categories",formatter:"category",sortable:true},{key:"note",label:"Note"}];listSchema=[{key:"flag"},{key:"couponid"},{key:"quantity",parser:YAHOO.util.DataSource.parseNumber},{key:"note"},{key:"description"},{key:"type"},{key:"linkurl"},{key:"expiration",parser:YAHOO.util.DataSource.parseDate},{key:"sourceid",parser:YAHOO.util.DataSource.parseNumber},{key:"storeid",parser:YAHOO.util.DataSource.parseNumber},{key:"categories"},{key:"status",parser:YAHOO.util.DataSource.parseNumber}];YAHOO.hcw.datasource.have=new YAHOO.util.DataSource("coupon.php?");YAHOO.hcw.datasource.have.responseType=YAHOO.util.DataSource.TYPE_JSON;YAHOO.hcw.datasource.have.connXhrMode="queueRequests";YAHOO.hcw.datasource.have.responseSchema={resultsList:"results",fields:listSchema};var K={initialLoad:false,sortedBy:{key:"expiration",dir:YAHOO.widget.DataTable.CLASS_ASC}};YAHOO.hcw.datatable.have=new YAHOO.widget.DataTable("havetable",S,YAHOO.hcw.datasource.have,K);function t(AX){var x=this.getRecord(AX.target),o=new Array();var AY=AX.target.value.toLowerCase();var Aa=x._oData.categories.split(",");var AZ=YAHOO.hcw.tabView.get("activeTab").get("label").toLowerCase().substr(0,4);for(i=0;i<Aa.length;i++){o.push(Aa[i].trimzero())}if(AY=="edit"){document.addlist["do"].value="editlist";document.addlist.listtype.value=AZ;document.addlist.note.value=x._oData.note;document.addlist.couponid.value=x._oData.couponid;if((AZ=="have")||(AZ=="keep")){document.getElementById("dltitle").innerHTML="Please enter how many coupons you have.";document.getElementById("dllabel").innerHTML="Quantity:";document.getElementById("dlquantity").innerHTML='<input type="text" name="quantity" size="3"/>';document.addlist.quantity.value=x._oData.quantity}else{if(AZ=="wish"){document.getElementById("dltitle").innerHTML="Please specify your interest level in this coupon.";document.getElementById("dllabel").innerHTML="Level:";document.getElementById("dlquantity").innerHTML='<select id="dllevel" name="quantity" size="1"></select>';YAHOO.hcw.loadCombo("dllevel",YAHOO.hcw.userdict.level,true,new Array(x._oData.quantity.toString()))}}YAHOO.hcw.dialoglist.show()}AX.target.selectedIndex=0}YAHOO.hcw.datatable.have.subscribe("checkboxClickEvent",function(o){if(o.target.checked){this.getRecord(o.target)._oData.flag=true}else{this.getRecord(o.target)._oData.flag=false}});YAHOO.hcw.datatable.have.subscribe("dropdownChangeEvent",t);YAHOO.hcw.datasource.keep=new YAHOO.util.DataSource("coupon.php?");YAHOO.hcw.datasource.keep.responseType=YAHOO.util.DataSource.TYPE_JSON;YAHOO.hcw.datasource.keep.connXhrMode="queueRequests";YAHOO.hcw.datasource.keep.responseSchema={resultsList:"results",fields:listSchema};YAHOO.hcw.datatable.keep=new YAHOO.widget.DataTable("keeptable",G,YAHOO.hcw.datasource.keep,K);YAHOO.hcw.datatable.keep.subscribe("checkboxClickEvent",function(o){if(o.target.checked){this.getRecord(o.target)._oData.flag=true}else{this.getRecord(o.target)._oData.flag=false}});YAHOO.hcw.datatable.keep.subscribe("dropdownChangeEvent",t);YAHOO.hcw.datasource.wish=new YAHOO.util.DataSource("coupon.php?");YAHOO.hcw.datasource.wish.responseType=YAHOO.util.DataSource.TYPE_JSON;YAHOO.hcw.datasource.wish.connXhrMode="queueRequests";YAHOO.hcw.datasource.wish.responseSchema={resultsList:"results",fields:listSchema};YAHOO.hcw.datatable.wish=new YAHOO.widget.DataTable("wishtable",k,YAHOO.hcw.datasource.wish,K);YAHOO.hcw.datatable.wish.subscribe("checkboxClickEvent",function(o){if(o.target.checked){this.getRecord(o.target)._oData.flag=true}else{this.getRecord(o.target)._oData.flag=false}});YAHOO.hcw.datatable.wish.subscribe("dropdownChangeEvent",t);function O(o){if(o.newValue.get("label")=="Incoming"){YAHOO.widget.DataTable.MSG_EMPTY="No one currently has any of the items in your Wish List in their Have List.  Please check again soon.";YAHOO.hcw.refreshTradeTab("incoming")}else{if(o.newValue.get("label")=="Outgoing"){YAHOO.widget.DataTable.MSG_EMPTY="No one currently has any of the items in your Have List in their Wish List.  Please check again soon.";YAHOO.hcw.refreshTradeTab("outgoing")}else{if(o.newValue.get("label")=="History"){YAHOO.widget.DataTable.MSG_EMPTY="No archived trades were found.";YAHOO.hcw.refreshTradeTab("tradehist")}}}}YAHOO.hcw.tradeTabView=new YAHOO.widget.TabView("tradeview");YAHOO.hcw.tradeTabView.on("activeTabChange",O);YAHOO.widget.DataTable.Formatter.haswants=function(AY,x,AZ,Aa){if(YAHOO.lang.isArray(Aa.dropdownOptions)){AY.innerHTML="";selectEl=document.createElement("select");YAHOO.util.Dom.addClass(selectEl,YAHOO.widget.DataTable.CLASS_DROPDOWN);selectEl=AY.appendChild(selectEl);for(i=0;i<Aa.dropdownOptions.length;i++){var AX=Aa.dropdownOptions[i];var o=document.createElement("option");o.value=(YAHOO.lang.isValue(AX.value))?AX.value:AX;o.innerHTML=(YAHOO.lang.isValue(AX.text))?AX.text:AX;o=selectEl.appendChild(o)}AY.innerHTML=AY.innerHTML+'<br/><button type="button" class="'+YAHOO.widget.DataTable.CLASS_BUTTON+'">Trader Details...</button><br/><button type="button" class="'+YAHOO.widget.DataTable.CLASS_BUTTON+'">Trader Lists...</button><br/><button type="button" class="'+YAHOO.widget.DataTable.CLASS_BUTTON+'">Initiate Trade...</button>'}};function V(o,x){return'<button id="'+o+"_"+x+'" type="button" class="'+YAHOO.widget.DataTable.CLASS_BUTTON+'">'+o+"</button>&nbsp"}function AP(AY,x){var AX=false;for(var o=0;o<x.length;o++){if(x[o].action==AY){AX=true;break}}return AX}function R(AX,AZ){var AY=YAHOO.hcw.tradeTabView.get("activeTab").get("label");var x="";if((AP("Sender Canceled",AX))||(AP("Recipient Canceled",AX))){}else{if(AY=="Incoming"){if(AP("Sender Initiated",AX)){if(!AP("Recipient Accepted",AX)){x+=V("Accept",AZ)}else{if((AP("Sender Completed",AX))&&(!AP("Recipient Completed",AX))){x+=V("Complete",AZ)}else{if((AP("Sender Completed",AX))&&(!AP("Recipient Left Feedback",AX))){x+=V("Feedback",AZ)}}}}else{if((!AP("Recipient Accepted",AX))&&(AP("Sender Accepted",AX))){x+=V("Accept",AZ)}else{if((AP("Recipient Accepted",AX))&&(AP("Sender Completed",AX))&&(!AP("Recipient Completed",AX))){x+=V("Complete",AZ)}else{if((AP("Recipient Completed",AX))&&(!AP("Recipient Left Feedback",AX))){x+=V("Feedback",AZ)}}}}}else{if(AY=="Outgoing"){if(AP("Recipient Initiated",AX)){if(!AP("Sender Accepted",AX)){x+=V("Accept",AZ)}else{if((AP("Recipient Accepted",AX))&&(!AP("Sender Completed",AX))){x+=V("Complete",AZ)}else{if((AP("Recipient Completed",AX))&&(!AP("Sender Left Feedback",AX))){x+=V("Feedback",AZ)}}}}else{if((AP("Recipient Accepted",AX))&&(!AP("Sender Accepted",AX))){x+=V("Accept",AZ)}else{if((AP("Sender Accepted",AX))&&(AP("Recipient Accepted",AX))&&(!AP("Sender Completed",AX))){x+=V("Complete",AZ)}else{if((AP("Sender Completed",AX))&&(!AP("Sender Left Feedback",AX))){x+=V("Feedback",AZ)}}}}}}}if(((AP("Recipient Completed",AX))&&(AP("Sender Completed",AX)))||(AP("Recipient Canceled",AX))||(AP("Sender Canceled",AX))){x+=V("Archive",AZ)}x+=V("Comment",AZ);var o=AP("Recipient Canceled",AX)||AP("Sender Canceled",AX);var Aa=AP("Recipient Completed",AX)&&AP("Sender Completed",AX);if((!o)&&(!Aa)){x+=V("Cancel",AZ)}if(AY=="History"){x=""}return x}YAHOO.widget.DataTable.Formatter.history=function(AY,Ad,Aa,AX){var Ab=YAHOO.hcw.tradeTabView.get("activeTab").get("label");if((YAHOO.lang.isObject(AX))&&(AX.trade.length>0)){var Ae="";var AZ="";var x="";var o="";for(var Ac=0;Ac<AX.trade.length;Ac++){if(AX.trade[Ac].quantity==0){AZ="a yet to be determined number"}else{AZ=AX.trade[Ac].quantity}if(Ab=="History"){x="You traded for "}else{x="You are currently trading for "}Ae+='<table width="100%"><tr><td colspan="3">'+x+AZ+" of this coupon with "+AX.trade[Ac].othersidename;Ae+=".<hr/></td></tr><tr><th>Last Activity</th><th>Action</th><th>Comment</th></tr>";for(j=0;j<AX.trade[Ac].workflow.length;j++){if(AX.trade[Ac].workflow[j].action.indexOf("Feedback")>-1){if(Ab=="Outgoing"){if(AX.trade[Ac].workflow[j].action=="Sender Left Feedback"){AX.trade[Ac].workflow[j].comment='Click <a href="itrader.php?u='+AX.trade[Ac].othersideid+'" target="_blank">here</a> to view.'}else{AX.trade[Ac].workflow[j].comment='Click <a href="itrader.php?u='+AX.trade[Ac].thissideid+'" target="_blank">here</a> to view.'}}else{if(Ab=="Incoming"){if(AX.trade[Ac].workflow[j].action=="Recipient Left Feedback"){AX.trade[Ac].workflow[j].comment='Click <a href="itrader.php?u='+AX.trade[Ac].othersideid+'" target="_blank">here</a> to view.'}else{AX.trade[Ac].workflow[j].comment='Click <a href="itrader.php?u='+AX.trade[Ac].thissideid+'" target="_blank">here</a> to view.'}}}}if(AX.trade[Ac].workflow[j].action.indexOf("Sender")>-1){o="background: #FFDBB0"}else{o="background: #FFFFFF"}Ae+='<tr style="'+o+'"><td>'+AX.trade[Ac].workflow[j].timestamp+"</td><td>"+AX.trade[Ac].workflow[j].action+"</td><td>"+AX.trade[Ac].workflow[j].comment+"</td></tr>"}Ae+='<tr><td colspan="3">'+R(AX.trade[Ac].workflow,AX.trade[Ac].tradeid)+"</td></tr></table>"}AY.innerHTML=Ae}else{AY.innerHTML="None"}};var AB=[{key:"quantity",label:"Interest",formatter:"priority"},{key:"type",label:"Value"},{key:"expiration",label:"Expires",formatter:"expires"},{key:"description",label:"Description",formatter:"description"},{key:"haswants",label:"Who Has (Qty)(Rating)",formatter:"haswants"},{key:"history",label:"Active Trades",formatter:"history"}];var B=[{key:"couponid",parser:YAHOO.util.DataSource.parseNumber},{key:"type"},{key:"expiration",parser:YAHOO.util.DataSource.parseDate},{key:"quantity",parser:YAHOO.util.DataSource.parseNumber},{key:"description"},{key:"linkurl"},{key:"haswants"},{key:"history"}];var T=[{key:"description",label:"Description",formatter:"description"},{key:"direction",label:"Direction"},{key:"history",label:"Trade Details",formatter:"history"}];var AM=[{key:"description"},{key:"direction"},{key:"history"}];var AV={initialLoad:false};function r(o){var Ad=this.getRecord(o.target);var AZ=o.target.id.split("_");var AX=YAHOO.hcw.tradeTabView.get("activeTab").get("label");var Ac=AX.toLowerCase();var Aa=o.target.offsetParent.getElementsByTagName("select")[0];var x=0;document.getElementById("dtqtylabel").style.visibility="hidden";document.getElementById("dtqtyvalue").style.visibility="hidden";document.getElementById("dtcond").innerHTML="";if(Aa){x=Aa.selectedIndex}if(o.target.innerHTML=="Trader Details..."){window.open("itrader.php?u="+Aa.options[x].value)}else{if(o.target.innerHTML=="Trader Lists..."){text=Aa.options[x].text.split("(")[0].trim();listurl=document.location.href.substr(0,document.location.href.lastIndexOf("/"));listurl=listurl.substr(0,listurl.lastIndexOf("/"));listurl=listurl+"/userlists/"+text;window.open(listurl)}else{if(o.target.innerHTML=="Initiate Trade..."){document.tradeaction.listtype.value=Ac;document.tradeaction.couponid.value=Ad._oData.couponid;document.tradeaction.traderid.value=Aa.options[x].value;document.tradeaction.listact.value=AX+" Initiated";if(AX=="Incoming"){document.getElementById("dtqtylabel").style.visibility="";document.getElementById("dtqtyvalue").style.visibility="";maxqty=Aa.options[x].text.split("(")[1].split(")")[0];document.tradeaction.maxqty.value=maxqty}YAHOO.hcw.dialogtrade.show()}else{if(o.target.innerHTML=="Accept"){document.tradeaction.listact.value=AX+" Accepted";document.tradeaction.tradeid.value=AZ[1];document.tradeaction.listtype.value=Ac;Ad=this.getRecord(o.target.parentNode.parentNode.parentNode.parentNode.parentNode);var Ab=Ad._oData.history.trade;for(var AY=0;AY<Ab.length;AY++){if(Ab[AY].tradeid==AZ[1]){break}}if((AX=="Incoming")&&(AP("Sender Initiated",Ab[AY].workflow))){document.getElementById("dtqtylabel").style.visibility="";document.getElementById("dtqtyvalue").style.visibility="";document.tradeaction.maxqty.value=Ab[AY].maxqty}YAHOO.hcw.dialogtrade.show()}else{if(o.target.innerHTML=="Complete"){document.tradeaction.listact.value=AX+" Completed";document.tradeaction.tradeid.value=AZ[1];document.tradeaction.listtype.value=Ac;Ad=this.getRecord(o.target.parentNode.parentNode.parentNode.parentNode.parentNode);Ab=Ad._oData.history.trade;for(var AY=0;AY<Ab.length;AY++){if(Ab[AY].tradeid==AZ[1]){break}}if(AX=="Incoming"){document.getElementById("dtcond").innerHTML='<input type="checkbox" checked="true" name="addtolist"/>Add these items to my&nbsp;<select name="whichlist"><option value="have">Have List</option><option value="keep">Keep List</option></select>?'}else{if(AX=="Outgoing"){document.getElementById("dtcond").innerHTML='<input type="checkbox" checked="true" name="removefromlist"/>&nbsp;Decrease the quantity in my Have List for this coupon by '+Ab[AY].quantity+"?"}}YAHOO.hcw.dialogtrade.show()}else{if(o.target.innerHTML=="Feedback"){Ad=this.getRecord(o.target.parentNode.parentNode.parentNode.parentNode.parentNode);Ab=Ad._oData.history.trade;for(var AY=0;AY<Ab.length;AY++){if(Ab[AY].tradeid==AZ[1]){break}}if(confirm("Would you like to leave trader Feedback for this person?")){window.open("itrader_feedback.php?u="+Ab[AY].othersideid,"_blank");post="do=tradeaction&listact="+AX+" Left Feedback&tradeid="+AZ[1];YAHOO.util.Connect.asyncRequest("POST","coupon.php",{success:function(Ae){YAHOO.hcw.refreshTradeTab(Ac)}},post)}}else{if(o.target.innerHTML=="Archive"){post="do=tradeaction&listact="+AX+" Archive&tradeid="+AZ[1];YAHOO.util.Connect.asyncRequest("POST","coupon.php",{success:function(Ae){YAHOO.hcw.refreshTradeTab(Ac)}},post)}else{document.tradeaction.listact.value=AX+" "+o.target.innerHTML+"ed";document.tradeaction.tradeid.value=AZ[1];document.tradeaction.listtype.value=Ac;YAHOO.hcw.dialogtrade.show()}}}}}}}}YAHOO.hcw.datasource.incoming=new YAHOO.util.DataSource("coupon.php?");YAHOO.hcw.datasource.incoming.responseType=YAHOO.util.DataSource.TYPE_JSON;YAHOO.hcw.datasource.incoming.connXhrMode="queueRequests";YAHOO.hcw.datasource.incoming.responseSchema={resultsList:"results",fields:B};YAHOO.hcw.datatable.incoming=new YAHOO.widget.DataTable("inctable",AB,YAHOO.hcw.datasource.incoming,AV);YAHOO.hcw.datatable.incoming.subscribe("buttonClickEvent",r);AB[0].formatter=null;AB[0].label="Quantity";AB[4].label="Who Wants (Interest)(Rating)";YAHOO.hcw.datasource.outgoing=new YAHOO.util.DataSource("coupon.php?");YAHOO.hcw.datasource.outgoing.responseType=YAHOO.util.DataSource.TYPE_JSON;YAHOO.hcw.datasource.outgoing.connXhrMode="queueRequests";YAHOO.hcw.datasource.outgoing.responseSchema={resultsList:"results",fields:B};YAHOO.hcw.datatable.outgoing=new YAHOO.widget.DataTable("outtable",AB,YAHOO.hcw.datasource.outgoing,AV);YAHOO.hcw.datatable.outgoing.subscribe("buttonClickEvent",r);YAHOO.hcw.datasource.tradehist=new YAHOO.util.DataSource("coupon.php?");YAHOO.hcw.datasource.tradehist.responseType=YAHOO.util.DataSource.TYPE_JSON;YAHOO.hcw.datasource.tradehist.connXhrMode="queueRequests";YAHOO.hcw.datasource.tradehist.responseSchema={resultsList:"results",fields:AM};YAHOO.hcw.datatable.tradehist=new YAHOO.widget.DataTable("tvhtable",T,YAHOO.hcw.datasource.tradehist,AV);listurl=document.location.href.substr(0,document.location.href.lastIndexOf("/"));listurl=listurl.substr(0,listurl.lastIndexOf("/"));listurl=listurl+"/userlists";text='Your lists are shared for others to see at <a target="_blank" href="'+listurl+"/"+YAHOO.hcw.userdict.username+'">'+listurl+"/"+YAHOO.hcw.userdict.username+'</a> and you may browse other member\'s lists by visiting <a target="_blank" href="'+listurl+'">'+listurl+"</a>";document.getElementById("globalhavelist").innerHTML=text;document.getElementById("globalwishlist").innerHTML=text;if(document.location.href.indexOf("?")>0){parts=document.location.href.split("?");var u="";var c="";if(parts[1].indexOf("&")>0){parts=parts[1].split("&");u=parts[0].split("=")[1];c=parts[1].split("=")[1]}else{u=parts[1].split("=")[1]}if((u=="have")&&(tab=YAHOO.hcw.tabView.getTab(1))){YAHOO.hcw.tabView.set("activeTab",tab)}else{if((u=="keep")&&(tab=YAHOO.hcw.tabView.getTab(2))){YAHOO.hcw.tabView.set("activeTab",tab)}else{if((u=="wish")&&(tab=YAHOO.hcw.tabView.getTab(3))){YAHOO.hcw.tabView.set("activeTab",tab)}else{if((u=="trades")&&(tab=YAHOO.hcw.tabView.getTab(4))){YAHOO.hcw.tabView.set("activeTab",tab);if((c=="outgoing")&&(tab=YAHOO.hcw.tradeTabView.getTab(1))){YAHOO.hcw.tradeTabView.set("activeTab",tab)}}}}}}}}catch(AE){alert("The coupon database encountered a JSON error - please\nuse the Contact Us link to report an issue if the\nproblem persists.")}},failure:function(B){if(!YAHOO.util.Connect.isCallInProgress(B)){alert("The coupon database is not responding - please\nuse the Contact Us link to report an issue, if the\nproblem persists.")}}};YAHOO.util.Connect.asyncRequest("GET","coupon.php?do=getconfig",A)}YAHOO.util.Event.onDOMReady(init);