<!-- Begin
var isNN = (navigator.appName.indexOf("Netscape")!=-1);


function autoTab(inputKeyEnter,len, e, sel) {
var selItem = sel;
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(inputKeyEnter.value.length >= len && !containsElement(filter,keyCode)) {
inputKeyEnter.value = inputKeyEnter.value.slice(0, len);

tipoFocus = inputKeyEnter.form[(getIndexEnter(inputKeyEnter)+1) % inputKeyEnter.form.length].type;
 if((tipoFocus == 'text') || (tipoFocus == 'textarea') || (tipoFocus == 'select-one') || (tipoFocus == 'checkbox') || (tipoFocus == 'button')) {

try { 

  inputKeyEnter.form[(getIndexEnter(inputKeyEnter)+1) % inputKeyEnter.form.length].focus();
  if(selItem == true) {
  inputKeyEnter.form[(getIndexEnter(inputKeyEnter)+1) % inputKeyEnter.form.length].select();
  }
return false; } catch(err) {}
}}
}


function enterTab(inputKeyEnter, eEnter, sel) {
var keyCodeEnter = (isNN) ? eEnter.which : eEnter.keyCode; 
var selItem = sel;
if(keyCodeEnter == 13) {
tipoFocus = inputKeyEnter.form[(getIndexEnter(inputKeyEnter)+1) % inputKeyEnter.form.length].type;
 if((tipoFocus == 'text') || (tipoFocus == 'textarea') || (tipoFocus == 'select-one') || (tipoFocus == 'checkbox') || (tipoFocus == 'button')) {

try { 

  inputKeyEnter.form[(getIndexEnter(inputKeyEnter)+1) % inputKeyEnter.form.length].focus();
  if(selItem == true) {
  inputKeyEnter.form[(getIndexEnter(inputKeyEnter)+1) % inputKeyEnter.form.length].select();
  }
return false; } catch(err) {}
}}
}



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 getIndexEnter(inputKeyEnter) {
var indexEnter = -1, i = 0, found = false;
while (i < inputKeyEnter.form.length && indexEnter == -1)
if (inputKeyEnter.form[i] == inputKeyEnter)indexEnter = i;
else i++;
return indexEnter;
}


function check_press(e,AlfaNum,OtherCond,acao) {

var checkChar = false;
var whichCode = (isNN) ? e.which : e.keyCode;
var charevent = String.fromCharCode(whichCode);

  if ((whichCode != 34) && (whichCode != 39)) {

    if (AlfaNum == 'n') {
      if ((whichCode < 48) || (whichCode > 57)) {
	checkChar = false;
      } else {
	checkChar = true;

      }


      if (OtherCond.indexOf(charevent) >= 0) {
	  if (acao == "+") {
	    checkChar = true;
	  } else {
	    checkChar = false;
	  }
      }
    }


    if (AlfaNum == 'nl') {
      if (((whichCode >= 48) && (whichCode <= 57)) || ((whichCode >= 65) && (whichCode <= 90))  || ((whichCode >= 97) && (whichCode <= 122))) {
	checkChar = true;
      } else {
	checkChar = false;
      }

      if (OtherCond.indexOf(charevent) >= 0) {
	  if (acao == "+") {
	    checkChar = true;
	  } else {
	    checkChar = false;
	  }
      }
    }


    if (AlfaNum == 'all') {
      checkChar = true;

      if (OtherCond.indexOf(charevent) >= 0) {
	  if (acao == "+") {
	    checkChar = true;
	  } else {
	    checkChar = false;
	  }
      }
    }
  }

  if (checkChar == false) {

	if (isNN) {
	   e.preventDefault();
	   e.stopPropagation();
	   e.returnValue=false;
	   return false;
	} else {
	   e.returnValue = false;
	}
  }
}


function check_text(ItName) {
var theWord = '';
out1 = '"'; 
out2 = "'";
add = "";

if(ItName.value != '') {
temp = "" + ItName.value;

while (temp.indexOf(out1)>-1) {
pos= temp.indexOf(out1);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out1.length), temp.length));
theWord = 'ok';
}

