
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function Popup(arq,largura,altura)
{
     var newURL = arq;
     var newWindow = window.open(""+newURL+"", "newURL", "status,width="+largura+",height="+altura+",top=20,left=20,scrollbars,resizable=no");
}

function JanelaPopup(id,largura,altura,titulo)
{	var popup = new Popup(id,largura,altura);
	popup.setTitle(titulo);
	popup.init();
}
	 
function abreJanela(Url,NomeJanela,width,height,extras) {

var largura = width; 
var altura = height; 
var adicionais= extras; 
var topo = (screen.height-altura)/2; 
var esquerda = (screen.width-largura)/2; 
novaJanela=window.open(''+ Url + '',''+ NomeJanela + '','width=' + 
largura + ',height=' + altura + ',top=' + topo + ',left=' + esquerda + 
',scrollbars=yes,features=' + adicionais + ''); 

novaJanela.focus(); 
} 
	 
function Monstra(p)
{
    getElementById(p).style.display=block;
}

function verifica(form)
{
	var x = document.getElementById(form);
	var retorno = true;
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);

	if(( x.nome.value == "") || ( x.endereco.value == "") || ( x.email.value == "") || ( x.duvida.value == "")) {
	alert("Os campos devem estar preenchidos corretamente!");
	retorno = false;
	}
	else{
	        if(er.test(x.email.value)){ retorno = true; }

		else{
        	retorno = false;
                alert("Os campos devem estar preenchidos corretamente!");
		}		
	}
	
	return retorno;
}

	function exibiMapa(obj){
						var imagem = $(obj).attr("imagem");
				  		var imagemAtual = $("#mapsIE img").attr("src");
				  		var displayDiv = $("#mapsIE").css("display");

				  		if (imagem == imagemAtual){
							$("#mapsIE").BlindToggleVertically(500);
						}else if(displayDiv == "none"){
					  		$("#mapsIE img").attr("src", imagem);
					  		$("#mapsIE").BlindToggleVertically(500);
					  	}else{
							$("#mapsIE img").attr("src", imagem);
						};
	}
	
	function exibirConteudoAjaxNoticia(item,id){	
		$('#loading').ajaxStart(function(){
			$(this).show();
		})
		$('#loading').ajaxStop(function(){
			$(this).hide();
		})
		
		$.ajax({
		   type: "GET",
		   url: "view.php",
		   data: "itemID="+item+"&id="+id,
		   beforeSend: function(data){
		   	 $('#boxRefresh').html("");
		   },
		   success: function(data){
		     $('#boxRefresh').html(data);
		   }
		 });
	}	
	
	function findPages(pagina,tipo){
		$.post("ConsultarArtigos.php",{pagina: pagina,tipoConsulta: tipo},function(data){
		if(tipo=='comDownload'){
			$('#comDownload').html("");
			$('#comDownload').html(data);
		}else{
			$('#semDownload').html(""); 
			$('#semDownload').html(data);
		}
		
		});
	}
	
	function enviaPostArtigos(){
		
		$("#col_1").hide();
		$("#conteudo").hide();
	
		$('#loading').ajaxStart(function(){			
			$(this).show();		
		});
		$('#loading').ajaxStop(function(){			
			$(this).hide();			
		});
		
		var txtBusca = $("#txtBuscaArtigo").val();		
		var txtComboNome = $("#comboListDoc").val();	
		
		$.post("artigos.php",{busca: txtBusca,comboProfs: txtComboNome},function(data){
			$("#valor-consulta-artigos").html("");			
			$("#valor-consulta-artigos").show();
			$("#valor-consulta-artigos").html(data); 
		});
	}
	
	function exibirConteudoAjax(item){				
	
				$('#loading').ajaxStart(function(){
					$(this).show();
				})
				$('#loading').ajaxStop(function(){
					$(this).hide();
				})
				
				
				
				$.ajax({
				   type: "GET",
				   url: "view.php",
				   data: "itemID="+item,
				   beforeSend: function(data){
				   	 $('#boxRefresh').html("");
				   },
				   success: function(data){
				     $('#boxRefresh').html(data);
				   }
				 });
	}
	
	function exibirConteudoSubDomAjax(dir,item){	

				$('#loading').ajaxStart(function(){
					$(this).show();
				})
				$('#loading').ajaxStop(function(){
					$(this).hide();
				})
				
				$.ajax({
				   type: "GET",
				   url: dir,
				   data: "itemID="+item,
				   beforeSend: function(data){
				   	 $('#boxRefresh').html("");
				   },
				   success: function(data){
				     $('#boxRefresh').html(data);
				   }
				 });
	}
	
	function fadeDiv(obj){							    		
  		var newDiv = obj.name;  				    			
		$("#box > div").hide();	    				
		$("#"+newDiv+"").fadeIn("fast");		
	}
	
	function fadeDivPubPesq(obj){
		if(obj=="Livros"){			
			$("#Boletins").fadeOut("fast");	    				
			$("#Livros").fadeIn("fast");						
		}else{
			$("#Livros").fadeOut("fast");	    				
			$("#Boletins").fadeIn("fast");			
		}
			
	}
	
	function FadeAbstracts(autores, titulo, texto, data, titulo_pub) {
		$("#abstract").find("table").fadeOut("fast", mostra);
		function mostra(){
			document.getElementById("abstract").innerHTML = '<b><a onclick="exibirConteudoAjax(\'BaseDadosAbstracts\');" href="javascript:;">&laquo; Voltar</a></b><p>&nbsp;</p><b>Autor Principal:</b> ' + autores + '<br><b>T�tulo do Artigo:</b> ' + titulo + '<br><b>T�tulo da publica��o:</b> ' + titulo_pub + '<br><b>Data de publica��o:</b> ' + data + '<p>&nbsp;</p><b>Abstract/Resumo:</b> ' + texto;			
		}
		
	}
	
	function FadeDivParam(div,titulo,texto, url_img, path){
		$("#padrao").find("table").fadeOut("fast", mostra);
		function mostra(){
			document.getElementById("sub_titulo").innerHTML = titulo;
			document.getElementById("sub_texto").innerHTML = texto;			
			document.getElementById("sub_img").innerHTML = '<img src='+ path + 'Downloads/' + url_img + '>';					    				  				    				
			$("#"+div+"").fadeIn("fast");
		}
	}
	
	function FadeDivParamVoltar(div){										    			
  		$("#"+div+"").fadeOut("fast", mostra);
  		
  		function mostra(){
  			$("#padrao table").fadeIn("fast");	    				
		}
	}

  
	function RefreshDivAjax(obj, item){	
	
				$('#loading').ajaxStart(function(){
					$(this).show();
				})
				$('#loading').ajaxStop(function(){
					$(this).hide();
				})
				
				$.ajax({
				   type: "GET",
				   url: "view.php",
				   data: "itemID="+obj+"&id="+item,
				   beforeSend: function(data){
				   	 $('#'+obj+'').html("");
				   },
				   success: function(data){
				     $('#'+obj+'').html(data);
				   }
				 });
	}
	
	function RefreshDivAjaxPrinc(objID,op,id){	
	
				$('#loading').ajaxStart(function(){
					$(this).show();
				})
				$('#loading').ajaxStop(function(){
					$(this).hide();
				})
				
				$.ajax({
				   type: "GET",
				   url: "view.php",
				   data: "itemID="+op+"&id="+id,
				   beforeSend: function(data){
				   	 $('#'+objID+'').html("");
				   },
				   success: function(data){
				     $('#'+objID+'').html(data);
				   }
				 });
	}
	
	function RefreshDivAjaxPub(exibirDetPub,ocultaDiv,id,voltar){	
				
					
				$('#loading').ajaxStart(function(){
					$(this).show();
				})
				$('#loading').ajaxStop(function(){
					$(this).hide();
				})
				
				$.ajax({
				   type: "GET",
				   url: "view.php",
				   data: "itemID="+exibirDetPub+"&retornar="+voltar+"&id="+id,
				   beforeSend: function(data){
				   	 $('#'+ocultaDiv+'').html("");
				   },
				   success: function(data){
				     $('#'+ocultaDiv+'').html(data);
				   }
				 });
				
	}
	
	function exibirPaginacao(item, setor, pag){	
				
				$("#T").html("");
				$('#loading').ajaxStart(function(){
					$(this).show();
				})
				$('#loading').ajaxStop(function(){
					$(this).hide();
				})
				
				$.ajax({
				   type: "GET",
				   url: "view.php",
				   data: "itemID="+ item +"&setor="+ setor +"&pag="+ pag,
				   beforeSend: function(data){
				   	 $('#boxRefresh').html("");
				   },
				   success: function(data){
				     $('#boxRefresh').html(data);
				   }
				 });
	}
	
	function ArredondaCantosAjax(){
		$("box").corner();
	}	
	
	
	function carregarConteudo(elemento_pai, pagina) {
	
	document.getElementById(elemento_pai).innerHTML = ""; // efetua a limpeza da Tag que cont�m o id conteudo
	
	documentoXml = carregarDococumentoXml(pagina+".xml"); // chama uma fun��o para carregar o documento XML
	
	elementoXml = documentoXml.getElementsByTagName("texto"); // seleciona todas as tags texto dentro do documento XML
	
	for (i=0;i<elementoXml.length;i++){ // faz um loop contando a quantidade de elementos tag texto dentro do arquivo XML
		
	local_exibir = document.getElementById(elemento_pai); // variavel - captura a tag com id conteudo
	elemento_div = document.createElement("DIV"); // cria uma tag div
	elemento_div.style.padding="5px 10px 5px 10px"; // aplica um estilo para a div criada acima padding: ;
	var informacoes = elementoXml[i].childNodes[0].nodeValue; // captura os valores dentros das tags visitadas pelo loop
	elemento_texto = document.createTextNode(informacoes); // cria um n� de valores
	
	elemento_div.appendChild(elemento_texto); // aplica o n� de valores dentro do n� div
	local_exibir.appendChild(elemento_div); // aplica o n� div dentro no n� conteudo que est� na p�gina html
	
	} // fim do loop

}

function carregarDococumentoXml(pagina){
	
	if(window.ActiveXObject){ // verifica qual browser o usuario esta usando
		documentoXml = new ActiveXObject("Microsoft.XMLDOM"); // Internet Explorer
	} else {
		documentoXml = document.implementation.createDocument("","",null); // Mozilla, Safari...
	}
	
	documentoXml.async = false;
	documentoXml.load(pagina); // carrega a p�gina enviada como parametro
	return(documentoXml); // retorna o documento XML carregado

}
	
	
