/* Wine Picks UI functions */
var WinePicksUI = {
    shoppingAjaxURL: "/winepicks/shoppinglist_ajax.aspx",
    AddToShoppingList: function(wid) { $.getJSON(WinePicksUI.shoppingAjaxURL + "?adding=set&wid=" + escape(wid), function(data) { if (data.added != null) { $("#wslistadd").hide(); $("#wslistrmv").fadeOut().fadeIn(); } }); },
    RemoveFromShoppingList: function(wid) { $.getJSON(WinePicksUI.shoppingAjaxURL + "?removing=set&wid=" + escape(wid), function(data) { if (data.removed != null) { $("#wslistrmv").hide(); $("#wslistadd").fadeOut().fadeIn(); } }); },
    AddWToShoppingList: function(wid) { $.getJSON(WinePicksUI.shoppingAjaxURL + "?adding=set&wid=" + escape(wid), function(data) { if (data.subscribe != null) { location.href = "/winepicks/subscription/"; return; } if (data.added != null) { $("#wslistadd_" + wid).hide(); $("#wslistrmv_" + wid).fadeOut().fadeIn(); } }); },
    RemoveWFromShoppingList: function(wid) { $.getJSON(WinePicksUI.shoppingAjaxURL + "?removing=set&wid=" + escape(wid), function(data) { if (data.removed != null) { $("#wslistrmv_" + wid).hide(); $("#wslistadd_" + wid).fadeOut().fadeIn(); } }); },
    ShoppingListRemove: function(wid) { $.getJSON(WinePicksUI.shoppingAjaxURL + "?removing=set&wid=" + escape(wid), function(data) { if (data.removed != null) { $("#wp_" + wid).fadeOut() } }); },
    ShoppingListReset: function() { $.getJSON(WinePicksUI.shoppingAjaxURL + "?resetall=set", function(data) { if (data.removed != null) { $(".printwp").fadeOut(); } }); },
    wishListAjaxURL: "/winepicks/wishlist_ajax.aspx",
    AddToWishList: function(wid) { $.getJSON(WinePicksUI.wishListAjaxURL + "?adding=set&wid=" + escape(wid), function(data) { if (data.added != null) { $("#wwlistadd").hide(); $("#wwlistrmv").fadeOut().fadeIn(); } }); },
    RemoveFromWishList: function(wid) { $.getJSON(WinePicksUI.wishListAjaxURL + "?removing=set&wid=" + escape(wid), function(data) { if (data.removed != null) { $("#wwlistrmv").hide(); $("#wwlistadd").fadeOut().fadeIn(); } }); },
    AddWToWishList: function(wid) { $.getJSON(WinePicksUI.wishListAjaxURL + "?adding=set&wid=" + escape(wid), function(data) { if (data.subscribe != null) { location.href = "/winepicks/subscription/"; return; } if (data.added != null) { $("#wwlistadd_" + wid).hide(); $("#wwlistrmv_" + wid).fadeOut().fadeIn(); } }); },
    RemoveWFromWishList: function(wid) { $.getJSON(WinePicksUI.wishListAjaxURL + "?removing=set&wid=" + escape(wid), function(data) { if (data.removed != null) { $("#wwlistrmv_" + wid).hide(); $("#wwlistadd_" + wid).fadeOut().fadeIn(); } }); },
    WishListRemove: function(wid) { $.getJSON(WinePicksUI.wishListAjaxURL + "?removing=set&wid=" + escape(wid), function(data) { if (data.removed != null) { $("#wp_" + wid).fadeOut() } }); },
    WishListReset: function() { $.getJSON(WinePicksUI.wishListAjaxURL + "?resetall=set", function(data) { if (data.removed != null) { $(".printwp").fadeOut(); } }); },
    searchAJAXURL: "/winepicks/search_ajax.aspx",
    searchPageNumber: 0, searchSortBy: "", searchResults: "", searchTotals: "", releaseDateDropdown: "#reviewdates",
    WineTypeSelected: function() { $.getJSON(WinePicksUI.searchAJAXURL + "?mode=getwines&wtype=" + $("#wrwt").val(), function(data) { if (data.wines != null) { var options = '<option value="">Please Choose</option>'; $.each(data.wines, function(i, item) { options += '<option value="' + item + '">' + item + '</option>'; }); $("#wrgrape").html('').html(options).fadeOut().fadeIn(); } }); },
    FoodMatchSelected: function() { fm = "" + $("#wrfood").val(); if ("_" != fm.substring(0, 1)) { $.getJSON(WinePicksUI.searchAJAXURL + "?mode=getfoods&ftype=" + $("#wrfood").val(), function(data) { if (data.foods != null) { var options = '<option value="">Please Choose</option>' + data.foods; $("#wrfood").html('').html(options).fadeOut("slow").fadeIn("slow").val(fm); } }); } },
    ReviewDateSelected: function() { rd = "" + $("#reviewdates").val(); if (rd.length == 0) { $("#wrrdm").val(""); $("#wrrdd").val(""); $("#wrrdy").val(""); } else { if (rd == "AllDates") { $("#reviewdates").hide(); WinePicksUI.releaseDateDropdown = "#reviewdatesall"; $("#reviewdatesall").show().fadeOut().fadeIn(); } else if (rd.length == 10) { rdparts = rd.split("-"); rdm = parseInt(rdparts[0], 10); if (!isNaN(rdm)) { $("#wrrdm").val(rdm); } rdd = parseInt(rdparts[1], 10); if (!isNaN(rdd)) { $("#wrrdd").val(rdd); } rdy = parseInt(rdparts[2], 10); if (!isNaN(rdy)) { $("#wrrdy").val(rdy); } } } },
    ReviewDateSelectedFromAll: function() { rd = "" + $("#reviewdatesall").val(); if (rd.length == 0) { $("#wrrdm").val(""); $("#wrrdd").val(""); $("#wrrdy").val(""); } else if (rd.length == 10) { rdparts = rd.split("-"); rdm = parseInt(rdparts[0], 10); if (!isNaN(rdm)) { $("#wrrdm").val(rdm); } rdd = parseInt(rdparts[1], 10); if (!isNaN(rdd)) { $("#wrrdd").val(rdd); } rdy = parseInt(rdparts[2], 10); if (!isNaN(rdy)) { $("#wrrdy").val(rdy); } } },
    SelectLatestRelease: function() { $("#wrrdm").val(parseInt(wrpldM, 10)); $("#wrrdd").val(parseInt(wrpldD, 10)); $("#wrrdy").val(wrpldY); $(WinePicksUI.releaseDateDropdown).val("" + wrpldM + "-" + wrpldD + "-" + wrpldY); },
    SelectLastRelease: function() { $("#wrrdm").val(parseInt(wrplldM, 10)); $("#wrrdd").val(parseInt(wrplldD, 10)); $("#wrrdy").val(wrplldY); $(WinePicksUI.releaseDateDropdown).val("" + wrplldM + "-" + wrplldD + "-" + wrplldY); },
    PrintReview: function() { var sd = "" + $(WinePicksUI.releaseDateDropdown).val(); if (sd.length > 0) { ndpopup("/winepicks/winepicks_bydate.aspx?wdate=" + sd, 800, 600); } else { $(WinePicksUI.releaseDateDropdown).fadeOut().fadeIn(); } },
    TopRatedPicked: function() { /*var tp = "" + $("#wrtp").val();if(tp.length > 0){var p = "reviewdates wrpd wrwt wrgrape wrrg wrsc wrrdm wrrdd wrrdy wrwn wrfood";var params = p.split(" ");$.each(params,function(i,item){$("#"+item).val("");});}*/ },
    PrintTopRated: function() { var tp = "" + $("#wrtp").val(); if (tp.length > 0) { tpurl = "/winepicks/winepicks_toppicks.aspx?tp=" + tp + "&"; var p = "wrpd wrwt wrgrape wrrg wrsc wrrdm wrrdd wrrdy wrwn wrtp wrfood wrpricea wrpriceb wrvintagea wrvintageb"; var params = p.split(" "); $.each(params, function(i, item) { var pv = "" + $("#" + item).val(); if (pv.length > 0) { tpurl += item + "=" + $("#" + item).val() + "&"; } }); ndpopup(tpurl, 800, 600); } else { $("#wrtp").fadeOut().fadeIn(); } },
    WPSearchParameters: function() { var url = ""; var p = "wrpd wrwt wrgrape wrrg wrgs wrsc wrrdm wrrdd wrrdy wrwn wrtp wrfood wrpricea wrpriceb wrvintagea wrvintageb wagent"; var params = p.split(" "); $.each(params, function(i, item) { var vv = "" + $("#" + item).val(); if (vv.length > 0) { url += item + "=" + vv + "&"; } }); if (wpreset == 1) { url += "&wpreset=set"; } return url; },
    DoSearch: function(extravar) { var fm = "" + $("#wrfood").val(); if (fm.length > 1) { if (fm.substring(0, 1) != "_") { $("#wrfood").val(""); } } WinePicksUI.searchResults = ""; $("#searchWaitImage").show(); var params = WinePicksUI.WPSearchParameters(); var pagenum = "&pnum=" + WinePicksUI.searchPageNumber; var orderby = "&psort=" + WinePicksUI.searchSortBy; $.getJSON(WinePicksUI.searchAJAXURL + "?" + params + pagenum + orderby + extravar, function(data) { if (data.wpsubscribeplz != null) { location.href = "/winepicks/subscription/"; return; } $("#searchWaitImage").hide(); if (data.content != null) { $("#wpresults").slideUp(); WinePicksUI.searchResults = data.content; WinePicksUI.searchTotals = data.currentlyshowing; setTimeout("WinePicksUI.ViewUpdate()", 800); } }); return false; },
    ViewUpdate: function() { $('#wpresults').html(WinePicksUI.searchResults).slideDown(); $("#wppages").html(WinePicksUI.searchTotals); $("#wppages2").html(WinePicksUI.searchTotals); },
    SearchForWines: function() { WinePicksUI.searchPageNumber = 0; WinePicksUI.DoSearch("&dosearch=set"); return false; },
    PagePrevious: function() { WinePicksUI.searchPageNumber = WinePicksUI.searchPageNumber - 1; if (WinePicksUI.searchPageNumber < 0) { WinePicksUI.searchPageNumber = 0; } WinePicksUI.DoSearch(""); return false; },
    PageNext: function() { WinePicksUI.searchPageNumber = WinePicksUI.searchPageNumber + 1; WinePicksUI.DoSearch(""); return false; },
    SortWinery: function() { WinePicksUI.searchSortBy = "winery"; WinePicksUI.DoSearch("&dosearch=set"); return false; },
    SortWine: function() { WinePicksUI.searchSortBy = "wine"; WinePicksUI.DoSearch("&dosearch=set"); return false; },
    SortReview: function() { WinePicksUI.searchSortBy = "review"; WinePicksUI.DoSearch("&dosearch=set"); return false; },
    StoresClick: function(cntid) { $(".stores").hide(); $("#storesfor_" + cntid).fadeIn(); location.href = "#sdiv_" + cntid; return false; },
    lcboAjaxURL: "/stores/ontario/ajax_userstores.aspx",
    AnonLCBOSearch: function() { pc = $("#lcbo_pcode"); if (pc != null) { pcode = "" + $("#lcbo_pcode").val(); if (pcode.length > 0) { if (pcode.length == 6 || pcode.length == 7) { wid = $("#lcbo_wid").val(); whash = $("#lcbo_whash").val(); $("#lcbo_wait").show(); $("#lcbo_sub").hide(); $.getJSON(WinePicksUI.lcboAjaxURL + "?mode=anon&pcode=" + pcode + "&wid=" + wid + "&whash=" + whash, function(data) { if (data.lcbourl != null) { location.href = data.lcbourl; } else if (data.error != null) { alert(data.error); } else { alert("Unable to look up LCBO stock right now. Please try again later."); } }); } else { alert("Please enter a valid Ontario postal code"); } } else { alert("Please enter a Postal code"); pc.focus(); } } return false; },
    ToggleSection: function(id) { $("#" + id).toggle(); t = "" + $("#href_" + id).text(); if ("Compress" == t) { $("#href_" + id).text("Expand"); } if ("Expand" == t) { $("#href_" + id).text("Compress"); } },
    OpenSort: function() { $("#sortheader").hide(); $("#sortbtns").show(); },
    HandleShoppingListScroller: function(wineid) { $.post($("#whandlerurl").val(), { mode: "shoppinglist", wid: wineid }, function(data) { if (data.error != null) { /*"#wmsg_" + wineid*/$("#scrollermsgs").html("").fadeOut(); $("#scrollermsgs").html("" + data.error).fadeIn(); } else if (data.shoppinglistremoved != null) { $("#shplnk_" + wineid).removeClass("wdShopOK").addClass("wdShop").fadeOut().fadeIn(); /*"#wmsg_" + wineid*/$("#scrollermsgs").html("Wine removed from your <a href=\"/winepicks/shoppinglist.aspx\">Shopping List</a>").fadeIn(); } else if (data.shoppinglistadded != null) { $("#shplnk_" + wineid).removeClass("wdShop").addClass("wdShopOK").fadeOut().fadeIn(); /*"#wmsg_" + wineid*/$("#scrollermsgs").html("Wine added to your <a href=\"/winepicks/shoppinglist.aspx\">Shopping List</a>").fadeIn(); } }, "json"); },
    HandleWishListScroller: function(wineid) { $.post($("#whandlerurl").val(), { mode: "wishlist", wid: wineid }, function(data) { if (data.error != null) { $("#scrollermsgs").html("" + data.error).fadeIn(); } else if (data.wishlistremoved != null) { $("#wshlnk_" + wineid).removeClass("wdWishOK").addClass("wdWish").fadeOut().fadeIn(); $("#scrollermsgs").html("").fadeOut(); $("#scrollermsgs").html("Wine removed from your <a href=\"/winepicks/wishlist.aspx\">Wish List</a>").fadeIn(); } else if (data.wishlistadded != null) { $("#wshlnk_" + wineid).removeClass("wdWish").addClass("wdWishOK").fadeOut().fadeIn(); $("#scrollermsgs").html("").fadeOut(); $("#scrollermsgs").html("Wine added to your <a href=\"/winepicks/wishlist.aspx\">Wish List</a>").fadeIn(); } }, "json"); },
    HandleShoppingListBottleScroller: function(wineid) { $.post($("#whandlerurl").val(), { mode: "shoppinglist", wid: wineid }, function(data) { if (data.error != null) { $("#bottlescrollermsgs").html("").fadeOut(); $("#bottlescrollermsgs").html("" + data.error).fadeIn(); } else if (data.shoppinglistremoved != null) { $("#shplnk_" + wineid).removeClass("wdShopOK").addClass("wdShop").fadeOut().fadeIn(); /*"#wmsg_" + wineid*/$("#bottlescrollermsgs").html("Wine removed from your <a href=\"/winepicks/shoppinglist.aspx\">Shopping List</a>").fadeIn(); } else if (data.shoppinglistadded != null) { $("#shplnk_" + wineid).removeClass("wdShop").addClass("wdShopOK").fadeOut().fadeIn(); /*"#wmsg_" + wineid*/$("#bottlescrollermsgs").html("Wine added to your <a href=\"/winepicks/shoppinglist.aspx\">Shopping List</a>").fadeIn(); } }, "json"); },
    HandleWishListBottleScroller: function(wineid) { $.post($("#whandlerurl").val(), { mode: "wishlist", wid: wineid }, function(data) { if (data.error != null) { $("#bottlescrollermsgs").html("" + data.error).fadeIn(); } else if (data.wishlistremoved != null) { $("#wshlnk_" + wineid).removeClass("wdWishOK").addClass("wdWish").fadeOut().fadeIn(); $("#bottlescrollermsgs").html("").fadeOut(); $("#bottlescrollermsgs").html("Wine removed from your <a href=\"/winepicks/wishlist.aspx\">Wish List</a>").fadeIn(); } else if (data.wishlistadded != null) { $("#wshlnk_" + wineid).removeClass("wdWish").addClass("wdWishOK").fadeOut().fadeIn(); $("#bottlescrollermsgs").html("").fadeOut(); $("#bottlescrollermsgs").html("Wine added to your <a href=\"/winepicks/wishlist.aspx\">Wish List</a>").fadeIn(); } }, "json"); },
    HandleShoppingList: function(wineid) { $.post($("#whandlerurl").val(), { mode: "shoppinglist", wid: wineid }, function(data) { if (data.error != null) { $("#wmsg_" + wineid).html("" + data.error).fadeIn(); } else if (data.shoppinglistremoved != null) { $("#shplnk_" + wineid).removeClass("wdShopOK").addClass("wdShop").fadeOut().fadeIn(); $("#wmsg_" + wineid).html("Wine removed from your <a href=\"/winepicks/shoppinglist.aspx\">Shopping List</a>").fadeIn(); } else if (data.shoppinglistadded != null) { $("#shplnk_" + wineid).removeClass("wdShop").addClass("wdShopOK").fadeOut().fadeIn(); $("#wmsg_" + wineid).html("Wine added to your <a href=\"/winepicks/shoppinglist.aspx\">Shopping List</a>").fadeIn(); } }, "json"); },
    HandleWishList: function(wineid) { $.post($("#whandlerurl").val(), { mode: "wishlist", wid: wineid }, function(data) { if (data.error != null) { $("#wmsg_" + wineid).html("" + data.error).fadeIn(); } else if (data.wishlistremoved != null) { $("#wshlnk_" + wineid).removeClass("wdWishOK").addClass("wdWish").fadeOut().fadeIn(); $("#wmsg_" + wineid).html("Wine removed from your <a href=\"/winepicks/wishlist.aspx\">Wish List</a>").fadeIn(); } else if (data.wishlistadded != null) { $("#wshlnk_" + wineid).removeClass("wdWish").addClass("wdWishOK").fadeOut().fadeIn(); $("#wmsg_" + wineid).html("Wine added to your <a href=\"/winepicks/wishlist.aspx\">Wish List</a>").fadeIn(); } }, "json"); },
    categoriesAJAXURL: "/winepicks/categorylisting_ajax.aspx",
    LoadCategoryContent: function(cid) { $.getJSON(WinePicksUI.categoriesAJAXURL + "?cid=" + escape(cid), function(data) { if (data.uicontent != null) { location.href = "#wine"; $("#winecategoryscrollerdiv").html(data.uicontent); } else { location.href = "#wine"; $("#winecategoryscrollerdiv").html('<p align="center">No Wines Found</p>'); } if (data.titlelink != null) { $("#winecatlink").html(data.titlelink); } if (data.title != null) { $("#winecattitle").html(data.title); } }); return false; },
    LoadCategoryContentNoJump: function(cid) { $.getJSON(WinePicksUI.categoriesAJAXURL + "?cid=" + escape(cid), function(data) { if (data.uicontent != null) { $("#winecategoryscrollerdiv").html(data.uicontent); } else { $("#winecategoryscrollerdiv").html('<p align="center">No Wines Found</p>'); } if (data.titlelink != null) { $("#winecatlink").html(data.titlelink); } if (data.title != null) { $("#winecattitle").html(data.title); } }); return false; },

    LoadMoreCategories: function() { $.getJSON("/winepicks/category_ajax.aspx?mode=loadmore&catids=" + escape($("#showncatids").val()), function(data) { if (data.uicontent != null) { var c = "" + data.uicontent; if (c.length > 0) { $("#morewinecategories").append(data.uicontent); } else { $("#showmorelink").hide(); } } else { $("#showmorelink").hide(); } }); },
    scrollerAJAXURL: "/winepicks/index_ajax.aspx",
    ScrollerTopPicks: function() {
        if ($("#uwss").val() == "false") { $("#paypopup").trigger('click'); return false; }
        witems = $('#wine-review-selection li a');
        witems.removeClass('active');
        $("#wine-picks-gettoppicks").addClass("active");
        wcontainer = $('#latest-wine-reviews .wine-picks-scroller-container');
        wcontainer.animate({ opacity: 0 }, 500, function() {
            $.getJSON(WinePicksUI.scrollerAJAXURL + "?type=toppicks", function(data) {
                if (data.error != null) { wcontainer.html(data.error); }
                else if (data.content != null) {
                    $('#latest-wine-reviews .wine-picks-items').html("");
                    wcontainer.html(data.content);
                }
                wcontainer.animate({ opacity: 1 }, 500);
                WinePicksUI.ScrollerWidthFix();
            })
        });
        return false;
    },
    ScrollerAllWines: function() {
        witems = $('#wine-review-selection li a');
        witems.removeClass('active');
        $("#wine-picks-getallpicks").addClass("active");
        wcontainer = $('#latest-wine-reviews .wine-picks-scroller-container');
        $.getJSON(WinePicksUI.scrollerAJAXURL + "?type=allwines", function(data) {
            if (data.error != null) { wcontainer.html(data.error); }
            else if (data.content != null) {
                $('#latest-wine-reviews .wine-picks-items').html("");
                wcontainer.animate({ opacity: 0 }, 500);
                wcontainer.html(data.content);
            }

            wcontainer.animate({ opacity: 1 }, 500);
            WinePicksUI.ScrollerWidthFix();
        });
        return false;
    },

    WSAllNext: function() { wcontainer = $('#latest-wine-reviews .wine-picks-scroller-container'); var nxtpg = parseInt($("#wsallpage").val(), 10) + 1; wcontainer.html('<p align="center"><img src="/images/wait_arrows.gif" alt="Loading..." /></p>'); $.getJSON("/winepicks/scroller_ajax.aspx?type=allwines&pg=" + nxtpg, function(data) { if (data.error != null) { wcontainer.html(data.error); } else if (data.content != null) { $('#latest-wine-reviews .wine-picks-items').html(""); wcontainer.animate({ opacity: 0 }, 500); wcontainer.html(data.content); $("#wsallpage").val(nxtpg); } wcontainer.animate({ opacity: 1 }, 500); WinePicksUI.ScrollerWidthFix(); wcontainer.scrollLeft(0); }) },
    WSTopNext: function() { wcontainer = $('#latest-wine-reviews .wine-picks-scroller-container'); var nxtpg = parseInt($("#wstoppage").val(), 10) + 1; wcontainer.html('<p align="center"><img src="/images/wait_arrows.gif" alt="Loading..." /></p>'); $.getJSON("/winepicks/scroller_ajax.aspx?type=toppicks&pg=" + nxtpg, function(data) { if (data.error != null) { wcontainer.html(data.error); } else if (data.content != null) { $('#latest-wine-reviews .wine-picks-items').html(""); wcontainer.animate({ opacity: 0 }, 500); wcontainer.html(data.content); $("#wstoppage").val(nxtpg); } wcontainer.animate({ opacity: 1 }, 500); WinePicksUI.ScrollerWidthFix(); wcontainer.scrollLeft(0); }); },
    ScrollerWidthFix: function() { var width = 0; $('#latest-wine-reviews .wine-picks-items > li').each(function() { width += $(this).outerWidth(true); }); $('#latest-wine-reviews .wine-picks-items').css('width', width + 50); },
    LoadScrollerContent: function() { }
};


