function success(e) {
  if (e == 'true') {
    $('#frm').html('<h1>Thank You<\/h1><p><strong>We will get back to you shortly!<\/strong><br \/> If you have any immediate questions, please give us a call.<\/p>');
  } else {
    if (e != 'false') {
      try {
        eval(e);
      } catch(er) { error(e); }
    } else {
      error(e);
    }
  }
}

function success_reports(e) {
  if (e == 'true') {
    $('#frm').html('<h1>Thank You<\/h1><p><strong>We have emailed you your report.<\/strong><br \/> Please allow a few minutes for it to show up.  If you don\'t recieve the report, check your spam folder or feel free to <a href="/contact/">contact us</a>.<\/p>');
  } else {
    if (e != 'false') {
      try {
        eval(e);
      } catch(er) { error(e); }
    } else {
      error(e);
    }
  }
}

function error(e) {
  $('#frm').html('<h1>Sorry<\/h1>We\'ve encountered an error.<br />Please try again later.');
  alert(e);
}

function submit() {
  $('#loader').show();
  $.ajax({
    type:'POST',
    url:'/contact/proc.php?'+$('#frm form').serialize(),
    success:success,
    error:error,
    cache:false,
    complete:function() { $('#loader').hide(); }
  });
  return false;
}

function submit_report() {
  $('#loader').show();
  $.ajax({
    type:'POST',
    url:'/reports/proc_reports.php?'+$('#frm form').serialize(),
    success:success_reports,
    error:error,
    cache:false,
    complete:function() { $('#loader').hide(); }
  });
  return false;
}


// global load
jQuery(function() {
  $('ul.sf-menu').superfish({ delay: 0, autoArrows: false, speed: 200, dropShadows: true});
});
