//
// Player Control code for PlayNetwork web player
//
// Programed by LUX Media, 10/2005
//

// Scrolling text functions
//
// Each field needs its own function for DIV targeting, and also for the boolean trigger
//
// works as follows:
// - first line displays the size-limited substring of the current message
// - next line lops a single character off and moves it to the end of the string
// - final line waits a give time interval, and then calls the function again

var songText = "";
var artistText = "";
var artistScrollInterval = 300;
var songScrollInterval = 500;
var wantScrollingArtist = false;
var wantScrollingSong = false;
      
function scrollArtist(artistText){
   if (wantScrollingArtist){
       document.getElementById("idArtist").innerHTML = artistText.substring(0,artistWindowSize);
       newArtistText = artistText.substring(1,artistText.length) + artistText.substring(0,1);
       window.setTimeout("scrollArtist(newArtistText)", artistScrollInterval);
       }
   }

function scrollSong(songText){
   if (wantScrollingSong){
       document.getElementById("idSong").innerHTML = songText.substring(0,songWindowSize);
       newSongText = songText.substring(1,songText.length) + songText.substring(0,1);
       window.setTimeout("scrollSong(newSongText)", songScrollInterval);
       }
   }

//
// Player control functions
//

function PN_PlayPause() {
    // Test whether Windows Media Player is playing - if so, pause. Otherwise play.
    player = document.getElementById("PNPlayer");

   if (player.playstate == 3){
 	player.controls.pause();
	}
    else 
	player.controls.play();
}

//    if (document.PNPlayer.playState == 3) {
//        document.PNPlayer.controls.pause();
//        }
//    else {
//        document.PNPlayer.controls.play();
//        }
//    }

function PN_Stop() {
    document.PNPlayer.controls.Stop();
} 

function PN_Next() {
    document.PNPlayer.controls.next();
}

function PN_Previous() {
    document.PNPlayer.controls.previous();
}
