/*  SoundManager2-Remote Addon by Axel Sixt
  all copyrights reserved.
  www.pixelradius.de
  You want to use it, too?
  contact info@pixelradius.de
*/

function openPopup(url) {
 if(typeof outerWidth!='undefined'){
 playerpopup=window.open(url, "rock4player", "scrollbars=no,toolbar=no,status=no,resizable=no,width=420,height=405, left="+(document.outerWidth-420)+", top="+(document.outerHeight-405)+"");
 }else{
 playerpopup=window.open(url, "rock4player", "scrollbars=no,toolbar=no,status=no,resizable=no,width=420,height=405, left="+(document.Width-420)+", top="+(document.Height-405)+"");
 }
 return false;
}


function getActiveSong(){
actsong=0;
try{
if(playerpopup.document.getElementById('song1li').className=="sm2_playing"){actsong=0;}
if(playerpopup.document.getElementById('song2li').className=="sm2_playing"){actsong=1;}
if(playerpopup.document.getElementById('song3li').className=="sm2_playing"){actsong=2;}
if(playerpopup.document.getElementById('song4li').className=="sm2_playing"){actsong=3;}
if(playerpopup.document.getElementById('song5li').className=="sm2_playing"){actsong=4;}
if(playerpopup.document.getElementById('song6li').className=="sm2_playing"){actsong=5;}
if(playerpopup.document.getElementById('song7li').className=="sm2_playing"){actsong=6;}
if(playerpopup.document.getElementById('song8li').className=="sm2_playing"){actsong=7;}

if(playerpopup.document.getElementById('song1li').className=="sm2_paused"){actsong=0;}
if(playerpopup.document.getElementById('song2li').className=="sm2_paused"){actsong=1;}
if(playerpopup.document.getElementById('song3li').className=="sm2_paused"){actsong=2;}
if(playerpopup.document.getElementById('song4li').className=="sm2_paused"){actsong=3;}
if(playerpopup.document.getElementById('song5li').className=="sm2_paused"){actsong=4;}
if(playerpopup.document.getElementById('song6li').className=="sm2_paused"){actsong=5;}
if(playerpopup.document.getElementById('song7li').className=="sm2_paused"){actsong=6;}
if(playerpopup.document.getElementById('song8li').className=="sm2_paused"){actsong=7;}
}catch(e){}
return actsong;
}


function getSongName(){
var r="- loading -";
try{r=playerpopup.document.getElementById('song'+(getActiveSong()+1)+'li').firstChild.textContent}catch(e){}
return r;
}


function act_player(){
	
	if(typeof playerpopup!='undefined'){
		if(playerpopup.closed==true){
			document.getElementById('playerinfo').textContent='- player closed. press play again -';
		}else{
			document.getElementById('playerinfo').textContent=getSongName();
		}
	}
	

	
	setTimeout("act_player()", 1000);
}


function smplay(){
if(typeof playerpopup!='undefined' && playerpopup.closed!=true ){
		playerpopup.playsong(getActiveSong()+1);
	}
}


function smnext(){
if(typeof playerpopup!='undefined' && playerpopup.closed!=true ){
		playerpopup.nextsong();
	}
}

function smprev(){
if(typeof playerpopup!='undefined' && playerpopup.closed!=true ){
		playerpopup.prevsong();
	}
}

function smminus(){
if(typeof playerpopup!='undefined' && playerpopup.closed!=true ){
		playerpopup.minus();
	}
}


function smplus(){
if(typeof playerpopup!='undefined' && playerpopup.closed!=true ){
		playerpopup.plus();
	}
}
