/**
 * odesila data z formulare pomoci ajaxu
 * a vypisuje vysledky
 * 
 * class: cSendform
 * verze: verze: 1.9.0 
 * 
 */

$(document).ready(function(){

	$("form.sendform").ajaxStart(function(){
	   $(this).animate({ 
			opacity: 0.4									
		}, 250);													   				   
	 });
	 $("form.sendform").ajaxStop(function(){
	   $(this).animate({ 
			opacity: 1
		}, 250);	
	 });	
  
	$("form#Formular input#submit").click(function() {
      var fields = $("form#Formular :input").serialize();
     $.ajax({
       type: "POST",
       url: "/core/exec/sendform-rpc.php",
       data: fields,
       dataType: "html",
       success: function(data){  
         var c = data.length;

        if (c < 2) {
          $("form#Formular").load("/theme/sendform/sendform-uspech-html.php");
          window.location.hash = "#dekujeme";                    
        }
        else { // jsou chyby
         $("form#Formular .sendform-chyby").empty();
         $("form#Formular .sendform-chyby").html(data);
        }
       }
     });

    return false;
	});   		 
});	
