/*	aloader - async crossdomain javascript loader written by Artico Bandurini [artico@overdesign.net]
	usage: aloader.load(path_to_js_file, callback_function);
	callback_function will be called in the window scope with no arguments
*/
aloader = {
	queue: [],
	queueCallback: null,
	load: function(src, callback){
		if(src instanceof Array){
			if(!src.length){
				return false;
			}
			else if(src.length == 1){
				src = src[0];
			}
			else{
				this.queue = src;
				this.queueCallback = callback;
				callback = null;
				src = this.queue[0];
			}
		}
		if(!src){
			return false;
		}
		var tag = document.createElement('script');
		var holder = document.getElementsByTagName('head')[0] || document.body;
		tag.src = src;
		holder.appendChild(tag);
		var receive = function(){
			if(aloader.queue.length && src == aloader.queue[0]){
				aloader.queue.shift();
				if(aloader.queue.length){
					aloader.load(aloader.queue[0]);
				}
				else{
					callback = aloader.queueCallback;
				}
			}
			if(callback){
				callback.call(tag);
			}
			tag.parentNode.removeChild(tag);
		};
		if(navigator.userAgent.indexOf('MSIE') >= 0){
			tag.onreadystatechange = function(){
				if(this.readyState == 'loaded' || this.readyState == 'complete'){
					receive();
				}
			}
		}
		else{
			tag.onload = receive;
		}
	}
};

SpeedTest = function(holder, options){
	if(!holder || (!holder.tagName && !(holder = document.getElementById(holder)))){return;}
	if(!options){options = {};}
	var pass = options.pass || 2;
	var size = options.size || 32764;
	var path = options.path || 'http://radiolla.com/play/';
	var p = pass;
	var opass = pass;
	var step = 20;	// in milliseconds
	var gears = [0, 150, 750, 1500, 3000, 5000];	// in Kbps
	// attempts: 3   5    8    11    14    18
	var timer, speedArray = [], speed = 0, time = 0, gear = 1, seed = 999999999, percent = 0;
	var y = function(){
		timer = setInterval(function(){
			time += step;
		}, step);
		var per = Math.floor((pass - p + 1)/(pass + 1)*100);
		if(per > percent){
			percent = per;
		}
		var x = new Image();
		x.onload = z;
		x.src = path + size + '.png?pass=' + (pass - p + 1) + '&seed=' + Math.round(Math.random() * seed);
		var lines = holder.getElementsByTagName('div');
		for (var i=0; i<lines.length; i++) {
			var j = Math.floor(percent / 20);
			lines[i].className = lines[i].className.replace(' active', '');
			if (lines[i].className.indexOf(j) >= 0) {
				lines[i].className += ' active';
			}
		}
		holder.onclick = null;
	};
	var z = function(){
		clearInterval(timer);
		speed = Math.floor(size * 8 * (pass - p + 1) / time);
		speedArray.push(speed);
		var again = function(){
			time = 0;
			percent = 0;
			gear = 1;
			p = pass = opass;
			y();
		};
		if(p){
			p--;
			if(gear == 1 && speed > gears[gear]){
				p += 2;
				pass += 2;
				gear++;
			}
			else if(gear == 2 && speed > gears[gear]){
				p += 3;
				pass += 3;
				gear++;
			}
			else if(gear == 3 && speed > gears[gear]){
				p += 3;
				pass += 3;
				gear++;
			}
			else if(gear == 4 && speed > gears[gear]){
				p += 3;
				pass += 3;
				gear++;
			}
			else if(gear == 5 && speed > gears[gear]){
				p += 4;
				pass += 4;
				gear = 0;
			}
			y();
		}
		else if(speedArray.length){
			var all = 0;
			for(var i=0; i<speedArray.length; i++){
				all += speedArray[i];
			}
			var finalSpeed = Math.floor(all/speedArray.length);
			if (typeof options.onReady == 'function') {
				options.onReady.call(window, finalSpeed);
			}
			var j = 0;
			var js = [32, 128, 256, 512, 1024];
			for (var i=0; i<js.length; i++) {
				if (finalSpeed > js[i]) {
					j++;
				}
				else {
					break;
				}
			}
			var lines = holder.getElementsByTagName('div');
			for (var i=0; i<lines.length; i++) {
				lines[i].className = lines[i].className.replace(' active', '');
				for (var k=0; k<=j; k++){
					if (lines[i].className.indexOf(k) >= 0) {
						lines[i].className += ' active';
					}
				}
			}
			if (finalSpeed < 32) {
				help(lang.help32k);
			}
			else if (finalSpeed < 128) {
				help(lang.help128k);
			}
			holder.title = lang.speed +': '+ (finalSpeed / 1024).toString().substring(0, 3) +' '+ lang.speedMbps;
			holder.onclick = again;
		}
	};
	y();
};