while (temp.indexOf(out2)>-1) {
pos= temp.indexOf(out2);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out2.length), temp.length));
theWord = 'ok';
}

theWordsText = '[ '+out1+' ]  [ '+out2+' ]'
ItName.value = temp;
	if (theWord != '')
	{
	alert('Este campo não aceita o seguintes caracteres: \n'+ theWordsText +' !')
	}
}
}




function check_text_pur(ItName) {
var theWord = '';

if(ItName.value != '') {
temp = "" + ItName.value;

var out1 = new Array('à','á','ã','â','ä','å')
add1 = "a";

var out2 = new Array('À','Á','Ã','Â','Ä','Ǻ')
add2 = "A";

var out3 = new Array('è','é','ê','ë')
add3 = "e";

var out4 = new Array('È','É','Ê','Ë')
add4 = "E";

var out5 = new Array('ì','í','î','ï')
add5 = "i";

var out6 = new Array('Ì','Í','Î','Ï')
add6 = "I";

var out7 = new Array('ò','ó','ô','õ','ö')
add7 = "o";

var out8 = new Array('Ò','Ó','Ô','Õ','Ö')
add8 = "O";

var out9 = new Array('ù','ú','û','ü')
add9 = "u";

var out10 = new Array('Ù','Ú','Û','Ü')
add10 = "U";

var out11 = new Array('ç')
add11 = "c";

var out12 = new Array('Ç')
add12 = "C";

var out13 = new Array('ñ')
add13 = "n";

var out14 = new Array('Ñ')
add14 = "N";

var out15 = new Array('~','^',"'",'´','`',':',';','"')
add15 = "";

for (x in out1) {
while (temp.indexOf(out1[x])>-1) {
pos= temp.indexOf(out1[x]);
temp = "" + (temp.substring(0, pos) + add1 + 
temp.substring((pos + out1[x].length), temp.length));
theWord = 'ok';
}}

for (x in out2) {
while (temp.indexOf(out2[x])>-1) {
pos= temp.indexOf(out2[x]);
temp = "" + (temp.substring(0, pos) + add2 + 
temp.substring((pos + out2[x].length), temp.length));
theWord = 'ok';
}}


for (x in out3) {
while (temp.indexOf(out3[x])>-1) {
pos= temp.indexOf(out3[x]);
temp = "" + (temp.substring(0, pos) + add3 + 
temp.substring((pos + out3[x].length), temp.length));
theWord = 'ok';
}}

for (x in out4) {
while (temp.indexOf(out4[x])>-1) {
pos= temp.indexOf(out4[x]);
temp = "" + (temp.substring(0, pos) + add4 + 
temp.substring((pos + out4[x].length), temp.length));
theWord = 'ok';
}}

for (x in out5) {
while (temp.indexOf(out5[x])>-1) {
pos= temp.indexOf(out5[x]);
temp = "" + (temp.substring(0, pos) + add5 + 
temp.substring((pos + out5[x].length), temp.length));
theWord = 'ok';
}}

for (x in out6) {
while (temp.indexOf(out6[x])>-1) {
pos= temp.indexOf(out6[x]);
temp = "" + (temp.substring(0, pos) + add6 + 
temp.substring((pos + out6[x].length), temp.length));
theWord = 'ok';
}}

for (x in out7) {
while (temp.indexOf(out7[x])>-1) {
pos= temp.indexOf(out7[x]);
temp = "" + (temp.substring(0, pos) + add7 + 
temp.substring((pos + out7[x].length), temp.length));
theWord = 'ok';
}}

for (x in out8) {
while (temp.indexOf(out8[x])>-1) {
pos= temp.indexOf(out8[x]);
temp = "" + (temp.substring(0, pos) + add8 + 
temp.substring((pos + out8[x].length), temp.length));
theWord = 'ok';
}}

for (x in out9) {
while (temp.indexOf(out9[x])>-1) {
pos= temp.indexOf(out9[x]);
temp = "" + (temp.substring(0, pos) + add9 + 
temp.substring((pos + out9[x].length), temp.length));
theWord = 'ok';
}}

for (x in out10) {
while (temp.indexOf(out10[x])>-1) {
pos= temp.indexOf(out10[x]);
temp = "" + (temp.substring(0, pos) + add10 + 
temp.substring((pos + out10[x].length), temp.length));
theWord = 'ok';
}}

for (x in out11) {
while (temp.indexOf(out11[x])>-1) {
pos= temp.indexOf(out11[x]);
temp = "" + (temp.substring(0, pos) + add11 + 
temp.substring((pos + out11[x].length), temp.length));
theWord = 'ok';
}}

for (x in out12) {
while (temp.indexOf(out12[x])>-1) {
pos= temp.indexOf(out12[x]);
temp = "" + (temp.substring(0, pos) + add12 + 
temp.substring((pos + out12[x].length), temp.length));
theWord = 'ok';
}}

for (x in out13) {
while (temp.indexOf(out13[x])>-1) {
pos= temp.indexOf(out13[x]);
temp = "" + (temp.substring(0, pos) + add13 + 
temp.substring((pos + out13[x].length), temp.length));
theWord = 'ok';
}}

for (x in out14) {
while (temp.indexOf(out14[x])>-1) {
pos= temp.indexOf(out14[x]);
temp = "" + (temp.substring(0, pos) + add14 + 
temp.substring((pos + out14[x].length), temp.length));
theWord = 'ok';
}}

for (x in out15) {
while (temp.indexOf(out15[x])>-1) {
pos= temp.indexOf(out15[x]);
temp = "" + (temp.substring(0, pos) + add15 + 
temp.substring((pos + out15[x].length), temp.length));
theWord = 'ok';
}}

ItName.value = temp;
	if (theWord != '') {
	alert('Este campo não aceita acentuações !')
	}
}
}



