/**
 *	AJAX FORM EFFECT
 *
 *	required new files:
 *		/cs/templates/_form-validation.tpl
 *		/js/jquery/jquery-1.1.4.pack.js
 *		/js/jquery/jquery.form.js
 *		/functions/function.autoczech.php
 *		
 *	modifed files
 *		/content/send_email.php
 *		/cs/templates/_write.tpl
 *		.htaccess (add QSA to lines containing odeslani-emailu)
 */

var success = 0;
var infoDivExpanded=0;

function initAjaxForm(url, formId, infoDivId) {
	$(document).ready(function() { // bind 'myForm' and provide a simple callback function 
 		$('#'+formId).ajaxForm({ 
			target:        	'#'+infoDivId,   // target element(s) to be updated with server response 
			url:			url+'?javascript=enabled',
			success:       	function(){
				if (success==1) {
					$('#'+formId).slideUp();
					$('#'+formId).clearForm();
				} else {
					if (infoDivExpanded==0) {
						$('#'+infoDivId).hide();
						$('#'+infoDivId).slideDown();		
						infoDivExpanded = 1;
					}
				}			
			}
		});
	});
};
