// Supports the console

// Used to determine whether we prompt when a user
// navigates away from the current page.
var fcms_console_WarnBeforeLeave = false;

// Event handlers

window.onbeforeunload = function(){
    if(fcms_console_WarnBeforeLeave){
        return fcms_WarnBeforeLeave_Message;
    }
}

// Ensure that a postback does not trigger the
// navigate away warning

var __oldDoPostBack;
if (typeof __doPostBack != "undefined")
{
  __oldDoPostBack = __doPostBack;
  __doPostBack = __fcmsPostBack;
}

function __fcmsPostBack(eventTarget, eventArgument) {
    SetNavigateAwayWarning(false);
    return __oldDoPostBack (eventTarget, eventArgument);
}

// Set whether the warning is displayed when attempting
// to navigate away.
function SetNavigateAwayWarning(on) {
    fcms_console_WarnBeforeLeave = on;
}

// Confirm content deletion
function DoDelete(deleteMessage) {
    if (confirm(deleteMessage)) {
        return true;
    }
    return false;
}