(function(a){var j={apiUrl:"http://timbroddin.be/projects/anysong/"},i={init:function(d){function k(){a.get(c.apiUrl,{songName:c.song,artistName:c.artist,albumName:c.album,playlistId:c.playlist,theme:c.theme},function(f){if(f){a(e).html(f.widget);a.each(f,function(b,g){b!=="widget"&&a(e).data(b,g)});a(e).trigger("ready.anySong");h=false}else{a(e).addClass("anysong-not-found");a(e).html(c.labels.notFound)}},"jsonp")}var e=this,h=false,c={apiUrl:"",song:"",artist:"",album:"",playlist:"",labels:{notFound:"Song, artist or album not found."},
theme:"metal"};a.extend(true,c,j);d&&a.extend(true,c,d);a.each(["artist","album","song","playlist","theme"],function(f,b){if((value=a(e).data(b))||(value=a(e).attr("data-"+b)))c[b]=value});k();a(e).bind("changeData",function(f,b,g){if(b=="song"||b=="album"||b=="artist"||b=="playlist"){c[b]=g;if(!h){setTimeout(function(){k()},200);h=true}}})}};a.fn.anySong=function(d){argv=arguments;return this.each(function(){if(i[d])return i[d].apply(this,Array.prototype.slice.call(argv,1));else if(typeof d==="object"||
!d){options=[d];return i.init.apply(this,options)}})};a.anySong=function(d){j=d}})(jQuery);
