function rand ( n )
{
  return ( Math.floor ( Math.random ( ) * n + 1) );
}

function changeStation(station,site,logo,boolpre,name,country)
{
    sponsors = new Array(3);
    for( i = 0; i < 3; i++ )
    {
        sponsors[i] = new Array(3);
    }
    sponsors[0][0] = 'http://www.atworx.nl';
    sponsors[0][1] = 'bestanden/sponsor.gif';
    sponsors[0][2] = 'AtWorX.com Sponsor message';
    sponsors[1][0] = 'http://www.quickradio.nl/index.php?page=contact';
    sponsors[1][1] = 'bestanden/advertisement.gif';
    sponsors[1][2] = 'QuickRadio Sponsor message';
    sponsors[2][0] = 'http://www.visserslatijn.nl';
    sponsors[2][1] = 'bestanden/visserslatijn.gif';
    sponsors[2][2] = 'Visserslatijn.nl Sponsor Message';
    if( boolpre == 'true' )
    {
        var wmpdisplay = 'none';
        var addisplay = 'inline';
        setTimeout("hidead()",15000);
    }
    else
    {
        var wmpdisplay = 'inline';
        var addisplay = 'none';
    }
    var randomno = rand (3);
    var randomno2 = (randomno - 1);
	document.getElementById('tekst').innerHTML='<br /><center><b><img id="wmplayer" style="display: ' + wmpdisplay + ';" src="bestanden/prelistenbox.gif" alt="QuickRadio Prelistening" /><a href="' + sponsors[randomno2][0] + '"><img id="adbanner" style="display: ' + addisplay + ';" src="' + sponsors[randomno2][1] + '" alt="' + sponsors[randomno2][2] + '" /></a><br /><embed type="application/x-mplayer2" src="'+station+'" width="365" height="65" showstatusbar="1" autostart="1" invokeurls="0"></embed><br /><br />Now playing:<br /> ' + name + ' - ' + country;
	document.getElementById('hiddenadblock').style.display = 'block';
}

function hidead()
{
    document.getElementById('adbanner').style.display = 'none';
    document.getElementById('wmplayer').style.display = 'inline';
}
