function checkBrowser(){
  this.ver=navigator.appVersion
  this.dom=document.getElementById?1:0
  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
  this.ie4=(document.all && !this.dom)?1:0;
  this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
  this.ns4=(document.layers && !this.dom)?1:0;
  this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns5)
  return this
}
bw=new checkBrowser()
function hideIt(){
	try{
	  if(bw.bw){
	  div="divLoadCont";
	  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?document[div]:0;
	  obj.display='none';
	  
	  div="formularios";
	  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?document[div]:0;
	  obj.display='';
	  }
	}
	catch(err){
	}
}

function showIt(){
	try{
	  if(bw.bw){
	  div="divLoadCont";
	  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?document[div]:0;
	  obj.display='';
	  
	  div="formularios";
	  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?document[div]:0;
	  obj.display='none';
	  }
	 }
	 catch(err) {
	 }
}

function createIt(){
	try{
		if(bw.bw){
			document.write('<div id="divLoadCont"><table width="100%" height="300px" align="rigth" valign="middle"><tr><td width="100%" height="100%" align="center" valign="middle"><FONT FACE="Verdana" SIZE="2" COLOR="#000000"><B>Carregando...</B></FONT></td></tr></table></div>')
			}	
		  div="formularios";
		  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?document[div]:0;
		  obj.display='none';
	} 
	catch(err){
		
	}
}	

function irParaFluxo(_noFluxo, _noForm, _op){
	document.main.op.value = _op;
	document.main.noFluxo.value = _noFluxo;
	document.main.noForm.value = _noForm;
	document.main.submit();
}

function back(){
	irParaFluxo(document.main.noFluxo.value, document.main.noForm.value,"FormCmd");
}

function irParaProduto(_noFluxo, _noForm, _op, _codPSA){
	document.main.op.value = _op;
	document.main.noFluxo.value = _noFluxo;
	document.main.noForm.value = _noForm;
	document.main.codPSA.value = _codPSA;
	document.main.submit();
}

function unCheckRadio(oRadio) {
	  var or = document.getElementsByName(oRadio);
      for (var i = 0; i < or.length; i++) {
         or[i].checked = false;
     }
}
function limita(textarea, campo1, qtd){
	retorno = true;
	obj2 = eval("document.main." + textarea);
	obj1 = eval("document.main." + campo1);
	if(obj2.value.length >= (qtd)){
		obj2.value = obj2.value.substring(0, qtd);
		
		retorno = false;
	}
	obj1.value = (qtd) - obj2.value.length;
	return retorno;
}