cookies = {
	set: function(name, value, expires, path, domain, secure){
		document.cookie = name + '=' + escape(value) +
			(expires ? ';expires=' + (new Date((new Date()).getTime() + (expires * 1000))).toGMTString() : '') +
			(path? ';path=' + path : '') +
			(domain ? ';domain=' + domain : '') +
			(secure ? ';secure' : '');
	},
	get: function(name){
		var allCookies = document.cookie.split(';');
		var cookiePair;
		if (!allCookies.length) {return null;}
		for (var i=0; i<allCookies.length; i++) {
			cookiePair = allCookies[i].split('=');
			if (name == cookiePair[0].replace(/^\s+|\s+$/g, '')) {
				return cookiePair[1].replace(/^\s+|\s+$/g, '');
			}
		}
		return null;
	}
};

skin = function(name){
	var logo = document.getElementById('logo');
	var stripe = document.getElementById('stripe');
	switch (name) {
		case 'winter':
			stripe.className = 'stripe_winter';
			logo.className = 'logo_grey';
			cookies.set('skin', 'winter', 604800);
		break;
		case 'mountain':
			stripe.className = 'stripe_mountain';
			logo.className = 'logo_grey';
			cookies.set('skin', 'mountain', 604800);
		break;
		default:
			stripe.className = 'stripe_classic';
			logo.className = 'logo_red';
			cookies.set('skin', 'default', 604800);
		break;
	}
}

skinName = cookies.get('skin');
if (skinName) {skin(skinName);}

UniplayerGUIRadiolla = function(player){
	var lang = UniplayerLanguages[player.options.language];
	var HTMLControls =
		'<div id="speedtest" class="rSpeed" onclick="speedtest();" title="' +window.lang.speedTest+' '+window.lang.speed+ '"><div class="speed5"></div><div class="speed4"></div><div class="speed3"></div><div class="speed2"></div><div class="speed1"></div></div>'+
		'<div class="upGUIButtonSet"><a href="javascript:" class="upGUIButton upGUIButtonPlay" title="'+lang.controlsPlay+'"></a><a href="javascript:" class="upGUIButton upGUIButtonStop" title="'+lang.controlsStop+'"></a></div><div class="upGUIVolume"><div class="upGUISlider" title="'+lang.controlsVolume+'"><div class="upGUISliderTail"></div><a href="javascript:" class="upGUIButton upGUIPointer"></a></div></div>'+
		'<a class="r128k" href="http://air.radiolla.com/radiolla.128k.mp3.m3u" onclick="radiolla.uniplayer.load(\'http://air.radiolla.com/radiolla.128k.mp3\'); radiolla.uniplayer.play(); this.blur(); return false;"><a class="r32k" href="http://air.radiolla.com/radiolla.32k.mp3.m3u" onclick="radiolla.uniplayer.load(\'http://air.radiolla.com/radiolla.32k.mp3\'); radiolla.uniplayer.play(); this.blur(); return false;"></a>'+
		'<div class="rPlaylists"><a class="rM3u" title="iTunes" href="http://radiolla.com/radiolla.mp3.m3u">m3u </a><a class="rPls" title="Windows Media Player" href="http://radiolla.com/radiolla.mp3.pls">pls </a><a class="rXspf" title="VLC" href="http://radiolla.com/radiolla.mp3.xspf">xspf </a><a class="rRam" title="RealPlayer" href="http://radiolla.com/radiolla.mp3.ram">ram</a></div>';
	this.getHTML = function(){
		if(player.options.showControls || player.options.showSupply){
			UniplayerUtils.loadCSS(player.options.guiPath + 'uniplayer.css');
		}
		return '<div class="upGUI"><div class="upGUIWrapper"><div class="upGUIMovie"></div><div class="upGUIControls" style="width: 284px; height: 49px; display: '+(player.options.showControls ? 'block' : 'none')+'">'+(player.options.showControls ? HTMLControls : '')+'</div></div></div>';
	};
};


