//code written  by Mike DiBacco (X-Files) - copyright ChipTalk.Net 2005

function convert(HandForm) {
	var handhistory = HandForm.HandInput.value
	
	var HandArray = new Array()
	var HandOutput = new Array()
	var replacearray = new Array(10)
	replacearray[0] = "Button"
	replacearray[1] = "SB"
	replacearray[2] = "BB"
	replacearray[3] = "UTG"
	replacearray[4] = "UTG+1"
	replacearray[5] = "MP1"
	replacearray[6] = "MP2"
	replacearray[7] = "MP3"
	replacearray[8] = "MP4"
	replacearray[9] = "CO"
	var seatarray = new Array(10)
	seatarray[0] = new Array(8)
	seatarray[1] = new Array(8)
	seatarray[2] = new Array(8)
	seatarray[3] = new Array(8)
	seatarray[4] = new Array(8)
	seatarray[5] = new Array(8)
	seatarray[6] = new Array(8)
	seatarray[7] = new Array(8)
	seatarray[8] = new Array(8)
	seatarray[9] = new Array(8)
	for (i = 0; i <= 9 ; i++) {
		 for (j = 0; j <= 7; j++){
			 seatarray[i][j] = ""
		 }
	}
	
	
	
	var line = ""
	var j = 0
	for (var i = 0; i < handhistory.length; i++) {
		if (handhistory.charCodeAt(i) == 10) {
		//if ((handhistory.charCodeAt(i) == 13) && (handhistory.charCodeAt(i + 1) == 10)) {
			//line += handhistory.charAt(i) + handhistory.charAt(i + 1)			
			HandArray[j] = line
			line = ""
			j = j + 1
		} 
		else {
		line += handhistory.charAt(i);
		}
		//HandArray[j] = line
	}
	
	/* figure out what seat is what postition */
	


	var hand = HandForm.HandInput.value

	var seats = 0
	for (s = 0; s <= 9; s++) {
		seatnum = 'Seat ' + s + ':'
		if (hand.indexOf(seatnum) >= 0) {
			seats = seats + 1
		}
	}
	if (hand.indexOf('Seat #') >= 0) {	
		var character = hand.indexOf('Seat #')
		character = character + 6
		var button = hand.charAt(character)
	}
	var replacecount = 0
	seatarray[button - 1][1] = replacearray[replacecount]
	replacecount = replacecount + 1
	var seatcount = 1
	var seat = parseInt(button) + 1
	var seatname = 'Seat ' + seat + ':'
	while (seatcount < seats) {	
		while (hand.indexOf(seatname) < 0) {
			seat = seat + 1
			if (seat > 9) {seat = 1}
			seatname = 'Seat ' + seat + ':'
		}
		seatarray[seat - 1][1] = replacearray[replacecount]
		replacecount = replacecount + 1
		seat = seat + 1
		if (seat > 9) {seat = 1}
		seatcount = seatcount + 1
		seatname = 'Seat ' + seat + ':'
	}
	if (hand.indexOf('Dealt to') >= 0) {	
		var character = hand.indexOf('Dealt to')
		var heroname = ""
		character = character + 9
		while (hand.charAt(character) != "[") {
			if (hand.charAt(character + 1) != "[") {
				heroname += hand.charAt(character)
			}
			character = character + 1
		}
	}
	
	if (hand.indexOf(heroname) >=0) {
		character = hand.indexOf(heroname)
		character = character - 3
		var heroseat = parseInt(hand.charAt(character)) - 1
		seatarray[heroseat][5] = seatarray[heroseat][1]
		seatarray[heroseat][1] = "HERO"		
	}
	
	/* Convert the hand history	*/
	HandOutput = convertpositions(HandArray, seatarray, HandForm)

	
	myString = HandOutput.toString()
	rExp = /,/gi;
	newString = new String ("")
	results = myString.replace(rExp, newString)
	HandForm.HandOutput.value = HandOutput
	
	
}

