/**
 * confirmDeletion will confirm if the user wishes
 * to delete a record.
 * @param {String} message The message to display to
 * the user.
 * @param {Event} e The event object, as passed by
 * Gecko-based browsers.
 * @return true if the users selects OK; false if the
 * user selects Cancel.
 * @type Boolean
 */
function confirmDeletion(message, e)
{
  return confirm(message);
}
/**
 * setFocus gives the focus to the specified control,
 * if that control is not disabled.
 * @param {String} controlID The ID of the control
 * which should receive the focus.
 * @param {Event} e The event object, as passed by
 * Gecko-based browsers.
 */
function setFocus(controlID, e)
{
  var elFocus = document.getElementById(controlID);
  if (elFocus !== null)
  {
    if (elFocus.disabled == false)
    {
      elFocus.focus();
    }
  }
}
/**
 * Opens a new window with the features provided.
 * Will set all of the features for a new window.
 * @param {String} url The url to open in the new window. Default: "about:blank".
 * @param {String} name The name of the window. Default: "".
 * @param {Boolean} linkbar true to display the toolbar with quick links on it (Links in IE, Bookmarks Toolar in Mozilla). Default: true.
 * @param {Boolean} location true to display the input field for entering URLs directly into the browser (Address in IE, Navigation Toolbar in Mozilla). Default: true.
 * @param {Boolean} menubar true to display the menu bar. Default: true.
 * @param {Boolean} resizable true to display resize handles at the corners of the window. Default: true.
 * @param {Boolean} scrollbars true to display horizontal and vertical scroll bars. Default: true.
 * @param {Boolean} status true to add a status bar at the bottom of the window. Default: true.
 * @param {Boolean} toolbar true to display the browser toolbar, making buttons such as Back, Forward, and Stop available. Default: true.
 * @param {Number} height Specifies the height of the window, in pixels. The minimum value is 100.
 * @param {Number} width Specifies the width of the window, in pixels. The minimum value is 100.
 * @param {Number} top Specifies the top position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to 0.
 * @param {Number} left Specifies the left position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to 0.
 * @param {Boolean} replace true to replace an already-opened window with the url given. Default: true.
 * @return The window object created.
 */
function openNewWindow(url, name, linkbar, location, menubar, resizable, scrollbars, status, toolbar, height, width, top, left, replace)
{
  //validate input
  linkbar = (linkbar == true)?true:(linkbar == "yes")?true:(linkbar == "1")?true:(linkbar == "-1")?true:false;
  location = (location == true)?true:(location == "yes")?true:(location == "1")?true:(location == "-1")?true:false;
  menubar = (menubar == true)?true:(menubar == "yes")?true:(menubar == "1")?true:(menubar == "-1")?true:false;
  resizable = (resizable == true)?true:(resizable == "yes")?true:(resizable == "1")?true:(resizable == "-1")?true:false;
  scrollbars = (scrollbars == true)?true:(scrollbars == "yes")?true:(scrollbars == "1")?true:(scrollbars == "-1")?true:false;
  status = (status == true)?true:(status == "yes")?true:(status == "1")?true:(status == "-1")?true:false;
  toolbar = (toolbar == true)?true:(toolbar == "yes")?true:(toolbar == "1")?true:(toolbar == "-1")?true:false;
  if (height === null) { height = 100 };
  height = (height < 100)?100:height;
  if (width === null) { width = 100 };
  width = (width < 100)?100:width;
  if (top === null) { top = 0 };
  top = (top < 0)?0:top;
  if (left === null) { left = 0 };
  left = (left < 0)?0:left;
  var sUrl = new String(url);
  var sName = new String(name);
  var sFeatures = new String("");
  sFeatures += (!linkbar)?"linkbar=no":"";
  sFeatures += (linkbar)?"linkbar=yes":"";
  sFeatures += (!location)?(sFeatures.length > 0)?",location=no":"location=no":"";
  sFeatures += (location)?(sFeatures.length > 0)?",location=yes":"location=yes":"";
  sFeatures += (!menubar)?(sFeatures.length > 0)?",menubar=no":"menubar=no":"";
  sFeatures += (menubar)?(sFeatures.length > 0)?",menubar=yes":"menubar=yes":"";
  sFeatures += (!resizable)?(sFeatures.length > 0)?",resizable=no":"resizable=no":"";
  sFeatures += (resizable)?(sFeatures.length > 0)?",resizable=yes":"resizable=yes":"";
  sFeatures += (!scrollbars)?(sFeatures.length > 0)?",scrollbars=no":"scrollbars=no":"";
  sFeatures += (scrollbars)?(sFeatures.length > 0)?",scrollbars=yes":"scrollbars=yes":"";
  sFeatures += (!status)?(sFeatures.length > 0)?",status=no":"status=no":"";
  sFeatures += (status)?(sFeatures.length > 0)?",status=yes":"status=yes":"";
  sFeatures += (!toolbar)?(sFeatures.length > 0)?",toolbar=no":"toolbar=no":"";
  sFeatures += (toolbar)?(sFeatures.length > 0)?",toolbar=yes":"toolbar=yes":"";
  sFeatures += (sFeatures.length > 0)?",height=":"height=";
  sFeatures += height;
  sFeatures += ",width=" + width;
  sFeatures += ",top=" + top;
  sFeatures += ",left=" + left;
  var bReplace = new Boolean(replace);
  return window.open(sUrl, sName, sFeatures, bReplace);
}
