/*
 * JavaScript Ajax Form
 * (12-DEC-2009)
 * 
 *
 * 
 * 
 *   
 *   
 */

$(document).ready(function(){
  
  //bind form using 'ajaxForm' 
  $('#ajax-form').ajaxForm({  
    target:"#hiddenDIV", 
    beforeSubmit:function() {$("#ajax-msg").css({display:"block"});
       	$("#ajax-msg").html("Sending...");
       	$("#ajax-msg").css({border:"1px solid #e58484", backgroundColor:"#eda5a5"});
    },
    success:function(response) {
      if (response=="success") {
        $("#ajax-form").resetForm();
        $("#ajax-msg").css({border:"1px solid #049e33", backgroundColor:"#a5cab0"});
        $("#ajax-msg").html("Thank you! Your submission has been successful.");
        $("#ajax-msg").animate({opacity: 1.0}, 3000)
        $("#ajax-msg").fadeOut('slow', function() {$(this).remove();});
      } else {
      	$("#ajax-msg").html(  $("#hiddenDIV #content ul").html() );
        $("#hiddenDIV").empty(); 
      }
    }
  });
  
});