
var currentSongId;var activeSongId;var nOffSet=0;var rowNum=0;var DJIDlocal=0;var thisStr="";var playerState=0;currentSongId=-1;activeSongId=-1;function StartStream(StreamURL,DisplayText,Position,nLength,url)
{activeSongId=Position;if(nLength>120)
{nOffSet=90;}
else
{nOffSet=Math.round(nLength*.25);}
if((nOffSet+30)>nLength)
{nOffSet=0;}
bNewSong=true;StreamURL=StreamURL.replace(/___/g,"_00");StreamURL=StreamURL.replace(/---/g,"/00");StreamURL=GetMediaLimeLightURL(StreamURL,'mp3',StartStream2CallBack,url);}
function StopStream()
{var Position=-1;sendEvent('stop');if(currentSongId!=-1){document.getElementById('timer'+currentSongId).innerHTML="";document.getElementById('stopButton'+currentSongId).style.display='none';document.getElementById('playButton'+currentSongId).style.display='';currentSongId=Position;}}
function StartStream2CallBack(StreamURL)
{StopStream();loadFile(StreamURL,'',null,null,123);sendEvent('playpause');sendEvent('scrub',nOffSet);sendEvent('volume',70);currentSongId=activeSongId;document.getElementById('stopButton'+currentSongId).style.display='';document.getElementById('playButton'+currentSongId).style.display='none';}
function thisMovie(movieName)
{if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document[movieName];}}
function sendEvent(typ,prm)
{thisMovie("mediaplayer").sendEvent(typ,prm);}
function loadFile(fil,tit,lnk,img,fid)
{thisMovie("mediaplayer").loadFile(fil,tit,lnk,img,fid);}
function GetMediaLimeLightURL(media,mediaType,callBack,url)
{var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false;}}
if(!xmlhttp&&window.createRequest){try{xmlhttp=window.createRequest();}catch(e){xmlhttp=false;}}
var URL;switch(mediaType)
{}
xmlhttp.open("GET",url+'GetEncodedMediaURL.aspx?media='+media+'&mediaType='+mediaType,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){callBack(xmlhttp.responseText);}}
xmlhttp.send(null)}
function getUpdate(typ,pr1,pr2)
{if(typ=="state")
{playerState=pr1;if(pr1==2)
{}}
else if(typ=="time")
{currentPosition=pr1-nOffSet;remainingTime=Math.round(pr2);if(currentPosition<0)
{}
else if(currentPosition<32)
{if((currentPosition>=0)&&(currentPosition<=20))
{document.getElementById('timer'+activeSongId).innerHTML=":"+(30-currentPosition);}
else
{document.getElementById('timer'+activeSongId).innerHTML=":0"+(30-currentPosition);}
if(currentPosition>=31)
{StopStream();}}
else if(currentPosition>=60)
{min=Math.floor(currentPosition/60);sec=currentPosition-(min*60);if(sec<10)
{}
else if(sec>=10)
{}}}
else if(typ=="load")
{iLoad=pr1;if(iLoad<100)
{document.getElementById('playButton'+activeSongId).style.display='none';document.getElementById('stopButton'+activeSongId).style.display='';}
else
{document.getElementById('playButton'+activeSongId).style.display='none';document.getElementById('stopButton'+activeSongId).style.display='';sendEvent('playpause');}}}
function IncrementTracking(incLength)
{var len=0;var currentWidth=0;if((currentSongId>0)&&(playerState!=0))
{len=(document.getElementById('songid'+currentSongId).style.width).length;if(len==2)
{currentWidth=(document.getElementById('songid'+currentSongId).style.width).substring(0,2);}
else
{currentWidth=(document.getElementById('songid'+currentSongId).style.width).substring(0,3);}
currentWidth=parseFloat(currentWidth)+parseFloat(incLength);setTimeout('IncrementTracking(1)',105);}}
var currentSongId;var activeSongId;var nOffSet=0;var rowNum=0;var thisStr="";currentSongId=-1;activeSongId=-1;function movefrw(timeIn)
{sendEvent('hiddenplayer','scrub',timeIn);}
function setVolumeW(iPct)
{thisMovieW("WMAPlayer").settings.volume=iPct;}
function PlayW()
{thisMovieW("WMAPlayer").controls.play();}
function PauseW()
{thisMovieW("WMAPlayer").controls.pause();}
function StopW()
{thisMovieW("WMAPlayer").controls.stop();}
function FfwdW(iSecs)
{thisMovieW("WMAPlayer").controls.currentPosition=iSecs;}
function loadFileW(sStreamURL)
{thisMovieW("WMAPlayer").URL=sStreamURL;}
function thisMovieW(movieName)
{return document.WMAPlayer;}
function getWMPlayer()
{}
function StartStreamW(StreamURL,DisplayText,Position,nLength,url)
{if(document.getElementById('playerdiv'))
{sendEvent('playerdiv','stop');}
activeSongId=Position;if(nLength>120)
{nOffSet=90;}
else
{nOffSet=Math.round(nLength*.25);}
if((nOffSet+30)>nLength)
{nOffSet=0;}
bNewSong=true;StreamURL=GetMediaLimeLightURL(StreamURL,'wma',StartStreamWCallBack,url);}
function StartStreamWCallBack(StreamURL)
{StopStreamW();loadFileW(StreamURL);PauseW();FfwdW(nOffSet);setVolumeW(70);currentSongId=activeSongId;var cmd='WaitForLoad();';setTimeout(cmd,10);if(document.getElementById('songid'+activeSongId)){document.getElementById('songid'+currentSongId).style.display='';document.getElementById('songid'+currentSongId).style.width='0px';}
document.getElementById('stopButton'+currentSongId).style.display='';document.getElementById('playButton'+currentSongId).style.display='none';}
function StopStreamW()
{var Position=-1;StopW();if(currentSongId!=-1)
{document.getElementById('timer'+currentSongId).innerHTML="";document.getElementById('stopButton'+currentSongId).style.display='none';document.getElementById('playButton'+currentSongId).style.display='';if(document.getElementById('songid'+activeSongId)){document.getElementById('songid'+currentSongId).style.display='';document.getElementById('songid'+currentSongId).style.width='0px';}
currentSongId=Position;}}
function WaitForLoad()
{if(thisMovieW("WMAPlayer").openState<13)
{document.getElementById('playButton'+activeSongId).style.display='none';document.getElementById('stopButton'+activeSongId).style.display='';if(document.getElementById('songid'+activeSongId)){document.getElementById('songid'+activeSongId).style.display='';document.getElementById('songid'+activeSongId).style.width='0px';}
var cmd='WaitForLoad();';setTimeout(cmd,10);}
else
{if(document.getElementById('songid'+activeSongId)){document.getElementById('songid'+activeSongId).style.display='';document.getElementById('songid'+activeSongId).style.width='0px';}
document.getElementById('playButton'+activeSongId).style.display='none';document.getElementById('stopButton'+activeSongId).style.display='';PlayW();var randomnumber=Math.floor(Math.random()*99999)
rowNum=randomnumber;RefreshPreview(randomnumber);}}
function RefreshPreview(locRowNum)
{if(rowNum==locRowNum)
{var currentPosition=parseInt(document.WMAPlayer.controls.currentPosition)-nOffSet;if(currentPosition<0)currentPosition=parseInt(document.WMAPlayer.controls.currentPosition);if(currentPosition<0)
{document.getElementById('stopButton'+currentSongId).style.display='none';document.getElementById('playButton'+currentSongId).style.display='';if(document.getElementById('songid'+activeSongId)){document.getElementById('songid'+currentSongId).style.display='';document.getElementById('songid'+currentSongId).style.width='0px';}}
else if(currentPosition<31)
{if(currentPosition==1)
{}
if(currentSongId>0)
{if((currentPosition>=0)&&(currentPosition<=20))
{document.getElementById('timer'+currentSongId).innerHTML=":"+(30-currentPosition);}
else
{document.getElementById('timer'+currentSongId).innerHTML=":0"+(30-currentPosition);}}
setTimeout("RefreshPreview("+locRowNum+")",1000);}
else
{document.getElementById('stopButton'+currentSongId).style.display='none';document.getElementById('playButton'+currentSongId).style.display='';if(document.getElementById('songid'+activeSongId)){document.getElementById('songid'+currentSongId).style.display='';document.getElementById('songid'+currentSongId).style.width='0px';}
document.WMAPlayer.controls.Stop();document.getElementById('timer'+currentSongId).innerHTML="";currentSongId=-1;}}}
function IncrementTrackingIE(incLength,locRowNum)
{var len=0;var currentWidth=0;if((currentSongId>0)&&(rowNum==locRowNum))
{len=(document.getElementById('songid'+currentSongId).style.width).length;if(len==2)
{currentWidth=(document.getElementById('songid'+currentSongId).style.width).substring(0,2);}
else
{currentWidth=(document.getElementById('songid'+currentSongId).style.width).substring(0,3);}
currentWidth=parseFloat(currentWidth)+parseFloat(incLength);document.getElementById('songid'+currentSongId).style.display='';document.getElementById('songid'+currentSongId).style.width=currentWidth+'px';setTimeout('IncrementTrackingIE(1,'+locRowNum+')',105);}}
var onStop=0;function ShowStopBtn(currentSongId)
{document.getElementById('imgStop'+currentSongId).style.display='';document.getElementById('timer'+currentSongId).style.display='none';}
function ShowTimer(currentSongId)
{document.getElementById('imgStop'+currentSongId).style.display='none';document.getElementById('timer'+currentSongId).style.display='';onStop=0;}
function ShowTimer2(currentSongId)
{if(onStop==0)
{document.getElementById('imgStop'+currentSongId).style.display='none';document.getElementById('timer'+currentSongId).style.display='';}}
function MouseFix()
{onStop=1;}