// JavaScript Document

nm=["Te Esperando","Na Pari Tomai","Red Line","Nao Sabemos Seu Nome","Moscow Strut","Don't Get Around","Como Te Encontrar","Lullaby","Cymbaline","Beguinin' to C","Caravan","AutumnLove","Para Tom"];
track=["Te Esperando.mp3","Na Pari Tomai.mp3","Red Line.mp3","Nao Sabemos Seu Nome.mp3","Moscow Strut.mp3","Don't Get Around.mp3","Como te Encontrar.mp3","Lullaby.mp3","Cymbaline.mp3","Beguinin' to C.mp3","Caravan.mp3","AutumnLove(TRP).mp3","ParaTom(TRP).mp3"]

function playlist(){
	var object=document.getElementById('playlist')
	object.innerHTML=''
	tr=[]
	var i=0
	//for(i=0; i<track.length; i++)
	var timer=setInterval(function(){
		tr[i]=document.createElement('a')
		tr[i].href='#'
		tr[i].onclick=(function(n){return function(){play(n)}})(i)
		tr[i].onmouseover=(function(n){return function(){mhover(n)}})(i)
		tr[i].onmouseout=(function(n){return function(){uhover(n)}})(i)
		tr[i].innerHTML=nm[i]
		object.appendChild(tr[i])
		i++
		if(i>=track.length){clearInterval(timer)}
	}, 60)
}

function play(n){
var s1=new SWFObject("../files/player-viral.swf","sound","720","18","1");
s1.addVariable("file",'../audio/'+track[n]);
s1.addParam("wmode","transparent");
s1.addVariable("autostart","true");
s1.addVariable("width","720");
s1.addVariable("height","18");
s1.write("container");
}

function mhover(id){
	var color=255
	var timer=setInterval(function(){
		 var hex=color.toString(16)
		 tr[id].style.backgroundColor='#'+hex+hex+hex
		 color=color-5
		 if(color<225){clearInterval(timer)}
	}, 15)
}

function uhover(id){
	var color=225
	var timer=setInterval(function(){
		var hex=color.toString(16)
		tr[id].style.backgroundColor='#'+hex+hex+hex
		color=color+5
		if(color>255){clearInterval(timer)}
	}, 25)
}
