$(document).ready(
				  
				function(){
					$('#banner_image ul').innerfade({
						speed: 1300,
						timeout: 5000,
						type: 'random_start',
						containerheight: '250px'
					});			

					
					
					

				$('.lightbox').lightBox();

					
			});

   function mascaraData(x){
              var data = document.getElementById('data_'+x).value;
			 // alert(data);
              if (data.length == 2){
                  data = data + '/';
                  data = data;
				  document.getElementById('data_'+x).value = data ;
      return true;              
              }
              if (data.length == 5){
                  data = data + '/';
                  document.getElementById('data_'+x).value = data ;
                  return true;
              }
         }
 
function excluir(url,msg)
{
	if(confirm(msg)) 
	{
	window.open(url,'_parent')
	}
}
	
	
function completaCampo(campos,novo)
{
	var campo = document.getElementById(campos);
	if(campo.value=='')
	{
	campo.value = novo;	
	}

}

function addNews()
{
var email = document.getElementById('email').value;
var nome = document.getElementById('nome').value;


	if( nome=="" || nome=='Nome:')
	{
		alert('PREENCHA NOME');
	}else 
	if( email=="" || email.indexOf('@')==-1 || email.indexOf('.')==-1 )
	{
		alert('PREENCHA SEU E-MAIL CORRETAMENTE');
	}
	else
	{
			var url = 'tipo=news&email='+email+'&nome='+nome;
			enviaAjax(url,'.news');
	}

}
function enviaAjax(url,div)
{
$("#alvo_principal").show();
document.getElementById('alvo_principal').innerHTML = 'Verificando...';


		$.ajax({
			type: 'GET',
			url: 'arquivos/pages/ajax.php',
			data: url,
				success: function( data )
					{
						$(div).html(data);
						$("#alvo_principal").hide();
						$().ajaxStop(function() { 
						});
						}
					});
}

function newCadastro(frm)
{
	
	var email = frm =='frm_cad'?document.getElementById('email_cad').value:document.getElementById('email_log').value;
	var senha = frm =='frm_cad'?document.getElementById('senha_cad').value:document.getElementById('senha_log').value;
	if(email=="" || email.indexOf('@')==-1 || email.indexOf('.')==-1)
	{
		alert("Insira um valor em forma de e-mail: email@dominio.com.br ");
	}else if(senha==''  || senha.length < 4)
	{	
		alert("Insira uma senha com no minimo 4 digitos");
	}else
	{
	enviaAjaxPost("#alvo_principal","#"+frm);
	
	}
	return false;
}

function verificaCNPJ(cnpj,acao,id)
{
	var url = 'tipo=cnpjDuplicado&cnpj='+cnpj+'&acao='+acao+'&id='+id;
 	enviaAjax(url,'.alvoCNPJ');
	return false;
}

function enviaAjaxPost(apoio,form)
{

		$("#alvo_principal").show();
		document.getElementById('alvo_principal').innerHTML = 'carregando...';
		
		dataString = $(form).serialize();
		$.ajax({
			type: 'POST',
			url: 'arquivos/pages/ajax.php',
			data: dataString,
				success: function( data )
					{
						$(apoio).html(data);
						//$("#alvo_principal").hide();
						$().ajaxStop(function() { 
						});
						
						}
					});
		
		 
}

function clona()
{
document.contato.nome_responsavel.value = document.contato.nome_diretor.value;
document.contato.ddd_tel_responsavel.value =document.contato.ddd_tel.value;
document.contato.telefone_responsavel.value =document.contato.telefone.value;
document.contato.email_responsavel.value =document.contato.email.value;
document.contato.cpf_responsavel.value =document.contato.cpf.value;

}

