function logar()
{

	if(document.form_login.usuario.value == '')
	{
		window.alert('Informe o seu login');
		document.form_login.usuario.focus();
	}else if(document.form_login.senha.value == '')
	{
		window.alert('Informe sua senha');
		document.form_login.senha.focus();
	}else
	{
		document.form_login.submit();
	}
	
}

function enviarEmail()
{
	if(document.form_senha.login.value == '')
	{
		window.alert('Informe o seu login');
		document.form_senha.login.focus();
	}else if(document.form_senha.email.value == '')
	{
		window.alert('Informe seu e-mail');
		document.form_senha.email.focus();
	}else
	{
		document.form_senha.submit();
	}

}

function reticencias(id){
	var tam = document.getElementById(id).offsetHeight;
	
	if(tam > 20){
		var text = document.getElementById(id).innerHTML;
	
		var textVisible = text.substr(0,100)+" ...";
		
		document.getElementById(id).innerHTML = textVisible;

		var i = 99;
		while(tam > 20){
			textVisible = text.substr(0,i)+" ...";
			document.getElementById(id).innerHTML = textVisible;
			tam = document.getElementById(id).offsetHeight;
			i--;
		}
	}
}

function reticenciasTexto(id){
	var tam = document.getElementById(id).offsetHeight;
	
	if(tam > 58){
		var text = document.getElementById(id).innerHTML;
		
		var textVisible = text.substr(0,200)+"...(continue lendo)";
		
		document.getElementById(id).innerHTML = textVisible;

		var i = 199;
		while(tam > 58){
			
			textVisible = text.substr(0,i)+"...(continue lendo)";
			document.getElementById(id).innerHTML = textVisible;
			tam = document.getElementById(id).offsetHeight;
			i--;
		}
	}
}

function reticenciasNoticia(id){
	var tam = document.getElementById(id).offsetHeight;
	
	if(tam > 200){
		var text = document.getElementById(id).innerHTML;
	
		var textVisible = text.substr(0,500)+" ...(continue lendo)";
		
		document.getElementById(id).innerHTML = textVisible;

		var i = 499;
		while(tam > 200){
			textVisible = text.substr(0,i)+" ...(continue lendo)";
			document.getElementById(id).innerHTML = textVisible;
			tam = document.getElementById(id).offsetHeight;
			i--;
		}
		
		var link = textVisible.substr(0,textVisible.length-16);
		
		document.getElementById(id).innerHTML = link+"<a href='noticias.php'>(continue lendo)</a>";
		
	}
}

function reticenciasPedido(id){
	var tam = document.getElementById(id).offsetTop+document.getElementById(id).offsetHeight;
	var textoP = document.getElementById(id).innerHTML;

	if(tam > 313){
		var text = document.getElementById(id).innerHTML;
	
		var textVisible = text.substr(0,textoP.length)+"...(continue lendo)";
		
		document.getElementById(id).innerHTML = textVisible;
		
		var i = textoP.length - 1;
		while(tam > 313){
			textVisible = text.substr(0,i)+"...(continue lendo)";
			document.getElementById(id).innerHTML = textVisible;
			tam = document.getElementById(id).offsetTop+document.getElementById(id).offsetHeight;
			i--;
		}
	}
}

function mostrarServicos(id){
	var servicos = new Array("financas_sel","gestaoEst_sel","logistica_sel","marketing_sel","qualidade_sel","rh_sel");
	
	var i=0;
	for (i=0; i<6; i++)
	{
		if(servicos[i] == id) document.getElementById(id).style.display = "block";
		else document.getElementById(servicos[i]).style.display = "none";
		
	}
	
}

function branco(id){
	document.getElementById(id).style.color = "#fff";
}


function enviarContatoCliente(){

	if(document.formulario_contato.empresa.value == '')
	{
		window.alert('Informe o nome de sua empresa');
		document.formulario_contato.empresa.focus();
	}
	else if(document.formulario_contato.responsavel.value == '')
	{
		window.alert('Informe o responsável');
		document.formulario_contato.responsavel.focus();
	}
	else if(document.formulario_contato.end.value == '')
	{
		window.alert('Informe seu endereço');
		document.formulario_contato.end.focus();
	}
	else if(document.formulario_contato.telefone.value == '')
	{
		window.alert('Informe seu telefone');
		document.formulario_contato.telefone.focus();
	}
	else if(document.formulario_contato.email.value == '')
	{
		window.alert('Informe seu email');
		document.formulario_contato.email.focus();
	}
	else if(document.formulario_contato.logoEmpresa.value != '')
	{
		var i=0;
		var Ctrl=new Array();

		var nome = document.formulario_contato.logoEmpresa.value;

		var extensoesOk = ",.gif,.jpg,.png,";

		var extensao = "," + nome.substr( nome.length - 4 ).toLowerCase() + ",";

		if(extensoesOk.indexOf( extensao ) == -1) {
			window.alert('Formato inválido do arquivo do logo de sua empresa. Envie um arquivo de imagem.');
			document.formulario_contato.logoEmpresa.focus();
		}
		else{
			document.formulario_contato.submit();
		}
	}
	else
	{
		document.formulario_contato.submit();
	}
}

function enviarContatoParceiro(){

	if(document.formulario_contato.nome.value == '')
	{
		window.alert('Informe o seu nome');
		document.formulario_contato.nome.focus();
	}
	else if(document.formulario_contato.telefone.value == '')
	{
		window.alert('Informe seu telefone');
		document.formulario_contato.telefone.focus();
	}
	else if(document.formulario_contato.email.value == '')
	{
		window.alert('Informe seu email');
		document.formulario_contato.email.focus();
	}
	else if(document.formulario_contato.descricao.value == '')
	{
		window.alert('Descreva sua empresa');
		document.formulario_contato.descricao.focus();
	}
	else if(document.formulario_contato.descricaoP.value == '')
	{
		window.alert('Mostre sua proposta de parceria');
		document.formulario_contato.descricaoP.focus();
	}
	else if(document.formulario_contato.logoEmpresa.value != '')
	{
		var i=0;
		var Ctrl=new Array();

		var nome = document.formulario_contato.logoEmpresa.value;

		var extensoesOk = ",.gif,.jpg,.png,";

		var extensao = "," + nome.substr( nome.length - 4 ).toLowerCase() + ",";

		if(extensoesOk.indexOf( extensao ) == -1) {
			window.alert('Formato inválido do arquivo do logo de sua empresa. Envie um arquivo de imagem.');
			document.formulario_contato.logoEmpresa.focus();
		}
		else{
			document.formulario_contato.submit();
		}
	}
	else
	{
		document.formulario_contato.submit();
	}
}