//########### 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;
	
	
//------------------------------------------------------------------------------
//              CONFIRMAÇÃO ANTES DE EXECUTAR
//------------------------------------------------------------------------------
function onay() { 
return confirm("Deseja realmente apagar?"); 
}
				
				
//------------------------------------------------------------------------------
//              ATUALIZAR A JANELA     
//------------------------------------------------------------------------------
function atualiza(tempo){
window.setTimeout("window.location.reload(true);",tempo);
//window.setTimeout("window.location.reload(true);",15000);
}
//------------------------------------------------------------------------------
//              FECHA E ATUALIZA A JANELA     
//------------------------------------------------------------------------------

function atualiza_fecha(){
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow) {
    window.opener.progressWindow.close()
  }
window.close();
  
//window.opener.document.getElementById("iframe1").location.reload();

//window.opener.getElementById("iframe1").location.reload();
//window.close();
//window.opener.location.reload(true);
//window.location.reload(true);
//window.opener.document.location.reload(true);
}


//------------------------------------------------------------------------------
//              ABRIR JANELA
//------------------------------------------------------------------------------

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) {
		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;
		
	}
	
	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';
   }
  }
}
//------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------ //
// Verificar qual navegador
// ------------------------------------------------------------------------------------------ //
function QualNavegador(){
	var u = navigator.userAgent.toLowerCase();
	var s = navigator.appName;	
	if(u.indexOf('safari')!= -1)
		return "SA";	
	if ( s == "Microsoft Internet Explorer" )
		return "IE";
	else if ( s == "Netscape" )
		return "NE";
	else
		return "";
}


//------------------------------------------------------------------------------
//RESIZE IFRAME
//------------------------------------------------------------------------------
// no iframe onload="resize_iframe('id');"

function resize_iframeIE(frameId){
try{
frame = document.getElementById(frameId);
innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
objToResize = (frame.style) ? frame.style : frame;
objToResize.height = innerDoc.body.scrollHeight + 30;
}
catch(err){
window.status = err.message;
}

}

function resize_iframe(IDiframe){
	if ( QualNavegador() == "IE" ){
		resize_iframeIE(IDiframe)
	}
	else{
		// required for Moz, value can be "", null, or integer
		document.getElementById(IDiframe).height="";
		document.getElementById('iframe1').height=window.frames['iframe1'].document.body.scrollHeight;
	}
}

//------------------------------------------------------------------------------
//  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;};	
			
// -------------------------------------------------------------------------------------------------------