var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
$(window).ready(function() {
						 
		$('.site').attr('target', '_blank');				 

	$('#formName').focus(function() { 

		if($(this).val() == 'Name*')

		{

			$(this).val('');

		}

	});
	
	$('#formName').blur(function() { 

		if($(this).val() == '')

		{

			$(this).val('Name*');

		}

	});
	
	$('#formEmail').focus(function() { 

		if($(this).val() == 'Email Address*')

		{

			$(this).val('');

		}

	});
	
	$('#formEmail').blur(function() { 

		if($(this).val() == '')

		{

			$(this).val('Email Address*');

		}

	});
	
		$('.submit').click(function() { 

		var valid = true;

		$('.mustFields').each(function() { 		

			if($(this).val() == '' || $(this).val() == 'Please enter...')

			{

				$(this).val('Please enter...');

				valid = false;

			}

			else if($(this).attr('id') == 'formEmail'){

				if (!filter.test($(this).val())) {

					valid = false;

					alert('Please enter a valid email address...');

				}

			}

		});

		

		if(valid)

		{

			var msgbody = 'Name: ' + $('#formSalu :selected').text() + ' ' + $('#formName').val() + '\n' + 

						'Email: ' + 	$('#formEmail').val() + '\n' ; 	

			$.post("sendemail.php", { emailFrom: $('#formEmail').val(), subject: 'Registration details of ' + $('#formName').val(), message: msgbody },

				function(data){

					$('.form').hide().html("<div class=\"thank_you2\">Thank you for the registration.</div>").fadeIn('fast');		

				}

			);	

					

		}

		

		return false;

	});
	
});