$(document).ready(function(){
    
var percent = document.getElementById("calcplan").value;
	

	var percent =  parseFloat(document.getElementById("calcplan").value); 
	var minMoney 	= [25,300,6000,8000,30000,50000 ];
	var maxMoney	= [300,1000,100000,100000,500000,1000000 ];
	$("#money").val(minMoney[0]);
	console.log($("#money").val(minMoney[0]));
	
	//Calculator
	function calc(){
		var money = parseFloat($("#money").val());
		switch (percent) {
		    case 1:
		        if( (money >= 25 && money < 300)){
		        	var profitDaily = money / 100 * 10;
					var profitDaily = profitDaily.toFixed(2);
					var profitTotal = money / 100 * 1 * 10;
					var profitTotal = money + profitTotal;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text(profitDaily);
					$("#profitTotal").text(profitTotal);
				} if (money < 10 || money > 5000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;
			case 2:
		        if( (money >= 300 && money < 1000)){
		        	var profitDaily = money / 100 * 25;
					var profitDaily = profitDaily.toFixed(2);
					var profitTotal = money / 100 * 1 * 25;
					var profitTotal = money + profitTotal;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text(profitDaily);
					$("#profitTotal").text(profitTotal);
				} if (money < 300 || money > 1000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;
			case 3:
		        if( (money >= 6000 && money < 100000)){
		        	var profitDaily = money / 100 * 40;
					var profitDaily = profitDaily.toFixed(2);
					var profitTotal = money / 100 * 1 * 40;
					var profitTotal = money + profitTotal;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text(profitDaily);
					$("#profitTotal").text(profitTotal);
				} if (money < 6000 || money > 100000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;
			case 4:
		        if( (money >= 8000 && money < 100000)){
		        	var profitDaily = 0;
					var profitDaily = 0;
					var profitTotal = money * 55 / 100;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text("N/A");
					$("#profitTotal").text(profitTotal);
				} if (money < 8000 || money > 100000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;
			case 5:
		        if( (money >= 30000 && money < 500000)){
		        	var profitDaily = 0;
					var profitDaily = 0;
					var profitTotal = money * 900 / 100;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text("N/A");
					$("#profitTotal").text(profitTotal);
				} if (money < 30000 || money > 500000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;	
			case 6:
		        if( (money >= 50000 && money < 1000000)){
		        	var profitDaily = 0;
					var profitDaily = 0;
					var profitTotal = money * 1200 / 100;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text("N/A");
					$("#profitTotal").text(profitTotal);
				} if (money < 50000 || money > 1000000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;
			case 7:
		        if( (money >= 600 && money < 5000)){
		        	var profitDaily = 0;
					var profitDaily = 0;
					var profitTotal = money * 120 / 100;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text("N/A");
					$("#profitTotal").text(profitTotal);
				} if (money < 400 || money > 5000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;
			case 8:
		        if( (money >= 300 && money < 10000)){
		        	var profitDaily = 0;
					var profitDaily = 0;
					var profitTotal = money * 110 / 100;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text("N/A");
					$("#profitTotal").text(profitTotal);
				} if (money < 200 || money > 10000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;
			case 9:
		        if( (money >= 30 && money < 20000)){
		        	var profitDaily = 0;
					var profitDaily = 0;
					var profitTotal = money * 105 / 100;
					var profitTotal = profitTotal.toFixed(2);

					$("#profitDaily").text("N/A");
					$("#profitTotal").text(profitTotal);
				} if (money < 20 || money > 20000){
					$("#profitDaily").text("N/A");
					$("#profitTotal").text("N/A");
				}
		        break;			
		}
	}
	if($("#money").length){
		calc();
	}
	$("#money").keyup(function(){
		calc();
	});

	$("#calcplan").on('change', function() {
		percent = parseFloat(this.value);
		calc();
	})
});