/* String error(txt)
 *
 * txt: String - the error string to be displayed.
 * return: An HTML representation of an error.  Used to dynamically display an error.
 */
function error(txt) {  
  return error(txt,0);
}
function error(txt, showErr) {  
  return '<div class="ui-widget"><div class="ui-state-error ui-corner-all" style="margin-top: 0px; margin-bottom: 7px;  padding: 0 .7em;"><p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: 0.3em;"></span>'+(showErr ? '<b>Error:</b> ' : '')+txt+'</p></div></div></div>';
}

/* String highlight(txt)
 *
 * txt: String - the message to be displayed.
 * return: An HTML representation of a highlight message.  Used to dynamically display a highlighted error.
 */
function highlight(txt) { 
  return '<div class="ui-widget"><div class="ui-state-highlight ui-corner-all" style="margin-top: 0px; margin-bottom: 7px; padding: 0 .7em;"><p><span class="ui-icon ui-icon-info" style="float: left; margin-right: 0.3em;"></span>'+txt+'</p></div></div>';  
}

/* void errorHandler(retResp, retStatus) - Email contact@ any time we encounter an AJAX error.  This handler should be used as the error handler for all AJAX requests
 *
 * retResp: XMLHttpRequest object - The object containing the HTTP request information
 * retStatus: The status code of the return
 */
function errorHandler(retResp, retStatus) {
  /* Need to write something here that emails us when there's an error */
  alert(retResp.statusText);
  alert(retResp.responseText);
  $("#loginPage").prepend(error("Your login information was incorrect."));
}