<!--

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


/**
 * This array is used to remember mark status of rows in browse mode
 */
var marked_row = new Array;


/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   interger  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


/****************************************************************
* VALIDA CAMPO VAZIO                                            *
*****************************************************************
* EstaVazio(nome)
*/
function EstaVazio(campo){
   if (campo > ""){
      return false;
   }else{
      return true;
   }
}

/****************************************************************
* VALIDA CAMPO NUMERICO                                         *
*****************************************************************
* (checkNum(nr_endereco,false,"") == false) SO ACEITA NUMEROS
* (checkNum(nr_endereco,false,"-") == false) ACEITA TAMBEM O -
*/
function checkNum (campo, flgChar, charac){
   for (var i = 0; i < campo.length; i++){
      var ch = campo.substring(i, i + 1)
      if (flgChar == true){
         if (ch != charac){
            if (ch < "0" || ch > "9")
               return false;
            }
      }else{
         if (ch < "0" || ch > "9")
            return false;
         }
      }
   return true;
}

/****************************************************************
* VALIDACAO DE CPF                                              *
*****************************************************************
* checaCPF(document.cadastro.cpf.value)
*/ 
function checaCPF (CPF) {
   if (CPF.length != 11 || 
   	CPF == "00000000000" || CPF == "11111111111" || CPF == "33333333333" || 
   	CPF == "44444444444" || CPF == "55555555555" || CPF == "66666666666" || CPF == "77777777777" ||
      CPF == "88888888888" || CPF == "99999999999" || CPF == "01234567890" ){
      return true;
   } else {
      soma = 0;
      for (i=0; i < 9; i ++){
         soma += parseInt(CPF.charAt(i)) * (10 - i);
      }
      resto = 11 - (soma % 11);
      if (resto > 9){
      	resto = 0;
      }
      if (resto != parseInt(CPF.charAt(9))){
      	return true;
      } else { 
         soma = 0;
         for (i = 0; i < 10; i ++){
            soma += parseInt(CPF.charAt(i)) * (11 - i);
         }
         resto = 11 - (soma % 11);
         if (resto > 9){
            resto = 0;
         }
         if (resto != parseInt(CPF.charAt(10))){
         	return true;
         }
		}
   }
   return false;
}

/****************************************************************
* VALIDACAO DE CNPJ                                             *
*****************************************************************
* checaCNPJ(document.cadastro.cpf.value)
*/
function checaCNPJ (CNPJ) {
   if (CNPJ.length != 14 || 
  		 CNPJ == "11111111111111" || CNPJ == "22222222222222" || CNPJ == "33333333333333" ||
  		 CNPJ == "44444444444444" || CNPJ == "55555555555555" || CNPJ == "66666666666666" || CNPJ == "77777777777777" ||
       CNPJ == "88888888888888" || CNPJ == "99999999999999" || CNPJ == "01234567890123" ){
      return true;
   } else {
		var dig1=0; 
		var dig2=0; 
		var x; 
		var Mult1 = '543298765432'; 
		var Mult2 = '6543298765432'; 
		for(x=0; x<=11; x++) { 
			dig1 = dig1 +(parseInt(CNPJ.slice(x,x+1)) * parseInt(Mult1.slice(x,x+1))); 
		} 
		for(x=0; x<=12; x++) { 
			dig2 = dig2 + (parseInt(CNPJ.slice(x, x+1)) * parseInt(Mult2.slice(x,x+1)));
		} 
		dig1 = (dig1 * 10)%11; 
		dig2 = (dig2 * 10)%11; 
		if (dig1 == 10) {dig1 = 0;} 
		if (dig2 == 10) {dig2 = 0;} 
		if (dig1 != parseInt(CNPJ.slice(12, 13))) { 
			return true; 
		} else { 
			if (dig2 != parseInt(CNPJ.slice(13, 14))) { 
				return true; 
			} else { 
				return false; 
			} 
		} 
	}    
}

