function creaplayer ()
{
  if(-1 != navigator.userAgent.indexOf("MSIE")) // I.E.
  {
    document.write('<OBJECT	name="mediaPlayer" id="mediaPlayer" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"	STANDBY="l\'audio partirà tra qualche istante..." TYPE="application/x-oleobject"	STYLE="WIDTH:400px;HEIGHT:380px">');
    document.write('<PARAM NAME="SendOpenStateChangeEvents" VALUE="true">');
    document.write('<PARAM NAME="fileName" VALUE="mms://65.19.129.26/radioerre"><!-- http://onair2.xdevel.com/LatteMiele -->');
    document.write('<PARAM NAME="autoStart" VALUE="true">');
    //document.write('<param name="volume" value="50">');
    document.write('<param name="uiMode" value="full">');
    document.write('</OBJECT>');
    document.write('<br>');
    document.write('Attendere qualche istante... l\'audio partira\' in automatico');
	document.write('<div class="streaming">');
	document.write('Stato: <span id="pstatus">Attesa dati</span><br>');
	document.write('Buffer: <span id="buffer">Attesa dati</span><br>');
	document.write('Velocita\': <span id="speed">Attesa dati</span><br>');
	document.write('Qualita\': <span id="quality">Attesa dati</span><br>');
	document.write('Non senti? <span id="ext_link"><a href="http://65.19.129.26/radioerre">ASCOLTA&nbsp;&raquo;</a></span><br>');
    window.setInterval ("playerstatus()",3);
  }
  else  if(-1 != navigator.userAgent.indexOf("Firefox")) // lo provo su tutti
  {
    document.write('<OBJECT width="400" height="400" id="mediaPlayer" name="mediaPlayer" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" align="absmiddle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95">');
    //<param name="SRC" value="http://65.19.129.26/radioerre"><param name="AUTOPLAY" VALUE="true"><param name="CONTROLLER" VALUE="true"><EMBED SRC="http://65.19.199.26/radioerre" AUTOSTART="TRUE" LOOP="FALSE" WIDTH="330" HEIGHT="290" CONTROLLER="TRUE"></EMBED></OBJECT>');
    //document.write('<OBJECT	name="mediaPlayer" id="mediaPlayer" STANDBY="Caricamento player in corso..." type="application/x-ms-wmp"	STYLE="WIDTH:170px;HEIGHT:170px">');
    document.write('<param name="FileName" value="mms://65.19.129.26/radioerre">');
    document.write('<param name="ShowControls" value="1">');
    document.write('<param name="ShowStatusBar" value="1">');
    document.write('<param name="ShowDisplay" value="1">');
    document.write('<param name="DefaultFrame" value="Slide">');
    document.write('<param name="PlayCount" value="1">');
    document.write('<param name="Autostart" value="1">');
    document.write('<embed src="mms://65.19.129.26/radioerre" width="400" height="400" autostart="1" loop="0" align="absmiddle" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/download/default.asp" showcontrols="1" showdisplay="1" showstatusbar="1" > </embed>');
    document.write('</OBJECT>');
    document.write('<br>');
    document.write('Attendere qualche istante... l\'audio partira\' in automatico');
	document.write('<div class="streaming">');
	document.write('Stato: <span id="pstatus">Attesa dati</span><br>');
	document.write('Buffer: <span id="buffer">Attesa dati</span><br>');
	document.write('Velocita\': <span id="speed">Attesa dati</span><br>');
	document.write('Qualita\': <span id="quality">Attesa dati</span><br>');
	document.write('Non senti? <span id="ext_link"><a href="http://65.19.129.26/radioerre">ASCOLTA&nbsp;&raquo;</a></span><br>');
    window.setInterval ("playerstatus()",5);
  } 
  else 
  {
	document.write('<OBJECT name="mediaPlayer" id="mediaPlayer" width="320" height="285" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">');
	document.write('<param name="fileName" value="http://65.19.129.26/radioerre">');
	document.write('<param name="animationatStart" value="true">');
	document.write('<param name="transparentatStart" value="true">');
	document.write('<param name="autoStart" value="true">');
	document.write('<param name="showControls" value="true">');
	document.write('<param name="loop" value="true">');
	document.write('<EMBED type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" id="mediaPlayer" name="mediaPlayer" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="true" showtracker="-1" showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="320" height="285" src="http://65.19.129.26/radioerre" autostart="true" designtimesp="5311" loop="true"></EMBED>');
	document.write('</OBJECT>');
    document.write('<br>');
    document.write('Attendere qualche istante... l\'audio partira\' in automatico');
	document.write('<br><a href="http://65.19.129.26/radioerre">NON SENTI? ASCOLTA&nbsp;&raquo;</a></span><br>');
  }
}

