inputs = new Array;
inputs['email'] = 'Adres e-mail';
inputs['person_name'] = 'Imię i naziwsko';
inputs['phone'] = 'Numer telefonu';
inputs['body'] = 'Wiadomość';

function list_form(form)
{
		var form_list = new Array;
		$('input, textarea, select', form).not('.btn, [type=submit]').each(function() {
			if(inputs[this.name]==this.value) this.value='';
			form_list.push(this.name+'='+this.value);
		})
		return form_list.join('&');
}

$(function() {
	$('form').live('submit', function() {
		$('input, textarea, select', this).not('.btn, [type=submit]').each(function() {
			if(inputs[this.name]==this.value)
			$(this).val('');
		})
	});

	$('input, textarea, select', this).not('.btn, [type=submit]').each(function() {		
		if(this.value=='' && inputs[this.name])
		this.value = inputs[this.name];
	})

	$('input, textarea, select', this).not('.btn, [type=submit]').live('blur', function() {		
		if(this.value=='' && inputs[this.name])
		this.value = inputs[this.name];
	})
	$('input, textarea, select', this).not('.btn, [type=submit]').live('focus', function() {		
		if(inputs[this.name] && this.value==inputs[this.name])
		this.value = '';
	})

	$('.checkbox').click(function() {
		if($('input', this).attr('checked')==true)
		{
			$('.checkbox_input', this).removeClass('checked');
			$('input', this).attr('checked', false);
		}
		else
		{
			$('.checkbox_input', this).addClass('checked');
			$('input', this).attr('checked', true);
		}
	});

	$('.radio').click(function() {
		$('.radio', $(this).parents('.radios')).removeClass('checked');

		$(this).addClass('checked');
		$('input', this).attr('checked', true);
	});

	$('.radio input:checked').each(function() {
		$(this).parents('.radio').addClass('checked');
	})



	$('.checkbox').each(function() {
		$('input', this).hide();
		if($('input', this).attr('checked')==true)
		$('.checkbox_input', this).addClass('checked')
	});

	$('.input_error_container').click(function() {
		$(this).hide();
		$(this).parent().find('input').val('').focus();
	});
});