/****************************************************************
* VALIDACAO DE EMAIL                                            *
*****************************************************************
* (!IsEmail(trim(document.cadastro.email.value)))
*/
function IsEmail(str) {
	//verifica se o e-mail digitado é válido 
	var strAlfa = "ABCDEFGHIJKLMNOPQRSTUWVXYZ";
	var strNum = "0123456789";
	var strSpecial = "_.-@/";
	var strValid = strAlfa + strNum + strSpecial;
	var email = str.toUpperCase();
	//verifica se os caracteres do e-mail são válidos
	for (i=0; i<email.length; i++) {
		if (strValid.indexOf(email.charAt(i)) < 0) {
			return false;
		}
	}
	var strC = "@."; 
	//verifica se o e-mail contém @ e . (caracteres obrigatórios)
	for (i=0; i<strC.length; i++) {
		if (email.indexOf(strC.charAt(i)) < 0) 
			return false;
	}
	if (email.indexOf("@") != email.lastIndexOf("@"))
		return false;
	if (email.indexOf("@") > email.lastIndexOf("."))
	    return false;
	if (email.charAt(email.indexOf("@") + 1) == ".")
	    return false;
	if (!(email.indexOf("@") != 0 && email.lastIndexOf(".") != email.length-1))
		return false;
	return true;
}


/****************************************************************
* LIMPA ESPACOS NA VARIAVEL                                     *
*****************************************************************
* trim(document.cadastro.senha.value) != ""
*/
function trim(theString) {
	var aString = theString;
	var newString = "";
	var kBlank = " ";
	if (aString.indexOf(kBlank) >= 0)  {
		for (var i = 0; i < aString.length; i++)
			if (aString.charAt(i) != kBlank)
				break;
			
		for (var j =  aString.length-1; j >= 0; j--)
			if (aString.charAt(j) != kBlank)
				break;
			
		if (i == aString.length && j == -1)
			newString = "";
		else
			if (i != 0 || j != aString.length -1)
				newString = trim(aString.substring(i, j+1));
			else
				newString = aString.charAt(i) + trim(aString.substring(i+1, j+1)) + aString.charAt(j+1);
	}
	else
		newString = aString;
			
	return newString;
}
// VALIDA CARACTER
function IsStrValid(strToValidate, strValidChar) {
	var flag;
	var i;
	flag = true;
	
	if ((trim(strToValidate) != "") && (trim(strValidChar) != "")) {
		for (i=0;i<strToValidate.length;i++) {
			if (strValidChar.indexOf(strToValidate.charAt(i).toLowerCase()) == -1) {
				flag = false;
				return flag
			}
		}
	} else flag = false;
	
	return flag;
}
function IsCEP(cep) {
	//verifica se o CEP está corretamente digitado aceitando apenas números
	cep1 = substr(cep,0,5);
	cep2 = substr(cep,6,9);
	var i, strCEP = "0123456789";
	cep = cep1.cep2;
	if (cep.length != 8) return false;
	for (i=0; i<cep.length; i++) {
		if ( strCEP.indexOf(cep.charAt(i)) < 0 )
			return false;
	}
	return true;
}