Radiolla = function(conf){
	if(!conf){
		conf = {};
	}
	var self =	this;
	this.onReady = false;
	
	//-- settings
	this.updateURL = conf.updateURL || 'http://radiolla.com/rpc/status';
	this.historyURL = conf.historyURL || 'http://radiolla.com/rpc/history?type=json&past=5&future=5&order=asc';
	this.ratingURL = conf.ratingURL || 'http://radiolla.com/rpc/rate';
	this.statURL = conf.statURL || 'http://radiolla.com/rpc/stat';
	this.updateInterval = conf.updateInterval || 30;	//-- seconds, used if current track's length and time are undefined
	this.updateTimeout = conf.updateTimeout || 1;		//-- seconds, used with play and stop methods to get actual data after connect/disconnect the radio
	this.loader = conf.loader || aloader;
	this.uniplayer = conf.uniplayer || new Uniplayer({
			src: 'http://air.radiolla.com/radiolla.' + (cookies.get('bitrate') || '128') + 'k.mp3',
			mimetype: 'audio/mpeg',
			volume: cookies.get('volume') || .5,
			autoload: true,
			autoplay: typeof(conf.autoplay) != 'undefined' ? conf.autoplay : false,
			showSupply: false,
			background: '#000000',
			guiPath: 'http://radiolla.com/play/r2/',
			noCache: true,
			repeat: true,
			language: language
			,logger: window.console
		});
	
	// uniplayer modules
	//this.uniplayer.addModule(new UniplayerFlashFlowplayer);			// hungry caching - even after STOP and PLAY it plays the same again
	this.uniplayer.addModule(new UniplayerFlashJWPlayer({swf: 'http://radiolla.com/play/jwplayer.swf', flashvars: {bufferlength: 5}}));
	if(navigator.userAgent.indexOf('MSIE')>=0){
		this.uniplayer.addModule(new UniplayerWindowsMedia);
	}
	//this.uniplayer.addModule(new UniplayerVLC);	// change channel doesn't work
	this.uniplayer.write('listen', new UniplayerGUIRadiolla(this.uniplayer));
	
	this.tracksHistoryPast = conf.tracksHistoryPast || document.getElementById('tracksHistoryPast');	//-- should be an <ul> element
	this.tracksHistoryFuture = conf.tracksHistoryFuture || document.getElementById('tracksHistoryFuture');	//-- should be an <ul> element
	this.tracksHistoryPast.innerHTML = this.tracksHistoryFuture.innerHTML = '';	// remove empty <li> elements added to pass XHTML validation
	this.historyPastSize = 5;
	this.historyFutureSize = 5;
	this.status = {
		title: '',
		time: 0,
		length: 0
	};
	
	//-- status updater
	this.updateStatus = function(){
		self.loader.load(self.updateURL + (self.updateURL.indexOf('?') < 0 ? '?' : '&') + 'seed=' + Math.floor(Math.random()*100000000), function(){
			if(!self.onReady){
				self.onReady = true;
				if(typeof conf.onReady == 'function'){
					conf.onReady.call(self);
				}
			}
			var timeout = self.updateInterval;
			if(self.status.length - self.status.time > 0){
				timeout = self.status.length - self.status.time + 1;
			}
			if(self.updater){
				clearTimeout(self.updater);
			}
			self.updater = setTimeout(self.updateStatus, timeout * 1000);
			if(self.onStatusUpdate){
				self.onStatusUpdate.call(self, self.status);
			}
		});
	};
	
	//-- playing indicator	
	var playingInterval = null;
	var playingIndicator = null;
	var playing = function(turn){
			if(turn == 'on'){
				if(!playingIndicator){
					playingIndicator = document.getElementById('playing');
				}
				if(playingInterval){
		 			clearInterval(playingInterval);
		 		}
		 		playingInterval = setInterval(function(){playing();}, 500);
			}
			if(turn == 'off'){
				clearInterval(playingInterval);
				playingInterval = null;
			}
			if(playingIndicator){
				if(turn == 'off' || playingIndicator.className.indexOf('active') >= 0){
					playingIndicator.className = playingIndicator.className.replace(' active', '');
				}
				else{
					playingIndicator.className += ' active';
				}
			}
	};
	
	this.uniplayer.addEventListener('state', function(state){
		setTimeout(self.updateStatus, self.updateTimeout*1500);
		if(state == self.uniplayer.states.stopped || state == self.uniplayer.states.failed){
			cookies.set('play', 0, 604800);
			playing('off');
		}
		else{
			cookies.set('play', 1, 604800);
			playing('on');
		}
	});
	
	this.uniplayer.addEventListener('src', function(src){
		var k128 = UniplayerUtils.getElementsByClassName('r128k', 'a', self.uniplayer.holders.controls)[0];
		var k32 = UniplayerUtils.getElementsByClassName('r32k', 'a', self.uniplayer.holders.controls)[0];
		k128.className = k128.className.replace(' active', '');
		k32.className = k32.className.replace(' active', '');
		if (src.indexOf('128k.mp3') >= 0) {
			cookies.set('bitrate', 128, 604800);
			k128.className += ' active';
		}
		else if (src.indexOf('32k.mp3') >= 0) {
			cookies.set('bitrate', 32, 604800);
			k32.className += ' active';
		}
	});
	
	this.uniplayer.addEventListener('volume', function(volume){
		cookies.set('volume', volume, 604800);
	});
	
	this.rate = function(node, trackId, vote){
		this.loader.load(this.ratingURL + '?track_id=' + trackId + '&vote=' + vote, function(){
			node.className += ' rated';
			node.parentNode.className += ' rated';
		});
	};
	
	//-- tracks history listing
	this.toTracksHistory = function(data, future){
		var tracksHistory = future ? this.tracksHistoryFuture : this.tracksHistoryPast;
		if(!tracksHistory){return;}
		if((tracksHistory.childNodes.length && data.id != tracksHistory.firstChild.rel) || !tracksHistory.childNodes.length){
			// create new tracklist item
			var historyItem = document.createElement('li');
			var titleItem = document.createElement('span');
			if (!future) {
				var ratingItem = document.createElement('span');
				var plusItem = document.createElement('span');
				var minusItem = document.createElement('span');
				ratingItem.className = 'historyRating' + (data.plus || data.minus ? ' rated' : '');
				plusItem.className = 'plus' + (data.plus ? ' rated' : '');
				plusItem.title = lang.plus;
				minusItem.className = 'minus' + (data.minus ? ' rated' : '');
				minusItem.title = lang.minus;
				ratingItem.appendChild(plusItem);
				ratingItem.appendChild(minusItem);
				if (!data.plus && !data.minus) {
					plusItem.onclick = function(){
						self.rate(this, data.id, 'plus');
						plusItem.onclick = null;
						minusItem.onclick = null;
					};
					minusItem.onclick = function(){
						self.rate(this, data.id, 'minus');
						plusItem.onclick = null;
						minusItem.onclick = null;
					};
				}
			}
			titleItem.innerHTML = this.combineTitle(data);
			historyItem.rel = data.id;
			if (data.played) {
				var playedItem = document.createElement('span');
				playedItem.className = 'historyPlayed';
				var playedDate = new Date(data.played*1000);
				var playedHours = playedDate.getHours();
				var playedMinutes = playedDate.getMinutes();
				playedItem.innerHTML = (playedHours > 9 ? playedHours : '0' + playedHours) +':'+ (playedMinutes > 9 ? playedMinutes : '0' + playedMinutes) + ' ';
				historyItem.appendChild(playedItem);
			}
			else {
				titleItem.style.marginLeft = '69px';
			}
			titleItem.className = 'title';
			if (!future) {
				titleItem.appendChild(ratingItem);
			}
			historyItem.appendChild(titleItem);
			// prepend item
			if(tracksHistory.childNodes.length){
				tracksHistory.insertBefore(historyItem, tracksHistory.firstChild);
			}
			else{
				tracksHistory.appendChild(historyItem);
			}
			// remove outsider
			if(tracksHistory.childNodes.length > (future ? this.historyFutureSize : this.historyPastSize)){
				tracksHistory.removeChild(tracksHistory.lastChild);
			}
		}
	};
	
	//-- combineTitle
	this.combineTitle = function(data){
		if (!data.id) {return '';}
		var title = ('<a href="http://www.last.fm/music/' +data.artist+ '" target="_blank" title="' +(lang.readOnLastfm.replace('%artist%', data.artist))+ '">' +data.artist+ '</a>') + '&nbsp;&nbsp;-&nbsp;&nbsp;<span class="trackTitle">' + data.title + '</span>';
		if(data.album && data.year != '0000'){
			title += ' <small>(' + data.album + ' ' + data.year + ')</small>';
		}
		else if(data.album){
			title += ' <small>(' + data.album + ')</small>';
		}
		else if(data.year != '0000'){
			title += ' <small>(' + data.year + ')</small>';
		}
		return title;
	};
	
	this.showCountries = function(countries) {
		var holder = document.getElementById('countries'), str = '';
		for (var i=0; i<countries.length; i++) {
			if (countries[i]) {
				str += '<img src="/style/countries/'+ countries[i][0] +'.png" alt="'+ countries[i][1] +'" title="'+ countries[i][1] +'"/>';
			}
		}
		if (str) {
			holder.innerHTML = lang.nowListen + '&nbsp;' + str;
		}
	};

	//-- update status event
	this.onStatusUpdate = function(status){
		var lastfmArtistLink = true;
		document.title = lang.docTitle.replace('%artist%', status.artist).replace('%title%', status.title);
		document.getElementById('nextTitle').title = status.listeners;
		self.toTracksHistory(status);
		if (status.next) {
			self.toTracksHistory(status.next, true);
		}
		self.showCountries(status.countries);
	};

	//-- connect keyboard
	document.onkeypress = function(e){
		var keynum = 0;
		if(window.event){
			keynum = window.event.keyCode;
		}
		else if(e.which){
			keynum = e.which;
		}
		if(keynum == 32){	// space
			if(radiolla.uniplayer.current.state == radiolla.uniplayer.states.stopped){
				radiolla.uniplayer.load('http://air.radiolla.com/radiolla.256k.mp3');
				radiolla.uniplayer.play();
				cookies.set('bitrate', 256, 604800);
			}
			else{
				radiolla.uniplayer.stop();
			}
			return false;
		}
		else{
			return true;
		}
	};
	
	this.historyLoaded = function() {
		self.tracksHistoryFuture.style.display = 'block';
		var l = document.getElementById('historyLinkTitle');
		l.innerHTML = l.title;	// replace 'loading...' with 'previous #'
	};
	
	//-- load history
	//this.loader.load(this.historyURL, this.historyLoaded);
	
};

