//---------VALIDAÇÃO-------------------------------------------
function mask_tel( caixa, tecla ){
	if( tecla != 8 ){
		if( document.getElementById( caixa ).value.length == 4 ){
			document.getElementById( caixa ).value += '-'
		}
	}
}

//------------------validação formulário-------------------
function validar(){
 with( document.getElementById('frm_contato') ){
	
	//---nome--------------------------------------------------
	if( nome.value.length == 0 ){
		window.alert('Preencha o campo nome')
		nome.focus()
		return false
	}
	n=0
	for(i=0; i<=9; i++){
		if( nome.value.indexOf(i) != -1 ){
			n++
		}
	}
	if(n>0){
		window.alert('O campo nome não pode conter números')
		nome.focus()
		return false
	}
	//----email------------------------------------------------
	if( email.value.length < 6 ){
		window.alert('Preencha o campo e-mail corretamente')
		email.focus()
		return false
	}
	if( email.value.indexOf('@') == -1 ){
		window.alert('Todo e-mail tem 1 @')
		email.focus()
		return false
	}
	if( email.value.indexOf('@') != email.value.lastIndexOf('@') ){
		window.alert('O emai não pode ter mais que 1 @')
		email.focus()
		return false
	}
	if(email.value.lastIndexOf('.') < email.value.indexOf('@')+2 ){
		window.alert('Todo e-mail tem um ponto após o @')
		email.focus()
		return false
	}
	//-------------telefone---------------------------------------
	if( tel.value.length != 9 ){
		window.alert('Preecha o campo telefone corretamente')
		tel.focus()
		return false
	}	
	telx = tel.value.replace('-', '')
	if( telx*1 != telx ){
		window.alert('Campo telefone apenas números')
		tel.focus()
		return false
	}
	//-------estado-----------------------------------------------
	if( festa.value == 0 ){
		window.alert('Selecione o tipo de festa')
		festa.focus()
		return false
	}
	//data*********
	if( dia.value == 0 ){
		window.alert('Selecione o dia')
		dia.focus()
		return false
	}
	if( mes.value == 0 ){
		window.alert('Selecione o mês')
		mes.focus()
		return false
	}
	if( ano.value == 0 ){
		window.alert('Selecione o ano')
		ano.focus()
		return false
	}
	

	//-------------mensagem---------------------------------------
	if( msg.value.length == 0 ){
		window.alert('Preencha o campo mensagem')
		msg.focus()
		return false
	}
	

 }
}


















