//escreve o flash na div desejada para que nao precise clicar nele antes de usa-lo
function montaFlash(destino, flavez, width, height, trans, scale,tipo){
    var path = "swf/";
	 if(tipo=='y' || tipo=='v'){
        path = "";
    }
	
    var myFlash =
    '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+flavez+'" align="middle">'+
    '<param name="allowScriptAccess" value="sameDomain" />'+
    '<param name="movie" value="'+path+flavez+'" />'
    ;
    if (trans == "yes"){
        myFlash += '<param name="wmode" value="transparent" />';
    }
    if (scale == "yes"){
        myFlash += '<param name="scale" value="noscale" />';
    }

   
    myFlash +=
    '<param name="quality" value="high" />'+
    '<param name="bgcolor" value="#ffffff" />'+
    '<embed src="'+path+flavez+'" wmode="transparent" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="empresas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
    '</object>'
    ;
    document.getElementById(destino).innerHTML = myFlash;
}


/**
 * Montagem de banner
 */
function montaBanner(tipo,destino, src, width, height, trans, scale,titulo,link){
    var htmlImage;
	var aux = src.split("\/");
	
	if(aux[aux.length-1] == "")
	{
		return false;
	}
	
    switch(tipo){
        case "image/jpg":
        case "image/jpeg":
        case "image/gif":
        case "image/png":
            htmlImage = "<a href='"+link+"' alt='"+titulo+"' target='_blank' ><img alt='"+titulo+"' src='"+src+"' width='"+width+"' height='"+height+"' /></a>";
            break;
        case "application/x-shockwave-flash":
            htmlImage =
            '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+src+'" align="middle">'+
            '<param name="allowScriptAccess" value="sameDomain" />'+
            '<param name="movie" value="'+src+'" />'
            ;
            if (trans == "yes"){
                htmlImage += '<param name="wmode" value="transparent" />';
            }
            if (scale == "yes"){
                htmlImage += '<param name="scale" value="noscale" />';
            }
            htmlImage +=
            '<param name="quality" value="high" />'+
            '<param name="bgcolor" value="#ffffff" />'+
            '<embed src="'+src+'" wmode="transparent" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="empresas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
            '</object>'
            ;
            break;
        default:
            htmlImage = "<a href='"+link+"' alt='"+titulo+"' target='_blank' ><img alt='"+titulo+"' src='"+src+"' width='"+width+"' height='"+height+"' /></a>";
            break;
    }
	
    document.getElementById(destino).innerHTML = htmlImage;
}


// SOLU��O PARA O SCRIPT DO JQUERY QUE ENTRA EM CONFLITO COM O SCRIPT DO PROTOTYPE.
// FOI SUBSTTITUIDO O $ PARA $foo PARA SOLUCIONAR O PROBLEMA DO CONFLITO ENTRE OS SCRIPTS.
var $foo = jQuery.noConflict();

var inHome = true;


// 1 VARI�VEL (VETOR) E 2 METODOS PARA CONTROLAR AS LISTAS DE CATEGORIAS NA GALERIA DE FOTOS DO SITE
var categorias = new Array();


function verificaHome(){
    var urlAtual = window.location.href;
    var array = urlAtual.split("#");
    var tamanho = array.length;
    if(tamanho > 1){
        var param = array[tamanho-1];
    }else{
        var param = "";
    }
    if(param=="" && tamanho <= 2){
        carregapagina("principal");
    }
}


/*//carrega a pagina solicitada
function carregapagina(pagina){
	if(inHome == true){
		show_loading();
		setTimeout("pausa('"+pagina+"')",1000);
		inHome = false;

	}else{
		if(pagina == "home"){
			$foo("#internas").slideUp("normal");
			inHome = true;
		}else{
			$foo("#internas").slideDown("normal");
			show_loading();
			setTimeout("pausa('"+pagina+"')",1000);
		}
	}
}*/

//carrega a pagina solicitada
function carregapagina(params){
    show_loading();
	
    setTimeout("pausa('"+params+"')",2000);
}

function pausa (params) {
    $foo("#mostra").load("ctrl.php?acao="+params, hide_loading);
}


