if(!this.JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==="string"){return c}return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(typeof value.length==="number"&&!value.propertyIsEnumerable("length")){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})();"use strict";var FacebookAPIManager=(function(){var C,P,k,I=null,H=null,M=null,c=null,D,J,a=null,U=null,G=false,i="offline_access, publish_stream",S="affiliations, current_location, hometown_location,interests, music, name, pic_with_logo, pic_square_with_logo, about_me,profile_url, status";function N(){if(!C){C=FB.Facebook.apiClient}return C}function Q(m){if(m){P=m.uid;k=m.session_key}else{FBConnect.initNotConnected()}}function g(){if(!P){Q(N().get_session())}return P}function h(){if(!k){Q(N().get_session())}return k}function Y(){if(I===null){N().friends_get(null,function(m){I=m})}return I}function O(){if(c===null){N().friends_getAppUsers(function(m){c=m})}return c}function A(){if(!D){N().users_getInfo(g(),S,function(m){D=m})}return D}function X(){if(H===null){N().users_hasAppPermission("offline_access",function(m){H=m})}return H}function e(){if(M===null){N().users_hasAppPermission("publish_stream",function(m){M=m})}return M}function F(m,n){N().fql_query(m,n)}function j(m){return"SELECT uid, name, pic_square_with_logo FROM user WHERE uid IN ("+m.join(",")+") ORDER BY name ASC"}function B(o,n){var m=[];$(o).each(function(){m.push(this[n])});return m}function R(){if(a===null&&Y()){F(j(Y()),function(m){a=B(m,"uid2")})}return a}function T(){if(U===null&&O()){F(j(O()),function(m){U=B(m,"uid")})}return U}function l(m){FB.Connect.showPermissionDialog(i,function(n){if(n){J=n.indexOf(",")>-1?n.split(","):n;$(J).each(function(){switch(this){case"offline_access":H=1;break;case"publish_stream":M=1;break}});if(jQuery.isFunction(m)){m()}}else{if(jQuery.isFunction(m)){m()}}})}function L(n,p,m,o){FB.Connect.showFeedDialog(m,n,p,null,null,FB.RequireConnect.promptConnect,function(){})}function d(n,o,m){N().notifications_send(n,o,m||function(){})}function b(p,o,n,m){N().feed_publishUserAction(p,o,n,null,2,null,m||function(){})}function f(p,q){var n,o,m=j(q);n=new FB.BatchSequencer();o=N().fql_query(m,n);n.execute(function(){U=o.result})}function E(s){var m,q,o,r,p,n;m=new FB.BatchSequencer();q="SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = "+g()+") AND is_app_user";p=N().fql_query(q,m);o="SELECT "+i+" FROM permissions WHERE uid = "+g();r=N().fql_query(o,m);n=N().users_getInfo(g(),S,m);m.execute(function(){if(jQuery.isArray(r.result)){Log.write("Loaded permissions");H=r.result[0].offline_access;M=r.result[0].publish_stream}if(p.result){Log.write("Found app friends");c=B(p.result,"uid")}if(jQuery.isArray(n.result)){Log.write("Loaded User info");D=n.result[0]}if(p.result){Log.write("Executing FQL asset batch");f(I,c)}s();G=true})}function Z(){Log.write("Trying to log out current user.");G=false;$(".batch_data").remove();FB.Connect.logout(FBConnect.initNotConnected)}function V(n,m){FB.Connect.get_status().waitUntilReady(function(o){if(o===FB.ConnectState.appNotAuthorized){m()}else{if(o===FB.ConnectState.userNotLoggedIn&&null===H){m()}else{if(o===FB.ConnectState.connected||H){n()}}}})}function W(n,m){if(G){Log.write("data received, skipping FQL batch");V(n,m)}else{if(g()){Log.write("User id found = "+g());E(function(){V(n,m)})}else{Log.write("No user id, don't get any data");m()}}}function K(n,m){FB.Connect.requireSession(function(){Log.write("getConnected called as RequireSession callback");W(n,m)})}$(function(){if(DUMAS.facebookConnect){P=DUMAS.facebookConnect.userId}});return{getFeedDialog:L,getConnectionState:W,sendNotification:d,publishToFeed:b,logInUserToFacebook:K,fql:F,askForPermissions:l,changeUser:Z,Singletons:{getUserId:g,getSessionKey:h,getUserInfo:A,getOffline:X,getPublish:e,getFriends:Y,getFriendsData:R,getAppFriends:O,getAppFriendsData:T}}}());"use strict";var ConnectEventManager=(function(){var A=null;function B(C,D){switch(C){case"connected":A=20;break;case"album":A=21;break;case"album_rating":A=22;break;case"album_review":A=23;break;case"tellafriend_album":A=24;break;case"artist":A=25;break;case"artist_rating":A=26;break;case"tellafriend_artist":A=27;break;case"disconnected":A=28;break;case"dozens":A=29;break;case"spotlight":A=30;break}$.post("/user-event.html?eventCode="+A+"&externalID="+FBConnect.getUserId(),function(){if(D){D()}});pageTracker._trackEvent("Facebook",C);return true}return{logEvent:B}}());"use strict";var ConnectRESTManager=(function(){var B={format:"JSON",callback:"ConnectRESTManager.getFacebookRESTResponse"};function E(G,I){var H="",F;for(F in G){if(Object.hasOwnProperty.call(G,F)){H+=F+"="+G[F]+"&"}}$.ajax({type:"get",dataType:"json",url:"/facebook.html?"+H,success:function(J){if(J.status==="failed"){}else{if(J.status==="ok"){$.ajax({type:"get",dataType:"script",cache:true,url:J.url,success:I})}}}})}function D(F){if(F){}else{window.alert("There was an error.")}}function C(F,G,H){E(jQuery.extend({},B,{method:"stream.publish",uid:FacebookAPIManager.Singletons.getUserId(),message:F.message,attachment:JSON.stringify(F.attachment),action_links:JSON.stringify(F.action_links)}),H);return false}function A(F){E(jQuery.extend({},B,{method:"facebook.auth.revokeAuthorization",session_key:FacebookAPIManager.Singletons.getSessionKey(),uid:FacebookAPIManager.Singletons.getUserId()}),F);return false}return{callFacebookRESTMethod:E,getFacebookRESTResponse:D,disconnect:A,publish:C}}());"use strict";var ConnectJSONManager=(function(){function f(){return"http://www.emusic.com"}function g(){return"fref="+704017}function c(){return f()+"?"+g()}var L,N,V,M,D,C,K,U=false,O=5,G=null,E=null,P=null,H=null,B={shortStoryToken:"",actionText:"Discover eMusic",actionUrl:c()},R={text:"Discover eMusic",href:c()};function a(i){var h=i.indexOf("?")>-1?"&":"?";return f()+i+h+g()}function F(i,h){return'<a href="'+a(h)+'">'+i+"</a>"}function Y(h){return'<a href="'+c()+'">eMusic'+(h?".com":"")+"</a>"}function Q(){return{primaryLink:N?N:M,primaryName:D?D:C,primaryUrl:L?L:V,secondaryLink:M,secondaryName:C,secondaryUrl:V,label:K}}function b(h){return h.indexOf("http://")===0?h:"http://images.emusic.com"+h}function e(j,k){var l=[],i=$("#albumCover img").attr("src"),h;h={src:b(i),href:a(j)};if(k){h.type="image"}l.push(h);return l}function A(i,m){var h=[],l,k,j;i.each(function(n){if(n<O){l=(undefined!==$(this).attr("href"))?$(this).attr("href"):$(this).find("a").attr("href");k=$(this).find("img").attr("src");j={src:b(k),href:a(l)};if(m){j.type="image"}h.push(j)}});return h}function J(h){return A($(".albumImage"),h)}function Z(h){return A($(".dozImage"),h)}function d(h){return A($(".featureImg"),h)}function X(h,i){C=h.artistName;V=h.artistUrl;M=F(h.artistName,V);if(i){E={message:"checked out "+C+" at eMusic",attachment:jQuery.extend({},FBConnect.STREAM_ATTACH_ABSTRACT_JSON,{name:h.artistName,media:J(true)}),action_links:[{text:"Check out "+C,href:a(V)},R]}}else{E=jQuery.extend({},B,{oneLineToken:"checked out "+M+" at "+Y(true),images:J(),actionText:"Discover "+h.artistName+" at eMusic.com",actionUrl:a(V)})}if(h.hasRated){FBConnect.FACEBOOK_ARTIST_RATING_JSON=jQuery.extend({},E,i?{message:"rated "+C+" at eMusic: "+h.rating+" stars!"}:{oneLineToken:"rated "+M+" at "+Y(true)+": "+h.rating+" stars"})}FBConnect.FACEBOOK_ARTIST_JSON=E;FBConnect.getArtistImages=J;FBConnect.getSubject=Q}function T(){var h=Q();return jQuery.extend({},{oneLineToken:"checked out "+h.primaryLink+" by "+h.secondaryLink+" at "+Y(true),shortStoryToken:"<b>"+h.primaryLink+"</b><br/>"+jQuery.trim(h.secondaryName)+"<br/>"+jQuery.trim(h.label),images:e(h.primaryUrl),actionText:"Discover "+h.primaryName+" by "+h.secondaryName+" at eMusic.com",actionUrl:a(h.primaryUrl)})}function I(h,i){L=h.albumUrl;D=h.albumName;V=h.artistUrl;C=h.artistName;N=F(h.albumName,L);M=F(h.artistName,V);K=h.label;if(i){G={message:"checked out "+D+" by "+C+" at eMusic",attachment:jQuery.extend({},FBConnect.STREAM_ATTACH_ABSTRACT_JSON,{name:D,href:N,media:e(L,i),description:jQuery.trim(K)}),action_links:[{text:"Check out "+D,href:a(V)},R]}}else{G=T()}if(h.hasRated){FBConnect.FACEBOOK_ALBUM_RATING_JSON=jQuery.extend({},G,i?{message:"rated "+D+" by "+C+" at eMusic: "+h.rating+" stars"}:{oneLineToken:"rated "+N+" by "+M+" at "+Y(true)+": "+h.rating+" stars"})}FBConnect.FACEBOOK_ALBUM_JSON=G;FBConnect.getSubject=Q}function W(h,i){if(i){P={message:"checked out "+h.dozenTitle+", an eMusic Dozen by "+h.dozenAuthor+", at eMusic",attachment:jQuery.extend({},FBConnect.STREAM_ATTACH_ABSTRACT_JSON,{name:"The eMusic Dozen: "+h.dozenTitle,media:Z(i),description:h.dozenText}),action_links:[{text:"Check out "+h.dozenTitle,href:encodeURIComponent(a(h.dozenUrl))},R]}}else{P=jQuery.extend({},B,{oneLineToken:"checked out "+F(h.dozenTitle,h.dozenUrl)+", an eMusic Dozen by "+h.dozenAuthor+", at "+Y(true),images:Z()})}FBConnect.FACEBOOK_DOZEN_JSON=P}function S(i,j){var h=i.spotlightUrl.split(".com")[1];if(j){H={message:"checked out "+i.spotlightTitle+", an eMusic Spotlight by "+i.spotlightAuthor+", at eMusic",attachment:jQuery.extend({},FBConnect.STREAM_ATTACH_ABSTRACT_JSON,{name:i.dozenTitle,media:Z(j)}),action_links:[{text:"Check out "+i.spotlightTitle,href:encodeURIComponent(a(h))},R]}}else{H=jQuery.extend({},B,{oneLineToken:"checked out "+F(i.spotlightTitle,h)+", an eMusic Spotlight by "+F(i.spotlightAuthor,i.authorUrl)+", at "+Y(true),images:d()})}FBConnect.FACEBOOK_SPOTLIGHT_JSON=H}return{getFacebookArtistJSON:X,getFacebookAlbumJSON:I,getAlbumJSONForTemplate:T,getFacebookDozenJSON:W,getFacebookSpotlightJSON:S,geteMusicLink:Y}}());"use strict";var FacebookPopupManager=(function(){var D,A=675;function C(){return D}function B(F,H,G){$("#"+H+"Wrapper").html($("#"+H+"Cache").html());$("#"+H+"Wrapper").find(".set_id").attr("id",H);var E=document.getElementById(H);D=new FB.UI.PopupDialog(F,E,false,false);D.set_placement(FB.UI.PopupPlacement.topCenter);D.setContentWidth(A);D.show();$(E).show();if(jQuery.isFunction(G)){G()}}return{make:B,getFbDialog:C}}());"use strict";var ConnectFriendModule=(function(){var K=[],M,R,D,P,A,H,O=80051914510;function E(){if(!A){A=FacebookAPIManager.Singletons.getFriendsData()}return A}function J(){if(!H){H=FacebookAPIManager.Singletons.getAppFriendsData()}return H}function S(){return K}function L(){var V=FBConnect.getSubject();switch(M){case"rec_album":P="Share this album with your friends on Facebook";D="thinks "+V.primaryName+" by "+V.secondaryName+" is great and wanted to share it";break;case"rec_artist":P="Share this artist with your friends on Facebook";D="thinks "+V.primaryName+" is a great artist and wanted to share them with you!";break}}function F(V,W){return' onclick="'+W+"("+V+', this)"'}function G(b,W,V,c,a,Z){var Y="",X;if(b.length){$(b).each(function(){X=c?F(this.uid,c):"";Y+='<div class="'+V+'"'+X+">";Y+='<img src="'+(this.pic_square_with_logo?this.pic_square_with_logo:"/images/spacer.gif")+'" />';Y+="<p>"+this.name+"</p>";Y+="</div>"});a.append(Y);a.append('<div class="clear"></div>');window[W]=true;Z()}}function B(){var V;$("a.share_button").click(function(){FacebookPopupManager.getFbDialog().close();V=S();R=jQuery.extend({},ConnectJSONManager.getAlbumJSONForTemplate(),{oneLineToken:D});if(V.length===1){FacebookAPIManager.getFeedDialog(R,V,O,true)}FacebookAPIManager.sendNotification(V,D,function(){})});$("a.close_button").click(function(){FacebookPopupManager.getFbDialog().close()})}function U(c,b,V,Y,X,Z){var a=$("#"+b+"Cache"),W=a.find(".pickerWrapper");if(window[X]){Z()}else{G(c,X,V,Y,W,Z)}}function T(V){M=V;L();U(E(),"pickFriends","pickerData","ConnectFriendModule.pickFriend","friendsFbml",function(){FacebookPopupManager.make(P,"pickFriends",B)})}function N(){U(J(),"appFriends","appFriendData",null,"appFriendsFbml",function(){FacebookPopupManager.make("Your Facebook friends Connected to eMusic","appFriends",B)})}function C(){var V=$("#pickFriends").find(".count");if(K.length){V.find("span").html(" - <strong>"+K.length+"</strong> "+(K.length===1?"friend":"friends")).end().css("display","inline")}else{V.hide()}}function I(W,V){return jQuery.grep(W,function(X){return(X!==V)})}function Q(W,V){var X=$(V);if(X.hasClass("picked")){K=I(K,W);X.removeClass("picked")}else{K.push(W);X.addClass("picked")}C()}return{showFriendPicker:T,showAppFriends:N,pickFriend:Q}}());"use strict";var FBConnect={};jQuery.extend(FBConnect,function(){var V=false,J=null,B=null,U=null,A="/html/xd_receiver.htm",Y,X,N,Q,D,S,L,R;function H(){L=this;R=$(this).attr("facebook_type");try{if(undefined!==R){switch(R){case"album":Y=FBConnect.FACEBOOK_ALBUM_JSON;break;case"album_rating":Y=FBConnect.FACEBOOK_ALBUM_RATING_JSON;break;case"artist":Y=FBConnect.FACEBOOK_ARTIST_JSON;break;case"artist_rating":Y=FBConnect.FACEBOOK_ARTIST_RATING_JSON;break;case"dozens":Y=FBConnect.FACEBOOK_DOZEN_JSON;break;case"spotlight":Y=FBConnect.FACEBOOK_SPOTLIGHT_JSON;break}ConnectEventManager.logEvent(R);FacebookAPIManager.getFeedDialog(Y,null,U)}}catch(a){}return false}function K(a,b){a.hover(function(){$(this).addClass(b)},function(){$(this).removeClass(b)})}function I(){window.location.href=window.location.href}function Z(){return L}function C(){if(!B){B=FacebookAPIManager.Singletons.getUserId()}return B}function F(){V=false;if(C()){ConnectEventManager.logEvent("disconnected",I)}}function P(){K($(".faq"),"faqOpen");K($(".facebook_share"),"hoverShare");$(".facebook_share:not(.facebook_suggest)").each(function(){$(this).find("a").click(H)});$(".app_friends").click(ConnectFriendModule.showAppFriends);$(".disconnect").click(function(){ConnectRESTManager.disconnect(F)});$(".switch_user").click(FacebookAPIManager.changeUser)}function T(){var a=FacebookAPIManager.Singletons,c=a.getUserInfo(),d=$("#panel_name"),b=d.find("a").eq(0);if(c){if(c.profile_url){b.attr("href",c.profile_url)}if(c.current_location&&c.current_location.city&&c.current_location.state&&!$(".ap_location").length){b.after(' <strong class="batch_data ap_location">('+c.current_location.city+", "+c.current_location.state+")</strong>")}if(c.status.message&&!$(".ap_status_message").length){d.append('<br /><span class="batch_data ap_status_message">'+c.status.message+"</span>")}if(c.music&&!$(".ap_music").length){d.append('<p class="batch_data ap_music"><strong>Music you like:</strong><br />'+c.music+"</p>")}if(c.pic_with_logo){$("#panel_pic").html('<img src="'+c.pic_with_logo+'"/>')}if(c.pic_square_with_logo){$("a#facebookConnect").find("img").remove();$("a#facebookConnect").prepend('<img src="'+c.pic_square_with_logo+'"/>')}$(".switch_user").find("span").text(c.name?c.name:"you").end().show()}$(".app_friends").css("display",jQuery.isArray(a.getAppFriends())&&a.getAppFriends()[0]?"block":"none");$(".facebook_suggest").hide()}function O(){FBConnect.STREAM_ATTACH_ABSTRACT_JSON={uid:C(),caption:"eMusic, the internet's corner music store"};if(DUMAS.facebookAlbum){return ConnectJSONManager.getFacebookAlbumJSON(DUMAS.facebookAlbum,S)}if(DUMAS.facebookArtist){return ConnectJSONManager.getFacebookArtistJSON(DUMAS.facebookArtist,S)}if(DUMAS.facebookDozen){return ConnectJSONManager.getFacebookDozenJSON(DUMAS.facebookDozen,S)}if(DUMAS.facebookSpotlight){return ConnectJSONManager.getFacebookSpotlightJSON(DUMAS.facebookSpotlight,S)}}function E(){V=true;P();X.css("display","block");N.hide();S=FacebookAPIManager.Singletons.getPublish();T();O()}function G(){V=false;X.hide();N.css("display","block");Q.hide();$("#fb_login").click(function(){FacebookAPIManager.logInUserToFacebook(E,F)})}function W(){return V}function M(){return new FB_RequireFeatures(["Connect","Api"],function(){FB.init(J,A,{doNotUseCachedConnectState:1});Log.write("getConnectionState called from RequireFeatures after Init");FacebookAPIManager.getConnectionState(E,G)})}$(document).ready(function(){if($("body").hasClass("facebook")){X=$(".connected:not(.facebook_suggest), .facebook_ratings_action");N=$(".not_connected");Q=$(".facebook_ratings_alert, .facebook_ratings_action");D=DUMAS.facebookConnect;U=FBConnect.primary_template_id=D.template;J=FBConnect.api_key=D.apiKey;try{if(FB_RequireFeatures){M()}}catch(a){}}});return{getUserId:C,channel_path:A,initNotConnected:G,initConnected:E,getConnectStatus:W,conditionallyInit:M,getPublishTrigger:Z}}());