// Globals
var _hdn_IsDirty                    = false;


function ConfirmNavigation() 
{
    if(_hdn_IsDirty)
    {
        var msg = "There are changes that have not been saved.  Click 'Cancel' (and then 'Save') to prevent these changes from being lost, otherwise click 'OK'.";
        return (confirm(msg));
    }
    return true;    //go ahead and navigate away, it's not dirty
}

//window.open opens the page in a new window
function ConfirmWindowOpen(page)
{
    if(!ConfirmNavigation())
    {
        PreventPostBack();
        return;
    }
    window.open(page);
}

//location.href opens the page in the existing window
function ConfirmLocationHref(page)
{
    if(!ConfirmNavigation())
    {
        PreventPostBack();
        return;
    }
    window.location=page;
}