//mostra a mensagem de carregando
show_loading = function() {
    //document.getElementById("fundoInternas").style.backgroundColor = "#FFFFFF";
    $foo("#ajax_loader").show();
    $foo("#mostra").animate({
        opacity:0
    },"fast");
    $foo("#mostra").slideUp(300);
	
}

//oculta a mensagem de carregando
hide_loading = function() {
    $foo("#ajax_loader").hide();
	
    $foo("#mostra").slideDown("normal");
    //$foo("#internas").css("opacity","1");
    $foo("#mostra").animate({
        opacity:1
    },"fast");
    //setTimeout("document.title='// CONACS //';", 1000);

    //inicializa novamente o lightbox para paginas carregadas internamente via ajax
    setTimeout("Lightbox.prototype.updateImageList()", 1000);
}

function carregapagina2(params){
	
    setTimeout("pausa2('"+params+"')",200);
}

function pausa2 (params) {
    $foo("#mostra2").load("ctrl.php?acao="+params, hide_loading2);
}


//mostra a mensagem de carregando
show_loading2 = function() {
    //document.getElementById("fundoInternas").style.backgroundColor = "#FFFFFF";
    $foo("#ajax_loader2").show();
    $foo("#mostra2").animate({
        opacity:0
    },"fast");
    $foo("#mostra2").slideUp(300);
	
}

//oculta a mensagem de carregando
hide_loading2 = function() {
    $foo("#ajax_loader2").hide();
	
    $foo("#mostra2").slideDown("normal");
    //$foo("#internas").css("opacity","1");
    $foo("#mostra2").animate({
        opacity:1
    },"fast");
    //setTimeout("document.title='// CONACS //';", 1000);

    //inicializa novamente o lightbox para paginas carregadas internamente via ajax
    setTimeout("Lightbox.prototype.updateImageList()", 1000);
}


//valida data
function ValidaData(data){
    exp = /\d{2}\/\d{2}\/\d{4}/
    if(!exp.test(data.value)){
        return false;
    }
		
    return true;
}

//verifica se o email informada eh valido
function validaEmail(email){
    ER = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]{2,64}(\.[a-z0-9-]{2,64})*\.[a-z]{2,4}$");
    if (ER.test(email)){
        return true;
    }
    else{
        return false;
    }
}


function validaCEP(cep){
    if(!(/^[0-9]{2}\.[0-9]{3}\-[0-9]{3}$/.test(cep))){
        return false;
    } else {
        return true;
    }
}

function validaCPF(Objcpf){
    var cpf = Objcpf;
    exp = /\.|\-/g
    cpf = cpf.toString().replace( exp, "" );
    var digitoDigitado = eval(cpf.charAt(9)+cpf.charAt(10));
    var soma1=0, soma2=0;
    var vlr =11;

    for(i=0;i<9;i++){
        soma1+=eval(cpf.charAt(i)*(vlr-1));
        soma2+=eval(cpf.charAt(i)*vlr);
        vlr--;
    }
    soma1 = (((soma1*10)%11)==10 ? 0:((soma1*10)%11));
    soma2=(((soma2+(2*soma1))*10)%11);

    var digitoGerado=(soma1*10)+soma2;
    if(digitoGerado!=digitoDigitado){
        return false;
    }else {
        return true;
    }
}




function ocultaMostraQuem(div){
		
    document.getElementById('historia').style.display = 'none';
    document.getElementById('atendimento').style.display = 'none';
    document.getElementById('servicos').style.display = 'none';
    document.getElementById('loja').style.display = 'none';
		
    document.getElementById(div).style.display = '';
}

function validaFrmContato(form){
    scrollTo(0,0);
    document.getElementById("resposta").style.display = "block";
    if(form.nome.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo NOME!";
        form.nome.focus();
        return false;
    }
    if(form.email.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo EMAIL!";
        form.email.focus();
        return false;
    }else{
        if(!validaEmail(form.email.value)){
            document.getElementById("resposta").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
            form.email.focus();
            return false;
        }
    }
    if(form.assunto.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo ASSUNTO!";
        form.assunto.focus();
        return false;
    }
    if(form.mensagem.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo MENSAGEM!";
        form.mensagem.focus();
        return false;
    }
    $foo("#resposta").load('ctrl.php?acao=enviaContato&'+$foo("#frmContato").formSerialize());
}