stat = function(speed){
	cookies.set('speedtest', (new Date()).getTime());
	var stat = {};
	stat.browser = navigator.userAgent;
	var modules = [];
	for (var i in radiolla.uniplayer.modules) {
		modules.push(radiolla.uniplayer.modules[i].name +':'+ (radiolla.uniplayer.modules[i].present?'on':'off'));
	}
	stat.modules = modules.join(', ');
	stat.module_current = radiolla.uniplayer.current.module.name;
	stat.screen_width = screen.width;
	stat.screen_height = screen.height;
	stat.skin = skinName;
	stat.lang = language;
	stat.referrer = document.referrer || '';
	stat.speed = speed;
	var params = [];
	for (var i in stat) {
		params.push(i + '=' + escape(stat[i]));
	}
	radiolla.loader.load(radiolla.statURL + '?' + params.join('&'));
};


facebookLanguageCodes = {
	de: 'de_DE',
	da: 'da_DK',
	el: 'el_GR',
	en: 'en_GB',
	es: 'es_ES',
	fi: 'fi_FI',
	fr: 'fr_FR',
	it: 'it_IT',
	ja: 'ja_JP',
	nl: 'nl_NL',
	pl: 'pl_PL',
	pt: 'pt_PT',
	ru: 'ru_RU',
	tr: 'tr_TR',
	uk: 'uk_UA',
	zh: 'zh_CN'
};


