﻿

var MyCellar = {
    DeleteFromProfile: function(wineid) { $.post("/mycellar/ajax.aspx", { wid: wineid, mode: 'profiledelete' }, function(json) { if (json.removed != null) { $("#winerow_" + wineid).fadeOut("slow"); } else if (json.error != null) { alert(json.error); } else { alert("Unable to delete wine from your profile page"); } }, "json"); },
    DeleteFromCellar: function(wineid) { $.post("/mycellar/ajax.aspx", { wid: wineid, mode: 'cellardelete' }, function(json) { if (json.removed != null) { $("#winerow_" + wineid).fadeOut("slow"); } else if (json.error != null) { alert(json.error); } else { alert("Unable to delete wine from your cellar"); } }, "json"); },
    MoveToConsumed: function(wineid) { $.post("/mycellar/ajax.aspx", { wid: wineid, mode: 'movetoconsumed' }, function(json) { if (json.moved != null) { $("#wqty_" + wineid).html("Quantity: 0");$("#winerow_" + wineid).fadeOut().fadeIn(); } else if (json.error != null) { alert(json.error); } else { alert("Unable to move wine to consumed"); } }, "json"); },
    PostOnProfile: function(wineid) { $.post("/mycellar/ajax.aspx", { wid: wineid, mode: 'profilepost' }, function(json) { if (json.pposted != null) { $("#postprofilelnk_"+wineid).html("Posted");$("#winerow_" + wineid).fadeOut().fadeIn(); } else if (json.error != null) { alert(json.error); } else { alert("Unable to post on profile"); } }, "json"); },
}

