function RegisterEventObservers() { 
	var plugin = document.WMPlay;
	document.appObs.setByProxyDSNewStreamObserver(plugin, true); 
	troca();
	numero = numero-1;
}

function OnDSNewStreamEvt(oldstate, newstate) {
	setTimeout('troca();',1000);
} 	    


function trocalink(){
	
	try {
		a = document.links
		y = a.length;
		for (x=0;x<y;x++){
			a[x].target ='_blank';
		}
	}
	
	catch (e){}
	
}

function trocalink2(){
	
	try {
		a = document.links
		y = a.length;
		for (x=0;x<y;x++){
			a[x].target ='_self';
		}
	}
	
	catch (e){}
	
}


function PlayClick () {
	
	try {
		xajax_listen(urlradio);
	}

	catch (e){}
	
	if (navigator.appName.indexOf('Netscape') != -1){

		window.open(urlradio);
	
	} else {
		
		
		Stats('ON');
		
		document.WMPlay.Play();
		
		trocalink();
		
	}
	
	
}

function StopClick () {
	
	
	if (navigator.appName.indexOf('Netscape') != -1){
		
	} else {
		
		Stats("OFF");
		document.WMPlay.Stop();
		trocalink2();
		
	}
	
}

function PauseClick () {
	if (navigator.appName.indexOf('Netscape') != -1)
		estado=document.WMPlay.GetPlayState();
	else
		estado=document.WMPlay.PlayState;
	
	if(estado==1)
		document.WMPlay.Play();
	else if (estado==2)
		document.WMPlay.Pause();
}

function FowardClick() {
	document.WMPlay.Next();
}

function BackClick() {
	numero = numero-2;
	document.WMPlay.Previous();
}

function UpVolumeClick() {
	if (navigator.appName.indexOf('Netscape') != -1){
	
	} else {
		
		if (document.WMPlay.Volume <= -300) 
			document.WMPlay.Volume = document.WMPlay.Volume + 300;
	}
}

function DownVolumeClick() {
	if (navigator.appName.indexOf('Netscape') != -1){
		
	} else {
		if ( document.WMPlay.Volume >= -8000) 
			document.WMPlay.Volume = document.WMPlay.Volume - 300;
	}
}

function Stats(stats) {
	if(stats == "ON") {
		xajax.$('playertransamerica').src = 'templates/imagens/transamerica_player_on.gif';
		xajax.$('click_action').onclick = function () { StopClick(); };
	} else {
		xajax.$('playertransamerica').src = 'templates/imagens/transamerica_player_off.gif';
		xajax.$('click_action').onclick = function () { PlayClick(); };
	}
}



