onmouseover="this.className='nomdaclasse'"; onmouseout="this.className='nomdaoutraclasse'";

function hoverNotEconomia() {
	
	document.getElementById("abaultima").className="notinativa";
	document.getElementById("abaeconomia").className="economiaativa";
	visibilidadeByParam('noticiaultimas', 'none'); 
	visibilidadeByParam('noticiaeconomia', 'block');
}

function hoverNotUltimas() {
	
	document.getElementById("abaultima").className="ultimasativa";
	document.getElementById("abaeconomia").className="notinativa";

	visibilidadeByParam('noticiaeconomia', 'none'); 
	visibilidadeByParam('noticiaultimas', 'block');
}

////////////////////////////////////////////////////////////////////////////////////
// Função que determina a visibilidade de determinado objeto
//
// @param objeto (objeto) -> o objeto que deseja aplicar a visibilidade
// @param param (string) -> (none ou block) ou (hidden ou visible) de acordo com necessidade
////////////////////////////////////////////////////////////////////////////////////
function visibilidadeByParam(objeto, param) {

	var obj = document.getElementById(objeto);

	if (param == 'none' || param == 'block') {
		obj.style.display = param;
	}
	else {
		obj.style.visibility = param;
	}
	
	
}

////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////




function setCheckboxes(the_form, do_check) {
    var elts      = document.forms[the_form].elements['os[]'];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        } // end for
    } else {
        elts.checked        = do_check;
    } // end if... else
    if (do_check) {
    	xis = "";
    }
    else {
    	xis = "1";
    }
    
    document.forms[the_form].checkall.value = xis;

    return true;
} // end of the 'setCheckboxes()' function

function CriaArray (n) { 
	this.length = n 
	for (var i = 1 ; i <= n ; i++) { 
		this[i] = "" 
	} 
} 


function checkRadio(campo, str){
		for (var i = 0; i < campo.length; i++) {
			if (campo[i].value == str) {
				campo[i].checked = true;
			}
		}
}
function checkSelect(campo, str){
		for (var i = 0; i < campo.length; i++) {
			if (campo[i].value == str) {
				campo.selectedIndex = i;
			}
		}
}

/********************************************************************** 
Fun?o de formata?o de campos do tipo Data 
 
Objetivos : 
    - Mascarar a entrada de dados no formato : dd/mm/aaaa 
 
Par?etros : 
    objeto        -> Nome do campo de formul?io (Usar this) 
    teclapress    -> Tecla pressionada (Usar event) 
 
Exemplo : 
    OnKeyDown    FormataData(this,event); 
 
/**********************************************************************/ 
function FormataData(objeto,teclapress) 
{ 
    var tecla = teclapress.keyCode; 
 
    if (( tecla == 8 || tecla == 88 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 )&& objeto.value.length < (10)) 
    { 
        vr = objeto.value; 
        vr = vr.replace( "/", "" ); 
        vr = vr.replace( "/", "" ); 
        tam = vr.length; 
 
        if (tam < 8) 
            { 
                if (tecla != 8) {tam = vr.length + 1 ;} 
            } 
        else 
            { 
                window.event.cancelBubble = true; 
                window.event.returnValue = false; 
            } 
         
        if ((tecla == 8) && (tam > 1)) 
            {
                tam = tam - 1 ; 
                objeto.value = vr.substr(0,tam); 
                window.event.cancelBubble = true; 
                window.event.returnValue = false; 
            } 
                if ( tam <= 2 && tecla != 8){ 
                     objeto.value = vr ; } 

                if ( (tam >= 2) && (tam <= 4) ){ 
                     objeto.value = vr.substr(0, tam - 2) + '/' + vr.substr( tam - 2, 2 ); } 
 
                if ( (tam >= 6) && (tam <= 8) ){ 
                    objeto.value = vr.substr(0, tam - 6 ) + '/' + vr.substr( tam - 6, 2 ) + '/' + vr.substr( tam - 4, 4 ); } 

				if ((tam == (8)) && tecla != 8) 
                    { 
                        if(tecla >=96 && tecla <=105) 
                            { 
                                tecla = tecla - 48; 
                            } 
 
                        objeto.value = objeto.value + (String.fromCharCode(tecla)); 
                        window.event.cancelBubble = true; 
                        window.event.returnValue = false; 
 
                    } 
    } 
    else if((window.event.keyCode != 8) && (window.event.keyCode != 9) && (window.event.keyCode != 13) && (window.event.keyCode != 35) && (window.event.keyCode != 36) && (window.event.keyCode != 46)) 
        { 
            event.returnValue = false; 
        }  
}

