var needToConfirm = false;

window.onbeforeunload = confirmExit;

function ConfirmDelete(source, arguments)
{
    return confirm("Are you sure you want to remove the item?");
}

function cartWasUpdated(status)
{
    if(typeof needToConfirm != "undefined")
        needToConfirm = status;
}

function confirmExit()
{
    if(typeof needToConfirm != "undefined" && needToConfirm)
    {
        return "If you have made any changes to the shopping cart without clicking the Update button, your changes will be lost.  Are you sure you want to exit this page?";
    }
}