function playerstatus() {
var code = document.getElementById("mediaPlayer").OpenState;
if (code == 0) code = "Attesa"; 
if (code == 1) code = "Ricerca segnale";
if (code == 2) code = "Localizzazione segnale";
if (code == 3) code = "Connessione in corso"; //PlaylistConnecting Connecting to the playlist. 
if (code == 4) code = "Ricezione segnale"; //PlaylistLoading Playlist has been found and is now being retrieved. 
if (code == 5) code = "Apertura contenuto multimediale"; //PlaylistOpening Playlist has been retrieved and is now being parsed and loaded. 
if (code == 6) code = "Connesso"; //PlaylistOpenNoMedia Playlist is open. 
if (code == 7) code = "Sostituzione segnale"; //PlaylistChanged A new playlist has been assigned to currentPlaylist. 
if (code == 8) code = "Caricamento nuovo segnale"; //MediaChanging A new media item is about to be loaded. 
if (code == 9) code = "Localizzazione contenuto multimediale";// MediaLocating Windows Media Player is locating the media item. The file can be local or remote. 
if (code == 10) code = "Connessione server"; // MediaConnecting Connecting to the server that holds the media item. 
if (code == 11) code = "Preparazione ricezione contenuto multimediale"; // MediaLoading Media item has been located and is now being retrieved. 
if (code == 12) code = "Apertura contenuto multimediale"; // MediaOpening Media item has been retrieved and is now being opened. 
if (code == 13) code = "Contenuto multimediale aperto"; // MediaOpen Media item is now open. 
if (code == 14) code = "Inizio Acquisizione codec"; // BeginCodecAcquisition Starting codec acquisition. 
if (code == 15) code = "Fine Acquisizione codec"; // EndCodecAcquisition Codec acquisition is complete. 
if (code == 16) code = "Inizio acquisizione licenza DRM"; // BeginLicenseAcquisition Acquiring a license to play DRM protected content. 
if (code == 17) code = "Fine acquisizione licenza DRM"; // EndLicenseAcquisition License to play DRM protected content has been acquired. 
if (code == 18) code = "Inizio ricerca DRM"; // BeginIndividualization Begin DRM Individualization. 
if (code == 19) code = "Fine ricerca DRM"; // EndIndividualization DRM individualization has been completed. 
if (code == 20) code = "Contenuto multimediale in attesa"; // MediaWaiting Waiting for media item. 
if (code == 21) code = "Contenuto multimendiale non trovato"; // OpeningUnknownURL Opening a URL with an unknown type. 
document.getElementById("pstatus").innerHTML = code;
document.getElementById("buffer").innerHTML = " " + document.getElementById("mediaPlayer").BufferingProgress + "%";
var kbps = 0;
	kbps = parseInt(document.getElementById("mediaPlayer").Bandwidth / 1024);
//document.getElementById("speed").innerHTML = '<img alt="'+kbps+'kbps" src="grafica/_bar2.gif" height="10" width="'+(100-(kbps>100 ? 0 : kbps))+'">';
document.getElementById("speed").innerHTML = kbps + 'kbps';
document.getElementById("quality").innerHTML = (kbps>192 ? 'ottima' : (kbps>128 ? 'buona' : (kbps>64 ? 'discreta' : (kbps>32 ? 'sufficiente' : (kbps>16 ? 'scarsa' : 'n.d.')))));
}
