function calculate(){
	var part = document.getElementById('Participants').value;
	var PSold = document.getElementById('PSold').value;
	var TSold = part * PSold;
	var eachProfit = 0;
	
	document.getElementById('TSold').value = TSold;
	
	if((TSold > 0) && (TSold < 500)) {
		eachProfit = 5;
	}else if((TSold > 499) && (TSold < 1000)) {
		eachProfit = 5.5;
	}else {
		eachProfit = 6;
    }
	
	document.getElementById('profitEachPP').value = eachProfit;
	
	document.getElementById('Profit').value = eachProfit * TSold;
	
}

function calculate2(){ 
	var TSold = document.getElementById('TSold2').value;
	var eachProfit = 0;
        var p = 0;
	
	if((TSold > 0) && (TSold < 500)) {
		eachProfit = 5;
                p = 10;
	}else if((TSold > 499) && (TSold < 1000)) {
		eachProfit = 5.5;
                p = 9.5;
	}else {
		eachProfit = 6;
                p = 9;
    }
	
	document.getElementById('profitEachPP2').value = eachProfit;

        document.getElementById('TCost').value = p * TSold;
	
	document.getElementById('Profit2').value = eachProfit * TSold;
	
} 