function convertpositions(HandArray, seatarray, HandForm) {
	var k = 0
	var dollar = 0
	var prevraise = 0
	var folds = 0
	var flopfolds = 0
	var turnfolds = 0
	var riverfolds = 0
	var pot = 0
	var players = 0
	var floppot = 0
	var turnpot = 0
	var riverpot = 0
	var ante = 0
	var preflopaction = new Array()
	var flopaction = new Array()
	var turnaction = new Array()
	var riveraction = new Array()
	var showaction = new Array()
	var potarray = new Array(9)
	var flopresults = new Array()
	var flopresultscount = 0
	var turnresults = new Array()
	var turnresultscount = 0
	var riverresults = new Array()
	var riverresultscount = 0
	var startstring = ""
	var flopstring = ""
	var turnstring = ""
	var riverstring = ""
	var showstring = ""
	var summarystring = ""
	var toundollar = ""
	var preflopactioncount = 0
	var flopactioncount = 0
	var turnactioncount = 0
	var riveractioncount = 0
	var showactioncount = 0
	var handoutputline = 0
	var HandOutput = ""
	var status = "START"
	for (i = 0; i<=8; i++){
		potarray[i] = 0
	}
	while (k < HandArray.length) {
		var splitarray = HandArray[k].split(" ")
		if (splitarray[1] == "HOLE") {
			status = "HOLE"
		}
		if (splitarray[1] == "FLOP") {
			status = "FLOP"
		}
		if (splitarray[1] == "TURN") {
			status = "TURN"
		}
		if (splitarray[1] == "RIVER") {
			status = "RIVER"
		}
		if (splitarray[1] == "SHOW") {
			status = "SHOW"
		}
		if (splitarray[1] == "SUMMARY"){
			status = "SUMMARY"
			if (folds > 1) {
				preflopaction[preflopactioncount] = folds + " folds"
				preflopactioncount = preflopactioncount + 1
				folds = 0
			}
			if (folds == 1){
				preflopaction[preflopactioncount] = folds + " fold"
				preflopactioncount = preflopactioncount + 1
				folds = 0
			}
			
			if (flopfolds > 1) {
				flopaction[flopactioncount] = flopfolds + " folds"
				flopactioncount = flopactioncount + 1
				flopfolds = 0
			}
			if (flopfolds == 1){
				flopaction[flopactioncount] = flopfolds + " fold"
				flopactioncount = flopactioncount + 1
				flopfolds = 0
			}
			if (turnfolds > 1) {
				turnaction[turnactioncount] = turnfolds + " folds"
				turnactioncount = turnactioncount + 1
				turnfolds = 0
			}
			if (turnfolds == 1){
				turnaction[turnactioncount] = turnfolds + " fold"
				turnactioncount = turnactioncount + 1
				turnfolds = 0
			}
			if (riverfolds > 1) {
				riveraction[riveractioncount] = riverfolds + " folds"
				riveractioncount = riveractioncount + 1
				riverfolds = 0
			}
			if (riverfolds == 1){
				riveraction[riveractioncount] = riverfolds + " fold"
				riveractioncount = riveractioncount + 1
				riverfolds = 0
			}
		}
		
		switch (status) {			
			case "START":
				if ((splitarray[0] == "PokerStars") | (splitarray[0] == "POKERSTARS")) {
					startstring = "[b][color=cyan]Saw Flop[/color][/b] | [b][color=indigo]Saw Turn[/color][/b] | [b][color=orange]Saw River[/color][/b] | [b][color=yellow]Saw Showdown[/color][/b]  | [b][color=lime]Won[/color][/b] \n\n"
					startstring += HandArray[k]	+ "\n"
					if ((splitarray[10] == "Level") | (splitarray[10] == "LEVEL")){
						var level = splitarray[10] + " " + splitarray[11] + " " + splitarray[12]
					}
					else if (splitarray[5] == "Limit"){
						var level = splitarray[6]
					}
					else if (splitarray[6] == "Limit"){
						var level = splitarray[7]
					}
				}
				if (splitarray[0] == 'Table') {
					startstring += HandArray[k] + "\n\n"
				}
				if (splitarray[3] == "blind"){
					potarray = generatepot(splitarray[0], "", splitarray[4], seatarray, potarray, "", ante)
				}
				else if (splitarray[4] == "blind"){
					potarray = generatepot(splitarray[0], splitarray[1], splitarray[5], seatarray, potarray, "", ante)
				}
				if (splitarray[3] == "ante"){
					ante = splitarray[4]
					if (ante.charAt(0) == "$"){
						newString = new String ("")
						ante = ante.replace("\$",newString)
						ante = parseFloat(ante)				
					}
					else{
						ante = parseInt(ante)
					}
					potarray = generatepot(splitarray[0], "", splitarray[4], seatarray, potarray, "", ante)
				}
				else if (splitarray[4] == "ante"){
					ante = splitarray[5]
					if (ante.charAt(0) == "$"){
						newString = new String ("")
						ante = ante.replace("\$",newString)
						ante = parseFloat(ante)				
					}
					else{
						ante = parseInt(ante)
					}
					potarray = generatepot(splitarray[0], splitarray[1], splitarray[5], seatarray, potarray, "", ante)
				}
				if (splitarray[0] == 'Seat') {
					var testchar = splitarray[3].toString()
					if (testchar.charAt(0) == "(") {
						if (testchar.charAt(1) == "$") {
							toundollar = "$"
						}
						else{
							toundollar = "t"
						}
						var switchkey = splitarray[1].toString()
						switch (switchkey) {
							case "1:":
								seatarray[0][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[0][3] = chips.replace("\$",newString)							
								splitarray[1] = seatarray[0][1] + " " + seatarray[0][2] + " " + toundollar + seatarray[0][3]
								players = players + 1
							break 
							case "2:":
								seatarray[1][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[1][3] = chips.replace("\$",newString)
								splitarray[1] = seatarray[1][1] + " " + seatarray[1][2] + " " + toundollar + seatarray[1][3]
								players = players + 1
							break 
							case "3:":
								seatarray[2][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[2][3] = chips.replace("\$",newString)								
								splitarray[1] = seatarray[2][1] + " " + seatarray[2][2] + " " + toundollar + seatarray[2][3]
								players = players + 1
							break 
							case "4:":
								seatarray[3][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[3][3] = chips.replace("\$",newString)						
								splitarray[1] = seatarray[3][1] + " " + seatarray[3][2] + " " + toundollar + seatarray[3][3]
								players = players + 1
							break 
							case "5:":
								seatarray[4][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[4][3] = chips.replace("\$",newString)					
								splitarray[1] = seatarray[4][1] + " " + seatarray[4][2] + " " + toundollar + seatarray[4][3]
								players = players + 1
							break 
							case "6:":
								seatarray[5][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[5][3] = chips.replace("\$",newString)							
								splitarray[1] = seatarray[5][1] + " " + seatarray[5][2] + " " + toundollar + seatarray[5][3]
								players = players + 1
							break 
							case "7:":
								seatarray[6][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[6][3] = chips.replace("\$",newString)								
								splitarray[1] = seatarray[6][1] + " " + seatarray[6][2] + " " + toundollar + seatarray[6][3]
								players = players + 1
							break 
							case "8:":
								seatarray[7][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[7][3] = chips.replace("\$",newString)							
								splitarray[1] = seatarray[7][1] + " " + seatarray[7][2] + " " + toundollar + seatarray[7][3]
								players = players + 1
							break 
							case "9:":
								seatarray[8][2] = splitarray[2]
								var chips = splitarray[3]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[8][3] = chips.replace("\$",newString)					
								splitarray[1] = seatarray[8][1] + " " + seatarray[8][2] + " " + toundollar + seatarray[8][3]
								players = players + 1
							break 
							default:
							}
					}
					else {
						testchar = splitarray[4].toString()
						if (testchar.charAt(1) == "$") {
							toundollar = "$"
						}
						else{
							toundollar = "t"
						}						
						var switchkey = splitarray[1].toString()
						switch (switchkey) {
							case "1:":
								seatarray[0][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[0][3] = chips.replace("\$",newString)						
								splitarray[1] = seatarray[0][1] + " " + seatarray[0][2] + " " + toundollar + seatarray[0][3]
								players = players + 1
							break 
							case "2:":
								seatarray[1][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[1][3] = chips.replace("\$",newString)							
								splitarray[1] = seatarray[1][1] + " " + seatarray[1][2] + " " + toundollar + seatarray[1][3]	
								players = players + 1
								break 
							case "3:":
								seatarray[2][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[2][3] = chips.replace("\$",newString)					
								splitarray[1] = seatarray[2][1] + " " + seatarray[2][2] + " " + toundollar + seatarray[2][3]						
								players = players + 1
								break 
							case "4:":
								seatarray[3][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[3][3] = chips.replace("\$",newString)								
								splitarray[1] = seatarray[3][1] + " " + seatarray[3][2] + " " + toundollar + seatarray[3][3]					
								players = players + 1
								break 
							case "5:":
								seatarray[4][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[4][3] = chips.replace("\$",newString)							
								splitarray[1] = seatarray[4][1] + " " + seatarray[4][2] + " " + toundollar + seatarray[4][3]					
								players = players + 1
								break 
							case "6:":
								seatarray[5][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[5][3] = chips.replace("\$",newString)							
								splitarray[1] = seatarray[5][1] + " " + seatarray[5][2] + " " + toundollar + seatarray[5][3]						
								players = players + 1
								break 
							case "7:":
								seatarray[6][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[6][3] = chips.replace("\$",newString)							
								splitarray[1] = seatarray[6][1] + " " + seatarray[6][2] + " " + toundollar + seatarray[6][3]						
								players = players + 1
								break 
							case "8:":
								seatarray[7][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[7][3] = chips.replace("\$",newString)						
								splitarray[1] = seatarray[7][1] + " " + seatarray[7][2] + " " + toundollar + seatarray[7][3]				
								players = players + 1
								break 
							case "9:":
								seatarray[8][2] = splitarray[2] + " " + splitarray[3]
								var chips = splitarray[4]
								newString = new String ("")
								chips = chips.replace("\(", newString)
								seatarray[8][3] = chips.replace("\$",newString)				
								splitarray[1] = seatarray[8][1] + " " + seatarray[8][2] + " " + toundollar + seatarray[8][3]
								players = players + 1
								break 
							default:
							}
					}
				}
			break
			case "HOLE":
				var aliasarray = new Array(9)
				var namearray = new  Array(9)
				namearray[0] = HandForm.Name0.value
				namearray[1] = HandForm.Name1.value
				namearray[2] = HandForm.Name2.value
				namearray[3] = HandForm.Name3.value
				namearray[4] = HandForm.Name4.value
				namearray[5] = HandForm.Name5.value
				namearray[6] = HandForm.Name6.value
				namearray[7] = HandForm.Name7.value
				namearray[8] = HandForm.Name8.value
				aliasarray[0] = HandForm.Alias0.value
				aliasarray[1] = HandForm.Alias1.value
				aliasarray[2] = HandForm.Alias2.value
				aliasarray[3] = HandForm.Alias3.value
				aliasarray[4] = HandForm.Alias4.value
				aliasarray[5] = HandForm.Alias5.value
				aliasarray[6] = HandForm.Alias6.value
				aliasarray[7] = HandForm.Alias7.value
				aliasarray[8] = HandForm.Alias8.value
				for (i=0;i<=8;i++){
					if ((namearray[i] != "") && (aliasarray[i] != "")){						
						for (j=0;j<=8;j++){
							if (namearray[i] == seatarray[j][2]){
								seatarray[j][7] = aliasarray[i]
							}
						}
					}
				}											  
				for (j=0;j<=8;j++){
					var name = convertchiptalk(seatarray[j][2])
					seatarray[j][6] = name					
				}
				if (splitarray[0] == "Dealt") {
					var preflopstring = "[b]PREFLOP[/b] " + level + "\n"
					for (i=0;i<=8; i++) {
						if (splitarray[2] == seatarray[i][2]) {
							preflopstring += determinname(i,seatarray,HandForm, 1) 
							preflopstring += " is "
							preflopstring += seatarray[i][5] + " with "
						}
					}
					//covert cards for chiptalk.net
					suit1 = splitarray[3]
					if (suit1.charAt(0) == "[") {
						splitarray[3] = suit1.replace("\[", newString)
						suit2 = splitarray[4]
						var output = "";
						for (var i = 0; i < suit2.length; i++) {
							if ((suit2.charCodeAt(i) == 13) && (suit2.charCodeAt(i + 1) == 10)) {
								i++;
							} 
							else {
								output += suit2.charAt(i);
							}
						}
						splitarray[4] = output.replace("\]", newString)
						preflopstring += " " + convertsuit(splitarray[3])
						preflopstring += " " + convertsuit(splitarray[4])
						
					}
					else {
						suit1 = splitarray[4]
						splitarray[4] = suit1.replace("\[", newString)
						suit2 = splitarray[5]
												for (var i = 0; i < suit2.length; i++) {
							if ((suit2.charCodeAt(i) == 13) && (suit2.charCodeAt(i + 1) == 10)) {
								i++;
							} 
							else {
								output += suit2.charAt(i);
							}
						}
						splitarray[5] = suit2.replace("\]", newString)
						preflopstring += " " + convertsuit(splitarray[4])
						preflopstring += " " + convertsuit(splitarray[5])
						
					}
				}
				// check for folds
				if ((splitarray[1] == "folds") || (splitarray[2] == "folds")){
					folds = folds + 1
					players = players - 1
				}
				//check for raises
				if ((splitarray[1] == "raises") || (splitarray[2] == "raises")){
					
					if (folds > 1) {
						preflopaction[preflopactioncount] = folds + " folds"
						preflopactioncount = preflopactioncount + 1
						folds = 0
						}
					if (folds == 1){
						preflopaction[preflopactioncount] = folds + " fold"
						preflopactioncount = preflopactioncount + 1
						folds = 0
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "raises") {							
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[4], seatarray, potarray, 1, ante)
								preflopaction[preflopactioncount] = determinname(i,seatarray,HandForm,1)
								if (toundollar == "t"){
									preflopaction[preflopactioncount] += " " + splitarray[1] +  " " + toundollar + splitarray[2] + " to " + toundollar + splitarray[4]
								}
								else{
									preflopaction[preflopactioncount] += " " + splitarray[1] +  " " + splitarray[2] + " to " + splitarray[4]
								}
								preflopactioncount = preflopactioncount + 1
							}
						}
						else if (splitarray[2] == "raises"){
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[5], seatarray, potarray, 1, ante)
								preflopaction[preflopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									preflopaction[preflopactioncount] += " " + splitarray[2] +  " " + toundollar + splitarray[3] + " to " + toundollar + splitarray[5]
								}
								else{
									preflopaction[preflopactioncount] += " " + splitarray[2] +  " " + splitarray[3] + " to " + splitarray[5]
								}
								preflopactioncount = preflopactioncount + 1
							}
						}
					}
				}
				//check for checks
				if ((splitarray[1] == "checks") || (splitarray[2] == "checks")){
					if (folds > 1) {
						preflopaction[preflopactioncount] = folds + " folds"
						preflopactioncount = preflopactioncount + 1
						folds = 0
						}
					if (folds == 1){
						preflopaction[preflopactioncount] = folds + " fold"
						preflopactioncount = preflopactioncount + 1
						folds = 0
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "checks") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								preflopaction[preflopactioncount] = determinname(i,seatarray,HandForm,1) 
								preflopaction[preflopactioncount] +=  " " + splitarray[1]
								preflopactioncount = preflopactioncount + 1
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								preflopaction[preflopactioncount] = determinname(i,seatarray,HandForm,1) 
								preflopaction[preflopactioncount] +=  " " + splitarray[2]
								preflopactioncount = preflopactioncount + 1
							}
						}
					}
				}
				//check for bets
				if ((splitarray[1] == "bets") || (splitarray[2] == "bets")){
					if (folds > 1) {
						preflopaction[preflopactioncount] = folds + " folds"
						preflopactioncount = preflopactioncount + 1
						folds = 0
						}
					if (folds == 1){
						preflopaction[preflopactioncount] = folds + " fol "
						preflopactioncount = preflopactioncount + 1
						folds = 0
						}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "bets") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[2], seatarray, potarray, 3, ante)
								preflopaction[preflopactioncount] = determinname(i,seatarray,HandForm,1)
								if (toundollar == "t"){
									preflopaction[preflopactioncount] +=  " " + splitarray[1] + " " + toundollar + splitarray[2]
								}
								else{
									preflopaction[preflopactioncount] +=  " " + splitarray[1] + " " + splitarray[2]
								}
								preflopactioncount = preflopactioncount + 1								
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[3], seatarray, potarray, 3, ante)
								preflopaction[preflopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									preflopaction[preflopactioncount] +=  " " + splitarray[2]+ " " + toundollar + splitarray[3]
								}
								else{
									preflopaction[preflopactioncount] +=  " " + splitarray[2]+ " " + splitarray[3]
								}
								preflopactioncount = preflopactioncount + 1
							}
						}
					}
				}
				//check for calls
				if ((splitarray[1] == "calls") || (splitarray[2] == "calls")){
					if (folds > 1) {
						preflopaction[preflopactioncount] = folds + " folds"
						preflopactioncount = preflopactioncount + 1
						folds = 0
						}
					if (folds == 1){
						preflopaction[preflopactioncount] = folds + " fold"
						preflopactioncount = preflopactioncount + 1
						folds = 0
						}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "calls") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[2], seatarray, potarray, 2, ante)
								preflopaction[preflopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									preflopaction[preflopactioncount] +=  " " + splitarray[1] + " " + toundollar + splitarray[2]
								}
								else{
									preflopaction[preflopactioncount] +=  " " + splitarray[1] + " " + splitarray[2]
								}
								preflopactioncount = preflopactioncount + 1
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[3], seatarray, potarray, 2, ante)
								preflopaction[preflopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									preflopaction[preflopactioncount] +=  " " + splitarray[2]+ " " + toundollar + splitarray[3]
								}
								else{
									preflopaction[preflopactioncount] +=  " " + splitarray[2]+ " " + splitarray[3]
								}
								preflopactioncount = preflopactioncount + 1
							}
						}
					}
				}
			break
			case "FLOP":
				var flopplayers = players
				for (i=0;i<=8;i++){
					floppot += potarray[i]
				}
				if (toundollar == "$"){
					var potamount = floppot.toFixed(2)
				}
				else{
					var potamount = floppot
				}
				if (splitarray[1] == "FLOP"){
					flopstring = "[b]FLOP[/b] " + toundollar + potamount + " (" + flopplayers + " players)\n"
					//covert cards for chiptalk.net
					suit1 = splitarray[3]
					if (suit1.charAt(0) == "[") {
						splitarray[3] = suit1.replace("\[", newString)
						suit3 = splitarray[5]
						var output = "";
						for (var i = 0; i < suit2.length; i++) {
							if ((suit3.charCodeAt(i) == 13) && (suit3.charCodeAt(i + 1) == 10)) {
								i++;
							} 
							else {
								output += suit3.charAt(i);
							}
						}
						splitarray[5] = output.replace("\]", newString)
						flopstring += convertsuit(splitarray[3])
						flopstring += " " + convertsuit(splitarray[4])
						flopstring += " " + convertsuit(splitarray[5])
					}
				}
				// check for folds
				if ((splitarray[1] == "folds") || (splitarray[2] == "folds")){
					flopfolds = flopfolds + 1
					players = players - 1
					seatarray = setcolor(1,seatarray,splitarray[0],splitarray[1])
				}
				//check for raises
				if ((splitarray[1] == "raises") || (splitarray[2] == "raises")){			
					seatarray = setcolor(1,seatarray,splitarray[0],splitarray[1])
					if (flopfolds > 1) {
						flopaction[flopactioncount] = flopfolds + " folds"
						flopactioncount = flopactioncount + 1
						flopfolds = 0
						}
					if (flopfolds == 1){
						flopaction[flopactioncount] = flopfolds + " fold"
						flopactioncount = flopactioncount + 1
						flopfolds = 0
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "raises") {							
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[4], seatarray, potarray, 4, ante)
								flopaction[flopactioncount] = determinname(i,seatarray,HandForm,1)
								if (toundollar == "t"){
									flopaction[flopactioncount] += " " + splitarray[1] + " " + toundollar + splitarray[2] + " to " + toundollar + splitarray[4]
								}
								else{
									flopaction[flopactioncount] += " " + splitarray[1] + " " + splitarray[2] + " to " + splitarray[4]
								}
								flopactioncount = flopactioncount + 1
							}
						}
						else if (splitarray[2] == "raises"){
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[5], seatarray, potarray, 4, ante)
								flopaction[flopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									flopaction[flopactioncount] += " " + splitarray[2] + " " + toundollar + splitarray[3] + " to " + toundollar + splitarray[5]
								}
								else{
									flopaction[flopactioncount] += " " + splitarray[2] + " " + splitarray[3] + " to " + splitarray[5]
								}
								flopactioncount = flopactioncount + 1
							}
						}
					}
				}
				//check for checks
				if ((splitarray[1] == "checks") || (splitarray[2] == "checks")){
					seatarray = setcolor(1,seatarray,splitarray[0],splitarray[1])
					if (flopfolds > 1) {
						flopaction[flopactioncount] = flopfolds + " folds"
						flopactioncount = flopactioncount + 1
						flopfolds = 0
						}
					if (flopfolds == 1){
						flopaction[flopactioncount] = flopfolds + " fold"
						flopactioncount = flopactioncount + 1
						flopfolds = 0
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "checks") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								flopaction[flopactioncount] = determinname(i,seatarray,HandForm,1) 
								flopaction[flopactioncount] +=  " " + splitarray[1]
								flopactioncount = flopactioncount + 1
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								flopaction[flopactioncount] = determinname(i,seatarray,HandForm,1) 
								flopaction[flopactioncount] +=  " " + splitarray[2]
								flopactioncount = flopactioncount + 1
							}
						}
					}
				}
				//check for bets
				if ((splitarray[1] == "bets") || (splitarray[2] == "bets")){
					seatarray = setcolor(1,seatarray,splitarray[0],splitarray[1])
					if (flopfolds > 1) {
						flopaction[flopactioncount] = flopfolds + " folds"
						flopactioncount = flopactioncount + 1
						flopfolds = 0
						}
					if (flopfolds == 1){
						flopaction[flopactioncount] = flopfolds + " fol "
						flopactioncount = flopactioncount + 1
						flopfolds = 0
						}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "bets") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[2], seatarray, potarray, 3, ante)
								flopaction[flopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									flopaction[flopactioncount] +=  " " + splitarray[1] + " " + toundollar + splitarray[2]
								}
								else{
									flopaction[flopactioncount] +=  " " + splitarray[1] + " " + splitarray[2]
								}
								flopactioncount = flopactioncount + 1
								
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[3], seatarray, potarray, 3, ante)
								flopaction[flopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									flopaction[flopactioncount] +=  " " + splitarray[2]+ " " + toundollar + splitarray[3]
								}
								else{
									flopaction[flopactioncount] +=  " " + splitarray[2]+ " " + splitarray[3]
								}
								flopactioncount = flopactioncount + 1
							}
						}
					}
				}
				//check for calls
				if ((splitarray[1] == "calls") || (splitarray[2] == "calls")){
					seatarray = setcolor(1,seatarray,splitarray[0],splitarray[1])
					if (flopfolds > 1) {
						flopaction[flopactioncount] = flopfolds + " folds"
						flopactioncount = flopactioncount + 1
						flopfolds = 0
						}
					if (flopfolds == 1){
						flopaction[flopactioncount] = flopfolds + " fold"
						flopactioncount = flopactioncount + 1
						flopfolds = 0
						}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "calls") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[2], seatarray, potarray, 2, ante)
								flopaction[flopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									flopaction[flopactioncount] +=  " " + splitarray[1] + " " + toundollar + splitarray[2]
								}
								else{
									flopaction[flopactioncount] +=  " " + splitarray[1] + " " + splitarray[2]
								}
								flopactioncount = flopactioncount + 1
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[3], seatarray, potarray, 2, ante)
								flopaction[flopactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									flopaction[flopactioncount] +=  " " + splitarray[2]+ " " + toundollar + splitarray[3]
								}
								else{
									flopaction[flopactioncount] +=  " " + splitarray[2]+ " " + splitarray[3]
								}
								flopactioncount = flopactioncount + 1
							}
						}
					}
				}
				//check results
				if (HandForm.showresults.checked) {
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "shows") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								flopresults[flopresultscount] = determinname(i,seatarray,HandForm,1) 
								flopresults[flopresultscount] +=  " shows"
								suit1 = splitarray[2]
								if (suit1.charAt(0) == "[") {
									splitarray[2] = suit1.replace("\[", newString)
									suit2 = splitarray[3]
									splitarray[3] = suit2.replace("\]", newString)
									flopresults[flopresultscount] += " " + convertsuit(splitarray[2])
									flopresults[flopresultscount] += " " + convertsuit(splitarray[3])									
								}
								flopresultscount = flopresultscount + 1
							}
						}
						else if(splitarray[2] == "shows"){
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								flopresults[flopresultscount] = determinname(i,seatarray,HandForm,1) 
								flopresults[flopresultscount] +=  " shows"
								suit1 = splitarray[3]
								if (suit1.charAt(0) == "[") {
									splitarray[3] = suit1.replace("\[", newString)
									suit2 = splitarray[4]
									splitarray[4] = suit2.replace("\]", newString)
									flopresults[flopresultscount] += " " + convertsuit(splitarray[3])
									flopresults[flopresultscount] += " " + convertsuit(splitarray[4])					
								}
								flopresultscount = flopresultscount + 1
							}
						}
						if (splitarray[1] == "collected") {
							if (splitarray[0] == seatarray[i][2]) {
								flopresults[flopresultscount] = determinname(i,seatarray,HandForm,1) 
								flopresults[flopresultscount] +=  " collected "
								var wintotal = splitarray[2]
								if (wintotal.charAt(0) == "$"){
									splitarray[2] = wintotal.replace("\$",newString)
								}
								flopresults[flopresultscount] += toundollar + splitarray[2] + " from pot"
								flopresultscount = flopresultscount + 1
							}
						}
						else if(splitarray[2] == "collected"){
							if ((splitarray[0] + " " + splitarray[1]) == seatarray[i][2]) {
								flopresults[flopresultscount] = determinname(i,seatarray,HandForm,1) 
								flopresults[flopresultscount] +=  " collected"
								var wintotal = splitarray[3]
								if (wintotal.charAt(0) == "$"){
									splitarray[3] = wintotal.replace("\$",newString)
								}
								flopresults[flopresultscount] += toundollar + splitarray[2] + " from pot"
								flopresultscount = flopresultscount + 1
							}
						}
					}
				}
			break
			case "TURN":
				var turnplayers = players
				for (i=0;i<=8;i++){
					turnpot += potarray[i]
				}
				if (toundollar == "$"){
					var potamount = turnpot.toFixed(2)
				}
				else{
					var potamount = turnpot
				}
				if (splitarray[1] == "TURN"){
					turnstring = "[b]TURN[/b] " + toundollar + potamount + " (" + turnplayers + " players)\n"
					//covert cards for chiptalk.net
					suit1 = splitarray[3]
					if (suit1.charAt(0) == "[") {
						splitarray[3] = suit1.replace("\[", newString)
						suit3 = splitarray[5]
						var suit3output = "";
						for (var i = 0; i < suit3.length; i++) {
							if ((suit3.charCodeAt(i) == 13) && (suit3.charCodeAt(i + 1) == 10)) {
								i++;
							} 
							else {
								suit3output += suit3.charAt(i);
							}
						}
						splitarray[5] = suit3output.replace("\]", newString)
						suit4 = splitarray[6]
						splitarray[6] = suit4.replace("\[", newString)
						suit4 = splitarray[6]
						var suit4output = "";
						for (var i = 0; i < suit4.length; i++) {
							if ((suit4.charCodeAt(i) == 13) && (suit4.charCodeAt(i + 1) == 10)) {
								i++;
							} 
							else {
								suit4output += suit4.charAt(i);
							}
						}
						splitarray[6] = suit4output.replace("\]", newString)
						turnstring += convertsuit(splitarray[3])
						turnstring += " " + convertsuit(splitarray[4])
						turnstring += " " + convertsuit(splitarray[5])
						turnstring += " " + convertsuit(splitarray[6])
					}
				}
				// check for folds
				if ((splitarray[1] == "folds") || (splitarray[2] == "folds")){
					turnfolds = turnfolds + 1
					players = players - 1
					seatarray = setcolor(2,seatarray,splitarray[0],splitarray[1])
				}
				//check for raises
				if ((splitarray[1] == "raises") || (splitarray[2] == "raises")){	
					seatarray = setcolor(2,seatarray,splitarray[0],splitarray[1])
					if (turnfolds > 1) {
						turnaction[turnactioncount] = turnfolds + " folds"
						turnactioncount = turnactioncount + 1
						turnfolds = 0
						}
					if (turnfolds == 1){
						turnaction[turnactioncount] = turnfolds + " fold"
						turnactioncount = turnactioncount + 1
						turnfolds = 0
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "raises") {							
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[4], seatarray, potarray, 4, ante)
								turnaction[turnactioncount] = determinname(i,seatarray,HandForm,1)
								if (toundollar == "t"){
									turnaction[turnactioncount] += " " + splitarray[1] + " " + toundollar + splitarray[2] + " to " + toundollar + splitarray[4]
								}
								else{
									turnaction[turnactioncount] += " " + splitarray[1] + " " + splitarray[2] + " to " + splitarray[4]
								}
								turnactioncount = turnactioncount + 1
							}
						}
						else if (splitarray[2] == "raises"){
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[5], seatarray, potarray, 4, ante)
								turnaction[turnactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									turnaction[turnactioncount] += " " + splitarray[2] + " " + toundollar + splitarray[3] + " to " + toundollar + splitarray[5]
								}
								else{
									turnaction[turnactioncount] += " " + splitarray[2] + " " + splitarray[3] + " to " + splitarray[5]
								}
								turnactioncount = turnactioncount + 1
							}
						}
					}
				}
				//check for checks
				if ((splitarray[1] == "checks") || (splitarray[2] == "checks")){
					seatarray = setcolor(2,seatarray,splitarray[0],splitarray[1])
					if (turnfolds > 1) {
						turnaction[turnactioncount] = turnfolds + " folds"
						turnactioncount = turnactioncount + 1
						turnfolds = 0
						}
					if (turnfolds == 1){
						turnaction[turnactioncount] = turnfolds + " fold"
						turnactioncount = turnactioncount + 1
						turnfolds = 0
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "checks") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								turnaction[turnactioncount] = determinname(i,seatarray,HandForm,1) 
								turnaction[turnactioncount] +=  " " + splitarray[1]
								turnactioncount = turnactioncount + 1
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								turnaction[turnactioncount] = determinname(i,seatarray,HandForm,1) 
								turnaction[turnactioncount] +=  " " + splitarray[2]
								turnactioncount = turnactioncount + 1
							}
						}
					}
				}
				//check for bets
				if ((splitarray[1] == "bets") || (splitarray[2] == "bets")){
					seatarray = setcolor(2,seatarray,splitarray[0],splitarray[1])
					if (turnfolds > 1) {
						turnaction[turnactioncount] = turnfolds + " folds"
						turnactioncount = turnactioncount + 1
						turnfolds = 0
						}
					if (turnfolds == 1){
						turnaction[turnactioncount] = turnfolds + " fol "
						turnactioncount = turnactioncount + 1
						turnfolds = 0
						}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "bets") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[2], seatarray, potarray, 3, ante)
								turnaction[turnactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									turnaction[turnactioncount] +=  " " + splitarray[1] + " " + toundollar + splitarray[2]
								}
								else{
									turnaction[turnactioncount] +=  " " + splitarray[1] + " " + splitarray[2]
								}
								turnactioncount = turnactioncount + 1
								
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[3], seatarray, potarray, 3, ante)
								turnaction[turnactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									turnaction[turnactioncount] +=  " " + splitarray[2]+ " " + toundollar + splitarray[3]
								}
								else{
									turnaction[turnactioncount] +=  " " + splitarray[2]+ " " + splitarray[3]
								}
								turnactioncount = turnactioncount + 1
							}
						}
					}
				}
				//check for calls
				if ((splitarray[1] == "calls") || (splitarray[2] == "calls")){
					seatarray = setcolor(2,seatarray,splitarray[0],splitarray[1])
					if (turnfolds > 1) {
						turnaction[turnactioncount] = turnfolds + " folds"
						turnactioncount = turnactioncount + 1
						turnfolds = 0
						}
					if (turnfolds == 1){
						turnaction[turnactioncount] = turnfolds + " fold"
						turnactioncount = turnactioncount + 1
						turnfolds = 0
						}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "calls") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[2], seatarray, potarray, 2, ante)
								turnaction[turnactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									turnaction[turnactioncount] +=  " " + splitarray[1] + " " + toundollar + splitarray[2]
								}
								else{
									turnaction[turnactioncount] +=  " " + splitarray[1] + " " + splitarray[2]
								}
								turnactioncount = turnactioncount + 1
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[3], seatarray, potarray, 2, ante)
								dollar = splitarray[3]
								turnaction[turnactioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									turnaction[turnactioncount] +=  " " + splitarray[2]+ " " + toundollar + splitarray[3]
								}
								else{
									turnaction[turnactioncount] +=  " " + splitarray[2]+ " " + splitarray[3]
								}
								turnactioncount = turnactioncount + 1
							}
						}
					}
				}
				//check results
				if (HandForm.showresults.checked) {
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "shows") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								turnresults[turnresultscount] = determinname(i,seatarray,HandForm,1) 
								turnresults[turnresultscount] +=  " shows"
								suit1 = splitarray[2]
								if (suit1.charAt(0) == "[") {
									splitarray[2] = suit1.replace("\[", newString)
									suit2 = splitarray[3]
									splitarray[3] = suit2.replace("\]", newString)
									turnresults[turnresultscount] += " " + convertsuit(splitarray[2])
									turnresults[turnresultscount] += " " + convertsuit(splitarray[3])									
								}
								turnresultscount = turnresultscount + 1
							}
						}
						else if(splitarray[2] == "shows"){
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								turnresults[turnresultscount] = determinname(i,seatarray,HandForm,1) 
								turnresults[turnresultscount] +=  " shows"
								suit1 = splitarray[3]
								if (suit1.charAt(0) == "[") {
									splitarray[3] = suit1.replace("\[", newString)
									suit2 = splitarray[4]
									splitarray[4] = suit2.replace("\]", newString)
									turnresults[turnresultscount] += " " + convertsuit(splitarray[3])
									turnresults[turnresultscount] += " " + convertsuit(splitarray[4])					
								}
								turnresultscount = turnresultscount + 1
							}
						}
						if (splitarray[1] == "collected") {
							if (splitarray[0] == seatarray[i][2]) {
								turnresults[turnresultscount] = determinname(i,seatarray,HandForm,1) 
								turnresults[turnresultscount] +=  " collected "
								var wintotal = splitarray[2]
								if (wintotal.charAt(0) == "$"){
									splitarray[2] = wintotal.replace("\$",newString)
								}
								turnresults[turnresultscount] += toundollar + splitarray[2] + " from pot"
								turnresultscount = turnresultscount + 1
							}
						}
						else if(splitarray[2] == "collected"){
							if ((splitarray[0] + " " + splitarray[1]) == seatarray[i][2]) {
								turnresults[turnresultscount] = determinname(i,seatarray,HandForm,1) 
								turnresults[turnresultscount] +=  " collected"
								var wintotal = splitarray[3]
								if (wintotal.charAt(0) == "$"){
									splitarray[3] = wintotal.replace("\$",newString)
								}
								turnresults[turnresultscount] += toundollar + splitarray[2] + " from pot"
								turnresultscount = turnresultscount + 1
							}
						}
					}
				}
			break
			case "RIVER":
				var riverplayers = players
				for (i=0;i<=8;i++){
					riverpot += potarray[i]
				}
				if (toundollar == "$"){
					var potamount = riverpot.toFixed(2)
				}
				else{
					var potamount = riverpot
				}
				if (splitarray[1] == "RIVER"){
					riverstring = "[b]RIVER[/b] " + toundollar + potamount + " (" + riverplayers + " players)\n"
					//covert cards for chiptalk.net
					suit1 = splitarray[3]
					if (suit1.charAt(0) == "[") {
						splitarray[3] = suit1.replace("\[", newString)
						suit4 = splitarray[6]
						var suit4output = "";
						for (var i = 0; i < suit4.length; i++) {
							if ((suit4.charCodeAt(i) == 13) && (suit4.charCodeAt(i + 1) == 10)) {
								i++;
							} 
							else {
								suit4output += suit4.charAt(i);
							}
						}
						splitarray[6] = suit4output.replace("\]", newString)
						suit5 = splitarray[7]
						splitarray[7] = suit5.replace("\[", newString)
						suit5 = splitarray[7]
						var suit5output = "";
						for (var i = 0; i < suit5.length; i++) {
							if ((suit5.charCodeAt(i) == 13) && (suit5.charCodeAt(i + 1) == 10)) {
								i++;
							} 
							else {
								suit5output += suit5.charAt(i);
							}
						}
						splitarray[7] = suit5output.replace("\]", newString)
						riverstring += convertsuit(splitarray[3])
						riverstring += " " + convertsuit(splitarray[4])
						riverstring += " " + convertsuit(splitarray[5])
						riverstring += " " + convertsuit(splitarray[6])
						riverstring += " " + convertsuit(splitarray[7])
					}
				}
				// check for folds
				if ((splitarray[1] == "folds") || (splitarray[2] == "folds")){
					riverfolds = riverfolds + 1
					players = players - 1
					seatarray = setcolor(3,seatarray,splitarray[0],splitarray[1])
				}
				//check for raises
				if ((splitarray[1] == "raises") || (splitarray[2] == "raises")){
					seatarray = setcolor(3,seatarray,splitarray[0],splitarray[1])
					if (riverfolds > 1) {
						riveraction[riveractioncount] = riverfolds + " folds"
						riveractioncount = riveractioncount + 1
						riverfolds = 0
						}
					if (riverfolds == 1){
						riveraction[riveractioncount] = riverfolds + " fold"
						riveractioncount = riveractioncount + 1
						riverfolds = 0
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "raises") {							
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[4], seatarray, potarray, 4, ante)
								riveraction[riveractioncount] = determinname(i,seatarray,HandForm,1)
								if (toundollar == "t"){
									riveraction[riveractioncount] += " " + splitarray[1] + " " + toundollar + splitarray[2] + " to " + toundollar + splitarray[4]
								}
								else{
									riveraction[riveractioncount] += " " + splitarray[1] + " " + splitarray[2] + " to " + splitarray[4]
								}
								riveractioncount = riveractioncount + 1
							}
						}
						else if (splitarray[2] == "raises"){
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[5], seatarray, potarray, 4, ante)
								riveraction[riveractioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									riveraction[riveractioncount] += " " + splitarray[2] + " " + toundollar + splitarray[3] + " to " + toundollar + splitarray[5]
								}
								else{
									riveraction[riveractioncount] += " " + splitarray[2] + " " + splitarray[3] + " to " + splitarray[5]
								}
								riveractioncount = riveractioncount + 1
							}
						}
					}
				}
				//check for checks
				if ((splitarray[1] == "checks") || (splitarray[2] == "checks")){
					seatarray = setcolor(3,seatarray,splitarray[0],splitarray[1])
					if (riverfolds > 1) {
						riveraction[riveractioncount] = riverfolds + " folds"
						riveractioncount = riveractioncount + 1
						riverfolds = 0
						}
					if (riverfolds == 1){
						riveraction[riveractioncount] = riverfolds + " fold"
						riveractioncount = riveractioncount + 1
						riverfolds = 0
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "checks") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								riveraction[riveractioncount] = determinname(i,seatarray,HandForm,1) 
								riveraction[riveractioncount] +=  " " + splitarray[1]
								riveractioncount = riveractioncount + 1
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								riveraction[riveractioncount] = determinname(i,seatarray,HandForm,1) 
								riveraction[riveractioncount] +=  " " + splitarray[2]
								riveractioncount = riveractioncount + 1
							}
						}
					}
				}
				//check for bets
				if ((splitarray[1] == "bets") || (splitarray[2] == "bets")){
					seatarray = setcolor(3,seatarray,splitarray[0],splitarray[1])
					if (riverfolds > 1) {
						riveraction[riveractioncount] = riverfolds + " folds"
						riveractioncount = riveractioncount + 1
						riverfolds = 0
						}
					if (riverfolds == 1){
						riveraction[riveractioncount] = riverfolds + " fol "
						riveractioncount = riveractioncount + 1
						riverfolds = 0
						}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "bets") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[2], seatarray, potarray, 3, ante)
								riveraction[riveractioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									riveraction[riveractioncount] +=  " " + splitarray[1] + " " + toundollar + splitarray[2]
								}
								else{
									riveraction[riveractioncount] +=  " " + splitarray[1] + " " + splitarray[2]
								}
								riveractioncount = riveractioncount + 1								
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[3], seatarray, potarray, 3, ante)
								riveraction[riveractioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									riveraction[riveractioncount] +=  " " + splitarray[2]+ " " + toundollar + splitarray[3]
								}
								else{
									riveraction[riveractioncount] +=  " " + splitarray[2]+ " " + splitarray[3]
								}
								riveractioncount = riveractioncount + 1
							}
						}
					}
				}
				//check for calls
				if ((splitarray[1] == "calls") || (splitarray[2] == "calls")){
					seatarray = setcolor(3,seatarray,splitarray[0],splitarray[1])
					if (riverfolds > 1) {
						riveraction[riveractioncount] = riverfolds + " folds"
						riveractioncount = riveractioncount + 1
						riverfolds = 0
						}
					if (riverfolds == 1){
						riveraction[riveractioncount] = riverfolds + " fold"
						riveractioncount = riveractioncount + 1
						riverfolds = 0
						}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "calls") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], "", splitarray[2], seatarray, potarray, 2, ante)
								riveraction[riveractioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									riveraction[riveractioncount] +=  " " + splitarray[1] + " " + toundollar + splitarray[2]
								}
								else{
									riveraction[riveractioncount] +=  " " + splitarray[1] + " " + splitarray[2]
								}
								riveractioncount = riveractioncount + 1
							}
						}
						else {
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								potarray = generatepot(splitarray[0], splitarray[1], splitarray[3], seatarray, potarray, 2, ante)
								riveraction[riveractioncount] = determinname(i,seatarray,HandForm,1) 
								if (toundollar == "t"){
									riveraction[riveractioncount] +=  " " + splitarray[2]+ " " + toundollar + splitarray[3]
								}
								else{
									riveraction[riveractioncount] +=  " " + splitarray[2]+ " " + splitarray[3]
								}
								riveractioncount = riveractioncount + 1
							}
						}
					}
				}
				//check results
				if (HandForm.showresults.checked) {
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "shows") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								riverresults[riverresultscount] = determinname(i,seatarray,HandForm,1) 
								riverresults[riverresultscount] +=  " shows"
								suit1 = splitarray[2]
								if (suit1.charAt(0) == "[") {
									splitarray[2] = suit1.replace("\[", newString)
									suit2 = splitarray[3]
									splitarray[3] = suit2.replace("\]", newString)
									riverresults[riverresultscount] += " " + convertsuit(splitarray[2])
									riverresults[riverresultscount] += " " + convertsuit(splitarray[3])									
								}
								riverresultscount = riverresultscount + 1
							}
						}
						else if(splitarray[2] == "shows"){
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								riverresults[riverresultscount] = determinname(i,seatarray,HandForm,1) 
								riverresults[riverresultscount] +=  " shows"
								suit1 = splitarray[3]
								if (suit1.charAt(0) == "[") {
									splitarray[3] = suit1.replace("\[", newString)
									suit2 = splitarray[4]
									splitarray[4] = suit2.replace("\]", newString)
									riverresults[riverresultscount] += " " + convertsuit(splitarray[3])
									riverresults[riverresultscount] += " " + convertsuit(splitarray[4])					
								}
								riverresultscount = riverresultscount + 1
							}
						}
						if (splitarray[1] == "collected") {
							if (splitarray[0] == seatarray[i][2]) {
								riverresults[riverresultscount] = determinname(i,seatarray,HandForm,1) 
								riverresults[riverresultscount] +=  " collected "
								var wintotal = splitarray[2]
								if (wintotal.charAt(0) == "$"){
									splitarray[2] = wintotal.replace("\$",newString)
								}
								riverresults[riverresultscount] += toundollar + splitarray[2] + " from pot"
								riverresultscount = riverresultscount + 1
							}
						}
						else if(splitarray[2] == "collected"){
							if ((splitarray[0] + " " + splitarray[1]) == seatarray[i][2]) {
								riverresults[riverresultscount] = determinname(i,seatarray,HandForm,1) 
								riverresults[riverresultscount] +=  " collected"
								var wintotal = splitarray[3]
								if (wintotal.charAt(0) == "$"){
									splitarray[3] = wintotal.replace("\$",newString)
								}
								riverresults[riverresultscount] += toundollar + splitarray[2] + " from pot"
								riverresultscount = riverresultscount + 1
							}
						}
					}
				}
			break
			case "SHOW":
				if (HandForm.showresults.checked) {
					if (splitarray[1] == "SHOW"){
						showstring = "[b]SHOW DOWN[/b]"
					}
					for (i = 0; i <= 8; i++) {
						if (splitarray[1] == "shows") {
							if (splitarray[0] == (seatarray[i][2] + ":")) {
								seatarray[i][0] = "[b][color=yellow]"
								seatarray[i][4] = "[/color][/b]"
								showaction[showactioncount] = determinname(i,seatarray,HandForm,1) 
								showaction[showactioncount] +=  " shows"
								suit1 = splitarray[2]
								if (suit1.charAt(0) == "[") {
									splitarray[2] = suit1.replace("\[", newString)
									suit2 = splitarray[3]
									splitarray[3] = suit2.replace("\]", newString)
									showaction[showactioncount] += " " + convertsuit(splitarray[2])
									showaction[showactioncount] += " " + convertsuit(splitarray[3])									
								}
								showactioncount = showactioncount + 1
							}
						}
						else if(splitarray[2] == "shows"){
							if ((splitarray[0] + " " + splitarray[1]) == (seatarray[i][2] + ":")) {
								seatarray[i][0] = "[b][color=yellow]"
								seatarray[i][4] = "[/color][/b]"
								showaction[showactioncount] = determinname(i,seatarray,HandForm,1) 
								showaction[showactioncount] +=  " shows"
								suit1 = splitarray[3]
								if (suit1.charAt(0) == "[") {
									splitarray[3] = suit1.replace("\[", newString)
									suit2 = splitarray[4]
									splitarray[4] = suit2.replace("\]", newString)
									showaction[showactioncount] += " " + convertsuit(splitarray[3])
									showaction[showactioncount] += " " + convertsuit(splitarray[4])					
								}
								showactioncount = showactioncount + 1
							}
						}
						if (splitarray[1] == "collected") {
							if (splitarray[0] == seatarray[i][2]) {
								seatarray[i][0] = "[b][color=yellow]"
								seatarray[i][4] = "[/color][/b]"
								showaction[showactioncount] = determinname(i,seatarray,HandForm,1) 
								showaction[showactioncount] +=  " collected "
								var wintotal = splitarray[2]
								if (wintotal.charAt(0) == "$"){
									splitarray[2] = wintotal.replace("\$",newString)
								}
								showaction[showactioncount] += toundollar + splitarray[2] + " from pot"
								showactioncount = showactioncount + 1
							}
						}
						else if(splitarray[2] == "collected"){
							if ((splitarray[0] + " " + splitarray[1]) == seatarray[i][2]) {
								seatarray[i][0] = "[b][color=yellow]"
								seatarray[i][4] = "[/color][/b]"
								showaction[showactioncount] = determinname(i,seatarray,HandForm,1) 
								showaction[showactioncount] +=  " collected"
								var wintotal = splitarray[3]
								if (wintotal.charAt(0) == "$"){
									splitarray[3] = wintotal.replace("\$",newString)
								}
								showaction[showactioncount] += toundollar + splitarray[2] + " from pot"
								showactioncount = showactioncount + 1
							}
						}
					}
				}
				
				
			break
			case "SUMMARY":
				if (splitarray[1] == "SUMMARY"){
					summarystring = "Final Pot: "
				}
				if (splitarray[0] == "Total"){
					var totalpot = splitarray[2]
					if (totalpot.charAt(0) == "$"){
						summarystring += totalpot
					}
					else{
						summarystring += "t" + splitarray[2]
					}					
				}
				if (splitarray[3] == "Main"){
					var main = splitarray[5]
					if (main.charAt(0) == "$"){
						summarystring += " | Main pot " + main
					}
					else{
						summarystring += " | Main Pot t" + splitarray[5]
					}					
				}
				if (splitarray[6] == "Side"){
					var side = splitarray[8]
					if (side.charAt(0) == "$"){
						summarystring += " | Side pot " + side
					}
					else{
						summarystring += " | Side Pot t" + splitarray[5]
					}					
				}
				if (splitarray[10] == "Rake"){
					var rake = splitarray[11]
					if (rake.charAt(0) == "$"){
						summarystring += " | Rake " + side
					}
					else{
						summarystring += " | Rake t" + splitarray[5]
					}					
				}
				for (i = 0; i <= 8; i++) {
					if (splitarray[3] == "collected") {
						if (splitarray[2] == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}							
						}
						else if ((splitarray[2] + " " + splitarray[3]) == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
					}
					else if(splitarray[4] == "collected"){
						if (splitarray[2] == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
						else if ((splitarray[2] + " " + splitarray[3]) == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
					}
					else if(splitarray[5] == "collected"){
						if (splitarray[2]  == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
						else if ((splitarray[2] + " " + splitarray[3]) == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
					}
					else if(splitarray[6] == "collected"){
						if (splitarray[2] == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
						else if ((splitarray[2] + " " + splitarray[3]) == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
					}
					if (splitarray[7] == "won") {
						if (splitarray[2] == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
						else if ((splitarray[2] + " " + splitarray[3]) == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
					}
					else if(splitarray[8] == "won"){
						if (splitarray[2] == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
						else if ((splitarray[2] + " " + splitarray[3]) == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
					}
					else if(splitarray[9] == "won"){
						if (splitarray[2] == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
						else if ((splitarray[2] + " " + splitarray[3]) == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
					}
					else if(splitarray[10] == "won"){
						if (splitarray[2] == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
						else if ((splitarray[2] + " " + splitarray[3]) == seatarray[i][2]) {
							if (HandForm.showresults.checked) {
								seatarray[i][0] = "[b][color=lime]"
								seatarray[i][4] = "[/color][/b]"
							}
						}
					}
				}
			break
			default:
		}
		k = k + 1
	}
	//output start
	HandOutput = startstring
	
	//output preflop info
	for (i = 0; i <= 8; i++) {
		if (seatarray[i][1] != ""){
			HandOutput += determinname(i,seatarray,HandForm,2) 
			HandOutput += " - " + toundollar + seatarray[i][3] + "\n"
		}
	}
	HandOutput += "\n" + preflopstring + "\n"
	for (i = 0; i <= preflopactioncount - 1; i++){
		if (i == preflopactioncount - 1){
			HandOutput += preflopaction[i] + ".\n"
		}
		else {
			HandOutput += preflopaction[i] + ", "
		}
	}
	
	//output flop info
	if (flopplayers > 0){
		HandOutput += "\n" + flopstring + "\n"
		for (i = 0; i <= flopactioncount - 1; i++){
			if (i == flopactioncount - 1){
				HandOutput += flopaction[i] + ".\n"
			}
			else {
				HandOutput += flopaction[i] + ", "
			}
		}
		if ((HandForm.showresults.checked) && (flopresultscount != 0)) {
			HandOutput += "\n[b]Results[/b]\n"
			for (j=0;j <= flopresultscount - 1;j++){
				HandOutput += flopresults[j] + "\n"
			}
		}
	}
	
	//output turn info
	if (turnplayers > 0){
		HandOutput += "\n" + turnstring + "\n"
		for (i = 0; i <= turnactioncount - 1; i++){
			if (i == turnactioncount - 1){
				HandOutput += turnaction[i] + ".\n"
			}
			else {
				HandOutput += turnaction[i] + ", "
			}
		}
		if ((HandForm.showresults.checked) && (turnresultscount != 0)) {
			HandOutput += "\n[b]Results[/b]\n"
			for (j=0;j <= turnresultscount - 1;j++){
				HandOutput += turnresults[j] + "\n"
			}
		}
	}
	
	//output river info
	if ( riverplayers >0){
		HandOutput += "\n" + riverstring + "\n"
		for (i = 0; i <= riveractioncount - 1; i++){
			if (i == riveractioncount - 1){
				HandOutput += riveraction[i] + ".\n"
			}
			else {
				HandOutput += riveraction[i] + ", "
			}
		}
		if ((HandForm.showresults.checked) && (riverresultscount != 0)) {
			HandOutput += "\n[b]Results[/b]\n"
			for (j=0;j <= riverresultscount - 1;j++){
				HandOutput += riverresults[j] + "\n"
			}
		}
	}
	
	//output show info
	if ((HandForm.showresults.checked) && (showactioncount != 0)) {
		HandOutput += "\n" + showstring + "\n"
		for (i = 0; i <= showactioncount - 1; i++){
			HandOutput += showaction[i] + "\n"
		}
	}
		
	//output summary info
	HandOutput += "\n" + summarystring
	return HandOutput
}	

function setcolor(ftrs,seatarray,name1,name2){
	var name = ""
	if ((name2 == "folds") | (name2 == "raises") | (name2 == "bets") | (name2 == "calls")){
		name = name1
	}
	else{
		name = name1 + " " + name2
	}	
	for (i = 0; i <= 8; i++) {		
		if (name == seatarray[i][2] + ":") {
			switch (ftrs) {
				case 1: //flop
					seatarray[i][0] = "[b][color=cyan]"
					seatarray[i][4] = "[/color][/b]"
					break
				case 2: //turn
					seatarray[i][0] = "[b][color=indigo]"
					seatarray[i][4] = "[/color][/b]"
					break
				case 3: //river
					seatarray[i][0] = "[b][color=orange]"
					seatarray[i][4] = "[/color][/b]"
					break
				case 4: //showdown
					seatarray[i][0] = "[b][color=yellow]"
					seatarray[i][4] = "[/color][/b]"
					break
				default:
					break
			}
		}
	}
	return seatarray
}
function generatepot(name1, name2, dollar, seatarray, potarray, action, ante){
	if (name2 == ""){
		var name = name1
	}
	else{
		var name = name1 + " " + name2
	}
	for (i = 0; i <= 8; i++) {		
		if (name == (seatarray[i][2] + ":")) {
			if (dollar.charAt(0) == "$"){
				newString = new String ("")
				dollar = dollar.replace("\$",newString)
				dollar = parseFloat(dollar)				
			}
			else{
				dollar = parseInt(dollar)
			}
			switch (action) {
				case 1: //raise
					potarray[i] = dollar + ante
					break
				case 2: //call
					potarray[i] += dollar
					break
				case 3: //bet
					potarray[i] += dollar
					break
				case 4: //flop turn river raise
					potarray[i] += dollar + ante
					break
				default:
					potarray[i] += dollar
					break
			}
		}
	}			
	return potarray
}

function determinname(i, seatarray, HandForm, detail) {
	switch (detail){
		case 1: //no detail
			if (HandForm.replacenames[1].checked) {
				if (seatarray[i][7] == ""){
					return seatarray[i][1]
				}
				else{
					return seatarray[i][7]
				}
			}
			if (HandForm.replacenames[0].checked) {
				if (seatarray[i][7] == ""){
					return seatarray[i][2]
				}
				else{
					return seatarray[i][7]
				}
			}
			if (HandForm.replacenames[2].checked) {
				if (seatarray[i][7] == ""){
					return seatarray[i][6]
				}
				else{
					return seatarray[i][7]
				}
			}
			break
		case 2: //detail
			if (HandForm.replacenames[1].checked) {
				if (seatarray[i][7] == ""){
					return seatarray[i][0] + seatarray[i][1] + seatarray[i][4]
				}
				else{
					return seatarray[i][0] + seatarray[i][7] + seatarray[i][4]
				}
			}
			if (HandForm.replacenames[0].checked) {
				if (seatarray[i][1] == "Button"){
					if (seatarray[i][7] == ""){
						return seatarray[i][0] + seatarray[i][2] + seatarray[i][4] + " [b]" + seatarray[i][1] + "[/b]"
					}
					else{
						return seatarray[i][0] + seatarray[i][7] + seatarray[i][4] + " [b]" + seatarray[i][1] + "[/b]"
					}
				}
				else if (seatarray[i][5] == "Button"){
					if (seatarray[i][7] == ""){
						return seatarray[i][0] + seatarray[i][2] + seatarray[i][4] + " [b]" + seatarray[i][5] + "[/b]"
					}
					else{
						return seatarray[i][0] + seatarray[i][7] + seatarray[i][4] + " [b]" + seatarray[i][5] + "[/b]"
					}
				}
				else {
					if (seatarray[i][7] == ""){
						return seatarray[i][0] + seatarray[i][2] + seatarray[i][4]
					}
					else{
						return seatarray[i][0] + seatarray[i][7] + seatarray[i][4]
					}
				}
			}
			if (HandForm.replacenames[2].checked) {
				if (seatarray[i][1] == "Button"){
					if (seatarray[i][7] == ""){
						return seatarray[i][0] + seatarray[i][6] + seatarray[i][4] + " [b]" + seatarray[i][1] + "[/b]"
					}
					else{
						return seatarray[i][0] + seatarray[i][7] + seatarray[i][4] + " [b]" + seatarray[i][1] + "[/b]"
					}
				}
				else if (seatarray[i][5] == "Button"){
					if (seatarray[i][7] == ""){
						return seatarray[i][0] + seatarray[i][6] + seatarray[i][4]  + " [b]" + seatarray[i][5] + "[/b]"
					}
					else{
						return seatarray[i][0] + seatarray[i][7] + seatarray[i][4]  + " [b]" + seatarray[i][5] + "[/b]"
					}
				}
				else{
					if (seatarray[i][7] == ""){
						return seatarray[i][0] + seatarray[i][6] + seatarray[i][4]
					}
					else{
						return seatarray[i][0] + seatarray[i][7] + seatarray[i][4]
					}
				}
			}
	}
}

function convertchiptalk(name) {
	switch (name) {
		case "occabid":
			return "X-Files"
		break
		case "conradperil":
			return "puzzlemonkey"
		break
		case "craiture":
			return "fins"
		break
		case "Darvcus":
			return "SpeakEasy"
		break
		case "deanmoriarty":
			return "smoore"
		break
		case "Debaser555":
			return "tenpercenter"
		break
		case "FLomby":
			return "fast frank"
		break
		case "fredcgarvin":
			return "Jldecarlo"
		break
		case "gte792i":
			return "vanquish"
		break
		case "lilil":
			return "JM)"
		break
		case "lkahn":
			return "yaw"
		break
		case "mongster":
			return "dad604"
		break
		case "mwfeldman":
			return "jojobinks"
		break
		case "philly14":
			return "philthethrill"
		break
		case "pokerdwarf":
			return "chipper"
		break
		case "temujin":
			return "tomhimself"
		break
		case "xproffesorx":
			return "deuce"
		break
	    default:
		return name
		break
	}
}
function convertsuit(card) {
	switch (card) {
	case "2h":
	 return "2:heart:"
	 break
	case "3h":
	 return "3:heart:"
	 break
	case "4h":
	 return "4:heart:"
	 break
	case "5h":
	 return "5:heart:"
	 break
	case "6h":
	 return "6:heart:"
	 break
	case "7h":
	 return "7:heart:"
	 break
	case "8h":
	 return "8:heart:"
	 break
	case "9h":
	 return "9:heart:"
	 break
	case "Th":
	 return "T:heart:"
	 break
	case "Jh":
	 return "J:heart:"
	 break
	case "Qh":
	 return "Q:heart:"
	 break
	case "Kh":
	 return "K:heart:"
	 break
	case "Ah":
	 return "A:heart:"
	 break
	case "2d":
	 return "2:diamond:"
	 break
	case "3d":
	 return "3:diamond:"
	 break
	case "4d":
	 return "4:diamond:"
	 break
	case "5d":
	 return "5:diamond:"
	 break
	case "6d":
	 return "6:diamond:"
	 break
	case "7d":
	 return "7:diamond:"
	 break
	case "8d":
	 return "8:diamond:"
	 break
	case "9d":
	 return "9:diamond:"
	 break
	case "Td":
	 return "T:diamond:"
	 break
	case "Jd":
	 return "J:diamond:"
	 break
	case "Qd":
	 return "Q:diamond:"
	 break
	case "Kd":
	 return "K:diamond:"
	 break
	case "Ad":
	 return "A:diamond:"
	 break
	case "2c":
	 return "2:club:"
	 break
	case "3c":
	 return "3:club:"
	 break
	case "4c":
	 return "4:club:"
	 break
	case "5c":
	 return "5:club:"
	 break
	case "6c":
	 return "6:club:"
	 break
	case "7c":
	 return "7:club:"
	 break
	case "8c":
	 return "8:club:"
	 break
	case "9c":
	 return "9:club:"
	 break
	case "Tc":
	 return "T:club:"
	 break
	case "Jc":
	 return "J:club:"
	 break
	case "Qc":
	 return "Q:club:"
	 break
	case "Kc":
	 return "K:club:"
	 break
	case "Ac":
	 return "A:club:"
	 break
	case "2s":
	 return "2:spade:"
	 break
	case "3s":
	 return "3:spade:"
	 break
	case "4s":
	 return "4:spade:"
	 break
	case "5s":
	 return "5:spade:"
	 break
	case "6s":
	 return "6:spade:"
	 break
	case "7s":
	 return "7:spade:"
	 break
	case "8s":
	 return "8:spade:"
	 break
	case "9s":
	 return "9:spade:"
	 break
	case "Ts":
	 return "T:spade:"
	 break
	case "Js":
	 return "J:spade:"
	 break
	case "Qs":
	 return "Q:spade:"
	 break
	case "Ks":
	 return "K:spade:"
	 break
	case "As":
	 return "A:spade:"	 
	}
}

function highlight(field) {
        field.focus();
        field.select();
}
