//adicionar swf 

function addSWF(URL, WIDTH, HEIGHT, TRANSPARENT, ALIGN){

	document.write('<object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ WIDTH +'" height="'+ HEIGHT +'" align="'+ ALIGN +'">');
	document.write('   <param name="movie" value="'+ URL +'" />');
	document.write('   <param name="quality" value="high" />');
	if(TRANSPARENT){
		document.write('  	<param name="Wmode" value="Transparent" />');	
		
	}
	document.write('   <embed src="'+ URL +'" quality="high"');
	if(TRANSPARENT){
		document.write(' Wmode = "transparent" ');
		
	}
	document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'" align="'+ ALIGN +'"></embed>');
	document.write('</object>');

}


//

function Dados() {
with (document.dados){
	if (nome.value.length==0) {
		alert("Por favor, digite seu nome.");
		nome.focus();
		return false;
	}
	if (email.value.length==0) {
		alert("Por favor, digite seu email.");
		email.focus();
		return false;
	}
    if (email.value.indexOf('@' , 0) == -1){
		alert("E-mail inválido.");
		email.focus();
		return false;		
		}
    if (email.value.indexOf('.' , 0) == -1){
		alert("E-mail inválido.");
		email.focus();
		return false;		
		}
   if (email.value.length<5) {
		alert("E-mail inválido.");
		email.focus();
		return false;
      }
}
}
//
function VerificaDados() {
with (document.dados){	
	if (nome.value.length==0) {
	alert("Informe seu nome");
	return false;
	}
	if (cliRg.value.length==0) {
		alert("Informe seu RG");
		return false;
	}
	if (cliCpf.value.length==0) {
		alert("Informe seu CPF");
		return false;
	}
	if (cliDataNascimento.value.length==0){
		alert("Informe sua data de nascimento");
		return false;
	}
	if (cliMaeNome.value.length==0){
		alert("Informe o nome da sua mãe");
		return false;
	}
	if (email.value.length==0) {
		alert("Digite o seu email");
		return false;
	}
	if (! VerificaEmail(email.value)) {
		alert("E-mail inválido !");
		return false;
	}	
	if (resEndereco.value.length==0) {
		alert("Informe seu endereco");
		return false;
	}
	if (resCep.value.length==0) {
		alert("Informe seu CEP");
		return false;
	}
	if (! VerificaCEP(resCep.value)){
		alert("CEP inválido");
		return false;
	}
	
	if (resTelefone.value.length==0) {
		alert("Informe seu telefone");
		return false;
	}
		
	if(resTempoResidenciaAno.value==""){
		resTempoResidenciaAno.value=0
	}
	
	if(resTempoResidenciaMes.value==""){
		resTempoResidenciaMes.value=0
	}
	
	resTempoResidencia = resTempoResidenciaAno.value + " Anos e " + resTempoResidenciaMes.value + " Mes ";
	
	if(profTempoEmpresaAno.value==""){
		profTempoEmpresaAno.value=0;
	}
	
	if(profTempoEmpresaMes.value==""){
		profTempoEmpresaMes.value=0;
	}
	
	profTempoEmpresa = profTempoEmpresaAno.value + " Anos e " + profTempoEmpresaMes.value + " Mes ";
	//profRendaMensal.value = "R$ " + profRendaMensal.value;
}
return true;
}

function Mascara(formato, objeto)
{
	campo = eval(objeto);
	
	//TELEFONE
	if(formato=='TELEFONE'){
		if(campo.value.length == 0)
			campo.value += "(";
		else if(campo.value.length == 3)
			campo.value += ") ";
		else if(campo.value.length == 9)
			campo.value += " ";
	}
	
	//DATA
	if(formato=='DATA'){
		if(campo.value.length==2)
			campo.value += '/';
		if(campo.value.length==5)
			campo.value += '/';		
	}
	
	//CEP
	if(formato=='CEP')
	{
		if(campo.value.length==5)
			campo.value += '-';
	}
	
	//CPF
	if(formato=='CPF')
	{
		if(campo.value.length==3)
			campo.value += '.';
		if(campo.value.length==7)
			campo.value += '.';
		if(campo.value.length==11)
			campo.value += '-';
	}
	
	//CNPJ
	if(formato=='CNPJ')
	{
		if(campo.value.length==2)
			campo.value += '.';
		if(campo.value.length==6)
			campo.value += '.';
		if(campo.value.length==10)
			campo.value += '/';
		if(campo.value.length==15)
			campo.value += '-';
	}	
	
	//PLACA
	if(formato=='PLACA')
	{
		if(campo.value.length==3)
			campo.value += '-';
	}
}

function ValidaCampoTelefone(campo)
{
	re = /\(\d+\d+\)\s+\d+\d+\d+\d+\s+\d+\d+\d+\d+/;
	re2 = /\(\d+\d+\)\s+\d+\d+\d+\s+\d+\d+\d+\d+/;
	if (!( (re.test(campo.value) || re2.test(campo.value)) || campo.value==""))  {
		alert ("Telefone inválido");
		campo.value="";
		campo.focus();
		return false;
	}
}

function ValidaCampoPlaca(campo)
{
	re = /\D+\D+\D+\-\d+\d+\d+\d+/;
	if(!(re.test(campo.value) || campo.value=="")){
		alert("Placa Inválida");
		campo.value="";
		return false;
	}
}

function onlyNumber() {
	if((event.keyCode <= 47 || event.keyCode >= 58) && event.keyCode != 44) { return false; }
}

//-->

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
