Taking a look at your code, specifically this part:
function teamElement(round, team, isReady) {
<?php if(round == 1) $round2_array[] = team) ?>
I see you lack of some basic knowledge: Javascript is a client side scripting language, while PHP is a server side scripting language. PHP and Javascript are executed in two very different moments (generally PHP first and then Javascript (without using AJAX)). Therefore they cannot share variables that easily.
There are ways, though, to connect the two of them:
To pass a PHP variable to a Javascript script you could simply use string interpolation or the templating features of PHP:
var x = <?php echo $x; ?>;
Just notice that that is considered very bad practice and you should use AJAX here as well.
To pass a Javascript variable to a PHP script you can use AJAX (Asynchronous Javascript And XML), to execute a PHP script "in the background", after the page is loaded. In this regard I suggest you to take a look at the nice jQuery library which provides a very helpful set of functions for this task.