function atualizaPlaylist()
{
	playlist=top.frames['radio'].playlist.split(':')
}
function exibePlaylist()
{
var s=''
for(i=0;(i<10);i++)
	s+='<li><tt>'+playlist[ponteiro+i]+'</tt></li>'
return s
}
function avancaPlaylist()
{
var o=document.getElementById('playlist'),s='',bpm=document.getElementById('backMusicas'),opm=document.getElementById('proxMusicas')

if(playlist.length>ponteiro+10)
{
	bpm.innerHTML='Músicas anteriores'	
	bpm.href='javascript:retrocedePlaylist()'
	o.start=++ponteiro+1
	s+=exibePlaylist()
	o.innerHTML=s
}else{
	opm.innerHTML='<s>Próximas Músicas</s>'
	opm.href="javascript:alert('Fim da lista')"
}
}

function retrocedePlaylist()
{
var o=document.getElementById('playlist'),s='',bpm=document.getElementById('backMusicas'),opm=document.getElementById('proxMusicas')

if(ponteiro > 0)
{
	opm.innerHTML='Próximas Músicas'
	opm.href="javascript:avancaPlaylist()"
	o.start=--ponteiro+1
	s+=exibePlaylist()
	o.innerHTML=s
}else{
	bpm.innerHTML='<s>Músicas anteriores</s>'
	bpm.href="javascript:alert('Início da lista')"
}
}

/* animacao */
function abre(id)
{
	var get=document.getElementById(id),largura=parseInt(get.style.width),ordem='diminui',olm=document.getElementById('lista_musicas')

	if(largura==38)
		ordem='cresce'
	intervalo=window.setInterval(function()
	{
		if(ordem=='cresce')
		{
			if(largura<367)
				get.style.width=largura+'px'
			else
			{
				get.style.width='367px'
				olm.style.display='inline'
				clearInterval(intervalo)
			}
			largura+=20
		}
		else
		{
			if(largura>38)
				get.style.width=largura+'px'
			else
			{
				get.style.width='38px'
				clearInterval(intervalo)
			}
			largura-=20
		}
	}, 1)
	//troca botão
	if(status)
	{
		s='abre'
		olm.style.display='none'
	}
	else
	{
		s='fecha'
		document.getElementById('playlist').innerHTML=exibePlaylist()
	}
	document.getElementById('botao_abre').className=s
	status = !status
}

/*mural*/
function atualizaMural()
{
	var mural=eval('('+top.frames['radio'].strmural+')'),recados='',recados_resumo='',o=document.getElementById('recados')

	for(i=0;i<mural.length;i++)
	{
		if(mural[i][1] != '') var de= ' de '; else var de=''
		recados+='<li><span class="mural_amarelo vermelho">'+mural[i][0]+' <span class="cinza">escreveu'+ de +mural[i][1]+' em '+mural[i][2]+'</span></span><p>'+mural[i][3]+'</p></li>'
		if(i==3)
			recados_resumo=recados
	}

	if(o)
		o.innerHTML='<ul>'+recados+'</ul>'

	document.getElementById('recados_resumo').innerHTML='<ul>'+recados_resumo+'</ul>'
}

function limpa(o)
{
	if(o.value==o.defaultValue)
		o.value=''
}
function avalia(o)
{
	o.value=o.value.replace(/^\s+|\s+$/g,'')
	if(o.value=='')
		o.value=o.defaultValue
}
function valMural()
{
	var o=document.FrmMural,reA=/^[a-zA-Z]+.*/,a='Voce deve digitar ',b=' antes de enviar sua mensagem'
	if(!reA.test(o.TxtNome.value) || o.TxtNome.value == o.TxtNome.defaultValue)
	{
		alert(a+'seu nome'+b)
		o.TxtNome.value=''
		o.TxtNome.focus()
		return
	}
	if(!reA.test(o.TxtCidade.value) || o.TxtCidade.value == o.TxtCidade.defaultValue)
	{
		alert(a+'sua Cidade'+b)
		o.TxtCidade.value=''
		o.TxtCidade.focus()
		return
	}
	if(!reA.test(o.TxtRecado.value) || o.TxtRecado.value == o.TxtRecado.defaultValue)
	{
		alert(a+'algum recado'+b)
		o.TxtRecado.value=''
		o.TxtRecado.focus()
		return
	}
	o.submit()
}
function maxtext(obj){
	document.getElementById('progreso').innerHTML = "("+obj.value.length+" / 256)"
	obj.value=obj.value.substring(0,256)
}

/*enquete*/
function libera()
{
var o=document.getElementById('votaenquete')
o.href='javascript:votar()'
o.innerHTML='votar'
}
function votar()
{
	alert('Voto registrado!')
	document.FrmEnquete.submit()
}
function abrepop(pk){
	window.open('ver_enquete.php?id='+pk, 'janelinha', 'height=300,resizable=no,scrollbars=no,width=300')
}