function validacampo(e,v){
	var whichCode = (window.Event) ? e.which : e.keyCode;
    var teclas = String.fromCharCode(whichCode);
	var i = v.indexOf(teclas);
	if (i > (-1))
  	   return true;
	else {
          if (whichCode!=8 && whichCode!=13 && whichCode!=0)  // backspace,enter e tab
			 return false;
          else 
          	 return true;
	}
}
function usuariosenha(e){
    var v='0123456789abcdefghijklmnopqrstuvwxyz_*ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var whichCode = (window.Event) ? e.which : e.keyCode;
    var teclas = String.fromCharCode(whichCode);
	var i = v.indexOf(teclas);
	if (i > (-1))
  	   return true;
	else {
          if (whichCode!=8 && whichCode!=13 && whichCode!=0)  // backspace,enter e tab
			 return false;
          else 
          	 return true;
	}
}
function validacampod(fld,e,max,v,dec) {
         var sep = 0;
         var key = '';
         var i = j = 0;
         var len = len2 = 0;
         var strCheck = v;
         var aux = aux2 = '';
         var sinal = 0;
         var whichCode = (window.Event) ? e.which : e.keyCode;
		 if (whichCode==0) return true; //tab
         if (whichCode==8) return true; //backspace
         if (whichCode==13) return true; //enter
         key = String.fromCharCode(whichCode);
         if (strCheck.indexOf(key) == -1) return false;
         if (key=='-') {
         	if (fld.value.indexOf(key)!= -1) return false; 
         	fld.value='-'+fld.value;
         	return false;
         } 	
         // -- Joga o sinal para a primeira posição
         if (fld.value.indexOf('-')!= -1) { 
         	valor='';
         	len = fld.value.length;
         	for(i = 0; i < len; i++) { 
         	 if (fld.value.charAt(i) != '-') valor+=fld.value.charAt(i);
         	}
         	fld.value=valor;
         	sinal=1;
         }
         len = fld.value.length;
         if(len<=max) {
         	for(i = 0; i < len; i++) {         		
               if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != ',')) 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 (dec > 0) {
               	for (h = len; h < dec; h++) fld.value = '0'+ ',' + '0' + aux;
               }
               if (len > 0) {
                     aux2 = '';
                     for (j = 0, i = len - (dec+1); i >= 0; i--) {
                         if (j == 3) {
                            aux2 += '.';
                            j = 0;
                         }
                         aux2 += aux.charAt(i);
                         j++;
                    }
                    fld.value = '';
                    len2 = aux2.length;
                    for (i = len2 - 1; i >= 0; i--)
                        fld.value += aux2.charAt(i);
               		if (dec > 0) {
               			var t = len - dec;
               			if(t < 0) t = 0;
               			fld.value += ',' + aux.substr(t, len);
               		}
               }
         }         
		 if (sinal==1) fld.value='-'+fld.value;
         return false;
}
function validaCaracter_txt(e){
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		if ( tecla==39 || tecla==34) {
		        event.keyCode = 0;
			return true;
    		}
}
function validaCampo_txt(t){
         for (i = 0; i < t.length; i++) {
             s=t.charAt(i);
             if (s=="'") s=' ';
             if (s=='"') s=' ';

         }
}