//====================================================
// Desenvolvido por CANTINI Tecnologia
// www.cantini.com.br
//====================================================
function Menu(m)
{
	var d = new Date;
	var t = d.getTime();
	
	document.getElementById('Meio').innerHTML = '<p style="height:500px;line-height:500px;text-align:center;"><img src="images/indicator.gif" border="0" /></p>';
	
	switch(m)
	{
		case 'EMBRAPOL': Ajax.PostPagina( "embrapol.php?" + t, "Meio", "frm" ); break;
		case 'PORTFOLIO': Ajax.PostPagina( "portfolio.php?" + t, "Meio", "frm" ); break;
		case 'CADASTRAMENTO': Ajax.PostPagina("cadastro.php?" + t, "Meio", "frm"); break;	
		case 'TRABALHE': Ajax.PostPagina( "oportunidade.php?" + t, "Meio", "frm" ); break;
		case 'DICAS': Ajax.PostPagina( "dicas.php?" + t, "Meio", "frm" ); break;
		case 'LOCALIZACAOSP': Ajax.PostPagina( "localizacao.php?" + t, "Meio", "frm" ); break;
		case 'FALECONOSCO': Ajax.PostPagina( "contato.php?" + t, "Meio", "frm" ); break;
		default: location = 'index.php';
	}
}
//====================================================
function VerFilial(uf)
{

	MG.style.display = 'none';
	RS.style.display = 'none';
	PB.style.display = 'none';
	//RN.style.display = 'none';
	//RJ.style.display = 'none';
	SP.style.display = 'none';
	SPMat.style.display = 'none';
	SPMogi.style.display = 'none';
	SPSan.style.display = 'none';
	SPSJC.style.display = 'none';
	//SC.style.display = 'none';


	switch(uf)
	{
		case "MG" : MG.style.display = ''; break;
		case "RS" : RS.style.display = ''; break;
		case "PB" : PB.style.display = ''; break;
		//case "RN" : RN.style.display = ''; break;
		case "SP" : 
			SP.style.display = '';
			SPMat.style.display = '';
			SPMogi.style.display = '';
			SPSan.style.display = '';
			SPSJC.style.display = '';
			break;
	//	case "SC" : SC.style.display = ''; break;
		//case "RJ" : RJ.style.display = ''; break;
		default   :
			SP.style.display = '';
			SPMat.style.display = '';
			break;
	}

}
//==================================================================
function ExibirOcultar(i,n){

	for (j=1;j<=n;j++){
		div = eval( "c" + i + j);
		if (div.style.display=='')
			div.style.display = 'none';
		else
			div.style.display = '';
		}
}
//==================================================================
function Detalhe(pag){
	configurar = "left=0,top=0,width=600,height=600,menubar=yes,toolbar=no,scrollbars=yes ";
	pag = pag.toLowerCase();
	window.open("../" + pag, "Detalhe", configurar);
}
//========================================
function ValidarLogin()
{
	if (document.frm.Email.value=="")
	{
		alert( "Please, enter your Login!" );
		document.frm.Email.focus();
		return;
	}
	if (document.frm.Senha.value=="")
	{
		alert( "Please, enter your Password!" );
		document.frm.Senha.focus();
		return;
	}
	document.frm.submit();
}
//=========================================
function CadCurriculo()
{
	Ajax.PostPagina("cadcurriculo.php", "Meio", "frm" );
}
//=========================================
function Opacidade(id, opc)
{
	var Navegador 	= navigator.appName.toLowerCase();
	var isIE 		= (Navegador.indexOf('microsoft') != -1);

	if (isIE)
		id.style["filter"] = "Alpha(opacity=" + opc + ")";
	else
		id.style["opacity"] = (opc/100);
}
//=========================================
function DetalheVaga(id)
{
	obj = document.getElementById(id);
	
	if (obj.style.display=='none')
		obj.style.display = 'block';
	else
		obj.style.display = 'none';
}
//=========================================
function VerMapa()
{
	configurar = "width=940,height=600,left=0,top=0,menubar=yes,scrollbars=yes,toolbar=yes,locationbar=no";
	window.open( "mapa.htm", "Mapa", configurar );
}
//=========================================
function PosicionaFormPedido()
{
	var w 	= screen.width;
	var frm = document.getElementById( "formPedido" );
	var pLeft;
/*
   	switch(w)
   	{
   		case 800  : pLeft = "678px";
   			break;
   		case 1280 : pLeft = "730px";
   			break;
   		case 1400 : pLeft = "730px";
   			break;
   		case 1600 : pLeft = "1078px";
   			break;
   		case 2048 : pLeft = "1230px";
   			break;
   		default: pLeft = "730px";
   			break;
   	}
*/
	pLeft = "730px";   	
   	frm.style.left = pLeft;
}
//=========================================
function FacaSeuPedido()
{
	f = document.getElementById( "frm" );
	
	if (f.nome.value=="")
	{
		alert("Please, enter your Login!");
		f.nome.focus();
		return;
	}
	if (f.senha.value=="")
	{
		alert("Please, enter your Password!");
		f.senha.focus();
		return;
	}
	frm.submit();
}
//=========================================
function Video()
{
	document.getElementById( "divVideo" ).style.display = "block";
}
//=========================================
function FecharVideo()
{
	document.getElementById( "divVideo" ).style.display = "none";	
}
//=========================================
// Para utilização na página "Portfólio.
//
//=========================================
function LimpaProcura()
{
	//document.getElementById( "textoBusca" ).value = "";
	//document.getElementById("ulItens").innerHTML = ulHTML;
	Menu("PORTFOLIO");
}
//=========================================
function ProcurarTexto()
{
	var ul 		= document.getElementById("ulItens");
	var lista 	= ul.getElementsByTagName('li');
	var found	= false;
	var i;
	
	var isIE = (navigator.appName.indexOf('Microsoft') != -1);
	
	if (document.getElementById( "textoBusca" ).value=="")
	{
		alert("Please, enter search text!");
		document.getElementById( "textoBusca" ).focus();
		return;
	}

	for (i=0;i< lista.length;i++)
	{
		if (isIE)
			textInString = (lista[i].innerText.toLowerCase().indexOf(document.getElementById( "textoBusca" ).value.toLowerCase()) > -1);
		else
			textInString = (lista[i].textContent.toLowerCase().indexOf(document.getElementById( "textoBusca" ).value.toLowerCase()) > -1);
	
		if (textInString)
		{
			lista[i].style.display = 'block';
			lista[i].className = "LinkBusca";
			found = true;
		}
	}
	if (!found)
		alert("Sorry! Text not found!");
}
//===================================
function EnviarCadastro()
{
	Ajax.PostPagina("cadastro.php?btnEnviar=OK", "Meio", "frm" );
}
//===================================
function EnviarCurriculo()
{
	Ajax.PostPagina("cadcurriculo.php?btnEnviar=OK", "Meio", "frm" );
}
