// JavaScript Document

$(document).ready(function(){

	$("#nome2").click(function(){
		if($("#nome2").attr("value") == "Campo obrigatório")
			$("#nome2").attr("value", "")
	})
	
	$("#email2").click(function(){
		if($("#email2").attr("value") == "Campo obrigatório")
			$("#email2").attr("value", "")
	})
	
	$("#telefone2").click(function(){
		if($("#telefone2").attr("value") == "Campo obrigatório")
			$("#telefone2").attr("value", "")
	})
	
	$("#telefone2").mask("(99) 9999-9999")

	$("#enviar2").click(function(){
		enviar2 = true
		
		if($("#nome2").attr("value") == "" || $("#nome2").attr("value") == "Seu Nome!")
		{
			$("#nome2").attr("class", "camp_obrigatorio")
			$("#nome2").attr("value", "Preencher Nome")
			enviar2 = false
		}	
		else
			$("#nome2").attr("class", "")
			
			
		/************************************/

		if($("#telefone2").attr("value") == "" || $("#telefone2").attr("value") == "Seu Telefone!")
		{
			$("#telefone2").attr("class", "camp_obrigatorio")
			$("#telefone2").attr("value", "Preencher telefone")
			enviar2 = false
		}
		else
			$("#tel").attr("class", "")	

		/************************************/

		if($("#email2").attr("value") == "" || $("#email2").attr("value") == "Seu Email!")
		{
			$("#email2").attr("class", "camp_obrigatorio")
			$("#email2").attr("value", "Preencher Email")
			enviar2 = false
		}
		else
			$("#email2").attr("class", "")	
			
		/************************************/
		
		if ($("#email2").val() != '') {
			  var regmail = /^[\w!#$%&amp;'*+\/=?^`{|}~-]+(\.[\w!#$%&amp;'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
			  if (!regmail.test($("#email2").val())) {
				   $("#email2").attr("class", "camp_obrigatorio")
				   enviar2 = false
			  }
		 }
		 
		 /***************************************/
		
		if(enviar2 == false)
		{
			alert("Verifique se os campos em Vermelho estao corretos!")
			return false
		}
		else
			return true
	})

})
