<!-- 

function calcula(nvezes, valor, retorno, taxas, vezes, tot){
	
	vr  = valor.value;
	vr  = vr.replace( "/", "" );
	vr  = vr.replace( "/", "" );
	vr  = vr.replace( ".", "" );
	vr  = vr.replace( ".", "" );
	vr  = vr.replace( ".", "" );
	vr  = vr.replace( ".", "" );
	vr  = vr.replace( ".", "" );
	vr  = vr.replace( ",", "." );
	vr  = vr.replace( ",", "." );
	tam = vr.length;

	resposta = taxas[nvezes].value * vr;
	if (tam < 1)
	{
		resposta = "";
		retorno.value = resposta;
		tot.value     = resposta;
		return false;
	}
	retorno.value = resposta;
	tot.value     = ((nvezes * 1) + 4) * resposta;
	nponto = tot.value.indexOf('.');
	ponto  = retorno.value.indexOf('.');
	if (ponto > -1)
	{
		if ((retorno.value.substr(ponto + 3, 1) > 4) || (retorno.value.substr(ponto + 4, 1) > 4 && retorno.value.substr(ponto + 3, 1) > 3))
		{
			retorno.value =  (retorno.value * 1) + (0.01 * 1);
			retorno.value = retorno.value.substr(0, ponto + 3)
		} else {
			retorno.value =  retorno.value.substr(0, ponto + 3) ;
		}
	} else {
			retorno.value =  retorno.value + ".00";
	}
	if (nponto > -1)
	{
		if ((tot.value.substr(nponto + 3, 1) > 4) || (tot.value.substr(nponto + 4, 1) > 4 && tot.value.substr(nponto + 3, 1) > 3))
		{
			tot.value =  (tot.value * 1) + (0.01 * 1);
			tot.value = tot.value.substr(0, nponto + 2)
		} else {
			tot.value =  tot.value.substr(0, nponto + 2) ;
		}
	} else {
			tot.value =  tot.value/10 + ".00";
	}
	npont = tot.value.indexOf('.');
	ponto = retorno.value.indexOf('.');
	if (retorno.value.substr(ponto + 2, 1) == "")
	{
		retorno.value =  retorno.value + "0" ;
	}

	if (tot.value.substr(npont + 3, 1) == "")
	{
		tot.value =  tot.value + "0" ;
	}

	tot.value     = formatanumero(tot);
	retorno.value = formatanumero(retorno);
	retorno.value = "de R$ " + retorno.value;
	vezes.value   = nvezes * 1 + 4
}


function formatavalor(campo,tammax,teclapres){
	var tecla = teclapres.keyCode;
	vr = campo.value;
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( ",", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	tam = vr.length;

	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 <= 2 ){ 
	 		campo.value = vr ; }
	 	if ( (tam > 2) && (tam <= 5) ){
	 		campo.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 6) && (tam <= 8) ){
	 		campo.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 9) && (tam <= 11) ){
	 		campo.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 12) && (tam <= 14) ){
	 		campo.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 15) && (tam <= 17) ){
	 		campo.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
	}		
}

function formatanumero(campo){
	vr = campo.value;
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ",", "" );
	tam = vr.length;
		if ( tam <= 1 ){ 
	 		campo.value = vr ; }
	 	if ( (tam > 2) && (tam <= 5) ){
	 		campo.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 6) && (tam <= 8) ){
	 		campo.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 9) && (tam <= 11) ){
	 		campo.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 12) && (tam <= 14) ){
	 		campo.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 15) && (tam <= 17) ){
	 		campo.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
	    return campo.value;
	}		

function verifica(vr, teclapress)
{
    tecla = teclapress.keyCode;
	if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		vr = vr.replace( "/", "" );
		vr = vr.replace( "/", "" );
		vr = vr.replace( ".", "" );
		vr = vr.replace( ".", "" );
		vr = vr.replace( ".", "" );
		vr = vr.replace( ".", "" );
		vr = vr.replace( ",", "" );
		if (vr > 300000) { 
			alert('O valor deve estar entre R$ 200,00 e R$ 3.000,00.'); 
			campo.value = "3.000,00";
			formatavalor(campo,tammax,teclapres)
		}	
	}
}
//-->