/**
 * Use this ScriptDoc file to manage the documentation for the corresponding namespace in your JavaScript library.
 *
 * @author JEFFERSON
 */
function Add_Usuario()
{
	new Lightbox.base('Layer1');
}
function Remove_Escritor()
{
	if (confirm("Deseja remover o escritor?"))
	{
		document.forms[0].action = 'source/remove_escritor.php';
		document.forms[0].submit();
	}
}
function Atualiza_Escritor()
{
	if (confirm("Deseja atualizar dados?"))
	{
		document.forms[0].action = 'source/atualiza_escritor.php';
		document.forms[0].submit();
	}
}
function Adiciona_Usuario()
{
	if (confirm("Deseja atualizar dados?"))
	{
		document.forms[0].action = 'source/add_usuario.php';
		document.forms[0].submit();
	}
}
function Atualiza_Usuario()
{
	if (confirm("Deseja atualizar dados?"))
	{
		document.forms[1].action = 'source/atualiza_usuario.php';
		document.forms[1].submit();
	}
}
function Atualiza_Convenio()
{
	if (confirm("Deseja atualizar dados?"))
	{
		document.forms[1].action = 'source/atualiza_convenio.php';
		document.forms[1].submit();
	}
}
function Atualiza_Escritor()
{
	if (confirm("Deseja atualizar dados?"))
	{
		document.forms[1].action = 'source/atualiza_escritor.php';
		document.forms[1].submit();
	}
}
function Remove_Usuario()
{
	if (confirm("Deseja remover o usu�rio?"))
	{
		document.forms[1].action = 'source/remove_usuario.php';
		document.forms[1].submit();
	}
}
function Remove_Convenio()
{
	if (confirm("Deseja remover o convenio?"))
	{
		document.forms[1].action = 'source/remove_convenio.php';
		document.forms[1].submit();
	}
}
function Remove_Escritor()
{
	if (confirm("Deseja atualizar dados?"))
	{
		document.forms[1].action = 'source/remove_escritor.php';
		document.forms[1].submit();
	}
}
function Numerico(e)
{
   	if (window.event) //IE 
   	{ 
   		tecla = e.keyCode; 
   	} 
	else if (e.which) //FF 
	{ 
  		tecla = e.which; 
	} 
	if (tecla != 8 || tecla < 48 || tecla > 57) return ((tecla > 47) && (tecla < 58)) //Aceita de 48 � 57 (n�meros) 
   	{	 
    	return true; 
   	} 
}
function Adcionar_Convenio()
{
	var cond = 0;
	var text_cnpj   		= document.getElementById('input_cnpj3');
	var text_convenio 		= document.getElementById('input_convenio3');
	var text_endereco 		= document.getElementById('input_endereco3');
	if(text_cnpj.value == "Campo numerico")
	{
		alert("Preencha o campo CNPJ.");
		text_cnpj.focus();
		text_cnpj.value = "";
	}
	else
	{
		cond++;
		if(text_convenio.value == "")
		{
			alert("Preencha o campo Nome do convenio.");
			text_convenio.focus();
			text_convenio.value == "";
		}
	}
	if(cond == "1")
	{
		document.forms[2].action = 'source/add_convenio.php';
		document.forms[2].submit();
	}
}
function Adcionar_Escritor()
{
	var cond = 0;
	var text_cpf = document.getElementById('input_cpf3');
	var text_nome = document.getElementById('input_nome3');
	var text_email = document.getElementById('input_email3');
	var text_usuario = document.getElementById('input_usuario3');
	var text_senha = document.getElementById('input_senha3');
	var select_convenio = document.getElementById('select_convenio3');
	if(text_cpf.value == 'Campo numerico')
	{
		alert("Preencha o campo CPF");
		text_cpf.value = "";
		text_cpf.value.focus();
	}
	else
	{
		cond++;
		if(text_nome.value == "")
		{
			alert("Preencha o campo nome");
			text_nome.focus();
		}
		else
		{
			cond++;
			if(text_email.value == "")
			{
				alert("Preencha o campo email.")
				text_email.focus();
			}
			else
			{
				cond++;
				if(text_usuario.value == "")
				{
					text_usuario.focus();
					alert("Preencha o campo usuario.")
				}
				else
				{
					cond++;
					if(text_senha.value == "")
					{
						text_senha.focus();
						alert("Preencha o campo senha.");
					}	
					else
					{
						cond++;
						if(select_convenio.value == "1")
						{
							select_convenio.focus();
							alert("Preencha o campo convenio.");
						}
						else
						{
							cond++;
						}
					}
				}
			}
		}
	}
	if(cond == 6)
	{
		document.forms[2].action = 'source/add_escritor.php';
		document.forms[2].submit();
	}
}
function Adcionar_Usuario()
{
	var cond = 0;
	var text_cpf 		= document.getElementById('input_cpf3');
	var text_nome 		= document.getElementById('input_nome3');
	var text_email 		= document.getElementById('input_email3');
	var text_usuario 	= document.getElementById('input_usuario3');
	var text_senha 		= document.getElementById('input_senha3');
	var select_convenio = document.getElementById('select_convenio3');
	var filtros			= document.getElementById('checkebox_filtros3');
	var direstrizes     = document.getElementById('checkbox_diretrizes3');
	var avtecnologicas	= document.getElementById('checkbox_avaliacoestecnologicas3');
	if(text_cpf.value  == "Campo numerico")
	{
		cond++;
		alert("Preencha o campo CPF.");
		text_cpf.value = "";
		text_cpf.focus();
		
	}
	else
	{
		if(text_nome.value == "")
		{
			alert("Preencha o campo nome.");
			text_nome.focus();
		}
		else
		{
			cond++;
			if(text_email.value == "")
			{
				cond++;
				alert("Preencha o campo email");
				text_email.focus();
			}
			else
			{
				cond++;
				if(text_usuario.value == "")
				{
					alert("Preencha o campo usuario.");
					text_usuario.focus();
				}
				else
				{
					cond++;
					if (text_senha.value == "")
					{
						alert("Preencha o campo senha.");
						text_senha.focus();
					}
					else
					{
						cond++;
						if(select_convenio.value == "1")
						{
							alert("Preencha o campo convenio.");
							select_convenio.focus();
						}
						else
						{
							cond++;
							if(filtros.checked == 0 && direstrizes.checked == 0 && direstrizes.checked == 0)
							{
								alert("Selecione um acesso.");
							}
							else
							{
								cond++;
							}
						}
					}
				}
			}
		}
	}
	if(cond == "6")
	{
		document.forms[2].action = 'source/add_usuario.php';
		document.forms[2].submit();
	}
}
function Fields_Disabled_GU()
{
	var cpf = document.getElementById('input_cpf2');
	cpf.disabled = 1;
}
function Login()
{
	new Lightbox.base('Layer4');
}
function Criar_Parecer()
{
	var cont = 0;
	var select_pareceres 	= document.getElementById('select_pareceres');
	var nome_medicamento	= document.getElementById('textnomedocumento');
	var pal_chaves			= document.getElementById('textpalavraschaves');
	var text_documento		= document.getElementById('elm1');
	var tipo_parecer		= document.getElementById('tipo_parecer');
	var documento			= document.getElementById('documento');
	var palavras_chaves		= document.getElementById('palchaves');
	
	if(select_pareceres.value == '')
	{
		tipo_parecer.style.display = 'block';
		cont++;
	}
	else
	{
		tipo_parecer.style.display = 'none';
		cont--;
	}
	if(nome_medicamento.value == '')
	{
		documento.style.display = 'block';
		cont++;
	}
	else
	{
		documento.style.display = 'none';
		cont--;
	}
	if(pal_chaves.value == '')
	{
		palavras_chaves.style.display = 'block';
		cont++;
	}
	else
	{
		palavras_chaves.style.display = 'none';
		cont--;
	}
	if(cont == -3)
	{
		if (confirm("Deseja enviar o parecer para aprovação?"))
		{
			document.forms[0].action = 'source/parecer_aprovacao.php';
			document.forms[0].submit();
		}
	}
}
function Salvar_Parecer()
{
	var cont = 0;
	var select_pareceres 	= document.getElementById('select_pareceres');
	var nome_medicamento	= document.getElementById('textnomedocumento');
	var pal_chaves			= document.getElementById('textpalavraschaves');
	var text_documento		= document.getElementById('elm1');
	var tipo_parecer		= document.getElementById('tipo_parecer');
	var documento			= document.getElementById('documento');
	var palavras_chaves		= document.getElementById('palchaves');
	
	if(select_pareceres.value == '')
	{
		tipo_parecer.style.display = 'block';
		cont++;
	}
	else
	{
		tipo_parecer.style.display = 'none';
		cont--;
	}
	if(nome_medicamento.value == '')
	{
		documento.style.display = 'block';
		cont++;
	}
	else
	{
		documento.style.display = 'none';
		cont--;
	}
	if(pal_chaves.value == '')
	{
		palavras_chaves.style.display = 'block';
		cont++;
	}
	else
	{
		palavras_chaves.style.display = 'none';
		cont--;
	}
	if(cont == -3)
	{
		if (confirm("Deseja salvar o parecer?"))
		{
			document.forms[0].action = 'source/salvar_parecer.php';
			document.forms[0].submit();
		}
	}
}
function Criar_Salvar_Parecer()
{
	var cont = 0;
	var select_pareceres 	= document.getElementById('select_pareceres');
	var nome_medicamento	= document.getElementById('textnomedocumento');
	var pal_chaves			= document.getElementById('textpalavraschaves');
	var text_documento		= document.getElementById('elm1');
	var tipo_parecer		= document.getElementById('tipo_parecer');
	var documento			= document.getElementById('documento');
	var palavras_chaves		= document.getElementById('palchaves');
	
	if(select_pareceres.value == '')
	{
		tipo_parecer.style.display = 'block';
		cont++;
	}
	else
	{
		tipo_parecer.style.display = 'none';
		cont--;
	}
	if(nome_medicamento.value == '')
	{
		documento.style.display = 'block';
		cont++;
	}
	else
	{
		documento.style.display = 'none';
		cont--;
	}
	if(pal_chaves.value == '')
	{
		palavras_chaves.style.display = 'block';
		cont++;
	}
	else
	{
		palavras_chaves.style.display = 'none';
		cont--;
	}
	if(cont == -3)
	{
		if (confirm("Deseja enviar o HTML para aprovacao?"))
		{
			document.forms[0].action = 'source/parecer_atualizacao_aprovacao.php';
			document.forms[0].submit();
		}
	}
}
function Salvar_Parecer_Sem_Enviar()
{
	var cont = 0;
	var select_pareceres 	= document.getElementById('select_pareceres');
	var nome_medicamento	= document.getElementById('textnomedocumento');
	var pal_chaves			= document.getElementById('textpalavraschaves');
	var text_documento		= document.getElementById('elm1');
	var tipo_parecer		= document.getElementById('tipo_parecer');
	var documento			= document.getElementById('documento');
	var palavras_chaves		= document.getElementById('palchaves');
	
	if(select_pareceres.value == '')
	{
		tipo_parecer.style.display = 'block';
		cont++;
	}
	else
	{
		tipo_parecer.style.display = 'none';
		cont--;
	}
	if(nome_medicamento.value == '')
	{
		documento.style.display = 'block';
		cont++;
	}
	else
	{
		documento.style.display = 'none';
		cont--;
	}
	if(pal_chaves.value == '')
	{
		palavras_chaves.style.display = 'block';
		cont++;
	}
	else
	{
		palavras_chaves.style.display = 'none';
		cont--;
	}
	if(cont == -3)
	{
		if (confirm("Deseja salvar o HTML parecer?"))
		{
			document.forms[0].action = 'source/parecer_atualizacao_aprovacao_salvar.php';
			document.forms[0].submit();
		}
	}
}
function Salvar_Parecer_Adm()
{
	var cont = 0;
	var select_pareceres 	= document.getElementById('select_pareceres');
	var nome_medicamento	= document.getElementById('textnomedocumento');
	var pal_chaves			= document.getElementById('textpalavraschaves');
	var text_documento		= document.getElementById('elm1');
	var tipo_parecer		= document.getElementById('tipo_parecer');
	var documento			= document.getElementById('documento');
	var palavras_chaves		= document.getElementById('palchaves');
	
	if(select_pareceres.value == '')
	{
		tipo_parecer.style.display = 'block';
		cont++;
	}
	else
	{
		tipo_parecer.style.display = 'none';
		cont--;
	}
	if(nome_medicamento.value == '')
	{
		documento.style.display = 'block';
		cont++;
	}
	else
	{
		documento.style.display = 'none';
		cont--;
	}
	if(pal_chaves.value == '')
	{
		palavras_chaves.style.display = 'block';
		cont++;
	}
	else
	{
		palavras_chaves.style.display = 'none';
		cont--;
	}
	if(cont == -3)
	{
		if (confirm("Deseja atualizar o parecer?"))
		{
			document.forms[0].action = 'source/parecer_atualizacao_aprovacao_salvar_adm.php';
			document.forms[0].submit();
		}
	}
}
function Publica_Parecer()
{
	var cont = 0;
	var select_pareceres 	= document.getElementById('select_pareceres');
	var nome_medicamento	= document.getElementById('textnomedocumento');
	var pal_chaves			= document.getElementById('textpalavraschaves');
	var text_documento		= document.getElementById('elm1');
	var tipo_parecer		= document.getElementById('tipo_parecer');
	var documento			= document.getElementById('documento');
	var palavras_chaves		= document.getElementById('palchaves');
	
	if(select_pareceres.value == '')
	{
		tipo_parecer.style.display = 'block';
		cont++;
	}
	else
	{
		tipo_parecer.style.display = 'none';
		cont--;
	}
	if(nome_medicamento.value == '')
	{
		documento.style.display = 'block';
		cont++;
	}
	else
	{
		documento.style.display = 'none';
		cont--;
	}
	if(pal_chaves.value == '')
	{
		palavras_chaves.style.display = 'block';
		cont++;
	}
	else
	{
		palavras_chaves.style.display = 'none';
		cont--;
	}
	if(cont == -3)
	{
		if (confirm("Deseja publicar o parecer?"))
		{
			document.forms[0].action = 'source/parecer_atualizacao_publicacao.php';
			document.forms[0].submit();
		}
	}
}
function Logout()
{
	document.forms[0].action = 'source/logout.php';
	document.forms[0].submit();
}
function Ver_PDF(documento)
{
	//alert(documento);
	window.open('lib/htmltopdf/demo/html2ps.php','page','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=800,height=600');
}
function Remove_Parecer()
{
			if (confirm("Deseja remover o parecer?"))
		{
			document.forms[0].action = 'source/remove_parecer.php';
			document.forms[0].submit();
		}
}
function Remove_Parecer_2(parecer)
{
		if (confirm("Deseja remover o parecer?"))
		{
			document.forms[0].action = 'source/remove_parecer_2.php?parecer='+'PARECER-'+parecer;
			document.forms[0].submit();
		}
}
function Salvar_Parecer_Sem_Enviar_PDF()
{
	var cont = 0;
	var select_pareceres 	= document.getElementById('select_pareceres');
	var nome_medicamento	= document.getElementById('textnomedocumento');
	var pal_chaves			= document.getElementById('textpalavraschaves');
	var text_documento		= document.getElementById('elm1');
	var tipo_parecer		= document.getElementById('tipo_parecer');
	var documento			= document.getElementById('documento');
	var palavras_chaves		= document.getElementById('palchaves');
	
	if(select_pareceres.value == '')
	{
		tipo_parecer.style.display = 'block';
		cont++;
	}
	else
	{
		tipo_parecer.style.display = 'none';
		cont--;
	}
	if(nome_medicamento.value == '')
	{
		documento.style.display = 'block';
		cont++;
	}
	else
	{
		documento.style.display = 'none';
		cont--;
	}
	if(pal_chaves.value == '')
	{
		palavras_chaves.style.display = 'block';
		cont++;
	}
	else
	{
		palavras_chaves.style.display = 'none';
		cont--;
	}
	if(cont == -3)
	{
		if (confirm("Deseja salvar o PDF do parecer?"))
		{
			document.forms[0].action = 'source/parecer_atualizacao_aprovacao_salvar_pdf.php';
			document.forms[0].submit();
		}
	}
}
function Criar_Salvar_Parecer_PDF()
{
	var cont = 0;
	var select_pareceres 	= document.getElementById('select_pareceres');
	var nome_medicamento	= document.getElementById('textnomedocumento');
	var pal_chaves			= document.getElementById('textpalavraschaves');
	var text_documento		= document.getElementById('elm1');
	var tipo_parecer		= document.getElementById('tipo_parecer');
	var documento			= document.getElementById('documento');
	var palavras_chaves		= document.getElementById('palchaves');
	
	if(select_pareceres.value == '')
	{
		tipo_parecer.style.display = 'block';
		cont++;
	}
	else
	{
		tipo_parecer.style.display = 'none';
		cont--;
	}
	if(nome_medicamento.value == '')
	{
		documento.style.display = 'block';
		cont++;
	}
	else
	{
		documento.style.display = 'none';
		cont--;
	}
	if(pal_chaves.value == '')
	{
		palavras_chaves.style.display = 'block';
		cont++;
	}
	else
	{
		palavras_chaves.style.display = 'none';
		cont--;
	}
	if(cont == -3)
	{
		if (confirm("Deseja enviar o PDF para aprova��o?"))
		{
			document.forms[0].action = 'source/parecer_atualizacao_aprovacao_pdf.php';
			document.forms[0].submit();
		}
	}
}
function Pagina_construcao()
{
	alert("P�gina em constru��o");
}
function Validacao_Contato()
{
	var nome 	= document.getElementById('textnome');
	var email	= document.getElementById('textemail');
	var tel		= document.getElementById('texttelefone');
	var assunto	= document.getElementById('textassunto');
	var msg		= document.getElementById('textmsg');
	var cont 	= 0;
	if(nome.value == '')
	{
		nome.focus();
		alert('Favor preencher o nome');
		cont++;
	}
	else
	{
		cont--;
		if(email.value == '')
		{
			email.focus();
			alert('Favor preencher o campo email');
			cont++;			
		}
		else
		{
			cont--;
			if(tel.value == '')
			{
				tel.focus();
				alert('Favor preencher o campo telefone');
				cont++;
			}
			else
			{
				cont--;
				if(assunto.value == '')
				{
					assunto.focus();
					alert('Favor preencher o campo assunto');
					cont++;
				}
				else
				{
					cont--;
					if(msg.value == '')
					{
						msg.focus();
						alert('Favor preencher o campo mensagem.');
						cont++;
					}
				}
			}
		}
	}
	if(cont == -4)
	{
		if (confirm("Deseja enviar a mensagem?"))
		{
			document.forms[1].action = 'source/contato.php';
			document.forms[1].submit();
		}
	}
}
function Limpar_Formulario()
{
	var fields  	= document.getElementsByTagName('input');
	var textarea	= document.getElementById('textmsg'); 
	for(i=0;i<fields.length;i++)
	{
		fields[i].value = '';
	}
	textarea.value  = '';
}
function Parecer_Pendente_Escritor()
{
	if (confirm("Deseja enviar parecer para o escritor?"))
	{
		document.forms[0].action = 'source/parecer_pendente_escritor.php';
		document.forms[0].submit();
	}
}
function Pesquisa(pag)
{
	document.forms[0].action = 'source/pesquisa_documento.php?pag='+pag;
	document.forms[0].submit();
}
function LightboxDelegate(url,lightbox1,lbOn)
{
   var objLink = document.createElement('a');
   objLink.setAttribute('href',url);
   objLink.setAttribute('rel',lightbox1);
   //objLink.setAttribute('class',lbOn);
   Lightbox.prototype.start(objLink);
}
function Browser_Detect()
{
	var browser=navigator.appName;
	obBody = document.getElementById('body');
	if(browser == "Netscape")
	{
		LightboxDelegate('imagens/area_restrita.jpg','lightbox','lbOn');
	}
	if(browser == "Microsoft Internet Explorer")
	{
		initLightbox();
		LightboxDelegate('imagens/area_restrita.jpg','lightbox','lbOn');
	}
}
function Notice()
{
	if(confirm("1) Todos os documentos disponíveis neste site são protegidos por direito autoral e não podem ser reproduzidos por quaisquer meios eletrônicos ou impressos, sem autorizaçãoo expressa dos autores.\n\n 2) Se destinam apenas para uso interno dentro da contratante dos serviços -operadora de saúde, hospital, etc. \n\n 3) Não pode ser usado sob nenhum pretexto ou situação em outras operadoras de saúde, hospitais, serviços, etc, que não aqueles contratantes. \n\n 4) Os documentos tem caráter informativo, cabendo a decisão final sob sua aplicação ou não a cada um dos contratantes."))
	{}
	else
	{
		window.location.href = "source/logout.php"; 
	}
}
function Aviso_acesso_documento()
{
	alert('Somente usuários logados tem acesso ao conteúdo do site.');
}
function Envia_Newsletter()
{
	if (confirm("Deseja envair a news letter para todos os usuarios cadastrados"))
	{
		document.forms[0].action = 'source/enviar_news_letter.php';
		document.forms[0].submit();
	}
}
function Disable_Fields()
{
	var fields = document.getElementsByTagName('input');
	for(i=0;i<fields.length;i++)
	{
		fields[i].disabled = 1;
	}
}
function get(texto) {   
     
     var theText = texto;   
  
     var text = '';   
     var arr = new Array();   
  
     for( i=0; i < theText.length; i++ ){   
             arr[i] = theText.charCodeAt(i);   
             text += String.fromCharCode(arr[i]);   
     }   
     //alert(arr);   
     //alert(text); 
	 return(encodeURI(text));
}  