
 function musicItem(t,d,u)
 {
 this.title=t;
 this.desc=d;
 this.url=u;
 }
function musicBox(box,titleDoc)
{
	var player=null;
	var current = 0;
	var timer=null;
    var musics = new Array();
    var stopped=true;
    this.music_title=null;
	this.init=function()
	{
    this.music_title=document.getElementById(titleDoc);
	player=document.getElementById(box);
 
	if(musics.length>0){
		player.attachEvent("EndOfStream", this.onPlayEnd);
		connect();
		this.play();
		//this.setPlayList();
	}
	}
  this.addMusic= function(slide) {
  if(slide==null)return;
    var i = musics.length;
    musics[i] = slide;
  }
connect=function(){
	if(musics.length==0) return;
var item=musics[current];
	player.Filename = item.url;
	music_title.innerText = item.title + " - " + item.desc;
    }
 
this.isStopped=function()
{
 return stopped;
}   
this.play=function(){

	stopped=false;
	player.Play();
}
this.pause=function(){
	player.Pause();
}
this.stop=function(){
	stopped=true;
	player.Stop();
}
this.next=function(){
	current++;
	if(current>=musics.length){
		current = 0;
	}
	connect();
}
this.prev=function(){
	current--;
	if(current < 0){
		current = musics.length - 1;
	}
	connect();
}
this.jump=function(index){
	index = Math.min(index,musics.length);
	index = Math.max(index,0);
	current = index;
	if(timer) clearTimeout(timer);
	connect();
}
this.setPlayList=function(div1)
{
var html_music_play_list = "<ul class='musicBoxUL'>";
for(var i=0;i<musics.length;i++)
{
html_music_play_list += "<li><a style='margin:0 0 0 1px' href='javascript:jump1("+i+")' title='"+musics[i].desc+"'>"+musics[i].title+"</a></li>";
}
html_music_play_list += "</ul>";
div1.innerHTML=html_music_play_list;
}
this.onPlayEnd=function(){
	timer=setTimeout('next()', 8000);
}
 this.setActive=function(doc,action,obj)
           {
            var v=document.getElementById(doc);
            v.onclick=this.play;
            v.style.cursor='hand';
           }
this.musicBoxUserInterface=function(btnPlay,btnStop,btnPause,btnPrevious,btnNext)
{
  btnPlay= $('imgMusicPlay');
  btnStop= $('imgMusicStop');
  btnPause=$('imgMusicPause');
  btnPrevious=$('imgMusicPrevious');
  btnNext =$('imgMusicNext');
 btnPlay.style.cursor='hand';
 btnStop.style.cursor='hand';
 btnPause.style.cursor='hand';
 btnPrevious.style.cursor='hand';
 btnNext.style.cursor='hand';

btnPlay.onclick=this.play; 
btnStop.onclick=this.stop; 
btnPause.onclick=this.pause;
 btnPrevious.onclick=this.prev;
 btnNext.onclick=this.next;
}

}


//Heres the decode function

function chk_broswer(){
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		return(true);
	}
	else{
		return(false);
	}

}
 


     var musicBoxInfo="<object id=\"MediaPlayer\" classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" width=\"96%\" height=\"180\"> "	+"\n"+
		" <param name=\"uiMode\" value=\"invisible\" /> "	+"\n"+
		" <param name=\"autoStart\" value=\"true\" /> "	+"\n"+
		" <param name=\"volume\" value=\"0\"> "	+"\n"+
		" <param name=\"playCount\" value=\"1\"> "	+"\n"+
		" <param name=\"balance\" value=\"0\"> "	+"\n"+
		" \'<param name=\"baseURL\" value=\"\"> "	+"\n"+
		" <param name=\"currentPosition\" value=\"0\"> "	+"\n"+
		" <param name=\"currentMarker\" value=\"0\"> "	+"\n"+
		" <param name=\"enableContextMenu\" value=\"false\"> "	+"\n"+
		" <param name=\"enableErrorDialogs\" value=\"false\"> "	+"\n"+
		" <param name=\"fullScreen\" value=\"false\"> "	+"\n"+
		" <param name=\"invokeURLs\" value=\"false\"> "	+"\n"+
		" <param name=\"mute\" value=\"false\"> "	+"\n"+
		" <param name=\"rate\" value=\"1\"> "	+"\n"+
		" <param name=\"animationAtStart\" value=\"false\"> "	+"\n"+
		" </object> ";