/****************************************************************
* LIMPA CAMPO DE EMAIL                                          *
*****************************************************************
*  onKeyUp="javascript:limpacampo(cadastro.email);"
*/
var mikExp = /[$\ \\\#%\^\&\*\(\)\[\]\+\{\}\`\~\=\|\:\;\'\"\,\>\<\!\/\\]/;
function limpacampoemail(val) {

	var strPass = val.value;
	var strLength = strPass.length;
	var lchar = val.value.charAt((strLength) - 1);
	if(lchar.search(mikExp) != -1) {
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
   }
}

/****************************************************************
* FORMATA CAMPOS                                                *
*****************************************************************
* Descrição.: formata um campo do formulário de
* acordo com a máscara informada...
* Parâmetros: - objForm (o Objeto Form)
* - strField (string contendo o nome
* do textbox)
* - sMask (mascara que define o
* formato que o dado será apresentado,
* usando o algarismo "9" para
* definir números e o símbolo "!" para
* qualquer caracter...
* - evtKeyPress (evento)
*
* Uso.......: <input type="textbox"
* name="xxx".....
* onkeypress="return txtBoxFormat(document.rcfDownload, 'str_cep', '99999-999', event);">
* Observação: As máscaras podem ser representadas
* como os exemplos abaixo:
* CEP -> 99999-999
* CPF -> 999.999.999-99
* CNPJ -> 99.999.999/9999-99
* C/C -> 999999-!
* Tel -> (99) 9999-9999
***/
function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
	if(document.all) { // Internet Explorer
		nTecla = evtKeyPress.keyCode; 
	} else if(document.layers) { // Nestcape
		nTecla = evtKeyPress.which;
	} else {
		return true;
	}
	sValue = objForm[strField].value;
	// Limpa todos os caracteres de formatação que
	// já estiverem no campo.
	sValue = sValue.toString().replace( ":", "" );
	sValue = sValue.toString().replace( ":", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( " ", "" );
	fldLen = sValue.length;
	mskLen = sMask.length;

	i = 0;
	nCount = 0;
	sCod = "";
	mskLen = fldLen;

	while (i <= mskLen) {
		bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/")|| (sMask.charAt(i) == ":"))
		bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))	
		if (bolMask) {
			sCod += sMask.charAt(i);
			mskLen++; 
		} else {
			sCod += sValue.charAt(nCount);
			nCount++;
		}
		i++;
	}
	objForm[strField].value = sCod;
	if (nTecla != 8) { // backspace
		if (sMask.charAt(i-1) == "9") { // apenas números...
			return ((nTecla > 47) && (nTecla < 58)); 
		}	else { // qualquer caracter...
			return true;
		}
	} else {
		return true;
	}
}
/****************************************************************
* LIMPA CAMPO DE EMAIL                                          *
*****************************************************************
*  (!isHour(trim(document.cadastro.email.value)))
*/
function IsHour(lStrHorario){
	var lHora, lMinuto, lSegundo, lPrimeiroSeparador, lSegundoSeparador;
	if (lStrHorario.length != 8){
		return false;
	}
	lHora = lStrHorario.substr(0, 2);
	lPrimeiroSeparador = lStrHorario.substr(2, 1);
	if (lPrimeiroSeparador != ':'){
		return false;
	}
	lMinuto = lStrHorario.substr(3, 2);
	if (lStrHorario.length > 5){
		lSegundoSeparador = lStrHorario.substr(5, 1);
		if (lSegundoSeparador != ':'){
			return false;
		}
		lSegundo = lStrHorario.substr(6, 2);
		if (lSegundo.length < 2){
			return false;
		}
	}
	//Valida Hora
	if (!(fJSIsNumber(lHora))){
		return false;
	}
	if (!(fJSInRange(lHora, 0, 23))){
		return false;
	}
	//Valida Minuto
	if (!(fJSIsNumber(lMinuto))){
		return false;
	}
	if (!(fJSInRange(lMinuto, 0, 59))){
		return false;
	}
	//Valida Segundo
	if (lStrHorario.length > 5){
		if (!(fJSIsNumber(lSegundo))){
			return false;
		}
		if (!(fJSInRange(lSegundo, 0, 59))){
			return false;
		}
	}
	return true;
}
//Funcoes utilizadas para validação do horario
function fJSInRange( inputStr, ini, fim ){
	var num = parseInt(inputStr, 10);
	if ( num < ini || num > fim ) {
		return false;
	}
	return true;
}
function fJSIsNumber( num ){
	var numeros = '0123456789,';
	var valor = num.toString();
	var lCount = 0;
	for ( var i=0; i < valor.length; i++ ){
		if ( numeros.indexOf( valor.substr(i,1) ) == -1 ){
      	return false;
	 	}
	   if ( valor.substr(i,1) == ',' ) {
	   	lCount += 1;
	      if ( lCount > 1 ) { 
				return false; 
			}
	 	}
	}
	return true;
}
/****************************************************************
* RETIRA ESPACO                                                 *
*****************************************************************/
function retiraEspaco(theString) {
	//retira todos os espaços de uma string
	if (theString.indexOf(" ") >= 0) {
		var i = 0;
		while (theString.indexOf(" ") >= 0) {
			if (theString.charAt(i) == " ") 
				theString = theString.substring(0,i) + theString.substring(i+1,theString.length);
			else i++
		}
		newString = theString;
	} 
	else newString = theString;
	return newString;
}
/****************************************************************
* VALIDA DATA                                                   *
*****************************************************************/
function IsDate(sdata){
	day2   = sdata.substr(0,2);
	month2 = sdata.substr(3,2);
	year2  = sdata.substr(6,4);
	if ((sdata.substr(2,1) != "/") || (sdata.substr(5,1) != "/")){
		day2   = "";
		month2 = "";
		year2  = "";
	}
	var DayArray = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	var MonthArray = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
	var inpDate = day2 + month2 + year2;
	var filter=/^[0-9]{2}[0-9]{2}[0-9]{4}$/;
	//Check ddmmyyyy date supplied
	if (! filter.test(inpDate)){
		return false;
	}
	/* Check Valid Month */
	filter=/01|02|03|04|05|06|07|08|09|10|11|12/;
	if (! filter.test(month2)) {
		return false;
	}
	/* Check For Leap Year */
	var N = Number(year2);
	if ( ( N%4==0 && N%100 !=0 ) || ( N%400==0 ) ){
		DayArray[1]=29;
	}
	/* Check for valid days for month */
	for(var ctr=0; ctr<=11; ctr++){
	   if (MonthArray[ctr]==month2){
	      if (day2<= DayArray[ctr] && day2 >0 ){
	        inpDate = day2 + '/' + month2 + '/' + year2;
	        return true;
	      }
	      return false;
	   }
	}
}
/****************************************************************
* VALIDA DATA                                                   *
*****************************************************************/
// nao deixa a data inicial ser maior que a data final
function IsDateOrder(dt1,dt2)
{
	var hoje = new Date();
	var ano = hoje.getYear();
	if(ano >= 50 && ano <= 99)
	ano = 1900 + ano
	else
	ano = 2000 + ano;

	var pos1 = dt1.indexOf("/",0)
	var dd = dt1.substring(0,pos1)
	pos2 = dt1.indexOf("/", pos1 + 1)
	var mm = dt1.substring(pos1 + 1,pos2)
	var aa = dt1.substring(pos2 + 1,10)
	if(aa.length < 4)
	if(ano > 1999)
	aa = (2000 + parseInt(aa,10))
	else
	aa = (1900 + parseInt(aa,10));
	var data1 = new Date(parseInt(aa,10),parseInt(mm,10) - 1, parseInt(dd,10));
	var pos1 = dt2.indexOf("/",0)
	var dd = dt2.substring(0,pos1)
	pos2 = dt2.indexOf("/", pos1 + 1)
	var mm = dt2.substring(pos1 + 1,pos2)
	var aa = dt2.substring(pos2 + 1,10)
	if(aa.length < 4)
	if(ano > 80 && ano <= 99)
	aa = (1900 + parseInt(aa,10))
	else
	aa = (2000 + parseInt(aa,10));
	var data2 = new Date(parseInt(aa,10),parseInt(mm,10) - 1,parseInt(dd,10));
	if(data1 > data2)
	return true; 
	else
	return false;
} 

