		var blnAdicionar 	= false
		var blnNovo			= false
		var blnAtualizar	= false
		var blnExcluir		= false
		var blnConsultar	= false
		var blnEditar		= false
		var blnExportar		= false
		if(acao==ADICIONAR)
			blnAdicionar = true;
		else if(acao==NOVO)
			blnNovo =  true;
		else if(acao==ATUALIZAR)
			blnAtualizar = true;
		else if(acao==EXCLUIR)
			blnExcluir = true;
		else if(acao==CONSULTAR)
			blnConsultar = true;
		else if(acao==EDITAR)
			blnEditar = true;
		else if(acao==EXPORTAR)
			blnExportar = true;
		//------------------------------------------------------------------------------------------------
		function titulo(pObj, pTitulo) {
			var strOut = '';
			strOut+= '<table cellpadding="0" cellspacing="0" border="0" width="730">'	;
			strOut+= '<tr>';
			strOut+= '<td class="TituloArea">&nbsp;' + pTitulo + '</td>';
			strOut+= '</tr>';
			strOut+= '<tr>';
			strOut+= '<td bgColor="#314118"><img src="./Imagens/pixel.gif" width="1" height="1"></td>';
			strOut+= '</tr>';			
			strOut+= '</table>'
			strOut+= '<BR>'
			pObj.innerHTML = strOut;
		}
		//------------------------------------------------------------------------------------------------
		function subTitulo(pObj, pTitulo) {
			var strOut = '';
			strOut+= '<table cellpadding="0" cellspacing="0" border="0" width="730">'	;
			strOut+= '<tr>';
			strOut+= '<td class="SubTituloArea">&nbsp;' + pTitulo + '</td>';
			strOut+= '</tr>';
			strOut+= '<tr>';
			strOut+= '<td bgColor="steelblue"><img src="./Imagens/pixel.gif" width="1" height="1"></td>';
			strOut+= '</tr>';			
			strOut+= '</table>'
			pObj.innerHTML = strOut;
		}
		//------------------------------------------------------------------------------------------------
		function recarregaSeNS(blnInit) 		{  
			  if (blnInit==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=recarregaSeNS; }}
			  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
		}
		//------------------------------------------------------------------------------------------------		
		function pressionaEnter(frmFormulario)		{
		   var Key = window.event.keyCode;
		   if (Key == 13)
		     return frmFormulario.submit();
		   return true;
		}		
		//------------------------------------------------------------------------------------------------		
		function mudaEstilo(obj, novoEstilo) {
			obj.className = novoEstilo;
		}		
		//------------------------------------------------------------------------------------------------		
		function imprimir() {
			var comp, alt, objConteudo;
			objConteudo = pegaObjeto("divConteudo");
			comp = 780;
			alt = 400;
			win2 = window.open("about:blank","Imprimir","status=yes,menubar=yes,toolbar=yes,height=" + alt + ",width=" + comp + ",resizable=yes,left=0,top=0,screenX=" + comp + ",screenY=" + alt + ",scrollbars=yes");
			win2.focus();			
			with(win2.document) {
				open();
				write("<html>");
				write("<head>");
				write("<title>Tela de Impressão</title>");
				write(estiloADM());
				write("</head>");
				write("<body>");
				write("<table width=100% ><tr class='CabecalhoImpressao'>"); 
				write("<tr><td bgcolor='#CCCCCC'><font face='Verdana,arial'><b>Sistema " + TITULO_SISTEMA +  " </b></font></td></tr></table>");
				write(objConteudo.innerHTML);
				write("</body>");
				write("</html>")
				close();
			}
			win2.self.print();
		}
//------------------------------------------------------------------------------------------------						
		function estiloADM(){
			return "<LINK REL='STYLESHEET' TYPE='text/css' HREF='../Includes/Estilos/CssPadrao.css'><LINK REL='STYLESHEET' TYPE='text/css' HREF='../Includes/Estilos/CssTabela.css'> <LINK REL='STYLESHEET' TYPE='text/css' HREF='../Includes/Estilos/CssMenu.css'>";
		}
		
		//------------------------------------------------------------------------------------------------		
		function linkExportar(plink) {
			var comp, alt;
			//comp = window.screen.availWidth - 10;
			//alt = window.screen.availHeight - 150;
			comp = 670;
			alt = 400;
			win2 = window.open("about:blank","Exportar","status=yes,menubar=yes,toolbar=yes,height=" + alt + ",width=" + comp + ",resizable=yes,left=0,top=0,screenX=" + comp + ",screenY=" + alt + ",scrollbars=yes");
			var objDataHora = new DataHora("objDataHora");
			with(win2.document) {
				open();
				write("<html>");
				write("<head>");
				write("<title>Tela de Exportação</title>");
				write(selecionaEstilo());
				write("</head>");
				write("<body>");
				write("<table width=100% class=CabecalhoImpressao><tr>"); 
				write("<td>Sistema " + TITULO_SISTEMA +  " </td>");
				write("<td align=right>" + objDataHora.pegaData() + " - " + objDataHora.pegaHora() + "</td>");
				write("</tr></table>");
				write("<a href=\"" + plink + "\">Cliqui aqui</a>");
				write("</body>");
				write("</html>")
				close();
			}
			win2.focus();
		}		
		//------------------------------------------------------------------------------------------------
		function mostraObjeto(objMostra) {
			objMostra.style.display = "block";
		}
		//------------------------------------------------------------------------------------------------
		function escondeObjeto(objEsconde) {
			objEsconde.style.display = "none";
		}
		//------------------------------------------------------------------------------------------------		
		function formataData(campo,teclapress) {
			var tecla = teclapress.keyCode;
			vr = document.frm[campo].value;
			vr = vr.replace( ".", "" );
			vr = vr.replace( "/", "" );
			vr = vr.replace( "/", "" );
			tam = vr.length + 1;
	
			if ( tecla != 9 && tecla != 8 ){
				if ( tam > 2 && tam < 5 )
					document.frm[campo].value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
				if ( tam >= 5 && tam <= 10 )
					document.frm[campo].value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); }
		}
		//------------------------------------------------------------------------------------------------		
		function abreCalendario(campo) {
			setDateField(campo);
			newWin = window.open('about:blank','cal','dependent=yes,width=210,height=230,screenX=200,screenY=300,titlebar=yes')	
			newWin.document.write("<FRAMESET ROWS='70,*' FRAMEBORDER='0'>\n" + "  <FRAME NAME='topCalFrame' SRC='javascript:parent.opener.calDocTop' SCROLLING='no'>\n" + "  <FRAME NAME='bottomCalFrame' SRC='javascript:parent.opener.calDocBottom' SCROLLING='no'>\n" + "</FRAMESET>\n");
		}
		//------------------------------------------------------------------------------------------------
	function limpar(strCampoInicial)
	{

		//var codObs;
		var objFormulario;
		var objPrimeiro;
		var blnAchou;
		var i;
		var intTatil;
		
		objFormulario = parent.frConteudo.document.frm;
				
		var total;
		blnAchou = false;
		intTatil = 0
		for (i = 0; i < objFormulario.elements.length; i ++)
		{
			if(objFormulario.elements[i].type=='text' || objFormulario.elements[i].type=='password'){
				objFormulario.elements[i].value = '';
				intTatil++;
			}
			else if (objFormulario.elements[i].type=='checkbox'){
					objFormulario.elements[i].checked = false;
					intTatil++;
				}
				else if (objFormulario.elements[i].type=='select-one'){
						objFormulario.elements[i].options[0].selected = true;
						intTatil++;
					}
					else if (objFormulario.elements[i].type=='select-multiple'){				
							intTatil++;
							/*
							total = objFormulario.elements[j].length;
							for (var k = 0; k < total; k++) {
									//alert(",erda");
									document.frm.elements[j].options[0] =  null;
							}
							*/						
						}
						else  if (objFormulario.elements[i].type=='textarea'){
									objFormulario.elements[i].value = '';
										intTatil++;
						}	 
						
			if(intTatil==1) objPrimeiro = objFormulario.elements[i];
			if(strCampoInicial!=null) {
				if(objFormulario.elements[i].name = strCampoInicial) {
					objFormulario.elements[i].focus();
					blnAchou = true;
				}
			}
		}
		if(!blnAchou) {
			objPrimeiro.focus();
		}
	}
		//------------------------------------------------------------------------------------------------	
	function maiuscula()
	{
		var Key = window.event.keyCode;
		event.cancelBubble = true;
		if((Key > 96 && Key < 123)) window.event.keyCode = Key - 32;
		event.returnValue = true;
	}
		//------------------------------------------------------------------------------------------------	
	function defineStatusBar(mensagem) 
	{
    	//window.defaultStatus=mensagem; 
		return true;
	}
		//------------------------------------------------------------------------------------------------	
	function gravarStatus() 
	{
    	var strStatus = new String();
		var objFormulario;
		var i;
		
		//if((parent.frStatus.strStatus=='') || (parent.frStatus.strStatus==null))
		strStatus = '?'
		
		objFormulario = parent.frConteudo.document.frm;
		for (i = 0; i < objFormulario.elements.length; i++)
		{
				strStatus+= objFormulario.elements[i].name + '=' + objFormulario.elements[i].value + '&';
		}
		parent.frStatus.strStatus = strStatus;
	}
		//------------------------------------------------------------------------------------------------
	function limparStatus(mensagem) 
	{
    	if((parent.frStatus.strStatus!='') || (parent.frStatus.strStatus!=null)) {
			parent.frStatus.strStatus = '';
		}
	}
	String.prototype.replace2 = function(s, n){
			return this.split(s).join (n);
		}

	//------------------------------------------------------------------------------------------------
	function replace(Content, SearchFor, ReplaceWith) {

		var tmpContent = Content;
		var tmpBefore = new String();   
		var tmpAfter = new String();
		var tmpOutput = new String();
		var intBefore = 0;
		var intAfter = 0;

		if (SearchFor.length == 0)
			return;
	
	   while (tmpContent.toUpperCase().indexOf(SearchFor.toUpperCase()) > -1) {
	      // Get all content before the match
    	  intBefore = tmpContent.toUpperCase().indexOf(SearchFor.toUpperCase());
	      tmpBefore = tmpContent.substring(0, intBefore);
	      tmpOutput = tmpOutput + tmpBefore;

    	  // Get the string to replace
	      tmpOutput = tmpOutput + ReplaceWith;
		  
	      // Get the rest of the content after the match until
	      // the next match or the end of the content
	      intAfter = tmpContent.length - SearchFor.length + 1;
    	  tmpContent = tmpContent.substring(intBefore + SearchFor.length);
	
   		}	
	
		return tmpOutput + tmpContent;

	}
	//------------------------------------------------------------------------------------------------	
	function multiploAdicionar() {
		alert("Os dados foram adicionados com sucesso.");
		parent.frConteudo.limpar();
		parent.frConteudo.document.frm.chkMultiploAdicionar.checked = true;
	}
	//------------------------------------------------------------------------------------------------		
	function testaBrowser(strDiv) {			
			var strOut = '';
			if (!document.all || !document.getElementById) {
				strOut = '<table cellpadding="0" cellspacing="0" border="0" width="780">';
				strOut+= '<tr>';
				strOut+= '<td class="TextoAlerta"><b>Atenção:</b><br>Seu navegador de internet não suporta todas as funcionalidades deste sistema.<br>Erros poderão ocorrer.<br>Para o total uso dos recursos da aplicação, é recomendável o uso do navegador Internet Explorer 6.0, da Microsoft.<br> <a href="http://www.microsoft.com/windows/ie/downloads/ie6/default.asp" target="_blank">Clique aqui para instalá-lo.</a></td>'
				strOut+= '</tr>';
				strOut+= '</table>';
				if (strDiv!=null) {
					pegaObjeto(strDiv).innerHTML = strOut;
				}
			}		
		}
		//------------------------------------------------------------------------------------------------		
		function escreveCredito() {
			var strOut = '';
			strOut = '<a href="http://www.cryo.com.br" class="LinkCryo" target="_blank">by Cryo</a> / V3.1';
			document.write(strOut)
		}
		//------------------------------------------------------------------------------------------------		
		function maximizarJanela() {
			parent.parent.window.resizeTo(Math.ceil(screen.availWidth),Math.ceil(screen.availHeight));
			parent.parent.window.moveTo(0,0);
		}
		//------------------------------------------------------------------------------------------------		
		function normalizarJanela() {
			var windowW = 800;
			var windowH = 550;	
			var windowX = Math.ceil( (window.screen.width  - windowW) / 2 );
			var windowY = Math.ceil( (window.screen.height - windowH) / 2 );
			parent.parent.window.resizeTo(800,550);
			parent.parent.window.moveTo(Math.ceil( windowX ),Math.ceil( windowY ) );
		}
		//------------------------------------------------------------------------------------------------		
		function minimizarJanela() {
			parent.parent.window.resizeTo(800,20);
			parent.parent.window.moveTo(Math.ceil( windowX ),Math.ceil( windowY ) );
		}
		//------------------------------------------------------------------------------------------------				
		function mudarParametrosGET() {
			var objFormulario = pegaObjeto("frm")
			var strAction = '';
			var i;
			
			for (i = 0; i < objFormulario.elements.length; i ++) {
				strAction+= objFormulario.elements[i].name + "=" + escape(objFormulario.elements[i].value) + "&"
			}
			
			return strAction;
		}
		//------------------------------------------------------------------------------------------------				
		function mudarNomeUsuario(strNomeUsuario) {	
			parent.frStatusBar.document.all("spnNomeUsuario").innerHTML = strNomeUsuario;
		}
		//------------------------------------------------------------------------------------------------				
		function statusCarregando(strSt) {
			if(UTILIZAR_CARREGANDO=="S") {
				document.frmCarregando.inpTxtCarregando.value = strSt;
			}
		}
	function checkRadio(obj,strValue){

	if(obj.length != undefined)
	{		
			var i, j
	        var ret = false;
			j=0;
	        for (var i = 0; i < obj.length; i++) {		
			if (obj[i].checked)
				if (obj[i].value==strValue) {
		        	return true;

	}
	        }
 
	}else{
		 if (obj.checked) return true;
	}

       return false;

}
