$(document).ready(function(){
	//Instantiate APE Client
	var client = new APE.Client();
	
	//Load APE Core
	client.load();
	
	//Intercept 'load' event. This event is fired when the Core is loaded and ready to connect to APE Server
	client.addEvent('load', function() {
	    //Call core start function to connect to APE Server
	    client.core.start();
	});
	
	//4) Listen to the ready event to know when your client is connected
	client.addEvent('ready', function() {
	    //1) join 'testChannel'
	    client.core.join('hitradio');
	
	    //4) Intercept the reception of new message.
	    client.onRaw('songchanged', function(raw, pipe) {
	        title = unescape(raw.data.title);
	        artist = unescape(raw.data.artist);
	        albumart = unescape(raw.data.albumart);
	        time = unescape(raw.data.time);
	        newsong(artist, title, albumart, time);
	    });
	});
});