function AvisoSISBOV(link)
{
        var resp = confirm("A Coordernação de Sistemas de Rastreabilidade informa que a partir do dia 20 de Agosto de 2007, Segunda-Feira estarão sendo aplicadas no Sistema de Informática o SISBOV as regras de recontagem de quarentena constante, estabelecidos com base na Instrução Normativa 17/20.\nCampos que afetam recontagem de quarentena:\n\tNome do Produtor\n\tCPF do Produtor\n\tCNPJ do Produtor\n\tNome da Propriedade\n\tNIRF da Propriedade\n\tINCRA da Propriedade\n\tMunicípio de Localização da Propriedade");
        if (resp) window.location = link;
}

function mensagem(msg,link)
{
	var resp = confirm(msg);
	if (resp) window.location = link;
}

function fz(pp_nome,pp_nirf,ws_id)
{
        return "<b>NOME: </b>"+pp_nome+"<br>"+
"<b>NIRF/INCRA</b>: "+pp_nirf+"<br>"+
"<b>C&oacute;digo BND:</b> "+ws_id;
}

function an(an_dtsisbov,an_dtlibabate)
{
        return "<b>Data de Envio: </b> "+an_dtsisbov+"<br>"+
"<b>Data de Libera&ccedil;&atilde;o para Abate:</b> "+an_dtlibabate;
}

function municipios(est_codigo, obj_id) {
/*
O Ajax foi primeiro introduzido no Internet Explorer sob a forma de um objecto ActiveX chamado XMLHTTP.
Depois, o Mozilla, o Safari e outros browsers fizeram o mesmo, implementando uma classe de nome XMLHttpRequest
que suporta os mÃ©todos e as propriedades do objecto ActiveX original da Microsoft.
Portanto, temos os mesmos recursos em classes distintas, dependendo do navegador do usuÃ¡rio.
Padronizar para que, nÃ£o? Esses caras estÃ£o certinhos... errado tÃ¡ a BÃ­blia hehe
Enfim, para driblar essa bagunÃ§a, temos que instanciar o objeto via tentativa e erro.
*/
	  // Verifica se o browser tem suporte a AJAX
	  try {
		 // Tenta instanciar nosso objeto AJAX para IE
         ajax = new ActiveXObject("Microsoft.XMLHTTP");
      } 
      catch(e) {
         try {
            ajax = new ActiveXObject("Msxml2.XMLHTTP");
         }
	     catch(ex) {
            try {
				// Tenta instancia nosso objeto AJAX para Mozilla, Safari, ...
               ajax = new XMLHttpRequest();
            }
			// Se nÃ£o virou nada, Ã© porque o brownser nÃ£o suporta a tecnologia AJAX
			catch(exc) {
               alert("Esse browser nÃ£o tem recursos para uso do Ajax");
               ajax = null;
            }
         }
      }

	  // Se tiver suporte AJAX
	  if(ajax) {
  
		 /*
			MÃ©todo OPEN ( arg1, arg2, arg3 )
			arg1 = MÃ©todo do pedido HTML ( GET, POST, HEAD, ou whatever )
			arg2 = URL de chamada
			arg3 = Define se a chama serÃ¡ assÃ­ncrona, isto Ã©, se a execuÃ§Ã£o da funÃ§Ã£o Javascript irÃ¡ continuar enquanto
						a resposta do servidor nÃ£o for recebida
		*/
		 ajax.open("POST", "ajax_municipios.php?est_codigo="+est_codigo, true);
		
		 /*
			Note-se que se pretende enviar (POST) dados, vocÃª deve alterar o tipo MIME do pedido usando a seguinte linha:
		 */
		 ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

		 /*
			A prÃ³xima coisa a ser feita Ã© decidir o que quer fazer apÃ³s receber a resposta do servidor ao seu pedido.
			Nesta etapa sÃ³ precisa de dizer ao objecto pedido HTTP que funÃ§Ã£o JavaScript irÃ¡ processar a resposta.
			Isto Ã© feito definindo a propriedade onreadystatechange do objecto ao nome da funÃ§Ã£o JavaScript que
			pretende utilizar

			A lista completa dos valores readyState Ã© a seguinte:
			* 0 (nÃ£o inicializada)
			*  1 (carregando)
			* 2 (carregado)
			* 3 (interactivo)
			* 4 (completo) 
		 */

		 ajax.onreadystatechange = function()
		{

			// Se carregou todo o XML de resposta, vamos processÃ¡-lo
			var combo = document.getElementById(obj_id).options;
			var oOption;

			switch(ajax.readyState)
			 {
				case 2:
				case 3:
				case 4:
				   if(ajax.responseXML) {
					  processXML_municipios(ajax.responseXML, obj_id);
				   }
				break;

				case 1:
					combo.length = 0;
					oOption = new Option("Carregando...");
					combo.add(oOption);
				break;
			 }
			
         }

		// Manda bala na requisiÃ§Ã£o
         ajax.send(1);
      }
}


/* funÃ§Ã£o integrante da nossa funÃ§Ã£o AJAX acima que Ã© responsÃ¡vel por processar o arquivo XML de retorno */
function processXML_municipios(obj, obj_id)
{
	var combo = document.getElementById(obj_id).options;
	var dataArray   = obj.getElementsByTagName("municipio");
	var oOption;

	combo.length = dataArray.length+1;
	combo[0].innerHTML = "Escolha";
	combo[0].value=0;

	if(dataArray.length > 0)
	{
		var item;
        for(var i = 0 ; i < dataArray.length ; i++)
		{
			item = dataArray[i];
			combo[i+1].innerHTML = item.getElementsByTagName("mun_nome")[0].firstChild.nodeValue;
			combo[i+1].value = item.getElementsByTagName("mun_codigo")[0].firstChild.nodeValue;
		}
	}

}

/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint_bottom(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x+"px" // dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y+25+"px" // dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function showhint_right(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left= dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top= dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox
