// *****************************************************
// totallyradio player script for Internet Explorer 4.0+
// Design, Code and Project Management by Simon West.
// Copyright Festival Productions 1998-2000.
// *****************************************************

// ******************
//  Global Variables
// ******************

var xtime;               // the time delay for showing the info display
var atime;               // monitor playback - move pointer, show buffering etc.
var vtime;               // volume control delay.
var utime;               // return slider control.
var ptime;               // schedule scroll delay.
var qtime;               // rotate display information.
var stime;               // buffering progress.
var xpointer;            // position of pointer.
var xshiftleft;          // distance of pointer from strat position.
var xshiftright;         // distance of pointer from end position.
var interval;            // amount of playback time equal to one pixel of pointer movement.
var nexttime=0;          // the next time at which the pointer should be moved.
var stopped = false;     // playback stopped - true or false
var paused = false;      // playback paused - true or false.
var entries;             // number of entries in the asx file.
var volume=0;            // volume - 0=max  -5000=min.
var step=1;              // multiplier controlling the rate of change of volume.
var playerset=false;     // is the player ready to play? true or false.
var schedulebottom=120;  // used to create clipping area for schedule window.
var scheduletop=0;       // used to create clipping area for schedule window.
var whichinfo=2;         // used to rotate info screens.
var volumeright=23;      // defines clipping area for volume control.
var infovisible=true;    // whether info display is visible.
var joinwordD;           // can be with, by or blank
var joinwordT;           // can be with, by or blank

// ******************
//  Dreamweaver Code
// ******************

function MM_findObj(n, d) { //v3.0

var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ 
if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
for(i=0; i<a.length; i++) {
if (a[i].indexOf("#")!=0){ 
d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
}
}
}
setPlayer();
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

	

// ******************
//  Player Functions
// ******************

function getPos(){  //get the current position and relative position of the pointer.
//  xpointer = document.all.pointerlayer.style.pixelLeft;
//  xshiftleft = xpointer - (document.all.trackerbarlayer.style.pixelLeft);
//  xshiftright = (document.all.trackerbarlayer.style.pixelLeft + 115) - xpointer;
}

function setText(newText) { //set the text in the display box.
if (newText == "buffering") {
var Player = document.all.WMPlayer;
if ((Player.BufferingProgress == 100) && (!stopped)) {
newText = "connected";
} else {
if ((Player.BufferingProgress != 0) && (!stopped)) {
  newText = Player.BufferingProgress + "%";
} else {
  newText = 'disconnected';
}
stime = window.setTimeout('setText("buffering");', 250);

}
} else {
window.clearTimeout(stime);
}

if (newText == "marquee") {
  document.all.marqueelayer.style.visibility = 'visible';
  document.all.displaylayer.style.visibility = 'hidden';
} else {
  document.all.marqueelayer.style.visibility = 'hidden';
  document.all.displaylayer.style.visibility = 'visible';
}

document.all.displaylayer.innerHTML = '<div align="center" class="marquee">' + newText + '</div>';
}

function hideInfo() { //hide the 'info' display area.
document.all.showtitlelayer.style.visibility = 'hidden';
document.all.movielayer.style.pixelTop = 250;
window.clearTimeout(qtime);
infovisible=false;
}

function showInfo() { //display the 'info' display area.

infovisible=true;

var entryD = ((entry) ? (entry - 1) : 0);
var entryT=0;

for(var i = (entryD + 1); i < scheduleT.length; i++) {
if (scheduleT[i] != 'edits') {
entryT = i;
break;
}
}
if (scheduleT[entryT] == 'edits') {
for(var i = 0; i < scheduleT.length; i++) {
if (scheduleT[i] != 'edits') {
entryT = i;
break;
}
}
}
var entryM = entryD;

whichinfo=2;
document.all.movielayer.style.pixelTop = 10;
document.all.movie.Movie='../movies/' + scheduleM[entryM];
document.all.movie.width=165;
document.all.movie.height=66;

document.all.showtitlelayer.style.visibility = 'visible';

joinwordD = '';

if(scheduleL[entryD]) {
joinwordD = ' with ';
}

if (scheduleT[entryD] == 'word') {
joinwordD = ' by ';
}

joinwordT = '';

if(scheduleL[entryT]) {
joinwordT = ' with ';
}

if (scheduleT[entryT] == 'word') {
joinwordT = ' by ';
}


if (scheduleT[entryD] != 'edits') {
document.all.showtitlelayer.innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" vspace="0" hspace="0"><tr><td align="center"><font color="#FF6600">current show</font><br><font color="#FFCC00">' + scheduleD[entryD] + joinwordD + scheduleL[entryD] + '</font> </td></tr></table>';
} else {
document.all.showtitlelayer.innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" vspace="0" hspace="0"><tr><td align="center"> <font color="#FF6600">next show</font><br><font color="#FFCC00">' + scheduleD[entryT] + joinwordT + scheduleL[entryT] + '</font> </td></tr></table>';

}
window.clearTimeout(qtime);
qtime = window.setTimeout('rotateInfo();', 10000);
}

function showSchedule() { //display the schedule.
schedulebottom=120;
scheduletop=0;
document.all.schedulelayer.style.pixelTop=10;
document.all.schedulelayer.style.clip = "rect(" + scheduletop + " 160 " + schedulebottom + " 0)";
if (!(archive)) {
document.all.schedulelayer.innerHTML = ' <font color="#FF6600" style="font-size : 10pt"><b>' + schdate + ' schedule</b></font><br>';
for(var i = 0; i < scheduleT.length; i++) {
if (scheduleT[i] != 'edits') {
var scheduletext = ((scheduleD[i] != '') ? scheduleD[i] : "");
//scheduletext = scheduletext + (((scheduleD[i] != '') && (scheduleL[i] != '')) ? " - " : "");
scheduletext = scheduletext + (((scheduleD[i] != '') && (scheduleL[i] != '')) ? "<br>" : "");
scheduletext = scheduletext + ((scheduleL[i] != '') ? scheduleL[i] : "");
document.all.schedulelayer.innerHTML = document.all.schedulelayer.innerHTML + '<table class="topspace" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><font color="#FF6600">' + scheduleT[i] + '</font><br>';
document.all.schedulelayer.innerHTML = document.all.schedulelayer.innerHTML + ' <a href="#" onClick="JavaScript:advance(' + i + ');return(false);"> <font>' + scheduletext + '</font></a><br></td></tr></table>';
}
}
document.all.schedulelayer.style.visibility = 'visible';
document.all.rolldownlayer.style.visibility = 'visible';
} else {
document.all.schedulelayer.innerHTML = '<div> <font color="#FFCC00">this is an archived show</font> <br></div><br>';
document.all.schedulelayer.innerHTML = document.all.schedulelayer.innerHTML + '<div> <font color="#FF6600">' + description + '</font> </div><br>';
document.all.schedulelayer.innerHTML = document.all.schedulelayer.innerHTML + '<div><font color="#FFCC00"><a href="player.php" style="text-decoration : underline"><font color="#FFCC00">click here</font></a> to play ' + schdate + ' schedule</font><br>';
}
document.all.schedulelayer.style.visibility = 'visible';
document.all.rolldownlayer.style.visibility = 'visible';
}

function hideSchedule() { //hide the schedule.
document.all.schedulelayer.style.visibility = 'hidden';
document.all.rolldownlayer.style.visibility = 'hidden';
}

		

function showCommunity() { //show the community functions
document.all.messageboardlayer.style.visibility = 'visible';
document.all.tellafriendlayer.style.visibility = 'visible';
document.all.mailinglistlayer.style.visibility = 'visible';
document.all.messageboardtextlayer.style.visibility = 'visible';
document.all.tellafriendtextlayer.style.visibility = 'visible';
document.all.mailinglisttextlayer.style.visibility = 'visible';
}

function hideCommunity() { //hide the community functions
document.all.messageboardlayer.style.visibility = 'hidden';
document.all.tellafriendlayer.style.visibility = 'hidden';
document.all.mailinglistlayer.style.visibility = 'hidden';
document.all.messageboardtextlayer.style.visibility = 'hidden';
document.all.tellafriendtextlayer.style.visibility = 'hidden';
document.all.mailinglisttextlayer.style.visibility = 'hidden';
}

function clickSchedule() { //action when request is made to view schedule.
hideInfo();
showSchedule();
hideCommunity();
window.clearTimeout(xtime);
xtime = window.setTimeout('clickInfo();', 120000);
}

function clickCommunity() { //action when request is made to view community functions.
window.clearTimeout(xtime);
hideInfo();
hideSchedule();
showCommunity();
window.clearTimeout(xtime);
xtime = window.setTimeout('clickInfo();', 120000);
}

function clickInfo() { //action when request is made to view 'info' window.
if (!infovisible) {
window.clearTimeout(xtime);
hideSchedule();
hideCommunity();
showInfo();
window.clearTimeout(qtime);
qtime = window.setTimeout('rotateInfo();', 10000);
whichinfo=2;
} else {
rotateInfo();
}
}

function rotateInfo() { //rotate the show/track information
var entryD = ((entry) ? (entry - 1) : 0);
var entryT=0;

for(var i = (entryD + 1); i < scheduleT.length; i++) {
if (scheduleT[i] != 'edits') {
entryT = i;
break;
}
}
if (scheduleT[entryT] == 'edits') {
for(var i = 0; i < scheduleT.length; i++) {
if (scheduleT[i] != 'edits') {
entryT = i;
break;
}
}
}

joinwordD = '';

if(scheduleL[entryD]) {
joinwordD = ' with ';
}

if (scheduleT[entryD] == 'word') {
joinwordD = ' by ';
}

joinwordT = '';

if(scheduleL[entryT]) {
joinwordT = ' with ';
}

if (scheduleT[entryT] == 'word') {
joinwordT = ' by ';
}

var Player = document.all.WMPlayer;

whichinfo = ((whichinfo > 3) ? 1 : whichinfo);

if (scheduleT[entryD] != 'edits') {

switch (whichinfo) {
case 1:
document.all.showtitlelayer.innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" vspace="0" hspace="0"><tr><td align="center"><font color="#FF6600">current show</font><br><font color="#FFCC00">' + scheduleD[entryD] + joinwordD + scheduleL[entryD] + '</font></td></tr></table>';
break;
case 2:
var markerindex = Player.CurrentMarker;
var entryS = Player.getMarkerName(markerindex);
var count = Player.MarkerCount;
if ((entryS.length > 8) && (count > 1)) {
document.all.showtitlelayer.innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" vspace="0" hspace="0"><tr><td align="center"> <font color="#FF6600">track playing</font><br><font color="#FFCC00">' + entryS + '</font> </td></tr></table>';
break;
} else {
whichinfo = 3;
}
case 3:
if (entries > 1) {
document.all.showtitlelayer.innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" vspace="0" hspace="0"><tr><td align="center"> <font color="#FF6600">next show</font><br><font color="#FFCC00">' + scheduleD[entryT] + joinwordT + scheduleL[entryT] + '</font> </td></tr></table>';
}
break;
}

} else {

document.all.showtitlelayer.innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" vspace="0" hspace="0"><tr><td align="center"> <font color="#FF6600">next show</font><br><font color="#FFCC00">' + scheduleD[entryT] + joinwordD + scheduleL[entryT] + '</font> </td></tr></table>';


}

++whichinfo;
window.clearTimeout(qtime);
qtime = window.setTimeout('rotateInfo();', 10000);
}


function scheduleScrollup(stop) { //scroll the schedule layer up.
if (stop) {
window.clearTimeout(ptime);
window.clearTimeout(xtime);
xtime = window.setTimeout('clickInfo();', 120000);
} else {
var jkl = (50 * (scheduleD.length));
if (jkl < 300) {
jkl = 300;
}
if (schedulebottom < jkl) {
document.all.schedulelayer.style.pixelTop = document.all.schedulelayer.style.pixelTop - 2;
schedulebottom = schedulebottom + 2;
scheduletop = scheduletop + 2;
document.all.schedulelayer.style.clip = "rect(" + scheduletop + " 160 " + schedulebottom + " 0)";
window.clearTimeout(ptime);
ptime = window.setTimeout('scheduleScrollup();', 10);
} else {
window.clearTimeout(ptime);
}
}
}

		

