$(document).ready(function(){
	
	
	$('#nome').focus(function(){
		if($(this).val() == 'Name'){
			$(this).val('');	
		}							 
	});
	
	$('#nome').blur(function(){
		if($(this).val() == ''){
			$(this).val('Name');	
		}							 
	});	
	
	$('#email').focus(function(){
		if($(this).val() == 'E-mail'){
			$(this).val('');	
		}							 
	});
	
	$('#email').blur(function(){
		if($(this).val() == ''){
			$(this).val('E-mail');	
		}							 
	});
	
	
	$('#company').focus(function(){
		if($(this).val() == 'Company'){
			$(this).val('');	
		}							 
	});
	
	$('#company').blur(function(){
		if($(this).val() == ''){
			$(this).val('Company');	
		}							 
	});
	
	$('#phone_number').focus(function(){
		if($(this).val() == 'Phone Number'){
			$(this).val('');	
		}							 
	});
	
	$('#phone_number').blur(function(){
		if($(this).val() == ''){
			$(this).val('Phone Number');	
		}							 
	});
	
	
	$('#form-news').submit(function(){
									
		var nome = $('#nome');
		var email = $('#email');
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
																
									
		if(nome.val() == '' || nome.val() == 'Name'){
				alert('Enter your name.');
				nome.focus();
				return false;
			}
			
		else if(email.val() == '' || email.val() == 'Email'){
				alert('Enter your e-mail.');
				email.focus();
				return false;				
			}			
			
		else if( !emailReg.test(email.val()) ) {		
				alert('Enter a valid e-mail address');
				email.focus();
				return false;
			}
			
		//else if ($(this).submit) {
//			$.ajax({
//			contentType: 'application/x-www-form-urlencoded; charset=utf-8',
//			url: $(this).attr('action'),
//			type: 'GET',
//			data: $('#form-news').serialize(),
//			dataType:'html',
//			success: function(data) {  
//			$('#form-news').html("<div class='message'></div>");  
//			$('.message').html("<p class='txt-vermelho-12px'><br />Your information was sent successfully.")  
//			.hide()  
//			.fadeIn(1000);
//			}	
//			});	
//			return false;			
//		}	
			
		else { return true; }	
			
	    
	});						   
});
