// JavaScript Document
function zeracampos(valor){
	if (valor == 1){
		document.formulario.buscanei.value="";
		document.formulario.buscanei.style.color='#000000';
		document.formulario.buscanei.style.fontWeight='normal';
	}	
	if (valor == 2){
		document.formulario.senha.style.backgroundImage="url(/images/skin/v1/alert-vazio.gif)";		
		document.getElementById("merro").innerHTML = "";		
    }
	if (valor == 3){
		document.formulario.usuario.style.backgroundImage="url(/images/skin/v1/alert-vazio.gif)";	
		document.getElementById("merro").innerHTML = "";
	}	
	if (valor == 4){
	    if (document.formulario.contactEmail.value == "fulano@algum.com.br"){
		    document.formulario.contactEmail.value="";
		}
	}
	if (valor == 5){
		document.formulario.contactAssunto.value="";
	}	
	if (valor == 6){
		if (document.formulario.contactMensagem.value=="Digite aqui a sua mensagem."){
		    document.formulario.contactMensagem.value="";
		}
		document.getElementById("tcontatomin").style.display = 'block';
		document.getElementById("contato").style.width = '276px';
		document.getElementById("contato").style.position = 'absolute';
		document.getElementById("contato").style.left = '0px';
		document.getElementById("contactMensagem").style.width = '266px';
	}	
	if (valor == 7){
	    document.formulario.palavraBusca.value="";
	}	
	if (valor == 9){
	    if (document.formulario.palavraBuscaEvento.value == "Digite a palavra"){
	        document.formulario.palavraBuscaEvento.value="";
	    }
	}
	if (valor == 10){
		document.formulario.usuarioLogin.style.backgroundImage="url(/images/skin/v1/alert-vazio.gif)";	
	}
	if (valor == 11){
		document.formulario.senhaLogin.style.backgroundImage="url(/images/skin/v1/alert-vazio.gif)";
	}
	if (valor == 12){
	    if (document.formulario.palavraBuscaLancamento.value == "Digite a palavra"){
	        document.formulario.palavraBuscaLancamento.value="";
	    }
	}
	if (valor == 13){
		document.formulario.caixabuscatopfive.value="";
		document.formulario.caixabuscatopfive.style.color='#000000';
		document.formulario.caixabuscatopfive.style.fontWeight='normal';
	}		
}

function limpaValores(form){
	form.value = "";	
}

var disableBotao = 0;
var code;
function enviaLogin(valor){

    var usuario, senha, email = "", varUrl = "";
    
    if (valor == "1"){
        usuario = gE("usuario").value;
        varUrl = '/login/processaLogin.aspx?usuario='+usuario+'&o='+valor;

        if (gE("usuario").value == ""){
            alert("Preencha seu email");
            return;
        }
        
        gE("varAguarde").innerHTML = gE("txtwait").value;    
    
    } else if (valor == "2"){
        varUrl = '/login/processaLogin.aspx?o='+valor;
        gE("Topo_logar").innerHTML = gE("varAguarde").value;        
        
    } else if (valor == "4"){
        valor = 1;
        email = gE("alertemail").value;
        if (email == ""){ alert("Preencha o email"); return; }
        gE("malert").innerHTML = "...aguarde...";
        varUrl = '/login/processaLogin.aspx?usuario='+email+'&o='+valor;
    }
    
    location.href = varUrl;
}

function enviaEsqueciSenha(){
    
    var busca, usuario, string;
    busca = document.formulario.emailsenha.value;   
            
    if (busca.length > 2){
        string = "/includes/jxSearchs.aspx?searchWord="+busca+"&searchOption=4";
    }
    
    document.getElementById("rotuloesquecsenha").innerHTML = "Pesquisando...";    
    xhSend(string,'6');
}

function getPosicaoElemento(elemID){
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};    
}

function redireciona(varUrl){    
    varUrl = varUrl.replace("#1#","?");
    varUrl = varUrl.replace("#2#","&");
    varUrl = varUrl.replace("#2#","&");
    varUrl = varUrl.replace("#2#","&");
    varUrl = varUrl.replace("#2#","&");
    location.href = varUrl;    
}

function gE(ID) {
	return document.getElementById(ID);
}

function wfechar(window){
	gE(window).style.display = 'none';
}

function wabrir(window){
	gE(window).style.display = 'block';
}

var flagLimpa = false;
function limpaCampo(varObj){
    if (flagLimpa == false){
        varObj.value = "";
        flagLimpa = true;
    }    
}

//---------------------------------------------------------------------------------------------
//--- Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16977717-1']);
_gaq.push(['_setDomainName', '.nei.com.br']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();



//---------------------------------------------------------------------------------------------
//-- DFP
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();

googletag.cmd.push(function() {
googletag.defineSlot('/12535328/NEI_Mobile_Cabecalho_Celular_320x50', [320, 50], 'div-gpt-ad-1322248505748-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