showhelp = function(str) {
	var h = document.getElementById('help');
	var c = document.getElementById('helpContent');
	if (h.className.indexOf(' active') >= 0) {
		h.className = h.className.replace(' active', '');
	}
	else {
		h.className += ' active';
		if (str) {
			help_content = c.innerHTML;
			c.innerHTML = str;
		}
		else if (typeof help_content != 'undefined') {
			c.innerHTML = help_content;
		}
	}
};


showlang = function(name) {
	var l=document.getElementById('langswitcher');
	l.className = (l.className == 'open' ? '' : 'open');
}

var langLinks = document.getElementById('langswitcher').getElementsByTagName('a');
for (var i=0; i<langLinks.length; i++) {
	if (langLinks[i].className.indexOf('current') >= 0) {continue;}
	langLinks[i].onclick = function() {
		if (location.hash.length > 1) {
			location.href = this.href + location.hash;
			return false;
		}
		return true;
	};
}


speedtest = function() {
	new SpeedTest('speedtest', {onReady: stat});
};


radiolla = new Radiolla({
	autoplay: cookies.get('play') > 0,
	onReady: function() {
		var lastTest = cookies.get('speedtest');
		if (!lastTest || (lastTest - (new Date()).getTime() > 60)) {
			speedtest();
		}
	}
});


