function show_modalbox_alert(message, title){
  var modalbox_cont = "<div class=\"padding\"><div>" + message + "</div>";
    modalbox_cont +=    "<div class=\"MB_buttons\"><a href=\"javascript:blank()\" onclick=\"Modalbox.hide()\" id=\"MB_OK\">OK</a></div></div>";
    Modalbox.show(modalbox_cont, { transitions:false, width: 450, title: title, afterLoad: function(){ Modalbox.resizeToContent(); }});
}

function AjaxCall(url, params, success_handler){
  if(!spinner.visible()){
    spinner.show();
    if(params==undefined) params="";
    if(typeof(params)=="string") params += "&authenticity_token=" + authenticity_token; 
    if(success_handler==undefined) new Ajax.Request(url, {asynchronous:true, evalScripts:true, parameters: params, onFailure: ajax_failure_handler });
    else new Ajax.Request(url, {asynchronous:true, evalScripts:true, parameters: params, onSuccess: success_handler, onFailure: ajax_failure_handler });
  }
}
function ajax_failure_handler(response){ spinner.hide(); alert("An internal server error prevented your request from completing. We apologize for any inconvenience this might have caused.")}
function ajax_pagination(url){ var url_array = url.split("?"); AjaxCall(url_array[0], url_array[1]); }
function ajax_reload(){ window.location.href = window.location.href; }
function process_preview_login(event){ if(event.type == 'keypress' && event.keyCode == Event.KEY_RETURN) $("preview_login_form").submit(); }