//########### Funções Globais #####################//
	var ie4
	var ie5
	var ie6
	var ns4
	var ns6
	
	ie4 = (document.all) ? true : false;
	ie5 = (navigator.userAgent.indexOf("MSIE 5.")>-1) ? true : false;
	ie6 = (navigator.userAgent.indexOf("MSIE 6.")>-1) ? true : false;
	ns4 = (document.layers) ? true : false;
	ns6 = (document.getElementById && !document.all) ? true : false;
	
	url = window.location.href;
	url = (url.indexOf("?") != -1) ? url.substring(0, url.indexOf("?")) : url;
	url = (url.indexOf("#") != -1) ? url.replace("#", "") : url;
//------------------------------------------------------------------------------
function onay() { 
				return confirm("Deseja realmente apagar?"); 
				}
//------------------------------------------------------------------------------

function WinOpen(td, url, param, name, width, height, maximiza){
	var str = "height=" + height + ",innerHeight=" + height;
	str += ",width=" + width + ",innerWidth=" + width;
	str +=",scrollbars=yes, status=no";
	str +="," + maximiza;
	if (window.screen) {
		if(name == 'banner'){
			str += ",left=5, screenX=5, screenLeft=5";
			str += ",top=20, screenY=20, screenTop=20";
		}else{
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		
		var xc = (aw - width) / 2;
		var yc = (ah - height) / 2;
		
		str += ",left=" + xc + ",screenX=" + xc;
		str += ",top=" + yc + ",screenY=" + yc;
		}
	}
	
	if(td != 'null'){
		len_td = window.document.getElementById(td).childNodes.length;
		val_td = window.document.getElementById(td).childNodes[0].nodeName;
		if(len_td > 1 || val_td.toLowerCase() == 'table'){	
			window.open(url+param, name, str,scrollbars='yes');
		}else{		
			alert("Para iniciar a impressão é necessário obter algum, resultado no formulário de busca.");
			return false;
		}
	}else{
		window.open(url+param, name, str,scrollbars='yes');
	}
}

//------------------------------------------------------------------------------
//ocultar mostrar linhas tabela
function mostrahelp(linha,img) {
var linha = document.getElementById(linha);
  if (linha.style.display=='none') {
   linha.style.display='';
   if(img != null) {
      img.src='figuras/recolhe.gif';
   }
  } else {
   linha.style.display='none';
   if(img != null) {
      img.src='figuras/expand.gif';
   }
  }
}
//------------------------------------------------------------------------------

//===============================================================
function resize_iframe(){
document.getElementById("iframe1").height="" // required for Moz, value can be "", null, or integer
document.getElementById('iframe1').height=window.frames["iframe1"].document.body.scrollHeight
}
// no iframe onload="resize_iframe();"


//================================================================
function redimensiona(iframe1)
{
document.all[iframe1].height = document.frames[iframe1].document.body.scrollHeight+40;
}



// Adiciona Eventos
function addEvent(obj, evType, fn){
	if (obj.addEventListener)
		obj.addEventListener(evType, fn, true)
	if (obj.attachEvent)
		obj.attachEvent("on"+evType, fn)
}


// Gera o aumento do iframe na pagina principal ----------------------
function setSizeIframe(){
	if(typeof(window.parent.document.getElementById("iframe1")) == "object"){
		iframe = window.parent.document.getElementById("iframe1");
		if(iframe != null){
			if(typeof(window.document.getElementById("tblLoad")) == "object"){
				tabela = window.document.getElementById("tblLoad");
				if(tabela != null){
					aux = iframe;
					while(aux.nodeName.toLowerCase() != "td"){
						if (navigator.appName == "Netscape")
							aux = aux.parentNode;
						else
							aux = aux.parentElement;
					}
					iframe.height = 0;
					iframe.height = tabela.offsetHeight;
					iframe.width = aux.offsetWidth;				
					tabela.width = aux.offsetWidth;
				}
			}
		}
	}
}addEvent(window, "load", setSizeIframe);



//  Efeitos da tarja de msg --------------------------------------------------------------------

function bG(jF){setTimeout('ai()',jF);return false;};
 function ai(){dc=document.getElementById('statusmessage');
 	if(dA==false){
		if(dc){dc.innerHTML='';dc.style.display="none";}return false;}
 		dA=false;
	 if(dc)opacity('statusmessage',100,0,500);return false;};
 
 function c(jH,iM){dc=document.getElementById('statusmessage');
 	if(dc){dc.innerHTML=iM;dc.style.display="block";opacity('statusmessage',0,100,200);dA=true;}
	else return false;
	switch(jH){case 0:bG(3000);break;case 1:bG(5000);break;case 2:bG(9000);break;case 3:break;default:ai();break;}return false;};	 function opacity(id,opacStart,opacEnd,millisec){
		var speed=Math.round(millisec/100);
		var timer=0;
		if(opacStart>opacEnd){
			for(i=opacStart;i>=opacEnd;i--){setTimeout("gD("+i+",'"+id+"')",(timer*speed));timer++;}}
			else 
 			if(opacStart<opacEnd){for(i=opacStart;i<=opacEnd;i++){setTimeout("gD("+i+",'"+id+"')",(timer*speed));timer++;}}}; function gD(opacity,id){
				var mainobject=document.getElementById(id);if(!mainobject)return false;
				var object=document.getElementById(id).style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+opacity+")";};
				function Y(limitField,limitCount,limitNum,jv){if(limitField.value.length>limitNum){limitField.value=limitField.value.substring(0,limitNum);}else{limitCount.innerHTML=limitNum-(limitField.value.length+jv);}};

 
 
 function J(iO){
	 var jf=document.getElementById(iO);
 		if(!jf){c(0,"Falha ao copiar para a área de transferência, utilize CTRL+C");return false;}
 var text2copy=jf.value;
		if(window.clipboardData&&clipboardData.setData&&0){window.clipboardData.setData("Text",text2copy);c(0,"Link copiado com sucesso para área de transferência (Ctrl + V)");}
 		else{
	 		var flashcopier='flashcopier';
		if(!document.getElementById(flashcopier)){
	 		var divholder=document.createElement('div');divholder.id=flashcopier;document.body.appendChild(divholder);}document.getElementById(flashcopier).innerHTML='';
			var divinfo='<embed src="clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';document.getElementById(flashcopier).innerHTML=divinfo;c(0,"Link copiado com sucesso para área de transferência  (Ctrl + V)!");}return false;};	
			
// -------------------------------------------------------------------------------------------------------