function WPDateSel() { $("#tabscroll").html(""); bid = parseInt($("#wpbd").val(), 10); $(".pane").load("/winepicks/tabcontent.aspx?wdate=" + bid); }
function WPScrollLoadMore(type) { api = $("#scrollable").data("scrollable"); pgnum = parseInt($("#tabpg").val(), 10) + 1; $.get('/winepicks/tabcontentmore.aspx?type=' + type + '&pg=' + pgnum, function(data) { $("div.itempg_" + $("#tabpg").val()).remove(); api.addItem(data); $("#arrright").removeClass("disabled"); $("#tabpg").val(pgnum); WPScrollerSListVUpdate(); }); }
function WPScrollLoadMoreByBatch(type) { api = $("#scrollable").data("scrollable"); pgnum = parseInt($("#tabpg").val(), 10) + 1; $.get('/winepicks/tabcontentmore.aspx?wdate=' + $("#wpbd").val() + '&pg=' + pgnum, function(data) { $("div.itempg_" + $("#tabpg").val()).remove(); api.addItem(data); $("#arrright").removeClass("disabled"); $("#tabpg").val(pgnum); WPScrollerSListVUpdate(); }); }
function WPMoreTabs() { $("#wptabs").html('<li><a href="/winepicks/tabcontent.aspx?type=bestvalueroses">Best Value Ros&eacute;s</a></li><li><a href="/winepicks/tabcontent.aspx?type=topratedroses">Top Rated Ros&eacute;s</a></li><li><a href="/winepicks/tabcontent.aspx?type=bestvaluebubblies">Best Value Bubblies</a></li><li><a href="/winepicks/tabcontent.aspx?type=topratedbubblies">Top Rated Bubblies</a></li><li><a href="/winepicks/archive.aspx" onclick="return false;">more...</a></li>'); $(".tabs").tabs("div.pane", { effect: 'ajax' }); var apitabs = $(".tabs").data("tabs"); apitabs.onClick(function(e, index) { $("#tabpg").val(0); }); apitabs.onBeforeClick(function(e, index) { $("#tabscroll").html(""); if (index == 4) { e.stopPropagation(); WPEvenMoreTabs(); return false; } }); }
function WPEvenMoreTabs() { $("#wptabs").html('<li><a href="/winepicks/tabcontent.aspx?type=bestvaluedesserts">Best Value Dessert</a></li><li><a href="/winepicks/tabcontent.aspx?type=toprateddesserts">Top Rated Dessert</a></li><li><a href="/winepicks/archive.aspx">more...</a></li>'); $(".tabs").tabs("div.pane", { effect: 'ajax' }); var apitabs = $(".tabs").data("tabs"); apitabs.onClick(function(e, index) { $("#tabpg").val(0); }); apitabs.onBeforeClick(function(e, index) { $("#tabscroll").html(""); if (index == 2) { e.stopPropagation(); WPResetTabs(); return false; } }); }
function WPResetTabs() { $("#wptabs").html('<li><a href="/winepicks/tabcontent.aspx?type=all">All Wines</a></li><li><a href="/winepicks/tabcontent.aspx?type=bestvaluereds" >Best Value Reds</a></li><li><a href="/winepicks/tabcontent.aspx?type=bestvaluewhites" >Best Value Whites</a></li><li><a href="/winepicks/tabcontent.aspx?type=topratedreds">Top Rated Reds</a></li><li><a href="/winepicks/tabcontent.aspx?type=topratedwhites">Top Rated Whites</a></li><li><a href="/winepicks/archive.aspx" onclick="return false;">more...</a></li>'); $(".tabs").tabs("div.pane", { effect: 'ajax' }); var apitabs = $(".tabs").data("tabs"); apitabs.onClick(function(e, index) { $("#tabpg").val(0); }); apitabs.onBeforeClick(function(e, index) { $("#tabscroll").html(""); if (index == 5) { e.stopPropagation(); WPMoreTabs(); /*location.href = "/winepicks/search.aspx";*/return false; } }) }
function WPScrollerSListVUpdate() { $(winesids).each(function(index, val) { if ($("#wpsl_" + val) != null) { $("#wpsl_" + val).attr("src", "/images/winepicks/listing-icon-inshop.jpg"); } }); }
function WPScrollerATS(wid) { $.getJSON(WinePicksUI.shoppingAjaxURL + "?adding=set&wid=" + escape(wid), function(data) { if (data.added != null) { winesids[winesids.length] = wid; $("#wpsl_" + wid).attr("src", "/images/winepicks/listing-icon-inshop.jpg"); } }); }
function FWPScrollLoadMore(type) { api = $("#scrollable").data("scrollable"); pgnum = parseInt($("#tabpg").val(), 10) + 1; $.get('/food/tabcontentmore.aspx?type=' + type + '&pg=' + pgnum, function(data) { $("div.itempg_" + $("#tabpg").val()).remove(); api.addItem(data); $("#arrright").removeClass("disabled"); $("#tabpg").val(pgnum); }); }
function FWPMoreTabs() { $("#wptabs").html('<li><a href="/food/tabcontent.aspx?type=dazzlingdeal">Dazzling Deal</a></li><li><a href="/food/tabcontent.aspx?type=plushpork">Plush Pork</a></li><li><a href="/food/tabcontent.aspx?type=scrumptiousseafood">Scrumptious Seafood</a></li><li><a href="/food/tabcontent.aspx?type=splendidsalad">Splendid Salad</a></li><li><a href="/food/tabcontent.aspx?type=divinedessert">Divine Dessert</a></li><li><a href="/recipes/" onclick="return false;">more...</a></li>'); $(".tabs").tabs("div.foodpane", { effect: 'ajax' }); var apitabs = $(".tabs").data("tabs"); apitabs.onClick(function(e, index) { $("#tabpg").val(0); }); apitabs.onBeforeClick(function(e, index) { $("#tabscroll").html(""); if (index == 5) { e.stopPropagation(); FWPEvenMoreTabs(); return false; } }); }
function FWPEvenMoreTabs() { $("#wptabs").html('<li><a href="/food/tabcontent.aspx?type=gorgeousgift">Gorgeous Gift</a></li><li><a href="/food/tabcontent.aspx?type=heavenlyhamburger">Heavenly Hamburger</a></li><li><a href="/food/tabcontent.aspx?type=lusciouslamb">Luscious Lamb</a></li><li><a href="/food/tabcontent.aspx?type=outstandingorganic">Organic</a></li><li><a href="/food/tabcontent.aspx?type=terrificturkey">Turkey</a></li><li><a href="/food/tabcontent.aspx?type=voluptuousveal">Veal</a></li><li><a href="/recipes/" onclick="return false;">more...</a></li>'); $(".tabs").tabs("div.foodpane", { effect: 'ajax' }); var apitabs = $(".tabs").data("tabs"); apitabs.onClick(function(e, index) { $("#tabpg").val(0); }); apitabs.onBeforeClick(function(e, index) { $("#tabscroll").html(""); if (index == 6) { e.stopPropagation(); FWPResetTabs(); return false; } }); }
function FWPResetTabs() { $("#wptabs").html('<li><a href="/food/tabcontent.aspx?type=perfectpasta">Perfect Pasta</a></li><li><a href="/food/tabcontent.aspx?type=charmingchicken">Charming Chicken</a></li><li><a href="/food/tabcontent.aspx?type=captivatingcheese">Captivating Cheese</a></li><li><a href="/food/tabcontent.aspx?type=pizzapleaser">Pizza Pleaser</a></li><li><a href="/food/tabcontent.aspx?type=bestbeef">Best Beef</a></li><li><a href="/recipes/" onclick="return false;">more...</a></li>'); $(".tabs").tabs("div.foodpane", { effect: 'ajax' }); var apitabs = $(".tabs").data("tabs"); apitabs.onClick(function(e, index) { $("#tabpg").val(0); }); apitabs.onBeforeClick(function(e, index) { $("#tabscroll").html(""); if (index == 5) { e.stopPropagation(); FWPMoreTabs(); return false; } }) }