function validaFrmColabore(form){
    
    document.getElementById("respostaColabore").style.display = "block";
	
    if(form.nome.value==""){
        document.getElementById("respostaColabore").innerHTML = "Por favor, preencha o campo NOME!";
        form.nome.focus();
        return false;
    }
    if(form.email.value==""){
        document.getElementById("respostaColabore").innerHTML = "Por favor, preencha o campo EMAIL!";
        form.email.focus();
        return false;
    }else{
        if(!validaEmail(form.email.value)){
            document.getElementById("respostaColabore").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
            form.email.focus();
            return false;
        }
    }
    if(form.cidade.value==""){
        document.getElementById("respostaColabore").innerHTML = "Por favor, preencha o campo CIDADE!";
        form.cidade.focus();
        return false;
    }
	if(form.estado.value==""){
        document.getElementById("respostaColabore").innerHTML = "Por favor, preencha o campo ESTADO!";
        form.estado.focus();
        return false;
    }
	if(form.interesse.value=="null"){
        document.getElementById("respostaColabore").innerHTML = "Por favor, preencha o campo ASSUNTO!";
        form.interesse.focus();
        return false;
    }
    if(form.mensagem.value==""){
        document.getElementById("respostaColabore").innerHTML = "Por favor, preencha o campo MENSAGEM!";
        form.mensagem.focus();
        return false;
    }
	
}

/**/
function validaEnquete(){
    var respostas = document.getElementsByName("voto");
    var resposta = false;
	
    for(i=0;i<respostas.length;i++){
        if(respostas[i].checked == true){
            resposta = true;
        }
    }
	
    if(resposta == false){
        document.getElementById("respostaEnquete").innerHTML = "Favor selecione uma resposta!!!";
    }else{
        $foo("#mostra").load('ctrl.php?acao=enquete&'+$foo("#frmEnquete").formSerialize());
        document.getElementById("respostaEnquete").innerHTML = " ";
    }

    return resposta;

}

function validaFrmDenuncie(form){
    scrollTo(0,0);
    document.getElementById("resposta").style.display = "block";
    if(form.nome.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo NOME!";
        form.nome.focus();
        return false;
    }
    if(form.email.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo EMAIL!";
        form.email.focus();
        return false;
    }else{
        if(!validaEmail(form.email.value)){
            document.getElementById("resposta").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
            form.email.focus();
            return false;
        }
    }
    if(form.telefone.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo TELEFONE!";
        form.telefone.focus();
        return false;
    }
    if(form.cidade.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo CIDADE!";
        form.cidade.focus();
        return false;
    }
    if(form.estado.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo ESTADO!";
        form.estado.focus();
        return false;
    }
    if(form.mensagem.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo MENSAGEM!";
        form.mensagem.focus();
        return false;
    }
    $foo("#resposta").load('ctrl.php?acao=enviaDenuncia&'+$foo("#frmContato").formSerialize());
}

function validaFrmComentario1(form){
    scrollTo(0,0);
    document.getElementById("resposta").style.display = "block";
    if(form.nome.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo NOME!";
        form.nome.focus();
        return false;
    }
    if(form.email.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo EMAIL!";
        form.email.focus();
        return false;
    }else{
        if(!validaEmail(form.email.value)){
            document.getElementById("resposta").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
            form.email.focus();
            return false;
        }
    }
    if(form.mensagem.value==""){
        document.getElementById("resposta").innerHTML = "Por favor, preencha o campo MENSAGEM!";
        form.mensagem.focus();
        return false;
    }
}

//cadastra o email informado no newsletter
function strInicio(str){
    for(var i=0;i<str.length;i++){
		
        if(str.substr(i,i+1)==" "){
            str = str.substr(i,str.length);
            str += '.';
            alert("space: " + str);
        } else {
            break;
        }
    }
    alert(str);
    return str;
}
function cadNews(email){
    if(email=="E-mail" || email==""){
        alert("Informe seu e-mail");
    //return false;
    }else{
        if(!validaEmail(email)){
            alert("E-mail invalido!");
        //return false;
        }else{
            $foo("#submitHidden").load("ctrl.php?acao=addNews&email="+email);
        }
    }
}

