var ie_5_or_6_window_int_timer = null;

function XSPFPlayer(mdiv, width, height, flash_file, title, song_url) {
	//alert(song_url+ "==" + title);
	if (!flash_file) {
	
      flash_file='/xspf_player_slim.swf';
      this.fixed=true;
   }
   if (!title) {
      title='Nightangle Music';
   }
   if (!song_url) {
      song_url='';
   }
 
	this.obj = new SWFObject(flash_file, "single", width, height, "7");
	this.div = mdiv;
	this.obj.addVariable('autoplay','false');
    this.obj.addParam("wmode","transparent");
    this.obj.addParam("menu","false");
	this.obj.addVariable('song_url', song_url);
	this.obj.addVariable('song_title', title);
	this.obj.write(this.div);
}

XSPFPlayer.prototype.play_song = function(title, song_url) {
	/* minor hack - if they try to play the same song again it'll stop
	 * instead. */
	//alert(song_url+ "==" + title);
	if (this.obj.getVariable('song_url') == song_url) {
		this.stop();
		this.obj.addVariable('song_url', '');
		this.obj.addVariable('song_title', ' ');
		close_player();
	} else {	   	
		this.obj.addVariable('autoplay','true');
		this.obj.addVariable('autoresume','true')		/*&autoresume=1*/
		this.obj.addVariable('song_url', song_url);
		this.obj.addVariable('song_title', title);
		//alert(this.div);
		//this.play();
		this.obj.write(this.div);
		
	}
}

XSPFPlayer.prototype.stop = function() {
	this.obj.addVariable('autoplay','');
	this.obj.write(this.div);
}

function close_player() {
  xspfplayer.stop();
}
