// JavaScript Document

var CAnkieta = {
	onInit: function() {},
	GoClearText: function() {},
	checkEmail: function() {},
	showMessage: function() {}
};


CAnkieta.onInit = function() {};

if( typeof(jQuery) == 'function' ) {
	jQuery(document).ready(function() {
		
		
		/* czyszczenie pola tekstowego */
		$(".radio-text").change( function(){
			var radio = $(this).attr('txt');
			$("input[type='text']."+radio).val('');
			$("input[type='text']."+radio).attr('disabled', true);
		} );

		/* czyszczenie pola tekstowego */
		$(".radio-reset").change( function(){
			var radio = $(this).attr('txt');
			//$("input[type='text']."+radio).val('');
			$("input[type='text']."+radio).attr('disabled', false);
		} );

	});


	/* validacja adresu email */
	CAnkieta.checkEmail = function(email){
		if (email != "") {
			var re = new RegExp("[^@]{1,}[@]{1}[^@.]{1,}[.]{1}[^@]{1,}","gi");
			var wynik = re.test(email);
			return wynik;
		}
		return false;
	};

	CAnkieta.showMessage = function( msg_class, msg ){
		var div = $("div#form-errors");
		div.attr('class', msg_class);
		var okButton = ''; //'<a href="#" onclick="$(this).parent().slideUp(200);"> OK </a>';
		div.html(msg + okButton);
		div.slideDown(200);
	}
	


} else {
	alert('Brak biblioteki jQuery');
};

