var currentSongId;

currentSongId = -1;

function mounthFlashPlayer()
{
    var FO = {movie:"/player/new/flvplayer2.swf",id:"mediaplayer",name:"mediaplayer",width:"0px",height:"0px",majorversion:"8",build:"0",bgcolor:"#FFFFFF",allowfullscreen:"true",flashvars:"autostart=true&file=mediaplayer.xml&enablejs=true&bufferlength=1" };UFO.create(FO, "GetFlashMain");CheckPlayer();
    //document.getElementById('GetFlashMain').style.display = "none";   
}    

function StopStream2()
{
  var Position = -1;
  sendEvent('stop');
  if (currentSongId != -1) {
	document.getElementById('stopButton'+currentSongId).style.display = 'none';
	document.getElementById('playButton'+currentSongId).style.display = '';
	document.getElementById('songInfo'+currentSongId).innerHTML = '';
	document.getElementById('songInfo'+Position).innerHTML = '&nbsp;<span id="PreviewTiming"></span>';
	currentSongId = Position;
  }
}

function StartStream2(StreamURL, DisplayText,Position)
{
    bNewSong=true;
//	alert(StreamURL);
    StreamURL = StreamURL.replace(/___/g,"_00");
    StreamURL = StreamURL.replace(/---/g,"/00");
    StreamURL = 'http://mp3od.batanga.com/mp3/'+StreamURL+'.mp3';
    StopStream2();
    //sendEvent('stop');
//	alert(StreamURL);
    loadFile(StreamURL,'Test','','',123);
	sendEvent('volume',0);
//    sendEvent('next');
//    setTimeout("movefrw(0);",300);
    document.getElementById('PreviewText').innerHTML = DisplayText;
	//setTimeout("PlayTimeOut('" + MP3file+ "');", 30000);
	document.getElementById('songInfo'+currentSongId).innerHTML = '';
	document.getElementById('songInfo'+Position).innerHTML = '&nbsp;<span id="PreviewTiming"></span>';
	currentSongId = Position;
    document.getElementById('stopButton'+currentSongId).style.display = '';
    document.getElementById('playButton'+currentSongId).style.display = 'none';
    document.getElementById('pixelcounter').innerHTML = '<IMG height="0px" width="0px" src="http://adserver.planetatv.com/admentor/adserve.asp?B=1165&nocache=' + Math.random() +'" border="0px">';
}


function StartStream3(StreamURL, DisplayText,Position,pixelId)
{
    bNewSong=true;
//	alert(StreamURL);
    StreamURL = StreamURL.replace(/___/g,"_00");
    StreamURL = StreamURL.replace(/---/g,"/00");
    StreamURL = 'http://mp3od.batanga.com/mp3/'+StreamURL+'.mp3';
    StopStream2();
    //sendEvent('stop');
//	alert(StreamURL);
    loadFile(StreamURL,'Test','','',123);
	sendEvent('volume',0);
//    sendEvent('next');
//    setTimeout("movefrw(0);",300);
    document.getElementById('PreviewText').innerHTML = DisplayText;
	//setTimeout("PlayTimeOut('" + MP3file+ "');", 30000);
	document.getElementById('songInfo'+currentSongId).innerHTML = '';
	document.getElementById('songInfo'+Position).innerHTML = '&nbsp;<span id="PreviewTiming"></span>';
	currentSongId = Position;
    document.getElementById('stopButton'+currentSongId).style.display = '';
    document.getElementById('playButton'+currentSongId).style.display = 'none';
    document.getElementById('pixelcounter').innerHTML = '<IMG height="0px" width="0px" src="http://adserver.planetatv.com/admentor/adserve.asp?B='+pixelId+'&nocache=' + Math.random() +'" border="0px">';
}

function mounthFlashPlayerLayers() {
var myQueryString;
var debugDisplay;
var playerDebugDisplay;
myQueryString = location.href;
myQueryString = myQueryString.toLowerCase();
//alert(myQueryString.indexOf('debug=true'));
if (myQueryString.indexOf('debug=true')!=-1) {
	debugDisplay = '';
	playerDebugDisplay = 'visibility:visible';	
} else {
	debugDisplay = 'display:none';
	playerDebugDisplay = 'visibility:hidden';
}
document.write('<div id="GetFlashMain" style="height:0px;width:0px;overflow: auto;'+playerDebugDisplay+'">'+
				'<P id="player"> <A href="http://www.macromedia.com/go/getflashplayer"> '+
				'Get Flashplayer</A> </P></div>');
//document.write('<div id="PreviewTiming" style="'+debugDisplay+'"></div>');
document.write('<div id="OnLoadStatus" style="'+debugDisplay+'"></div>');
document.write('<div id="songInfo-1" style="'+debugDisplay+'">&nbsp;<span id="PreviewTiming"></span></div>');
document.write('<div id="PlayerLoadStatus" style="'+debugDisplay+'"></div>');
document.write('<div id="PreviewText" style="'+debugDisplay+'"></div>');
document.write('<div id="PreviewStatus" style="'+debugDisplay+'"></div>');
document.write('<div id="data" style="'+debugDisplay+'"></div>');
document.write('<div id="load" style="'+debugDisplay+'"></div>');
document.write('<div id="pixelcounter" style="'+debugDisplay+'"></div>');
mounthFlashPlayer();
//setTimeout("StartStream2('http://38.116.36.62/mp3/002801/00005480/002801000054800102_0001.mp3','Shakira - Para Obtener Un S%EF%BF%BD')",3000);

}
