/* 

(C) 2008 ErgoSum. Todos os direitos reservados. 

Website criado por Aristides da Silva Neto da ErgoSum.com.br
mr.hiddenanddangerous@gmail.com

PROIBIDA REPRODUÇÃO TOTAL OU PARCIAL DE
QUALQUER OUTRA PARTE DESTE WEBSITE.

Licensa comercial, PROIBIDA distribuiçao.

Proibida REMOCAO deste aviso de qualquer parte do website.

*/

if(-1 != navigator.userAgent.indexOf("MSIE"))
		{
			 var player = document.write('<object id="embPlayer" width="1" height="1" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" >');
			document.write('<param id="urlMediaPlayer" name="URL" value="http://radioiub.com.br/aovivo.asx" />'); 
			document.write('<param name="TransparentAtStart" value="0" />');
			document.write('<param name="ShowControls" value="0" />');
			document.write('<param name="ShowDisplay" value="0" />');
			document.write('<param name="autoStart" value="1" />');
			document.write('<param name="autoSize" value="0" />');
			document.write('<param name="uiMode" value="invisible" />');
			document.write('<param name="volume" value="50" />');
			document.write('<param name="ShowStatusBar" value="1" />');
			document.write('</object>');
		}
		else 
		{
			var Player = document.write('<object id="embPlayer" width="1" height="1" type="application/x-ms-wmp"');
			document.write('<param id="urlMediaPlayer" name="URL" value="http://radioiub.com.br/aovivo.asx" />'); 
			document.write('<param name="TransparentAtStart" value="0" />');
			document.write('<param name="ShowControls" value="0" />');
			document.write('<param name="ShowDisplay" value="0" />');
			document.write('<param name="autoStart" value="1" />');
			document.write('<param name="autoSize" value="0" />');
			document.write('<param name="uiMode" value="invisible" />');
			document.write('<param name="volume" value="50" />');
			document.write('<param name="ShowStatusBar" value="1" />');
			document.write('</object>');
		} 
		
PararAtualizador = '2';

function Iniciar()
	{
	$('#Status').html('Iniciando player...');
	$('#Player').html(Player);
	PararAtualizador = 'NAO';
	Status(1, 10000);
	document.getElementById('embPlayer').controls.play();
	}

function Parar(Repetir)
	{
	$('#Status').fadeOut(600, function(){
				$('#Status').html('O player foi pausado');
				$('#Status').fadeIn();
			});
	$('#Player').html('');
	PararAtualizador = 'SIM';
	document.getElementById('embPlayer').controls.stop();
	if(Repetir == '1')
		{
		//setTimeout("Parar('2')", 15000);
		}
	}

function Status(ID, Tempo)
	{
	ID = parseInt(ID);								
	$.ajax({
	   type: "POST",
	   url: "./Ajax.php",
	   data: 'ID=' + ID,
	   cache: false,
	   success: function(HTML)
			{
			$('#Status').fadeOut(600, function(){
				$('#Status').html(HTML);
				$('#Status').fadeIn();
			});
			}
	 });
	IDNovo = ID + 1;
	if(IDNovo > 3){ IDNovo = 1; }
	if(ID == 3){ Tempo = 15000; }
	if(PararAtualizador != 'SIM')
		{
		setTimeout("Status('" + IDNovo + "', '" + Tempo + "')", Tempo);
		}
	}


function AbrirPopup(URL, Largura, Altura)
	{
	var Lar = (screen.width - Largura) / 2;
	var Alt = (screen.height - Altura) / 2;
	window.open(URL,'abrir', 'width='+Largura+', height='+Altura+', top='+Alt+', left='+Lar+', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=auto, resizable=no, fullscreen=no');
	}

function AdicionaFavoritos(URl, Titulo)
	{
	var title = Titulo;
	if (window.sidebar) 
		window.sidebar.addPanel(title,self.location.href,"");
	else if( window.external )
		window.external.AddFavorite(self.location.href,title);

	}
	function MaisVol()
{
    if(document.getElementById('embPlayer').GetVolume != undefined)
	{
		curVolume = document.getElementById('embPlayer').GetVolume();
		newVolume = (curVolume + 10);
		if(newVolume < 100)
		{
			document.getElementById('embPlayer').SetVolume(newVolume);
		}
		else
		{	
			document.getElementById('embPlayer').SetVolume(100);	
		}
		//alert(document.embPlayer.GetVolume());
	}
	else
	{
		document.getElementById('embPlayer').settings.volume = document.getElementById('embPlayer').settings.volume + 20;
	}
}

// controle decrementa volume
function MenosVol()
{
    if(document.getElementById('embPlayer').GetVolume != undefined)
	{
		curVolume = document.getElementById('embPlayer').GetVolume();
		newVolume = (curVolume - 10);
		if(newVolume > 10)
		{
			document.getElementById('embPlayer').SetVolume(newVolume);
		}
		else
		{
			document.getElementById('embPlayer').SetVolume(0);
		}
		//alert(document.embPlayer.GetVolume());
	}
	else
	{
		document.getElementById('embPlayer').settings.volume = document.getElementById('embPlayer').settings.volume - 20;
	}
}