function check_number(ItName) {

out = "."; 
out1 = "-";
out2 = " ";
add = "";

if(ItName.value != '') {
temp = "" + ItName.value;

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}

while (temp.indexOf(out1)>-1) {
pos= temp.indexOf(out1);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out1.length), temp.length));
}

while (temp.indexOf(out2)>-1) {
pos= temp.indexOf(out2);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out2.length), temp.length));
}

ItName.value = temp;

	if (isNaN(ItName.value) == true) {
	alert('Este campo aceita apenas Numeros Inteiros!');	
	ItName.value = '';
	ItName.focus();
	ItName.select();
	}
}
}


function check_numberSimples(ItName) {

if(ItName.value != '') {
temp = "" + ItName.value;
num = temp.toString().replace(/\,|\,/g,'');

	if (isNaN(num) == true) {
	alert('Este campo aceita apenas numero!');	
	ItName.value = '';
	ItName.focus();
	ItName.select();
	temp = '';
	}
	num = temp.toString().replace(/\.|\./g,',');
	ItName.value = num;
}
}



function check_numberMoeda(ItName,n) {

if(ItName.value != '') {
temp = "" + ItName.value;
num = temp.toString().replace(/\.|\./g,'');
num = num.toString().replace(/\,|\,/g,'.');

	if (isNaN(num) == true) {
	alert('Este campo aceita apenas Formato Moeda!');	
	ItName.value = '';
	ItName.focus();
	ItName.select();
	} else {
	  if(n) {
	  numFormat = parseFloat(num).toFixed(n);
	  } else { 
	  numFormat = parseFloat(num);
	  }
	ItName.value = numFormat.toString().replace(/\.|\./g,',');
	}
}
}