function janela(mypage, myname, w, h) {
   var winl = (screen.width - w) / 2;
   var wint = (screen.height - h) / 2;
   winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,noresizable,status=no, location=no, toolbar=no, menubar=no';
   win = window.open(mypage, myname, winprops)
}

function printContato(dados){
	janela("imprimeempresa.php?dados="+dados, "IMPRIME_EMPRESA", 400, 250);
}


////////////////////////////////////////////////////////////////////////////////////
// Função que escreve o que eu quiser no objeto selecionado
//
// @param objeto (objeto) -> referencia o ID da div que terá o conteudo alterado
// @param texto (string) -> texto a ser escrito na div
////////////////////////////////////////////////////////////////////////////////////
function escreveNoHtml(objeto, texto) {

	objeto.innerHTML = texto;

}

function juntaemail(objeto){
	
	if(objeto._user.value.search("@") == -1){
		objeto._user.value = objeto._user.value + "@jfmail.com.br";
	}
	
	objeto.submit();
}

function juntaemailparticipacao(objeto){
	
	if(objeto.usuario.value.search("@") == -1){
		objeto.usuario.value = objeto.usuario.value + "@jfmail.com.br";
	}
	
	objeto.submit();
}
function submitaformparticipacao(form, e){
	if(e.keyCode == 13)	{
		juntaemailparticipacao(form);
	}
}
function submitaformemail(form, e){
	if(e.keyCode == 13)	{
		juntaemail(form);
	}
}
function enqueteresultado(dados) {
	janela("enqueteresultado.php", "ENQUETE", 250, 190);
}
function ampliar(dados) {
	janela("ampliar.php?dados="+dados, "AMPLIAR", 800, 600);
}
function pesquisaopiniao() {
	janela("pesquisaopiniao.php", "OPINIAO", 455, 350);
}
function pesquisaopiniao2() {
	janela("resultadopesquisaopiniao.php", "RESULTADO", 455, 350);
}

////////////////////////////////////////////////////////////////////////////////////
// Seta a classe de estilo 'obrigatorio' para os campos de preenchimento obrigatório
//
// @param obrigatorio (array) -> array com o nome dos campos obrigatórios
// @param form (form) -> o formulário onde estão os campos
// @param classe (string) -> a classe que será aplicada
//
////////////////////////////////////////////////////////////////////////////////////
function ColoreObrigatorio(obrigatorio, form, classe) {

	for (var i = 0; i < obrigatorio.length; i++) {
		form.elements[obrigatorio[i]].className = classe;
	}

}

////////////////////////////////////////////////////////////////////////////////////
// Seta a classe de estilo 'obrigatorio' para os campos de preenchimento obrigatório
//
// @param obrigatorio (array) -> array com o nome dos campos obrigatórios
// @param form (form) -> o formulário onde estão os campos
//
// @return (bool) -> retorna false se algum campo estiver em branco
//
////////////////////////////////////////////////////////////////////////////////////
function checaObrigatorio(obrigatorio, form) {
	var erro = new Array();

	ColoreObrigatorio(obrigatorio, form, 'obrigatorio');

	for (var i = 0; i < obrigatorio.length; i++) {
		if (form.elements[obrigatorio[i]].value == "") {
			 erro.push(obrigatorio[i]);
		}
	}
	if (erro.length > 0) {
		ColoreObrigatorio(erro, form, 'erro');
		alert('Os campos em destaque precisam ser preenchidos');
		return false;
	}
	else {
		return true;
	}
}
function vercandidato(cpf) {
	janela("curriculum/empresa/info.php?cpf="+cpf, "CANDIDATO", 700, 500);
}
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//  função q abre popup com o tamanho da foto
//  @largura -> largura da imagem a ser aberta
//  @altura -> altura da imagem a ser aberta
//  @foto -> caminho da foto desde a raiz
//
//////////////////////////////////////////////////////////////
function popup(largura, altura, foto) {
	var winl = (screen.width - largura) / 2;
    var wint = (screen.height - altura) / 2;
	winprops = 'height='+altura+',width='+largura+',top='+wint+',left='+winl+',scrollbars=no,noresizable,status=no, location=no, toolbar=no, menubar=no'
	window.open ("popup.php?foto="+foto, "Popup", winprops );
}

	function AbrePopup() {
		var pop = document.getElementById('popup');
		pop.style.display = 'block';
		setTimeout("FechaPopup()", 10000);
	}
	function FechaPopup() {
		var pop = document.getElementById('popup');
		pop.style.display = 'none';		
	}