var error_support = new ActiveXObject("IOSupport.SDFileSupport");
var EVENT_LOG_TYPE = 1;  // 1 indicates error event
var page_error_count = 0;

function OnSearchError(msg, url, line_num)
{
  var error_message =
    "Sharpdesk Search Script Error\n\n" +
	"Message  : " + msg + "\n" +
	"Location : " + url + "\n" +
	"Line no. : " + line_num;
	
  error_support.LogEvent(EVENT_LOG_TYPE, error_message);

  if(page_error_count > 0)
  {
	return true;
  }

  alert("Sharpdesk Search detected an error condition in this page.\n" +
        "However, it will attempt to continue.\n" +
        "If this message persists, see your system administrator for help.");

  page_error_count++;
  return true;
}

window.onerror = OnSearchError;