function mudaPagina(pagina){
    $foo("#lista_noticia").load("ctrl.php?acao=mudaPaginaNoticia&pagina="+pagina);
}

function ControlarQuantidade(valor,id){
    var input = document.getElementById(id);
    (id);
    if(valor == "+"){
        if(input.value < 999){
            input.value = parseInt(input.value) + 1;
        }
    }else if (valor == "-"){
        if(input.value >= 1){
            input.value = parseInt(input.value) - 1;
        }
			
    }
			
			
}
		
		
function Negativa(quantidade,id){
    var input = document.getElementById(id);
    if(quantidade < 0){
        alert("Valor invalido");
        input.value = 0;
    }
}
	
function Maior999(quantidade,id){
    var input = document.getElementById(id);
    if(quantidade > 999){
        alert("Valor Máximo Permitido 999.");
        input.value = 0;
    }
}

function testando(form){
		
    var arrayCheckBox = document.getElementsByName("bebidas");
    var qtdeHomem = document.getElementById("homens").value;
    var qtdeMulher = document.getElementById("mulheres").value;
    var qtdeCrianca = document.getElementById("criancas").value;
    var iElem;
    var dados = {
        cerveja : {
            homem:1.5,
            mulher:1,
            crianca:0
        },
        destilado : {
            homem:0.3,
            mulher:0.2,
            crianca:0
        },
        agua : {
            homem:0.3,
            mulher:0.2,
            crianca:0.3
        },
        refrigerante : {
            homem:0.5,
            mulher:0.3,
            crianca:0.5
        }
    }
					 
    var tipoEvento = parseInt(document.getElementById("evento").value)/100;
		
    var total, totalCerveja, totalDestilado, totalAgua, totalRefrigerante;
		
    total = totalCerveja = totalDestilado = totalAgua = totalRefrigerante = 0;
		
    for(var i=0; i<arrayCheckBox.length;i++){
        iElem = document.getElementById("txtBebidas").getElementsByTagName("div");
        if(arrayCheckBox[i].checked == true){
            iElem[i].style.display = '';
        } else {
            iElem[i].style.display = 'none';
        }
        with(dados){
            switch (arrayCheckBox[i].value){
				
                case 'cerveja' :
                    totalCerveja += cerveja.homem*qtdeHomem + cerveja.mulher*qtdeMulher + cerveja.crianca*qtdeCrianca;
                    totalCerveja *= tipoEvento;
                    totalCereveja = formatNumber(totalCerveja,2);
                    iElem[i].innerHTML = "Quantidade de Cerveja: "+formatNumber(totalCerveja,2)+" litros";
                    break;
                case 'destilado' :
                    totalDestilado += destilado.homem*qtdeHomem + destilado.mulher*qtdeMulher + destilado.crianca*qtdeCrianca;
                    totalDestilado *= tipoEvento;
                    totalDestilado = formatNumber(totalDestilado,2);
                    iElem[i].innerHTML = "Quantidade de Destilado: "+formatNumber(totalDestilado,2)+" litros";
                    break;
                case 'agua' :
                    totalAgua += agua.homem*qtdeHomem + agua.mulher*qtdeMulher + agua.crianca*qtdeCrianca;
                    totalAgua *= tipoEvento;
                    totalAgua = formatNumber(totalAgua,2);
                    iElem[i].innerHTML = "Quantidade de Água: "+formatNumber(totalAgua,2)+" litros";
                    break;
                case 'refrigerante' :
                    totalRefrigerante += refrigerante.homem*qtdeHomem + refrigerante.mulher*qtdeMulher + refrigerante.crianca*qtdeCrianca;
                    totalRefrigerante *= tipoEvento;
                    totalRefrigerante = formatNumber(totalRefrigerante,2);
                    iElem[i].innerHTML = "Quantidade de Refrigerante: "+formatNumber(totalRefrigerante,2)+" litros";
                    break;
				
            }
            }
			
    }
		
		
    total = totalCerveja + totalDestilado + totalAgua + totalRefrigerante;
    document.getElementById("txtBebidas").style.display='';
    document.getElementById("imgvoltacalcular").style.display='';
    document.getElementById("formcalculo").style.display='none';
		
		
    return false;

}
	