function scheduleScrolldown(stop) { //scroll the schedule layer down.
if (stop) {
window.clearTimeout(ptime);
window.clearTimeout(xtime);
xtime = window.setTimeout('clickInfo();', 120000);
} else {
if (scheduletop > 2) {
document.all.schedulelayer.style.pixelTop = document.all.schedulelayer.style.pixelTop + 2;
schedulebottom = schedulebottom - 2;
scheduletop = scheduletop - 2;
document.all.schedulelayer.style.clip = "rect(" + scheduletop + " 160 " + schedulebottom + " 0)";
window.clearTimeout(ptime);
ptime = window.setTimeout('scheduleScrolldown();', 10);
} else {
window.clearTimeout(ptime);
}
}
}

function getShowDuration() { //gets the duration in seconds of the current show and activates the pointer.

nexttime=0;
var Player = document.all.WMPlayer;
if (!Player) {
var ztime = window.setTimeout('getShowDuration();', 1000);
} else {
var duration = Player.Duration;
interval = duration/114
interval = Math.round(interval * 1000)
window.clearTimeout(atime);
atime = window.setTimeout('monitorPlayback();', 1000);
entries = Player.EntryCount;
entry = Player.GetCurrentEntry();
getPos();
MM_dragLayer('pointerlayer','',0,0,0,0,true,false,0,0,xshiftleft,xshiftright,false,false,0,'dropPointer();',true,'');
}

}

function returnSlider() { //returns the pointer to the starting position.
//var Player = document.all.WMPlayer;
//if (Player.PlayState == 0) {
// Player.Play();
//window.location = "../pages/player.php"; 
//}

window.clearTimeout(utime);
//if (document.all.pointerlayer.style.pixelLeft > 133) {
//document.all.pointerlayer.style.pixelLeft = document.all.pointerlayer.style.pixelLeft - 2
//utime = window.setTimeout('returnSlider();', 1);
//}
}

function advance(show) { //advance the player to the next show in the playlist.
infovisible=false;
var Player = document.all.WMPlayer;
var currententry = Player.GetCurrentEntry();

if (show != null) {
entry = show + 1;
} else {
if (!(currententry) || (currententry == entries)) {
entry = 1;
} else {
entry = currententry + 1;
}
}

if (entry != currententry) {
Player.SetCurrentEntry(entry);
returnSlider();
window.clearTimeout(atime);
getShowDuration();
}
clickInfo();
}

function dropPointer() { //called when the pointer is dropped at a location and sets the player position in the show.
if (description != 'totallyradio broadband') {
var Player = document.all.WMPlayer
getPos();
var playposition = (interval * xshiftleft)/1000;
if (playposition > (Player.Duration - 30)) {
playposition = (Player.Duration - 30)
}
Player.CurrentPosition = playposition;
nexttime=playposition + (interval/1000);
} else {
returnSlider();
}
}

function playerDisconnect () {
var Player = document.all.WMPlayer;
stopped = true;
Player.Stop();
paused = true;
document.all.playbutton.src="images/playbutton.gif";
document.all.connect.src="images/buffer_off.gif";
setText('disconnected');
}

function playerPause() { //toggles between pause and play
var Player = document.all.WMPlayer;
paused = !paused;
if (paused) {
Player.Pause();
document.all.playbutton.src="images/playbutton_p.gif";
} else {
Player.Play();
stopped = false;
document.all.playbutton.src="images/pausebutton_p.gif";
}
}

function playerPauseOver(out) {
if (out) {
if (paused) {
document.all.playbutton.src="images/playbutton.gif";
} else {
document.all.playbutton.src="images/pausebutton.gif";
}
} else {
if (paused) {
document.all.playbutton.src="images/playbutton_p.gif";
} else {
document.all.playbutton.src="images/pausebutton_p.gif";
}
}
}

		


