$(document).ready(function(){
	if( $('#frm_kontakt').length>0 )
	{
		$('#frm_sendQuestionSend').click( fSendQuestion );
		//VALIDACE
		$("#frm_kontakt").validate({
			errorLabelContainer: $("#frm_kontakt div.error")
		});
	}
});
	
//smazani prvku formulare
$.fn.clearForm = function() {
	return this.each(function() {
		var type = this.type, tag = this.tagName.toLowerCase();
		if (tag == 'form')
			return $(':input',this).clearForm();
		if (type == 'text' || type == 'password' || tag == 'textarea')
			this.value = '';
		else if (type == 'checkbox' || type == 'radio')
			this.checked = false;
		else if (tag == 'select')
			this.selectedIndex = -1;
	});
};


//click actions

function fSendQuestion() {
	$('#ajaxResponse').html('');
	if(!$('#frm_kontakt').valid()){
		alert(LanguageDefs['wrongFill']);
		return false;
	}
	fGetContent('frm_kontakt','ajaxResponse','frm_kontakt','question');
	$('#frm_kontakt').clearForm();
	return false;
}


$(document).ready(function(){
	if( $('#frm_register').length>0 )
	{
		$('#frm_sendQuestionSend').click( fSendRegister );
		//VALIDACE
		$("#frm_register").validate({
			errorLabelContainer: $("#frm_register div.error")
		});
	}
});

//click actions

function  fSendRegister() {
	$('#ajaxResponse').html('');
	if(!$('#frm_register').valid()){
		alert(LanguageDefs['wrongFill']);
		return false;
	}
	fGetContent('frm_register','ajaxResponse','frm_register','question');
	$('#frm_register').clearForm();
	return false;
}