function formatNumber(number,cd){
    return Math.ceil(number*(Math.pow(10,cd)))/Math.pow(10,cd);
}
	
function fecharCalculo(){
    document.getElementById("imgvoltacalcular").style.display='none';
    document.getElementById("txtBebidas").style.display='none';
    document.getElementById("formcalculo").style.display='';
}
	

/*
 * Pagina foto-da-semana
 * @form formulario a ser validado
 *
 */


function validaFrmComentario(form){
    document.getElementById("respostaComentario").style.display='block';
			
    if(form.nome.value == ""){
        document.getElementById("respostaComentario").innerHTML = "Por Favor, preencha o campo NOME!!!";
        form.nome.focus();
        return false;
    }
			
    if(form.cidade.value == ""){
        document.getElementById("respostaComentario").innerHTML = "Por Favor, preencha o campo CIDADE!!!";
        form.cidade.focus();
        return false;
    }
			
    if(form.email.value == ""){
        document.getElementById("respostaComentario").innerHTML = "Por Favor, preencha o campo E-MAIL!!!";
        form.email.focus();
        return false;
    }else{
        if(validaEmail(form.email.value) == false){
            document.getElementById("respostaComentario").innerHTML = "E-MAIL INV&Aacute;LIDO!!!";
            form.email.focus();
            return false;
        }
    }
			
    if(form.comentario.value == ""){
        document.getElementById("respostaComentario").innerHTML = "Por Favor, preencha o campo COMENT&Aacute;RIO!!!";
        form.comentario.focus();
        return false;
    }
			
    carregapagina("mostraComentarios&"+$foo("#frmComente").formSerialize());
}
	
	
/*
 *
 * Pagina Cadastro de Profile
 * @form formulario a ser validado
 *
 */
	
function validaFrmCadProfile(form){
    scrollTo(0,0);
    document.getElementById("respostaCadProfile").focus();
		
    if(form.nome.value == ""){
        document.getElementById("respostaCadProfile").innerHTML = "Preencha o campo NOME!";
        form.nome.focus();
        return false;
    }
		
    if(form.email.value == ""){
        document.getElementById("respostaCadProfile").innerHTML = "Preencha o campo E-MAIL!";
        form.email.focus();
        return false;
    }else{
        if(!validaEmail(form.email.value)){
            document.getElementById("respostaCadProfile").innerHTML = "E-MAIL INV&Aacute;LIDO!";
            form.email.focus();
            return false;
        }
    }
		
    if(form.senha.value == ""){
        document.getElementById("respostaCadProfile").innerHTML = "Preencha o campo SENHA!";
        form.senha.focus();
        return false;
    }else{
		if(form.senha.value.length < 5){
			document.getElementById("respostaCadProfile").innerHTML = "SENHA MUITO CURTA!";
			form.senha.focus();
			return false;
		}
	}
		
    if(form.cidade.value == ""){
        document.getElementById("respostaCadProfile").innerHTML = "Preencha o campo CIDADE!";
        form.cidade.focus();
        return false;
    }
		
    if(form.residencia.value == ""){
        document.getElementById("respostaCadProfile").innerHTML = "Preencha o campo ESTADO!";
        form.residencia.focus();
        return false;
    }
		
    if(form.skatista.value != ""){
        if(!ValidaData(form.skate)){
            document.getElementById("respostaCadProfile").innerHTML = "DATA INV&Aacute;LIDA!";
            form.skatista.focus();
            return false;
        }
    }
		
    if(form.idade.value == ""){
        document.getElementById("respostaCadProfile").innerHTML = "Preencha o campo DATA DE NASCIMENTO!";
        form.idade.focus();
        return false;
    }else{
        if(!ValidaData(form.idade)){
            document.getElementById("respostaCadProfile").innerHTML = "DATA DE NASCIMENTO INV&Aacute;LIDA!";
            form.idade.focus();
            return false;
        }
			
    }
		
}


