/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


$(function () {
	$('#frmNewsLetter').form({
		action : '/?module=default&controller=index&action=subscribe',
		onError : function (errors) {
			$('#form-errors').removeClass('success error').addClass('error');
			$('#form-errors').html(Format.arrayToList(errors));
		},
		onSuccess : function (data) {
			$('#form-errors').removeClass('success error').addClass('success');
			$('#form-errors').html(data.message);
			$('#txtName, #txtEmail, #txtCapcha').val('');
		}
	});

	$('#txtName, #txtEmail').focus(function () {
		var self = $(this);

		if (self.val() == self.attr('id').replace(/txt/, ''))
		{
			self.val('');
		}
	});

	$('#txtName, #txtEmail').blur(function () {
		var self = $(this);

		if (self.val() == '')
		{
			self.val(self.attr('id').replace(/txt/, ''));
		}
	});
});