function decreaseVolume(stop) { //decreases the playback volume while the mouse is held down.
var Player = document.all.WMPlayer;
if (stop) {
window.clearTimeout(vtime);
step=1;
} else { 
if (volume > -5000) {
volume = volume - (50 * step);
++step;
Player.volume=volume;
window.clearTimeout(vtime);
vtime = window.setTimeout('decreaseVolume();', 100);

} else {
window.clearTimeout(vtime);
step = 1;
}
}

if (volume > -250) {
volumeright=22;
}
else if (volume > -500) {
volumeright=21;
}
else if (volume > -1000) {
volumeright=20;
}
else if (volume > -1250) {
volumeright=18;
}
else if (volume > -1500) {
volumeright=17;
}
else if (volume > -1750) {
volumeright=16;
}
else if (volume > -2000) {
volumeright=14;
}
else if (volume > -2250) {
volumeright=13;
}
else if (volume > -2500) {
volumeright=11;
}
else if (volume > -3000) {
volumeright=9;
}
else if (volume > -3250) {
volumeright=8;
}
else if (volume > -3500) {
volumeright=7;
}
else if (volume > -3750) {
volumeright=6;
}
else if (volume > -4000) {
volumeright=4;
}
else if (volume > -4500) {
volumeright=2;
}
else {
volumeright=0;
}

document.all.newvolumelayer.style.clip = "rect(0 " + volumeright + " 26 0)";
}

function increaseVolume(stop) { //increases the playback volume while the mouse is held down.
var Player = document.all.WMPlayer;
if (stop) {
window.clearTimeout(vtime);
step=1;
} else { 
if (volume < 0) {
volume = volume + (50 * step);
++step;
if (volume > 0) volume=0;
Player.volume=volume;
window.clearTimeout(vtime);
vtime = window.setTimeout('increaseVolume();', 100);
} else {
window.clearTimeout(vtime);
step=1;
}
}
if (volume > -250) {
volumeright=22;
}
else if (volume > -500) {
volumeright=21;
}
else if (volume > -1000) {
volumeright=20;
}
else if (volume > -1250) {
volumeright=18;
}
else if (volume > -1500) {
volumeright=17;
}
else if (volume > -1750) {
volumeright=16;
}
else if (volume > -2000) {
volumeright=14;
}
else if (volume > -2250) {
volumeright=13;
}
else if (volume > -2500) {
volumeright=11;
}
else if (volume > -3000) {
volumeright=9;
}
else if (volume > -3250) {
volumeright=8;
}
else if (volume > -3500) {
volumeright=7;
}
else if (volume > -3750) {
volumeright=6;
}
else if (volume > -4000) {
volumeright=4;
}
else if (volume > -4500) {
volumeright=2;
}
else {
volumeright=0;
}

document.all.newvolumelayer.style.clip = "rect(0 " + volumeright + " 26 0)";
}

function monitorPlayback() { //checks the status of the player every second
  var Player = document.all.WMPlayer;

  if (interval == 0) {
  getShowDuration();
  } else {
    if (Player.PlayState == 0) {
      // Player.Play();
    }

    if ((Player.BufferingProgress == 100) && (!stopped))  {
      document.all.connect.src = "images/buffer_ok.gif";
      if (Player.CurrentPosition >= nexttime) {
        //if (xshiftright > 0) {
          //document.all.pointerlayer.style.pixelLeft = document.all.pointerlayer.style.pixelLeft + 1;
        nexttime = nexttime + (interval/1000);
        //}
      }
    } else {
      if (!stopped) {
        document.all.connect.src = "images/buffering.gif";
      } else
        document.all.connect.src = "images/buffer_off.gif";
    }
    
    if (Player.GetCurrentEntry() != entry) {
      if (Player.GetCurrentEntry() > entries) {
        Player.SetCurrentEntry(1);
      }
      infovisible=false;
      returnSlider();
      getShowDuration();
      //clickInfo();
    } 
  }
  atime = window.setTimeout('monitorPlayback();', 1000);
}