function construirArray(qtdElementos){
    this.length = qtdElementos
}

var	arrayDia = new construirArray(7);
arrayDia[0] = "Domingo";
arrayDia[1] = "Segunda-Feira";
arrayDia[2] = "Terça-Feira";
arrayDia[3] = "Quarta-Feira";
arrayDia[4] = "Quinta-Feira";
arrayDia[5] = "Sexta-Feira";
arrayDia[6] = "Sabado";

var arrayMes = new construirArray(12);
arrayMes[0] = "Janeiro";
arrayMes[1] = "Fevereiro";
arrayMes[2] = "Março";		
arrayMes[3] = "Abril";
arrayMes[4] = "Maio";
arrayMes[5] = "Junho";
arrayMes[6] = "Julho";
arrayMes[7] = "Agosto";
arrayMes[8] = "Setembro";
arrayMes[9] = "Outubro";
arrayMes[10] = "Novembro";
arrayMes[11] = "Dezembro";

function mostrarDataHora(diaSemana, dia, mes, ano){
    retorno += "&nbsp;&nbsp;"+diaSemana+", "+dia+" de "+mes+" de "+ano;

    document.getElementById("datahora").innerHTML = retorno;
}

function getMesExtenso(mes){
    return this.arrayMes[mes];
}


function getDiaExtenso(dia){
    return this.arrayDia[dia];
}

function atualizarDataHora(){ 
    dataAtual = new Date();
    dia = dataAtual.getDate();
    diaSemana = getDiaExtenso(dataAtual.getDay());
    mes = getMesExtenso(dataAtual.getMonth());
    ano = dataAtual.getYear();
    hora = dataAtual.getHours();
    minuto = dataAtual.getMinutes();
    segundo = dataAtual.getSeconds();

    mostrarDataHora( diaSemana, dia, mes, ano);
    setTimeout("atualizarDataHora()",1000);
} 



/******
* Pag Trabalhe Conosco
******/

function onBlurFocusOptions(id,evento){
    var selectOptions = document.getElementById("select"+id).getElementsByTagName("option");
		
    if(evento == "onfocus"){
        for(var i=0;i<selectOptions.length;i++){
            selectOptions[i].style.color='#fff'
        }
    }
		
    if(evento == "onblur"){
        for(var i=0;i<selectOptions.length;i++){
            selectOptions[i].style.color='#000'
        }
    }
}
	
function campoView(experiencia){
    if(experiencia == "S"){
        document.getElementById("infoExperiencia").style.display='block';
    }
    else{
        document.getElementById("infoExperiencia").style.display='none';
    }
}
	