function SetHelp(txt) { help.innerText = txt ; }

function FormataValor(fld, milSep, decSep, e) {
	var sep = 0;
	var key = '';
	var i = j = 0;
	var len = len2 = 0;
	var strCheck = '0123456789';
	var aux = aux2 = '';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 13) return true;  // Enter
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
	len = fld.value.length;
	if(len < 16)
	{
		for(i = 0; i < len; i++)
		if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
		aux = '';
		for(; i < len; i++)
		if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
		aux += key;
		len = aux.length;
		if (len == 0) fld.value = '';
		if (len == 1) fld.value = '0'+ decSep + '0' + aux;
		if (len == 2) fld.value = '0'+ decSep + aux;
		if (len > 2) {
		aux2 = '';
		for (j = 0, i = len - 3; i >= 0; i--) {
			if (j == 3) {
				aux2 += milSep;
				j = 0;
			}
			aux2 += aux.charAt(i);
			j++;
		}
		fld.value = '';
		len2 = aux2.length;
		for (i = len2 - 1; i >= 0; i--)
			fld.value += aux2.charAt(i);
			fld.value += decSep + aux.substr(len - 2, len);
		}
	}
	return false;
}

function getElement(e,f){
    if(document.layers){
        f=(f)?f:self;
        if(f.document.layers[e]) {
            return f.document.layers[e];
        }
        for(W=0;i<f.document.layers.length;W++) {
            return(getElement(e,fdocument.layers[W]));
        }
    }
    if(document.all) {
        return document.all[e];
    }
    return document.getElementById(e);
}

var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

function printPage()
{
  if (pr) // NS4, IE5
    window.print()
  else // other browsers
    alert("Desculpe seu browser não suporta esta função. Por favor utilize a barra de trabalho para imprimir a página.");
  return false;
}