function check_cep(objeto, e) {

var whichCode = (isNN) ? e.which : e.keyCode;

campo = eval(objeto);

 if (campo!='') {
	caracteres = '01234567890-';
	separacoes = 1;
	separacao1 = '-';
	conjuntos = 2;
	conjunto1 = 5;
	conjunto2 = 3;

  if ((caracteres.search(String.fromCharCode (whichCode))!=-1) && campo.value.length <= (conjunto1 + conjunto2 + 1)) {
    if (campo.value.length == conjunto1) {
	campo.value = campo.value + separacao1;
    }
  } else {

	if (isNN) {
	   e.preventDefault();
	   e.stopPropagation();
	   e.returnValue=false;
	   return false;
	} else {
	   e.returnValue = false;
	}
  }
 }
}






function check_email(ItName) {
	if (ItName.value != '') {
		if ((ItName.value.search("@") == -1 || ItName.value.search("[.*]") == -1)) {
		alert('Este é um e-mail inválido');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}


function check_url(ItName) {
	if (ItName.value != '') {
		if (ItName.value.search("[.*]") == -1) {
		alert('Este é um endereço inválido');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}


function check_url_dom(ItName) {
	if (ItName.value != '') {
		if ((ItName.value.search("www") == 0 || ItName.value.search("[.*]") == -1)) {
		alert('Este é um endereço inválido\nNão utilize www');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}

function check_url_sub(ItName) {
	if (ItName.value != '') {
		if ((ItName.value.search("www") == -1 || ItName.value.search("[.*]") == -1)) {
		alert('Este é um endereço inválido\nUtilize www');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}


function check_ip(ItName) {
	if (ItName.value != '') {
		if ((ItName.value.search("[.*]") == -1) || (ItName.value.length < 7) || (ItName.value.length > 15)) {
		alert('Este é um IP inválido');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}


function check_masc(ItName) {
	if (ItName.value != '') {
		if ((ItName.value.search("[.*]") == -1) || (ItName.value.length < 7) || (ItName.value.length > 15)) {
		alert('Este é um Máscara inválido');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}


function check_gat(ItName) {
	if (ItName.value != '') {
		if ((ItName.value.search("[.*]") == -1) || (ItName.value.length < 7) || (ItName.value.length > 15)) {
		alert('Este é um Gateway inválido');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}


function check_cnpj(ItName) {
	
	var doc = ItName.value;

	if(doc != '') {
		if (isCnpj(doc)) {
			ItName.value = formatCpfCnpj(doc, true, true);
			ItName.style.color = '#666666';
		} else {
			ItName.style.color = '#ff0000';
		}
	} else {
			ItName.style.color = '#666666';
	}

}

function check_cpf(ItName) {

	var doc = ItName.value;

	if(doc != '') {
		if (isCpf(doc)) {
			ItName.value = formatCpfCnpj(doc, true);
			ItName.style.color = '#666666';
		} else {
			ItName.style.color = '#ff0000';
		}
	} else {
			ItName.style.color = '#666666';
	}

}

function check_cpfoucnpj(ItName) {

	var doc = ItName.value;

	if(isCnpj(doc)) {
		check_cnpj(ItName);
	} else {
		check_cpf(ItName);
	}
}


function check_ie(ItName) {

  string = ItName.value || '';
  string = string + "";
  string = string.toUpperCase();
  chars = '0123456789.ISENTO';
  out   = '';

  for (i=0; i<string.length; i++) {
    schar = string.charAt(i);
    if (chars.indexOf(schar) != -1) { out += schar; }
  }
    
  ItName.value = out;

	if (ItName.value != '') {

		if ((ItName.value.search("[.*]") == -1) && (ItName.value != 'ISENTO')) 	{
		alert('Este é um I.E. inválido');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}

function check_rg(ItName) {

  string = ItName.value || '';
  string = string + "";
  string = string.toUpperCase();
  chars = '0123456789.-';
  out   = '';

  for (i=0; i<string.length; i++) {
    schar = string.charAt(i);
    if (chars.indexOf(schar) != -1) { out += schar; }
  }
    
  ItName.value = out;

	if (ItName.value != '') {
		if (ItName.value.search("[.*]") == -1) {
		alert('Este é um RG inválido');	
		ItName.value = '';
		ItName.focus();
		ItName.select();
		}
	}
}


//  End -->