// Poker Bankroll Calculator
// (c) 2009 Adam Stemple & Chris Wallace


	function ICCalculate(wr, g)
{
	// Games array: 0. spacer 1. FLHE 2. 6max FLHE 3. HU FLHE 4. FLO8 5. 6max FLO8 6. HU FLO8 7. Stud 8. Stud Eight 9. Razz 10. Badugi 11. HORSE  12. Spacer
	//	 BIg Bet Games:   13. NLHE  14. 6max NLHE  15. HU NLHE  16. PLO8  17. 6max PLO8  18.  HU PLO8  19.  7-game FTP  20. 8-game Stars 21. PLO 22. 6max PLO 23. HU PLO 
	var games = [ 0, 600, 850, 950, 500, 600, 750, 400, 400, 400, 650, 550, 0, 50, 50, 52, 45, 50, 55, 40, 45, 44, 47, 48 ]
	
	var wrA = parseFloat(wr);
	
	if (wrA<0) {
		document.getElementById('resultData1').innerHTML = "Your reported win rate of " + wrA + "/100 is negative.  No bankroll is big enough for a losing player."
		document.getElementById('icresultWindow').style.display = 'block';
		return;
		}
	
	var bb = games[g];
	var bbR = Math.round(bb/wrA);
	var bbRpro = Math.round(bbR*1.25);
	var bbRrisky = Math.round(bbR*.6);
	var by = Math.round(bb-(wrA*3))
	var byPro = Math.round(by*1.25)
	var byRisky = Math.round(by*.6)
	
	if (bbR<150) {bbR = 150}
	if (bbRpro<150) {bbRpro = 150}
	if (bbRrisky<150) {bbRrisky = 150}
	if (by<15) {by = 15}
	if (byPro<15) {byPro = 15}
	if (byRisky<15) {byRisky = 15}
	var contentA = "For a win rate of " + wrA + " BBs per 100 hands, your minimum bankroll for this game (in BBs) is: </p><p class='result_p'><span class='result_style'>Pro: </span>" + bbRpro + " &nbsp;&nbsp;&nbsp;&nbsp;<span class='result_style'>Protected: </span>" + bbR + " &nbsp;&nbsp;&nbsp;&nbsp;<span class='result_style'>Risky:</span> " + bbRrisky;
	var contentB = "For a win rate of " + wrA + " BBs per 100 hands,</p><p> your minimum bankroll (in max buyins) is: </p><p><span class='result_style'>Pro: </span>" + byPro + " &nbsp;&nbsp;&nbsp;&nbsp;<span class='result_style'>Protected: </span>" + by + " &nbsp;&nbsp;&nbsp;&nbsp;<span class='result_style'>Risky:</span> " + byRisky;

	if (g<12){
	document.getElementById("resultData").innerHTML = contentA ;}
	else
	{document.getElementById("resultData").innerHTML = contentB ;}
	
	
	document.getElementById("icWrapper").style.height = "31em";
	document.getElementById("row1").style.height = "34em";
	

	document.getElementById("icresultWindow").style.display = "block";
	}