var submeteuFormulario = 0;
function controleDoubleClick() 
{
	if(submeteuFormulario=="1") 
	{
		alert("O botão foi acionado mais de uma vez enquanto a transação estava em andamento. Aguarde por favor... ");
		return false;
	}
	submeteuFormulario = "1";
	return true;
}

// redireciona caso tentem abrir o site no ne4
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
if (browser_type=="Netscape"&&browser_version < 5)
{
	parent.location ='/netscape4.php';
}
// impede que outros sites insiram o site da Check OK em frames
//if(top.frames.length!=0)
//{
	//top.location=self.document.location;
//}
// nao deixa abrir com o lado direito do mouse
//var msg="Check OK - Verificaçao Eletrônica de Crédito";
//function disableIE() 
//{
//	if (document.all) 
//	{
//		alert(msg);return false;
//	}
//}
//function disableNS(e) 
//{
//	if (document.layers||(document.getElementById&&!document.all)) 
//	{
//		if (e.which==2||e.which==3) 
//		{
//  			alert(msg);return false;
//   		}
// 	}
//}
//if (document.layers) 
//{
//	document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
//} else 
//{
//	document.onmouseup=disableNS;document.oncontextmenu=disableIE;
//}
//document.oncontextmenu=new Function("alert(msg);return false")

function popUp(url) 
{
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=0, scrollbars=1 ,resizable=1,width=610,height=450');
	self.name = "mainWin"; 
}
function openPopup( windowURL,windowName, windowFeatures ) 
{ 
	return window.open( windowURL, windowName,windowFeatures);
} 
function refreshmainwindow() 
{
	// this will close the pop up window
	window.close();
	// this will reload the parent window...
	if (!window.opener.closed) 
	{
		window.opener.location.reload();
		window.opener.focus();
	}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function disableImpSelect(choicesSelect, impSelect) 
{
	if (choicesSelect.options[choicesSelect.selectedIndex].value == "0") 
	{
    	impSelect.selectedIndex = 0;
    	impSelect.disabled = true;
  	} else 
	{
    	impSelect.disabled = false;
  	}
}

var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) 
{
	var keyCode = (isNN) ? e.which : e.keyCode;
   	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
   	if(input.value.length >= len && !containsElement(filter,keyCode)) 
   	{
    	input.value = input.value.slice(0, len);
      	input.form[(getIndex(input)+1) % input.form.length].focus();
   	}
   	function containsElement(arr, ele) 
   	{
    	var found = false, index = 0;
      	while(!found && index < arr.length)
        	if(arr[index] == ele)
         	found = true;
         	else
         	index++;
      	return found;
   	}
   	function getIndex(input) 
   	{
    	var index = -1, i = 0, found = false;
      	while (i < input.form.length && index == -1)
        	if (input.form[i] == input)index = i;
         	else i++;
      	return index;
   	}
   	return true;
}
// para o menu da consulta 
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() 
{
var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_openBrWindow(theURL,winName,features) 
{ 
  	window.open(theURL,winName,features);
}
function mOvr(src,clrOver) 
{
	if (!src.contains(event.fromElement)) 
	{
		src.style.cursor = 'hand';
	 	src.bgColor = clrOver;
	}
}
function mOut(src,clrIn) 
{
	if (!src.contains(event.toElement)) 
	{
		src.style.cursor = 'default';
	 	src.bgColor = clrIn;
	}
}
function textCounter(field, countfield, maxlimit) 
{
	if (field.value.length > maxlimit)
	{
		field.value = field.value.substring(0, maxlimit);
	} else 
	{
	   countfield.value = maxlimit - field.value.length;
	}
} 
var mikExp = /[$\-\@\?\¨\ÃÕÁÉÍÓÚÀÈÌÒÙÂÊÎÔÛÇãõáéíóúàèìòùâêîôûç\º\ª\#\%\^\&\*\(\)\[\]\+\_\{\}\`\´\~\=\|\:\;\'\"\.\,\>\<\!\/\\]/;
function blockchar(val) 
{
	var strPass = val.value;
	var strLength = strPass.length;
	var lchar = val.value.charAt((strLength) - 1);
	if(lchar.search(mikExp) != -1) 
	{
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
   	}
}
//-->