// Firefox 3.6 feels BAD
var ff = navigator.userAgent.match(/Firefox\/(\d)\.(\d)/);
if (navigator.userAgent.match(/Windows/) && ff && ff[1] == 3 && ff[2] == 6) {
	//showhelp(lang.firefox36);
	radiolla.uniplayer.holders.movie.style.position = 'relative';
	radiolla.uniplayer.options.flashReloadPage = true;
}


overlayToggle = function() {
	if ($('#overlay').hasClass('visible')) {
		return overlayClose();
	}
	else {
		$('#overlay').slideDown(400);
		$('#overlay').addClass('visible');
		return true;
	}
};
overlayClose = function() {
	$('#overlay').slideUp(400);
	$('#overlay').removeClass('visible');
	if (!ff || ff[1] == 3 && ff[2] >= 5) {	// Firefox 3.0 reloads page when emptying hash
		location.hash = '';
	}
	return false;
};


// facebook comments
$('#comments').mouseover(function(){
	if (!$(this).hasClass('expanded')) {
		$(this).addClass('expanded');
		$('#comments').animate({
			height: $('#comments iframe').height()
		}, 500, function(){
			$(this).css('overflow', 'none');
			$(this).css('height', 'auto');
		});
	}
});


radiolla.toTracksHistory({id: 5527, title: 'Brasilia Freestylee', artist: 'DJ Kentaro', album: 'Bwoy On The Wheels Of Solid Steel', year: '2004', played: 1283719295, plus: 0, minus: 0});
radiolla.toTracksHistory({id: 18986, title: 'Cloud In The Sky', artist: 'Archive', album: 'Take My Head', year: '1999', played: 1283719439, plus: 0, minus: 0});
radiolla.toTracksHistory({id: 23852, title: 'Duck & Cover', artist: 'De-Phazz', album: 'LaLa 2.0', year: '2010', played: 1283719713, plus: 0, minus: 0});
radiolla.toTracksHistory({id: 13303, title: 'White Dove', artist: 'Wax Poetic', album: 'Wax Poetic', year: '2000', played: 1283719918, plus: 0, minus: 0});
radiolla.toTracksHistory({id: 5722, title: 'Pink Panza', artist: 'Spaceways', album: 'Trip Hop & Jazz Volume 3', year: '1999', played: 1283720150, plus: 0, minus: 0});
radiolla.toTracksHistory({id: 23657, title: 'Clap Your Hands', artist: 'Kabanjak', album: 'Grow', year: '2005', played: 0, plus: 0, minus: 0}, true);
radiolla.toTracksHistory({id: 2382, title: 'Hpe We Never Surface', artist: 'Two Lone Swordsmen', album: 'Stay Down', year: '1998', played: 0, plus: 0, minus: 0}, true);
radiolla.toTracksHistory({id: 23314, title: 'One More Round', artist: 'Kasso', album: 'Back To Mine - Royksopp', year: '2007', played: 0, plus: 0, minus: 0}, true);
radiolla.toTracksHistory({id: 24127, title: 'Last Orgy 3', artist: 'U.N.K.L.E. Featuring Takagi-Kan', album: 'James Vs. Nigo - A Bathing Ape Vs Mo\'Wax (James Disc)', year: '1997', played: 0, plus: 0, minus: 0}, true);
radiolla.toTracksHistory({id: 4757, title: 'Crooned', artist: 'Toshinori Kondo, Eraldo Bernocchi, Bill Laswell', album: 'Charged', year: '1999', played: 0, plus: 0, minus: 0}, true);
radiolla.historyLoaded();