Not really a PHP question but since javascript is so tightly woven into the web development experience these days...
Javascript variables declared outside of functions are automatically global.
<script type="text/javascript">
var one, two
function one()
{
one = 1;
two = 2;
}
function two()
{
alert(one);
alert(two);
}
</script>