
if('undefined'===typeof Alo_Midi){function Alo_Midi(name,playlist){var ref=Globals.add(this);var self=this;var state=0;var hover=0;var timerId=0;var index=-1;var player=null;var ie=-1!=window.navigator.userAgent.indexOf("MSIE");document.write('<img id="img_'+name+'" src="/common/spacer.gif" width="49" height="18" alt="*">');var disabled=!(playlist&&playlist.items&&playlist.items.length);if(disabled)return;var count=playlist.items.length;var defaultState=window.navigator.cookieEnabled?1:0;var list=[];for(var i=0;i<count;i++){list[i]=i;}
var i=count;while(--i){var j=Math.floor(Math.random()*(i+1));var tempi=list[i];var tempj=list[j];list[i]=tempj;list[j]=tempi;}
var image=document.getElementById("img_"+name);image.style.background="url('/common/music_buttons.gif') no-repeat";image.style.cursor="pointer";image.onclick=function(){self.toggleState();};image.onmouseover=function(){self.setHover(1);};image.onmouseout=function(){self.setHover(0);};var state=getCookie(name);if(null===state)state=defaultState;state=parseInt(state)?1:0;this.blur=function(){try{if(player)player.blur();}catch(err){}}
this.timer=function(){timerId=0;this.start();}
this.start=function(){if(timerId){window.clearTimeout(timerId);timerId=0;}
var track=null;if(state){++index;if(index>=count)index=0;track=playlist.items[list[index]];}
this.playTrack(track);}
this.playTrack=function(track){if(track){var src=track.location;if(!player){if(ie){var head=document.getElementsByTagName("HEAD")[0];player=head.appendChild(document.createElement("BGSOUND"));player.loop=1;player.src=src;}else{var div=document.createElement("DIV");div.innerHTML='<embed style="display:block;position:absolute;top:-10000px" src="'+src+'">';player=image.parentNode.insertBefore(div.firstChild,image.nextSibling);player.onfocus=function(){this.blur();};}}else{player.src=src;}
image.title=image.alt=(track.title||"")+" "+(track.creator||"")+" "+(track.annotation||"");var ms=(track.duration+5)*1000;timerId=window.setTimeout(ref+".timer()",ms);}else if(player){image.title=image.alt="clic para reproducir";player.src="/common/empty.mid";}}
this.toggleState=function(){this.setState(state?0:1);}
this.setState=function(bState){state=bState?1:0;setCookie(name,state,365,"/");this.showImage();window.setTimeout(ref+".start()",1);}
this.setHover=function(bHover){hover=bHover?1:0;this.showImage();}
this.showImage=function(){var x=state?-49:0;var y=hover?-18:0;image.style.backgroundPosition=x+"px "+y+"px";}
if(state){addLoadEvent(function(){self.start();});}
this.showImage();}}
