		function SimuladorCF()
		{
			this.input = document.getElementById('monto');
			this.valorCuota = document.getElementById('valor_cuota');
			this.range = 10000;
			this.minRange = 100000;
			this.maxRange = 600000;
			this.prefix = '$';
		
			this.init = function ()
			{
				this.input.value = this.formatnumber(this.minRange); 
				this.valorCuota.innerHTML = this.formatnumber(parseInt(this.unformatnumber(this.input.value)) * 0.05);
			}

			this.add = function()
			{
				if(this.unformatnumber(this.input.value)<this.maxRange)
				{
					this.input.value = this.formatnumber(parseInt(this.unformatnumber(this.input.value)) + parseInt(this.range));
					this.valorCuota.innerHTML = this.formatnumber(parseInt(this.unformatnumber(this.input.value)) * 0.05);
				}
			}
			this.rest = function()
			{
				if(this.unformatnumber(this.input.value) > this.minRange)
				{
					this.input.value = this.formatnumber(parseInt(this.unformatnumber(this.input.value)) - parseInt(this.range));
					this.valorCuota.innerHTML = this.formatnumber(parseInt(this.unformatnumber(this.input.value)) * 0.05);
				}
			}

			this.formatnumber = function (num,prefix)
			{
			   prefix = prefix || '';
			   num += '';
			   var splitStr = num.split('.');
			   var splitLeft = splitStr[0];
			   var splitRight = splitStr.length > 1 ? '.' + splitStr[1] : '';
			   var regx = /(\d+)(\d{3})/;
			   while (regx.test(splitLeft)) {
				  splitLeft = splitLeft.replace(regx, '$1' + '.' + '$2');
			   }
			   return prefix + splitLeft + splitRight;
			}

			this.unformatnumber = function(num) {
			   return num.replace(".", "");
			}
		}
		fnonload = window.onload;
		window.onload = function(){eval(fnonload); 
			oSimulador = new SimuladorCF();oSimulador.init();
		};