function validaFrmTrabalheConosco(form){
    scrollTo(0,0);
    if(form.cargo.value == "null"){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo CARGO!!!";
        form.cargo.focus();
        return false
    }
		
    if(form.foto.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo FOTO!!!";
        form.foto.focus();
        return false
    }
		
    if(form.nome.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo NOME!!!";
        form.nome.focus();
        return false
    }
		
    if(form.dataNascimento.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo DATA DE NASCIMENTO!!!";
        form.dataNascimento.focus();
        return false
    }else{
        if(!ValidaData(form.dataNascimento)){
            document.getElementById("respostaTrabalheConosco").innerHTML = "DATA INV&Aacute;LIDA";
            form.dataNascimento.focus();
            return false
        }
    }
		
    if(form.cpf.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo CPF!!!";
        form.cpf.focus();
        return false
    }else{
        if(!validaCPF(form.cpf.value)){
            document.getElementById("respostaTrabalheConosco").innerHTML = "CPF INV&Aacute;LIDO!!!";
            form.cpf.focus();
            return false
        }
    }
		
    if(form.estadoCivil.value == "null"){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo ESTADO CIVIL!!!";
        form.estadoCivil.focus();
        return false
    }
		
    if(form.escolaridade.value == "null"){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo ESCOLARIDADE!!!";
        form.escolaridade.focus();
        return false
    }
		
    if((form.sexo[0].checked == false) && (form.sexo[1].checked == false)){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo SEXO!!!";
        form.sexo[0].focus();
        return false
    }
		
    if(form.email.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo E-MAIL!!!";
        form.email.focus();
        return false
    }else{
        if(!validaEmail(form.email.value)){
            document.getElementById("respostaTrabalheConosco").innerHTML = "E-MAIL INV&Aacute;LIDO!!!";
            form.email.focus();
            return false
        }
    }
		
    if(form.telefoneFixo.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo TELEFONE FIXO!!!";
        form.telefoneFixo.focus();
        return false
    }
		
		
    if(form.uf.value == "null"){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo UF!!!";
        form.uf.focus();
        return false
    }
		
    if(form.cidade.value == "null"){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo CIDADE!!!";
        form.cidade.focus();
        return false
    }
		
    if(form.cep.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo CEP!!!";
        form.cep.focus();
        return false
    }
		
    if(form.bairro.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo BAIRRO!!!";
        form.bairro.focus();
        return false
    }
		
    if(form.endereco.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo ENDERE&Ccedil;O!!!";
        form.endereco.focus();
        return false
    }
		
		
    if((form.empregado[0].checked == false) && (form.empregado[1].checked == false)){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo Empregado Atualmente!!!";
        form.empregado[0].focus();
        return false
    }
		
    if((form.experiencia[0].checked == false) && (form.experiencia[1].checked == false)){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo Experi&ecirc;ncia Profissional!!!";
        form.experiencia[0].focus();
        return false
    }else if(form.experiencia[0].checked ){
        if(form.local.value == ""){
            document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo LOCAL!!!";
            form.local.focus();
            return false
        }
			
        if(form.cargoExp.value == ""){
            document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo CARGO!!!";
            form.cargoExp.focus();
            return false
        }
    }
		
    if(form.objProfissional.value == ""){
        document.getElementById("respostaTrabalheConosco").innerHTML = "Por favor preencha o campo OBJETIVO PROFISSIONAL!!!";
        form.objProfissional.focus();
        return false
    }

}
	
function getCidades(uf,id){
    document.getElementById("selectCidade"+id).style.visibility = "hidden";
    jQuery("#selectCidade"+id).load("ctrl.php?acao=listarCidades&uf="+uf,showCidades(id));

}
	
showCidades = function(id){
    document.getElementById("selectCidade"+id).style.visibility = "visible";
}


/****
TOPO
*****/

function validaBusca(form){
    if((form.busca.value == "") || (form.busca.value == "Preencha o campo BUSCA!")){
        form.busca.value = "Preencha o campo BUSCA!";
        form.busca.focus();
        return false;
    }
}	



/****
RODAPE
****/


function validaFrmNews(form){
    if((form.email.value == "") || (form.email.value == "Digite aqui seu e-mail para receber novidades e promoções!")){
        document.getElementById("respostaNews").innerHTML = "Preencha o campo ABAIXO!!!";
        form.email.focus();
        return false;
    }else{
        if(!validaEmail(form.email.value)){
            document.getElementById("respostaNews").innerHTML = "EMAIL INV&Aacute;LIDO!";
            form.email.focus();
            return false;
        }
    }
}


/******
ESQUECI SENHA
******/

function validaEsqueciSenha(form){
    if(form.email.value==""){
        document.getElementById("respostaEsqueciSenha").innerHTML = "Preencha o campo E-MAIL!!!";
        form.email.focus();
        return false;
    }else{
        if(!validaEmail(form.email.value)){
            document.getElementById("respostaEsqueciSenha").innerHTML = "EMAIL INV&Aacute;LIDO!";
            form.email.focus();
            return false;
        }
    }
}



function validaCampoSenha() {
    if (document.getElementById("senhaExcluir").value == ""){
        alert('Preencha o campo Senha!');
					
    }else{
					
        jQuery.post('ctrl.php',{
            acao : "deletarProfile",
            senha : document.getElementById("senhaExcluir").value
        },
        function(logado){
            if(logado == "1"){
                alert("Deletado com Sucesso!");
                document.location.href="profile";
            }else{
                alert("Senha incorreta!");
            }
        }
							  
							 
							  
        );
    }
}


function limiteMinimoSenha(){
    if(document.getElementById("senha").value.length <5){
        alert('Minimo de 5 caracteres!');
    }
}

