// JavaScript Document
function selTrump(player) { //if you push a play card, when necc perform function
	temp = parseFloat(player.substr(6,1));
	kittytemp = parseFloat(kitty[1].substr(2,1));
	if (vround == 1 && temp != kittytemp) {
		alone = disp_confirm("you chose suit, would you like to go alone?\nClick 'Ok' to go alone, or 'Cancel' to continue")
		if (alone == true) {
		choseGoAlone(1);
		//alert("go alone");
		}
		clearHands();
		round2 = false;
		whoCalledIt = firstplayer;
		setPlayer();
		vround = 2;
		setTrump(temp);
		document.getElementById('centercard').innerHTML = getSuit(trump);
		document.getElementById('topdialogbox').innerHTML = "";
		document.getElementById('botdialogbox').innerHTML = "";
		setTimeout("setupRound(2)", speed);
	} else if (vround == 1 && temp == kittytemp) {
		alert("cannot choose same suit as top card");
	}
}
	function funTrump(player) { //if you push a play card, when necc perform function
	temp = parseFloat(player);
	kittytemp = parseFloat(kitty[1].substr(2,1));
	if (vround == 1 && temp != kittytemp) {
		clearHands();
		round2 = false;
		whoCalledIt = firstplayer;
		setPlayer();
		vround = 2;
		setTrump(temp);
		document.getElementById('centercard').innerHTML = getSuit(trump);
		document.getElementById('topdialogbox').innerHTML = "";
		document.getElementById('botdialogbox').innerHTML = "";
		setTimeout("setupRound(2)", speed);
	} else if (vround == 1 && temp == kittytemp) {
		alert("cannot choose same suit as top card");
	}
}
////SET SCORE FUNCTIONS/////////////////////////////////////
function settrix(team) {
	if (team == 1 || team == 3) {
		team1trix++;
		} else if (team == 2 || team == 4) {
		team2trix++;
	}
	document.getElementById('team1trix').innerHTML = team1trix;
	document.getElementById('team2trix').innerHTML = team2trix;
}	
function setscores() { //check for sweep, if not, then score as usuall
	if (team2trix == 0) {
		if (whoCalledIt == 1 || whoCalledIt == 3) {
			if (goAlone != 0) {
				alert(whoCalledIt+" called it alone and swept");
				team1score += 4;
			} else {
				alert(whoCalledIt+" called it, team 1 swept");
				team1score += 2;
			}
			checkScoreForWin()
			return;
		} else if (whoCalledIt == 2 || whoCalledIt == 4) {
			alert(whoCalledIt+" stupidly called it, and team 1 swept");
			team1score += 4;
			checkScoreForWin()
			return;
		}
	}
	if (team1trix == 0) {
		if (whoCalledIt == 2 || whoCalledIt == 4) {
			alert(whoCalledIt+" called it, team 2 swept");
			team2score += 2;
			checkScoreForWin()
			return;
		} else if (whoCalledIt == 1 || whoCalledIt == 3) {
			alert(whoCalledIt+" stupidly called it, and team 2 swept");
			team2score += 4;
			checkScoreForWin()
			return;
		}
	}
	if (team1trix >= 3) {
		if (whoCalledIt == 1 || whoCalledIt == 3) {
			alert(whoCalledIt+" called it, team 1 won");
			team1score ++;
			checkScoreForWin()
			return;
		} else if (whoCalledIt == 2 || whoCalledIt == 4) {
			alert(whoCalledIt+" stupidly called it, team 1 won");
			team1score += 2;
			checkScoreForWin()
			return;
		}
	}
	if (team2trix >= 3) {
		if (whoCalledIt == 2 || whoCalledIt == 4) {
			alert(whoCalledIt+" called it, team 2 won");
			team2score ++;
			checkScoreForWin()
			return;
		} else if (whoCalledIt == 1 || whoCalledIt == 3) {
			alert(whoCalledIt+" stupidly called it, team 2 won");
			team2score += 2;
			checkScoreForWin()
			return;
		}
	}
}
function checkScoreForWin() {
	if (team1score >= 10) {
		alert("team 1 won the game!");
		start();
	} else if (team2score >= 10) {
		alert("team 2 won the game!");
		start();
	} else {
		document.getElementById('team1score').innerHTML = team1score;
		document.getElementById('team2score').innerHTML = team2score;
		return;
	}
}