<!--
function FormataTel(tammax,pos,teclapres){
	var tecla = teclapres.keyCode;
	var fvr = '';
	vr = event.srcElement.value;
	for(i=0;i<vr.length;i++){
		ch=vr.charAt(i);
		if((ch=="1")||(ch=="2")||(ch=="3")||(ch=="4")||(ch=="5")||(ch=="6")||(ch=="7")||(ch=="8")||(ch=="9")||(ch=="0")){
			fvr=fvr+ch;
		}
		}
		vr=fvr;
		
	tam = vr.length ;
	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

	if (tecla == 8 ){ tam = tam - 1 ; }
			
	if ( tecla == 8 || tecla == 88 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam <= 2 ){
			event.srcElement.value = "("+vr
		}
		if ( tam > pos+2 && tam <= tammax ){
			event.srcElement.value = vr.substr( 0, tam - pos ) + '-' + vr.substr( tam - pos, tam );
			txt=event.srcElement.value
			event.srcElement.value = "("+txt.substr(0,2)+")"+txt.substr(2,tam)
			
		}
	}
}

function FormataTel2(tammax,pos,teclapres){
	var fvr = '';
	vr = event.srcElement.value;
	for(i=0;i<vr.length;i++){
		ch=vr.charAt(i);
		if((ch=="1")||(ch=="2")||(ch=="3")||(ch=="4")||(ch=="5")||(ch=="6")||(ch=="7")||(ch=="8")||(ch=="9")||(ch=="0")){
			fvr=fvr+ch;
		}
		}
		vr=fvr;
		
	tam = vr.length ;
		if ((tam>0)&&(tam<=2)){
			event.srcElement.value = "("+vr
		}
		if ( tam > pos+2 && tam <= tammax ){
			event.srcElement.value = vr.substr( 0, tam - pos ) + '-' + vr.substr( tam - pos, tam );
			txt=event.srcElement.value
			event.srcElement.value = "("+txt.substr(0,2)+")"+txt.substr(2,tam)
			
		}
}


function FormataData(Campo,teclapres) {
	var tecla = teclapres.keyCode;
	vr = event.srcElement.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
		{
			event.srcElement.value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
		}
		if ( tam >= 5 && tam <= 10 )
		{
			event.srcElement.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); }
		}
}

function FormataHora(Campo,teclapres) {
	var tecla = teclapres.keyCode;
	vr = event.srcElement.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( ":", "" );
	vr = vr.replace( ":", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
		{
			event.srcElement.value = vr.substr( 0, tam - 2  ) + ':' + vr.substr( tam - 2, tam );
		}
	}
}

function FormataCampo(Campo,teclapres,mascara){ 
    
    strtext = Campo.value 
    tamtext = strtext.length 
    tammask = mascara.length 
    arrmask = new Array(tammask)     
  
    for (var i = 0 ; i < tammask; i++){ 
        arrmask[i] = mascara.slice(i,i+1) 
    } 
   
    if (((((arrmask[tamtext] == "#") || (arrmask[tamtext] == "9"))) || (((arrmask[tamtext+1] != "#") || (arrmask[tamtext+1] != "9"))))){ 
        if ((teclapres.keyCode >= 37 && teclapres.keyCode <= 40)||(teclapres.keyCode >= 48 && teclapres.keyCode <= 57)||(teclapres.keyCode >= 96 && teclapres.keyCode <= 105)||(teclapres.keyCode == 8)||(teclapres.keyCode == 9) ||(teclapres.keyCode == 46) ||(teclapres.keyCode == 13)){ 
            Organiza_Casa(Campo,arrmask[tamtext],teclapres.keyCode,strtext)         
        } 
        else{ 
            Detona_Event(Campo,strtext) 
        } 
    } 
    else{
        if ((arrmask[tamtext] == "A"))    { 
            charupper = event.valueOf() 
            Detona_Event(Campo,strtext) 
            masktext = strtext + charupper 
            Campo.value = masktext 
        } 
    } 
} 
function Organiza_Casa(Campo,arrpos,teclapres_key,strtext){ 
    if (((arrpos == "/") || (arrpos == ".") || (arrpos == ",") || (arrpos == ":") || (arrpos == " ") || (arrpos == "-")) && !(teclapres_key == 8)){ 
        separador = arrpos 
        masktext = strtext + separador 
        Campo.value = masktext 
    } 
} 
function Detona_Event(Campo,strtext){ 
    event.returnValue = false 
    if (strtext != "") { 
        Campo.value = strtext 
    } 
} 

function Tecla(e)
{
	if (document.all) 
		var tecla = event.keyCode;
	else if(document.layers) 
		var tecla = e.which;
		if (tecla > 47 && tecla < 58)
			return true;
		else
			{
				if (tecla != 8) 
					event.keyCode = 0;
					
				else
					return true;
			}

}


function Limpar(valor, validos) { 
// retira caracteres invalidos da string 
var result = ""; 
var aux; 
for (var i=0; i < valor.length; i++) { 
aux = validos.indexOf(valor.substring(i, i+1)); 
if (aux>=0) { 
result += aux; 
} 
} 
return result; 
} 

//Formata número tipo moeda usando o evento onKeyDown 

function FormataValor(campo,tammax,teclapres,decimal) { 
var tecla = teclapres.keyCode; 
vr = Limpar(campo.value,"0123456789"); 
tam = vr.length; 
dec=decimal 

if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; } 

if (tecla == 8 ) 
{ tam = tam - 1 ; } 

if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ) 
{ 

if ( tam <= dec ) 
{ campo.value = vr ; } 

if ( (tam > dec) && (tam <= 6) ){ 
campo.value = vr.substr( 0, tam - 2 ) + "." + vr.substr( tam - dec, tam ) ; } 
} 

} 

function isEmpty (x)
{
	y = new String (x.value)
	return (y.length == 0)
}

function verifica()
{
	ff = document.f
    ok = true;
    msg = ""
	
	if (isEmpty(ff.txtProduto))
    	{
        ok = false;
        msg = msg + " - Preencha campo Produto\n";
    	}
	   
    if (isEmpty(ff.txtValor))
    	{
        ok = false;
        msg = msg + " - Preencha campo Valor\n";
    	}
   if (isEmpty(ff.txtMinimo))
    	{
        ok = false;
        msg = msg + " - Preencha campo Minimo\n";
    	}
   if (isEmpty(ff.txtMultiplo))
    	{
        ok = false;
        msg = msg + " - Preencha campo multiplo\n";
    	}
      

if (! ok)
	alert (msg)
return ok
}


//-->