function clickArchive() {
var url = ' ';
var b = entry;
if (b) {
b = b - 1;
} else {
b = 0;
}
var a = scheduleQ[b];
if (scheduleT[b] == 'specials') {
a = 9990;
}
if (scheduleT[b] == 'word') {
a = 9999;
}
//if (a == 4) {
//url = '../../pages/archive.php';
//} else {
url = '../../pages/archive.php?showall=Y&show=' + a;
//}
window.open(url, 'totallyradio_main', '');
}

// Dreamweaver drag layer function

function MM_dragLayer(objName,x,hL,hT,hW,hH,toFront,dropBack,cU,cD,cL,cR,targL,targT,tol,dropJS,et,dragJS) { //v3.0
  //Copyright 1998 Macromedia, Inc. All rights reserved.
  var i,j,aLayer,retVal,curDrag=null,NS=(navigator.appName=='Netscape'), curLeft, curTop;
  if (!document.all && !document.layers) return false;
  retVal = true; if(!NS && event) event.returnValue = true;
  if (MM_dragLayer.arguments.length > 1) {
    curDrag = MM_findObj(objName); if (!curDrag) return false;
    if (!document.allLayers) { document.allLayers = new Array();
      with (document) if (NS) { for (i=0; i<layers.length; i++) allLayers[i]=layers[i];
        for (i=0; i<allLayers.length; i++) if (allLayers[i].document && allLayers[i].document.layers)
          with (allLayers[i].document) for (j=0; j<layers.length; j++) allLayers[allLayers.length]=layers[j];
      } else for (i=0;i<all.length;i++) if (all[i].style&&all[i].style.position) allLayers[allLayers.length]=all[i];}
    curDrag.MM_dragOk=true; curDrag.MM_targL=targL; curDrag.MM_targT=targT;
    curDrag.MM_tol=Math.pow(tol,2); curDrag.MM_hLeft=hL; curDrag.MM_hTop=hT;
    curDrag.MM_hWidth=hW; curDrag.MM_hHeight=hH; curDrag.MM_toFront=toFront;
    curDrag.MM_dropBack=dropBack; curDrag.MM_dropJS=dropJS;
    curDrag.MM_everyTime=et; curDrag.MM_dragJS=dragJS;
    curDrag.MM_oldZ = (NS)?curDrag.zIndex:curDrag.style.zIndex;
    curLeft= (NS)?curDrag.left:curDrag.style.pixelLeft; curDrag.MM_startL = curLeft;
    curTop = (NS)?curDrag.top:curDrag.style.pixelTop; curDrag.MM_startT = curTop;
    curDrag.MM_bL=(cL<0)?null:curLeft-cL; curDrag.MM_bT=(cU<0)?null:curTop -cU;
    curDrag.MM_bR=(cR<0)?null:curLeft+cR; curDrag.MM_bB=(cD<0)?null:curTop +cD;
    curDrag.MM_LEFTRIGHT=0; curDrag.MM_UPDOWN=0; curDrag.MM_SNAPPED=false; //use in your JS!
    document.onmousedown = MM_dragLayer; document.onmouseup = MM_dragLayer;
    if (NS) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  } else {
    var theEvent = ((NS)?objName.type:event.type);
    if (theEvent == 'mousedown') {
      var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
      var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
      var maxDragZ=null; document.MM_maxZ = 0;
      for (i=0; i<document.allLayers.length; i++) { aLayer = document.allLayers[i];
        var aLayerZ = (NS)?aLayer.zIndex:aLayer.style.zIndex;
        if (aLayerZ > document.MM_maxZ) document.MM_maxZ = aLayerZ;
        var isVisible = (((NS)?aLayer.visibility:aLayer.style.visibility).indexOf('hid') == -1);
        if (aLayer.MM_dragOk != null && isVisible) with (aLayer) {
          var parentL=0; var parentT=0;
          if (!NS) { parentLayer = aLayer.parentElement;
            while (parentLayer != null && parentLayer.style.position) {
              parentL += parentLayer.offsetLeft; parentT += parentLayer.offsetTop;
              parentLayer = parentLayer.parentElement; } }
          var tmpX=mouseX-(((NS)?pageX:style.pixelLeft+parentL)+MM_hLeft);
          var tmpY=mouseY-(((NS)?pageY:style.pixelTop +parentT)+MM_hTop);
          var tmpW = MM_hWidth;  if (tmpW <= 0) tmpW += ((NS)?clip.width :offsetWidth);
          var tmpH = MM_hHeight; if (tmpH <= 0) tmpH += ((NS)?clip.height:offsetHeight);
          if ((0 <= tmpX && tmpX < tmpW && 0 <= tmpY && tmpY < tmpH) && (maxDragZ == null
              || maxDragZ <= aLayerZ)) { curDrag = aLayer; maxDragZ = aLayerZ; } } }
      if (curDrag) {
        document.onmousemove = MM_dragLayer; if (NS) document.captureEvents(Event.MOUSEMOVE);
        curLeft = (NS)?curDrag.left:curDrag.style.pixelLeft;
        curTop = (NS)?curDrag.top:curDrag.style.pixelTop;
        MM_oldX = mouseX - curLeft; MM_oldY = mouseY - curTop;
        document.MM_curDrag = curDrag;  curDrag.MM_SNAPPED=false;
        if(curDrag.MM_toFront) {
          eval('curDrag.'+((NS)?'':'style.')+'zIndex=document.MM_maxZ+1');
          if (!curDrag.MM_dropBack) document.MM_maxZ++; }
        retVal = false; if(!NS) event.returnValue = false;
    } } else if (theEvent == 'mousemove') {
      if (document.MM_curDrag) with (document.MM_curDrag) {
        var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
        var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
        newLeft = mouseX-MM_oldX; newTop  = mouseY-MM_oldY;
        if (MM_bL!=null) newLeft = Math.max(newLeft,MM_bL);
        if (MM_bR!=null) newLeft = Math.min(newLeft,MM_bR);
        if (MM_bT!=null) newTop  = Math.max(newTop ,MM_bT);
        if (MM_bB!=null) newTop  = Math.min(newTop ,MM_bB);
        MM_LEFTRIGHT = newLeft-MM_startL; MM_UPDOWN = newTop-MM_startT;
        if (NS) {left = newLeft; top = newTop;}
        else {style.pixelLeft = newLeft; style.pixelTop = newTop;}
        if (MM_dragJS) eval(MM_dragJS);
        retVal = false; if(!NS) event.returnValue = false;
    } } else if (theEvent == 'mouseup') {
      document.onmousemove = null;
      if (NS) document.releaseEvents(Event.MOUSEMOVE);
      if (NS) document.captureEvents(Event.MOUSEDOWN); //for mac NS
      if (document.MM_curDrag) with (document.MM_curDrag) {
        if (typeof MM_targL =='number' && typeof MM_targT == 'number' &&
            (Math.pow(MM_targL-((NS)?left:style.pixelLeft),2)+
             Math.pow(MM_targT-((NS)?top:style.pixelTop),2))<=MM_tol) {
          if (NS) {left = MM_targL; top = MM_targT;}
          else {style.pixelLeft = MM_targL; style.pixelTop = MM_targT;}
          MM_SNAPPED = true; MM_LEFTRIGHT = MM_startL-MM_targL; MM_UPDOWN = MM_startT-MM_targT; }
        if (MM_everyTime || MM_SNAPPED) eval(MM_dropJS);
        if(MM_dropBack) {if (NS) zIndex = MM_oldZ; else style.zIndex = MM_oldZ;}
        retVal = false; if(!NS) event.returnValue = false; }
      document.MM_curDrag = null;
    }
    if (NS) document.routeEvent(objName);
  } return retVal;
}

function setPlayer() {
var Player = document.all.WMPlayer;
document.all.displaylayer.style.visibility = 'visible';
document.all.marqueelayer.style.visibility = 'visible';
Player.play();


if (entry != 1) {
advance((entry - 1));
} else {
getShowDuration();
} 
//rotateInfo();
//showInfo();
//setText('buffering');
//self.focus();
}