function postContactForm() {

  var error = '';
  var recipient_email = jQuery("input#par_recipient_email").val();
  var name = jQuery("input#par_name").val();
  var email = jQuery("input#par_email").val();
  var text = jQuery("textarea#par_text").val();

  if (!name) {
    jQuery('#par_name').addClass('missing');
    error = 1;
  } else {
    jQuery('#par_name').removeClass('missing');
  }

  if (!email) {
    jQuery('#par_email').addClass('missing');
    error = 1;
  } else {
    if (validateEmail(email)) {
      jQuery('#par_email').removeClass('missing');
    } else {
      jQuery('#par_email').addClass('missing');
      error = 1;
    }
  }

  if (!text) {
    jQuery('#par_text').addClass('missing');
    error = 1;
  } else {
    jQuery('#par_text').removeClass('missing');
  }

  if(error == 1) {
    //alert('Vänligen se över informationen och försök igen.');
    //jQuery('#contect_form_error').fadeIn("slow");
    jQuery('#contact_form_error').html('Vänligen se över informationen och försök igen.');


  } else {

    var dataString = '&par_name='+ name + '&par_email=' + email + '&par_text=' + text + '&par_recipient_email=' + recipient_email
    doAjaxRequest('CoMeT_function=run_module&module=Forms&function=contact_form&action=post_contact_form' + dataString, '#contact_form_container', postContactFormResponse);

  }
}

function postContactFormResponse(html) {

  var status = html.split('|');

  if (status[0] == 'error') {
    jQuery('#contact_form_container').html(status[1]);
  } else {
    jQuery('#contact_form_container').fadeIn("slow");
    jQuery('#contact_form_container').html(status[1]);
    setTimeout(postContactFormResponseSuccess, 2000);
  }
}

function postContactFormResponseSuccess() {
  jQuery('#contact_form_container').html('<div class="section_object"><h1>Tack</h1><p>Vi har tagit emot ditt meddelande och hör av oss inom kort.</p></div>');
}
