
function spinBall()
{
	var result = document.ARLayout.Spin()
	lastNumber()
	ClearPayouts()
	ShowPayouts()
}
   
function betTier()
{
	var result = document.ARLayout.BetTier()
}
   
function BetVoisin()
{
	var result = document.ARLayout.BetVoisin()
}
   
function BetOrphans()
{
	var result = document.ARLayout.BetOrphans()
}

function lastNumber()
{
	var last = document.ARLayout.m_iLastNumber

	if (last == 0)
	{
		ChangeColor("ARNumber", "black")
		ChangeBgColor("ARNumber", "green")
	}
	else if (last == 1 || last == 3 || last == 5 || last == 7 || last == 9 || last == 12 ||
	         last == 14 || last == 16 || last == 18 || last == 19 || last == 21 || last == 23 || 
	         last == 25 || last == 27 || last == 30 || last == 32 || last == 34 || last == 36)
	{
		ChangeColor("ARNumber", "yellow")
		ChangeBgColor("ARNumber", "red")
	}
	else
	{
		ChangeColor("ARNumber", "yellow")
		ChangeBgColor("ARNumber", "black")
	}

	ChangeText("ARNumber", last)
}

function ShowPayouts()
{
	var PayoutString = document.ARLayout.m_LastPayoutString

	var Payout = ""

	var chips = PayoutString.substring(0,4)
	if (chips > 0)
	{
		Payout = chips
		Payout = Payout + " Straight Up"
		if (chips > 1)
		{
			Payout = Payout + "s"
		}
		Payout = Payout + " @ 35 to 1 pays "
		Payout = Payout + chips * 35
		ChangeText("pt01", Payout)
	}

	chips = PayoutString.substring(5,9)
	if (chips > 0)
	{
		Payout = chips
		Payout = Payout + " Split"
		if (chips > 1)
		{
			Payout = Payout + "s"
		}
		Payout = Payout + " @ 17 to 1 pays "
		Payout = Payout + chips * 17
		ChangeText("pt02", Payout)
	}

	chips = PayoutString.substring(10,14)
	if (chips > 0)
	{
		Payout = chips
		Payout = Payout + " Corner"
		if (chips > 1)
		{
			Payout = Payout + "s"
		}
		Payout = Payout + " @ 8 to 1 pays "
		Payout = Payout + chips * 8
		ChangeText("pt03", Payout)
	}

	chips = PayoutString.substring(15,19)
	if (chips > 0)
	{
		Payout = chips
		Payout = Payout + " Street"
		if (chips > 1)
		{
			Payout = Payout + "s"
		}
		Payout = Payout + " @ 11 to 1 pays "
		Payout = Payout + chips * 11
		ChangeText("pt04", Payout)
	}

	chips = PayoutString.substring(20,24)
	if (chips > 0)
	{
		Payout = chips
		Payout = Payout + " Sixline"
		if (chips > 1)
		{
			Payout = Payout + "s"
		}
		Payout = Payout + " @ 5 to 1 pays "
		Payout = Payout + chips * 5
		ChangeText("pt05", Payout)
	}

	chips = PayoutString.substring(40,44)
	if (chips > 0)
	{
		Payout = "Total payout is "
		Payout = Payout + chips
		ChangeText("pt06", Payout)
	}

	chips = PayoutString.substring(25,29)
	if (chips > 0)
	{
		Payout = chips
		Payout = Payout + " Column"
		if (chips > 1)
		{
			Payout = Payout + "s"
		}
		Payout = Payout + " @ 2 to 1 pays "
		Payout = Payout + chips * 2
		ChangeText("pt07", Payout)
	}

	chips = PayoutString.substring(30,34)
	if (chips > 0)
	{
		Payout = chips
		Payout = Payout + " Dozen"
		if (chips > 1)
		{
			Payout = Payout + "s"
		}
		Payout = Payout + " @ 2 to 1 pays "
		Payout = Payout + chips * 2
		ChangeText("pt08", Payout)
	}

	chips = PayoutString.substring(35,39)
	if (chips > 0)
	{
		Payout = chips
		Payout = Payout + " Even Chance"
		if (chips > 1)
		{
			Payout = Payout + "s"
		}
		Payout = Payout + " @ 1 to 1 pays "
		Payout = Payout + chips
		ChangeText("pt09", Payout)
	}
}
  
function ClearPayouts()
{
	ChangeText("pt01", " ")
	ChangeText("pt02", " ")
	ChangeText("pt03", " ")
	ChangeText("pt04", " ")
	ChangeText("pt05", " ")
	ChangeText("pt06", " ")
	ChangeText("pt07", " ")
	ChangeText("pt08", " ")
	ChangeText("pt09", " ")
}  