
var forgotPasswordVisible=false;var showLoad;function onLoadRoutines(){visibilitytoggle();showLoad=false;onLoadInternal();}
function onLoadInternal(){}
function pageWidth(){return window.innerWidth!=null?window.innerWidth:document.documentElement&&document.documentElement.clientWidth?document.documentElement.clientWidth:document.body!=null?document.body.clientWidth:null;}
function pageHeight(){return window.innerHeight!=null?window.innerHeight:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body!=null?document.body.clientHeight:null;}
function displayWait(){if(self.pageYOffset){yPos=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yPos=document.documentElement.scrollTop;}else if(document.body){yPos=document.body.scrollTop;}
showLoad=true;$('shazamWait').style.position='absolute'
$('shazamWait').style.top=yPos+pageHeight()/2+"px";$('shazamWait').style.left=pageWidth()/2+"px";}
function showWait(){if(showLoad!=true)
{showLoad=true;$('shazamWait').style.visibility='visible';$('shazamWait').style.height='92px';intervalId=window.setInterval("displayWait()",10);}}
function hideWait(){if(showLoad!=false)
{window.clearInterval(intervalId)
showLoad=false;$('shazamWait').style.visibility='hidden';$('shazamWait').style.height='1px';}}
var hotspots=document.getElementsByName('hotspot');var toggles=document.getElementsByName('toggle');function visibilitytoggle()
{for(var i=0;i<hotspots.length;i++)
{hotspots[i].someProperty=i;hotspots[i].onclick=function(){toggle(this.someProperty)};}}
var loginBoxState=0;function toggleLogin()
{Set_Cookie('test','none','','/','','');if(Get_Cookie('test'))
{cookie_set=true;Delete_Cookie('test','/','');$('signin').style.top=Position.cumulativeOffset($('signInLink'))[1]+25+'px';$('signin').style.left=Position.cumulativeOffset($('signInLink'))[0]-130+'px';$('signin').style.visibility='visible';if(loginBoxState==0)
{loginBoxState=1;$('searchtype').style.visibility='hidden';new fx.Height($('signin'),{duration:400,onComplete:function(){$('loginusername').focus();}}).custom(0,$('signin').scrollHeight);}
else
{loginBoxState=0;new fx.Height($('signin'),{duration:400,onComplete:function(){$('searchtype').style.visibility='visible';}}).custom($('signin').scrollHeight,0);}}
else
{showMessagePopUp("Cookies are disabled in your browser.  You need to enable cookies in order to sign in");}}
var openTab="";function toggleTab(outerDiv,innerDiv)
{if(innerDiv==openTab)
{openTab="";new fx.Height($(outerDiv),{duration:400,onComplete:function(){$(outerDiv).innerHTML="";}}).custom($(outerDiv).scrollHeight,0);}
else
{oldHeight=$(outerDiv).scrollHeight;if(openTab!="")
{new fx.Height($(outerDiv),{duration:400,onComplete:function(){$(outerDiv).innerHTML=$(innerDiv).innerHTML;new fx.Height($(outerDiv),{duration:400}).custom(0,$(outerDiv).scrollHeight);}}).custom($(outerDiv).scrollHeight,0);}
else
{$(outerDiv).innerHTML=$(innerDiv).innerHTML;new fx.Height($(outerDiv),{duration:400}).custom(0,$(outerDiv).scrollHeight);}
openTab=innerDiv;}}
function toggleForgotPassword()
{if(forgotPasswordVisible==true)
{$('signin').style.background="transparent url('/music/images/signin2.png') no-repeat";forgotPasswordVisible=false;$('forgot1').style.visibility="hidden";$('forgot2').style.visibility="hidden";}
else
{$('signin').style.background="transparent url('/music/images/signin.png') no-repeat";forgotPasswordVisible=true;$('forgot1').style.visibility="visible";$('forgot2').style.visibility="visible";}}
function checkUsername()
{var msgData="username="+$('username').value;new Ajax.Request('/music/web/check-username.htm',{method:'post',parameters:msgData,onSuccess:function(sentMessage){if(sentMessage.responseText!==undefined){$('usernameAvailableMessage').innerHTML=sentMessage.responseText;}}});}
function hideRegistrationHelp()
{$('regHelpMsg').style.visibility='hidden';}
function showRegistrationHelp(element,text)
{$('regHelpMsg').style.position="absolute";$('regHelpMsg').style.visibility='visible';$('regHelpMsg').style.top=Position.cumulativeOffset($(element))[1]+'px';$('regHelpMsg').style.left=Position.cumulativeOffset($(element))[0]+300+'px';$('regHelpMsg').innerHTML=text;}
function validateMobileConfirm(obj){var poststr="validationCode="+encodeURI($("validationCode").value);new Ajax.Request('/music/web/validate-mobile.htm',{method:'validateMobileConfirm',parameters:poststr,onSuccess:function(alertMessage){if(alertMessage.responseText!==undefined){$('validationCodeMessage').innerHTML=alertMessage.responseText;}}});}
function resendValidationSMS()
{var msgData="username="+$('username').value;new Ajax.Request('/music/web/resend-validation-sms.htm',{method:'post',parameters:msgData,onSuccess:function(sentMessage){if(sentMessage.responseText!==undefined){$('smsValidationMessage').innerHTML=sentMessage.responseText;}}});}
function addPersonalPage()
{alert("addPersonalPage being called");var msgData="newPersonalPage="+$('newPersonalPage').value;new Ajax.Request('/music/web/add-personal-page.htm',{method:'post',parameters:msgData,onSuccess:function(sentMessage){alert(sentMessage.responseText);if(sentMessage.responseText!==undefined){$('validationCodeMessage').innerHTML=sentMessage.responseText;}}});}
var daysInMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);function updateDOBDays(){yearindex=document.getElementById('dob_year_select').selectedIndex;if(document.getElementById('dob_year_select').options[yearindex].value%4==0){daysInMonth[1]=29;}
else{daysInMonth[1]=28;}
monthIndex=document.getElementById('dob_month_select').selectedIndex;arrayindex=document.getElementById('dob_month_select').options[monthIndex].value;numDays=daysInMonth[arrayindex];if(monthIndex==0){numDays=31}
numOptions=numDays+1;document.getElementById('dob_day_select').options.length=numOptions;for(n=1;n<numOptions;n++){document.getElementById('dob_day_select').options[n].text=n;}
return true;}
function stopClipPlaying(){if(nowPlaying!=""){document.getElementById('mHF').src="/music/images/generic/spacer.gif";nowPlaying="";}}
function musiverse_play(whichClipURL){document.getElementById('mHF').src="/music/jsp/hidden_player.jsp?musicFileUrl="+whichClipURL;}
function musiverse_open(whichUrl){var eleft=(screen.width-1000)/2;var etop=(screen.height-600)/2;var explorer=window.open(whichUrl,'explorer','width=1000,height=596,left='+eleft+',top='+etop+',toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no');explorer.focus();}
function musiverse_user(aUrl){var leftpos=screen.width-840;if(leftpos<0)leftpos=0;var usernewwindow=window.open(aUrl+'?ICO=musicExplorer&ICL=userLink','usernewwindow','left='+leftpos+',top=0,width=840,height=650,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,menubar=yes');usernewwindow.focus();}
function musiverse_stop(){document.getElementById('mHF').src="/music/images/generic/spacer.gif";}
function embedPlayer(whichClip){document.write("<OBJECT id='mediaPlayer' name='mediaPlayer' width='320' height='285' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading MS WM components...' type='application/x-oleobject'>");document.write("<param name='fileName' value='"+whichClip+"'>");document.write("<param name='animationatStart' value='false'>");document.write("<param name='transparentatStart' value='false'>");document.write("<param name='autoStart' value='true'>");document.write("<param name='showControls' value='true'>");document.write("<param name='loop' value='true'>");document.write("<EMBED type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1' bgcolor='darkblue' showcontrols='true' showtracker='-1' showdisplay='0' showstatusbar='-1' videoborder3d='-1' width='320' height='285' src='"+whichClip+"' autostart='true' designtimesp='5311' loop='false'></EMBED>");document.write("</OBJECT>");}
var mw1=0;var mw2=0;function showMobileWidget(){displayMobileWidget();mw1=1;}
function showMobileWidget2(){displayMobileWidget();mw2=1;}
function displayMobileWidget(){$('mobileWidget').style.top=Position.cumulativeOffset($('mobileWidgetButton'))[1]+20+'px';$('mobileWidget').style.left=Position.cumulativeOffset($('mobileWidgetButton'))[0]-0+'px';$('mobileWidget').style.visibility='visible';}
function hideMobileWidget2(){setTimeout("if (mw1 == 0){$('mobileWidget').style.visibility = 'hidden';}",500);mw2=0;}
function hideMobileWidget(){setTimeout("if (mw2 == 0){$('mobileWidget').style.visibility = 'hidden';}",500);mw1=0;}
function resizeTab(tabIdName,clearTab){var tabLink=$(tabIdName+"Button");var tabDiv=$(tabIdName+"Target");if($(tabDiv).getStyle('height')=='0px'){tabLink.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Hide</div>';var heightAttributes=tabDiv.scrollHeight;new fx.Height(tabDiv,{duration:400}).custom(0,heightAttributes);}
else{tabLink.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Show</div>';var heightAttributes=0;new fx.Height(tabDiv,{duration:400,onComplete:function(){if(clearTab){var clearArgs=tabIdName;$(clearArgs+'Target').innerHTML="";}}}).custom(tabDiv.scrollHeight,heightAttributes);}}<!--
function c(whichID,whichMode,whichPage){if(whichPage==2){location.href="/music/web/album?id="+whichID;}else if(whichPage==3){location.href="/music/web/artist?id="+whichID;}else{location.href="/music/web/track?id="+whichID;}}
function m(newMode){if(location.href.indexOf('/mode/')!=-1){location.href=location.href.replace(/\/mode\/[^\/]*\//,"\/mode\/"+newMode+"\/");}else{location.href=location.href.replace(/\/portal/,"/portal/mode/"+newMode);}}
var nowPlaying="";function p(whichClipURL,whichID){var listenElements;if(nowPlaying!=whichID){if(nowPlaying!=""){listenElements=document.getElementsByName(nowPlaying);for(x=0;x<listenElements.length;x++){listenElements[x].lastChild.innerHTML="listen";}}
nowPlaying=whichID;listenElements=document.getElementsByName(whichID);for(x=0;x<listenElements.length;x++){listenElements[x].lastChild.innerHTML="loading";}
$('mHF').src="/music/jsp/hidden_player.jsp?musicFileUrl="+whichClipURL;}
else if(nowPlaying==whichID){nowPlaying="";listenElements=document.getElementsByName(whichID);for(x=0;x<listenElements.length;x++){listenElements[x].lastChild.innerHTML="listen";}
$('mHF').src="/music/images/generic/spacer.gif";}}
function gp(whichClipURL,whichID){var listenElements;if(nowPlaying!=whichID){if(nowPlaying!=""){listenElements=document.getElementsByName(nowPlaying);for(x=0;x<listenElements.length;x++){listenElements[x].lastChild.innerHTML='&nbsp;';}}
nowPlaying=whichID;listenElements=document.getElementsByName(whichID);for(x=0;x<listenElements.length;x++){listenElements[x].lastChild.innerHTML='<img src="/music/images/s/buttons/loading.png">';}
$('mHF').src="/music/jsp/hidden_player.jsp?musicFileUrl="+whichClipURL;}
else if(nowPlaying==whichID){nowPlaying="";listenElements=document.getElementsByName(whichID);for(x=0;x<listenElements.length;x++){listenElements[x].lastChild.innerHTML='&nbsp;';}
$('mHF').src="/music/images/generic/spacer.gif";}}
function p2(){var listenElements=document.getElementsByName(parent.nowPlaying);for(x=0;x<listenElements.length;x++){if(listenElements[x].lastChild.innerHTML.match("loading.png")=='loading.png')
{listenElements[x].lastChild.innerHTML='<img src="/music/images/s/buttons/stop.png">';}
else
{listenElements[x].lastChild.innerHTML='Stop';}}}
function stopClipPlaying(){if(nowPlaying!=""){document.getElementById('mHF').src="/music/images/generic/spacer.gif";nowPlaying="";}}
function musiverse_play(whichClipURL){document.getElementById('mHF').src="/music/jsp/hidden_player.jsp?musicFileUrl="+whichClipURL;}
function musiverse_user(aUrl){var leftpos=screen.width-840;if(leftpos<0)leftpos=0;var usernewwindow=window.open(aUrl+'?ICO=musicExplorer&ICL=userLink','usernewwindow','left='+leftpos+',top=0,width=840,height=650,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,menubar=yes');usernewwindow.focus();}
function musiverse_stop(){document.getElementById('mHF').src="/music/images/generic/spacer.gif";}
var hotspots=document.getElementsByName('hotspot');var toggles=document.getElementsByName('toggle');function visibilitytoggle()
{for(var i=0;i<hotspots.length;i++)
{hotspots[i].someProperty=i;hotspots[i].onclick=function(){toggle(this.someProperty)};}}
function toggle(i){var toggleHide=function(){toggles[i].style.display='none';}
if(toggles[i].style.display=='none'){toggles[i].style.display='';oldheight=toggles[i].scrollHeight;toggles[i].style.height='1px';new fx.Height(toggles[i],{duration:400}).custom(0,oldheight);if(hotspots[i].innerHTML.indexOf("comment")!=-1){document.forms['comment'].commentText.focus();}}
else{oldheight=toggles[i].scrollHeight;new fx.Height(toggles[i],{duration:400}).toggle();if((hotspots[i].innerHTML.indexOf("marketplace")!=-1)||(hotspots[i].innerHTML.indexOf("ringtones")!=-1)){var tabDiv=$("marketPlaceTabTarget");var mkttee=tabDiv.scrollHeight;new fx.Height(tabDiv,{duration:400,onComplete:function(){toggles[i].style.display='none';}}).custom(mkttee,mkttee-oldheight);}}
var toggleButtons=hotspots[i].getElementsByTagName("img");if(toggleButtons.length>0){if(toggleButtons[0].getAttribute("src").indexOf("show_all_full.gif")!=-1){toggleButtons[0].setAttribute("src","/music/images/s/show_top_full.gif");}
else if(toggleButtons[0].getAttribute("src").indexOf("show_top_full.gif")!=-1){toggleButtons[0].setAttribute("src","/music/images/s/show_all_full.gif");}
else if(toggleButtons[0].getAttribute("src").indexOf("show_all.gif")!=-1){toggleButtons[0].setAttribute("src","/music/images/s/show_top.gif");}
else if(toggleButtons[0].getAttribute("src").indexOf("show_top.gif")!=-1){toggleButtons[0].setAttribute("src","/music/images/s/show_all.gif");}}
else{if(hotspots[i].innerHTML.indexOf("Read user reviews")!=-1){hotspots[i].innerHTML='Hide user reviews';}
else if(hotspots[i].innerHTML.indexOf("Add a review")!=-1){hotspots[i].innerHTML='<strong>Cancel review<strong>';}
else if(hotspots[i].innerHTML.indexOf("Hide user reviews")!=-1){hotspots[i].innerHTML='<strong>Read user reviews</strong>';}
else if(hotspots[i].innerHTML.indexOf("Cancel review")!=-1){hotspots[i].innerHTML='<strong>Add a review<strong>';}
else if(hotspots[i].innerHTML.indexOf("Cancel review")!=-1){hotspots[i].innerHTML='<div class="explore_btn"><a href="#">&nbsp;</a><strong>Add a review</strong><div>';}
else if(hotspots[i].innerHTML.indexOf("marketplace")!=-1){if(hotspots[i].innerHTML.indexOf("Show all")!=-1){hotspots[i].innerHTML='<span id=\"marketplace\"><div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Show top 2</div></span>';}
else if(hotspots[i].innerHTML.indexOf("Show top 2")!=-1){hotspots[i].innerHTML='<span id=\"marketplace\"><div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Show all</div></span>';}}
else if(hotspots[i].innerHTML.indexOf("ringtones")!=-1){if(hotspots[i].innerHTML.indexOf("Show all")!=-1){hotspots[i].innerHTML='<span id=\"ringtones\"><div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Show 1</div></span>';}
else if(hotspots[i].innerHTML.indexOf("Show 1")!=-1){hotspots[i].innerHTML='<span id=\"ringtones\"><div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Show all</div></span>';}}
else if(hotspots[i].innerHTML.indexOf("Show top 5")!=-1){hotspots[i].innerHTML='<strong><div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Show all</div></strong>';}
else if(hotspots[i].innerHTML.indexOf("Show all")!=-1){hotspots[i].innerHTML='<strong><div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Show top 5</div></strong>';}}}
function setCookieToUri(name,uri){var expires=new Date();var expiresDelay=365;expires.setDate(expires.getDate()+expiresDelay);document.cookie=name+"="+encodeURI(uri)+"; path=\/; expires="+expires.toGMTString();}
function setCookie(name,value){var expires=new Date();var expiresDelay=365;expires.setDate(expires.getDate()+expiresDelay);document.cookie=name+"="+escape(value)+"; path=\/; expires="+expires.toGMTString();}
function getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return"";}else
begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)
end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}
function stripHTML(htstring){htstring=htstring.replace(/(<([^>]+)>)/ig," ");htstring=htstring.replace(/  /g," ");return htstring;}
function embedPlayer(whichClip){document.write("<OBJECT id='mediaPlayer' name='mediaPlayer' width='320' height='285' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading MS WM components...' type='application/x-oleobject'>");document.write("<param name='fileName' value='"+whichClip+"'>");document.write("<param name='animationatStart' value='false'>");document.write("<param name='transparentatStart' value='false'>");document.write("<param name='autoStart' value='true'>");document.write("<param name='showControls' value='true'>");document.write("<param name='loop' value='true'>");document.write("<EMBED type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1' bgcolor='darkblue' showcontrols='true' showtracker='-1' showdisplay='0' showstatusbar='-1' videoborder3d='-1' width='320' height='285' src='"+whichClip+"' autostart='true' designtimesp='5311' loop='false'></EMBED>");document.write("</OBJECT>");}
var hideAlbums=["Club Beats","Club November","Connexions Latina","Dance Express","DMC Commercial Collection","DMC DJ Only","Euro Express","Exitos Express","Hitdisc","Hitsheet","Pop Beats","Pop Beats","Pop Express","Pop November","Praisedisc","Radio Express","Radio Xtra","Rock Express","Sampler","Shazam Dummy Product","Street Beats","The Reel","TMC","Underground Beats","Urban Express","US Beats","XNC"];var thisLink,invalidLink;function fixLinks(){for(i=0;i<document.links.length;i++){invalidLink=false;thisLink=document.links[i];if(thisLink.href.indexOf("/page/track/")!=-1){thisLink.href=thisLink.href.replace("/page/track/","/page/ctrack/");}
if(thisLink.innerHTML==""&&thisLink.tagName!="AREA"){invalidLink=true;}else{for(j=0;j<hideAlbums.length;j++){if(thisLink.innerHTML.indexOf(hideAlbums[j])==0){invalidLink=true;}}}
if(invalidLink){thisLink.href="#";thisLink.innerHTML="[Compilation]";}
if((thisLink.href==location.href)&&(thisLink.parentNode.tagName!="LI")){thisLink.className="current";}}}
function checkSearch(aForm){if(aForm.query.value==""||aForm.query.value=="Search"){return false;}
else
return true;}
function writeSupportEmail(){document.write("<a href='mailto:support@shazam.com'>support@shazam.com</a>");}
function setUpMessagePopUp(){}
function showMessagePopUp(aMessage){$("popup_msg_msg").innerHTML='<div class="hd"><h2 class="white">alert</h2></div><div class="bd">'+aMessage+'<div class="cancel"><span class="links" onclick="hideMessagePopUp()";><br/><a href="#">> close</a></span></div></div>';lb=new lightbox();lb.initCallable('popup_msg_msg');lb.activate();$('lightbox').style.width='537px';$('lightbox').style.height='100px';}
function hideMessagePopUp(){lb=new lightbox();lb.initCallable('popup_msg_msg');lb.deactivate();}
function toggleRowVisibility(aRowID,onOrOff){if($(aRowID).getStyle('display')=='table-row'){if(onOrOff=='off'){$(aRowID).setStyle({visibility:'collapse'});}
else{$(aRowID).setStyle({visibility:'visible'});}}
else{if(onOrOff=='off'){$(aRowID).setStyle({display:'none'});}
else{$(aRowID).setStyle({display:'block'});}}}
var initRun=false;var waitBody='';var requiredMajorVersion=6;var requiredMinorVersion=0;var requiredRevision=0;var hasReqestedVersion=DetectFlashVer(requiredMajorVersion,requiredMinorVersion,requiredRevision);if(hasReqestedVersion){waitBody='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="155" height="110" id="loading" align="middle"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/music/swf/loading.swf" /><param name="quality" value="high" /><embed src="/music/swf/loading.swf" quality="high" wmode="transparent" width="155" height="110" name="loading" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';}else{waitBody='<img src="/music/images/s/communities/loading.gif" alt="Loading...">';}
function showMessageBox(aUserId){if(aUserId!=""){document.msgForm.to.value=aUserId;}
document.msgForm.reply.value="";document.msgForm.message.value="";toggleRowVisibility('messagereplybutton','off')
lb=new lightbox();lb.initCallable('msg_box');lb.activate();$('lightbox').style.width='537px';$('lightbox').style.height='400px';}
function showReplyMessageBox(aUserId,aReplyId){if(aUserId!=""){$('msgForm').to.value=aUserId;}
$('msgForm').reply.value=aReplyId;$('msgForm').message.value="";toggleRowVisibility('messagereplybutton','on')
lb=new lightbox();lb.initCallable('msg_box');lb.activate();$('lightbox').style.width='537px';$('lightbox').style.height='400px';}
function hideMessageBox(){lb=new lightbox();lb.initCallable('msg_box');lb.deactivate();}
function removeElementById(id){element=$(id);element.parentNode.removeChild(element);}
function getChecked(aList){for(i=0;i<aList.length;i++){if(aList[i].checked)return aList[i];}
return false;}
function getReplyValue(aReplyId,boolChecked){if(boolChecked){return aReplyId;}
return 0;}
var changeTabFailure=function(o){hideWait();showMessagePopUp("Loading Failed");}
function addFriendProfile(aUrl,userId,referUrl){var msgData="relationship_userb="+userId+"&relationship_type=FAVOURITE&relationship_action=add&referrerUri="+referUrl;new Ajax.Request(aUrl,{method:'post',parameters:msgData});var friendElements=document.getElementsByClassName('addFriend'+userId);var friendSpan=friendElements[0];friendSpan.innerHTML='<a href="#" onclick="removeFriendProfile(\''+aUrl+'\','+userId+',\''+referUrl+'\'); return false;"><img src="/music/images/s/buttons/del_sm_dark.png" alt=""/> remove as friend</a>';friendSpan.addClassName('removeFriend'+userId);friendSpan.removeClassName('addFriend'+userId);}
function removeFriendProfile(aUrl,userId,referUrl){console.log("aUrl: "+aUrl);var msgData="relationship_userb="+userId+"&relationship_type=FAVOURITE&relationship_action=remove&referrerUri="+referUrl;new Ajax.Request(aUrl,{method:'post',parameters:msgData});var friendElements=document.getElementsByClassName('removeFriend'+userId);var friendSpan=friendElements[0];friendSpan.innerHTML='<a href="#" onclick="addFriendProfile(\''+aUrl+'\','+userId+',\''+referUrl+'\'); return false;"><img src="/music/images/s/buttons/add_sm_dark.png" alt=""/> add to friends</a>';friendSpan.removeClassName('removeFriend'+userId);friendSpan.addClassName('addFriend'+userId);}
function msgPanelHideCallback(e){toggleRowVisibility('messagereplybutton','off');}
function init(){initRun=true;if(window.location.hash.indexOf("#")>-1){var myele=$(window.location.hash.substr(1,window.location.hash.length)+"Button");myele.onclick();}
var openme=$("recommendationsTabButton");if(openme!=null)openme.onclick();}
function sendMessage(message,to,visibility,replyId){hideMessageBox();$("messageContent").value=message;$("recipientId").value=to;$("replyId").value=replyId;$("visibility").value=visibility;document.forms["sendMessageForm"].submit();}
function setTempMessage(tmsg){Temp_Message=tmsg;}
function getTempMessage(){return(Temp_Message);}
function setTempUsername(tusr){Temp_Username=tusr;}
function getTempUsername(){return(Temp_Username);}
function changeSubTabArea(aUrl,tabIdName){showWait();var timeNow=new Date().getTime();var div=$(tabIdName+'Target');var heightAttributes=0;new fx.Height(div,{duration:400}).custom(0,heightAttributes);new Ajax.Request(aUrl+'&t='+timeNow,{method:'get',onSuccess:function(tabAreaContent){var div=$(tabIdName+'Target');div.innerHTML=tabAreaContent.responseText;var heightAttributes=div.scrollHeight;new fx.Height(div,{duration:400}).custom(0,heightAttributes);hideWait();},onFailure:function(ctfailure){showMessagePopUp("Loading Failed");}});hideWait();}
function changeTagList(aUrl){showWait();var timeNow=new Date().getTime();new Ajax.Request(aUrl+'&t='+timeNow,{method:'get',onSuccess:function(tagListChangeSuccess){var div=$('tag_list');if(tagListChangeSuccess.responseText!==undefined){div.innerHTML=tagListChangeSuccess.responseText;}},onFailure:function(tagListChangeFailure){hideWait();showMessagePopUp("Loading Failed");}})
hideWait();}
var clearArgs="";var clearTargetHandler=function(tabIdName){$(clearArgs+'Target').innerHTML="";}
function resizeAMGTab(tabIdName,clearTab){var tabLink=$(tabIdName+"Button");var tabDiv=$(tabIdName+"Target");if($(tabDiv).getStyle('height')=='100px'){tabLink.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">hide</div>';var heightAttributes=tabDiv.scrollHeight;new fx.Height(tabDiv,{duration:400}).custom(100,heightAttributes);}
else{tabLink.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">show</div>';var heightAttributes=100;new fx.Height(tabDiv,{duration:400}).custom(tabDiv.scrollHeight,heightAttributes);}}
function resizeAMGTabDisc(tabIdName,clearTab){var tabLink=$(tabIdName+"Button");var tabDiv=$(tabIdName+"Target");if($(tabDiv).getStyle('height')=='100px'){tabLink.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Hide</div>';var heightAttributes=tabDiv.scrollHeight;new fx.Height(tabDiv,{duration:400}).custom(100,heightAttributes);}
else{tabLink.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">More</div>';var heightAttributes=100;new fx.Height(tabDiv,{duration:400}).custom(tabDiv.scrollHeight,heightAttributes);}}
function resizeMarketplace(tabIdName,clearTab){var tabLink1=$(tabIdName+"Button1");var tabLink2=$(tabIdName+"Button2");if($(tabIdName+"Button3")){var tabLink3=$(tabIdName+"Button3");}
var tabDiv=$(tabIdName+"Target");if($(tabDiv).getStyle('height')=='0px'){tabLink1.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Hide Marketplace</div>';tabLink2.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Hide Marketplace</div>';if($(tabIdName+"Button3")){tabLink3.innerHTML="View Tracklisting";}
var heightAttributes=tabDiv.scrollHeight;}
else{tabLink1.innerHTML='<div class="showhide" onmouseover="this.style.cursor=\'pointer\'">Show Marketplace</div>';tabLink2.innerHTML="";if($(tabIdName+"Button3")){tabLink3.innerHTML="";}
var heightAttributes=0;}
new fx.Height(tabDiv,{duration:400}).toggle();}
var responseSuccess=function(o){var div=$(o.argument+'Target');div.innerHTML=o.responseText;hideWait();resizeTab(o.argument,false);};var recommendationsLoaded=false;var recommendationsTabContent;function loadTab(tabIdName,userName){if($(tabIdName+'Target').innerHTML!=""){resizeTab(tabIdName,true);}
else{var page="";var timeNow=new Date().getTime();switch(tabIdName){case"recommendationsTab":page="/music/web/myrecommendations";break;case"myReviewsTab":page="/music/jsp/communities/reviews.jsp?u="+userName+"&t="+timeNow;}
showWait();var tdiv=$(tabIdName+'Target');if((recommendationsLoaded==true)&&(tabIdName=="recommendationsTab"))
{tdiv.innerHTML=recommendationsTabContent;hideWait();resizeTab(tabIdName,false);}
else
{new Ajax.Request(page,{method:'get',onSuccess:function(loadedTab){tdiv.innerHTML=loadedTab.responseText;if(tabIdName=="recommendationsTab")
{recommendationsTabContent=loadedTab.responseText;}
hideWait();recommendationsLoaded=true;resizeTab(tabIdName,false);},onFailure:function(failedTab){hideWait();showMessagePopUp("Loading Failed");}})}}}
function warninghide(divref){state='hidden';if(document.all){eval("document.all."+divref+".style.visibility = state");}
if(document.layers){document.layers[divref].visibility=state;}
if($&&!document.all){divobj=$(divref);divobj.style.visibility=state;}}
function warningshow(divref){state='visible';if(document.all){eval("document.all."+divref+".style.visibility = state");}
if(document.layers){document.layers[divref].visibility=state;}
if($&&!document.all){divobj=$(divref);divobj.style.visibility=state;}}
function resizeAnimationTime(aAnimObject,aHeightSize){return Math.abs(aAnimObject.height.to-aHeightSize.substring(0,aHeightSize.length-2))/300;}
function webTag(wt_contentTypeId,wt_contentKey){var formAction="/music/web/webtagging";var msgData="contentTypeId="+wt_contentTypeId+"&contentKey="+wt_contentKey;new Ajax.Request(formAction,{method:'post',parameters:msgData,onSuccess:function(webTagSuccess){if(webTagSuccess.responseText!==undefined){$('webtag_status').innerHTML=webTagSuccess.responseText;}},onFailure:function(webTagFailure){if(webTagFailure.responseText!==undefined){$('webtag_status').innerHTML=webTagSuccess.responseText;}}})}
function iTunesCurrency(TLCurr){if(TLCurr=="GBP"){return("&pound; ");}
if((TLCurr=="USD")||(TLCurr=="USD")||(TLCurr=="AUD")){return("$ ");}
if(TLCurr=="EUR"){return("&euro; ");}
return("");}
function iTunesPrice(TLCurr,price){if((TLCurr=="GBP")||(TLCurr=="USD")||(TLCurr=="AUD")||(TLCurr=="EUR"))
{return(price)}
else
{return"";}}
var iTunesTrackingURL='http://clkuk.tradedoubler.com/click?p=23708&a=1332301&url=';function iTunesTrack(iTunesObject)
{eval(iTunesObject);if(iTunesObject.resultCount>0)
{iTunesHidden=false;for(resultCount=0;resultCount<1;resultCount++)
{var storeURL=iTunesTrackingURL+escape(iTunesObject.results[resultCount].trackViewUrl+partnerId);var listenURL=iTunesObject.results[resultCount].previewUrl;iTunesRow_col_1='<a title="buy from iTunes" target="_blank" href="'+storeURL+'"><img src="/music/images/itunes.png" alt="Buy from iTunes" width="69" height="25"></a>';iTunesRow_col_2='<a target="_blank" title="buy from iTunes" href="'+storeURL+'"><img src="'+iTunesObject.results[resultCount].artworkUrl60+'" alt="Buy from iTunes" width="60" height="60"></a>';iTunesRow_col_3=iTunesObject.results[resultCount].artistName+' - '+iTunesObject.results[resultCount].trackName;iTunesRow_col_4=iTunesCurrency(iTunesObject.results[resultCount].currency)+iTunesPrice(iTunesObject.results[resultCount].currency,iTunesObject.results[resultCount].trackPrice.toPrecision(2));if(iTunesObject.results[resultCount].trackPrice<0)
{iTunesRow_col_4="";}
iTunesRow_col_5='<a target="_blank" title="listen in iTunes"  href="'+listenURL+'"><img src="/music/images/s/itunes_listen.png" alt="Listen" width="22" height="22"></a>';iTunesRow_col_6='<a target="_blank" title="buy from iTunes" href="'+storeURL+'"><img src="/music/images/s/buttons/buy.png" alt="Buy from iTunes" width="44" height="19"></a><br/>';}
$('iTunesLinkContent_col_1').innerHTML=iTunesRow_col_1;$('iTunesLinkContent_col_2').innerHTML=iTunesRow_col_2;$('iTunesLinkContent_col_3').innerHTML=iTunesRow_col_3;$('iTunesLinkContent_col_4').innerHTML=iTunesRow_col_4;$('iTunesLinkContent_col_5').innerHTML=iTunesRow_col_5;$('iTunesLinkContent_col_6').innerHTML=iTunesRow_col_6;}
else{iTunesHidden=true;iTunesRow_col_1='<img src="/music/images/itunes.png" alt="iTunes" width="69" height="25">';iTunesRow_col_2='&nbsp;';iTunesRow_col_3='This track is not currently available from the iTunes store';iTunesRow_col_4='&nbsp;';iTunesRow_col_5='&nbsp;';iTunesRow_col_6='&nbsp;';$('iTunesLinkContent_col_1').innerHTML=iTunesRow_col_1;$('iTunesLinkContent_col_2').innerHTML=iTunesRow_col_2;$('iTunesLinkContent_col_3').innerHTML=iTunesRow_col_3;$('iTunesLinkContent_col_4').innerHTML=iTunesRow_col_4;$('iTunesLinkContent_col_5').innerHTML=iTunesRow_col_5;$('iTunesLinkContent_col_6').innerHTML=iTunesRow_col_6;}}
function iTunesAlbum(iTunesObject)
{eval(iTunesObject);if(iTunesObject.resultCount>0)
{for(resultCount=0;resultCount<1;resultCount++)
{var storeURL=iTunesTrackingURL+escape(iTunesObject.results[resultCount].collectionViewUrl+partnerId);iTunesRow_col_1='<a target="_blank" title="buy from iTunes" href="'+storeURL+'"><img src="/music/images/itunes.png" alt="Buy from  " width="69" height="25"></a>';iTunesRow_col_2='<a target="_blank" title="buy from iTunes" href="'+storeURL+'"><img src="'+iTunesObject.results[resultCount].artworkUrl60+'" alt="Buy from iTunes" width="60" height="60"></a>';iTunesRow_col_3=iTunesObject.results[resultCount].artistName+' - '+iTunesObject.results[resultCount].collectionName;;iTunesRow_col_4=iTunesCurrency(iTunesObject.results[resultCount].currency)+iTunesPrice(iTunesObject.results[resultCount].currency,iTunesObject.results[resultCount].collectionPrice.toPrecision(3));if(iTunesObject.results[resultCount].collectionPrice<0)
{iTunesRow_col_4="";}
iTunesRow_col_5='&nbsp;';iTunesRow_col_6='<a target="_blank" title="buy from iTunes" href="'+storeURL+'"><img src="/music/images/s/buttons/buy.png" alt="Buy from iTunes" width="44" height="19"></a>';}
$('iTunesLinkContent_col_1').innerHTML=iTunesRow_col_1;$('iTunesLinkContent_col_2').innerHTML=iTunesRow_col_2;$('iTunesLinkContent_col_3').innerHTML=iTunesRow_col_3;$('iTunesLinkContent_col_4').innerHTML=iTunesRow_col_4;$('iTunesLinkContent_col_5').innerHTML=iTunesRow_col_5;$('iTunesLinkContent_col_6').innerHTML=iTunesRow_col_6;}
else{iTunesHidden=true;iTunesRow_col_1='<img src="/music/images/itunes.png" alt="iTunes" width="69" height="25">';iTunesRow_col_2='&nbsp;';iTunesRow_col_3='This product is not currently available from the iTunes store';iTunesRow_col_4='&nbsp;';iTunesRow_col_5='&nbsp;';iTunesRow_col_6='&nbsp;';$('iTunesLinkContent_col_1').innerHTML=iTunesRow_col_1;$('iTunesLinkContent_col_2').innerHTML=iTunesRow_col_2;$('iTunesLinkContent_col_3').innerHTML=iTunesRow_col_3;$('iTunesLinkContent_col_4').innerHTML=iTunesRow_col_4;$('iTunesLinkContent_col_5').innerHTML=iTunesRow_col_5;$('iTunesLinkContent_col_6').innerHTML=iTunesRow_col_6;}}
function iTunesArtist(iTunesObject)
{$('iTunes').style.height="1";$('iTunes').remove();eval(iTunesObject);if(iTunesObject.resultCount>0)
{for(resultCount=0;resultCount<1;resultCount++)
{var storeURL=iTunesTrackingURL+escape(iTunesObject.results[resultCount].artistViewUrl+partnerId);iTunesRow_col_1='<a target="_blank" title="buy from iTunes" href="'+storeURL+'"><img src="/music/images/itunes.png" alt="Buy from iTunes" width="69" height="25"></a>';iTunesRow_col_2='&nbsp;';iTunesRow_col_3=iTunesObject.results[resultCount].artistName;iTunesRow_col_4='&nbsp;';iTunesRow_col_5='&nbsp;';iTunesRow_col_6='<a target="_blank" title="buy from iTunes" href="'+storeURL+'"><img src="/music/images/s/buttons/buy.png" alt="Buy from iTunes" width="44" height="19"></a>';}}
else{iTunesHidden=true;}}
function changeLocale(){var idx=document.forms['locale_form'].locale.selectedIndex;var alocale=document.forms['locale_form'].locale[idx].value;if(alocale!=''){var startURL=document.location.href;var startPos=startURL.indexOf("&l=");if(startPos>0)
{var subStringOne=startURL.substring(0,startPos+3);var subStringTwo=startURL.substring(startPos+8);document.location.href=subStringOne+alocale+subStringTwo;}
else
{var url=document.location.href+'&l='+alocale;document.location.href=url;}}}
function showMarketPlace(mp_musicObjectId,mp_musicObjectType,mp_DivId,mp_artistString,mp_addonSourceKey,mp_addonSourceTypeId,mp_addonsProductsFloat,mp_musicObjectTitle,mp_firstArtistName)
{iTunesHidden=true;var msgAction="/music/web/marketplace.do";mp_artistString=escape(mp_artistString);mp_firstArtistName=escape(mp_firstArtistName);var msgData="action="+msgAction+"&musicObjectId="+mp_musicObjectId+"&musicObjectType="+mp_musicObjectType+"&template=marketplace"+"&mode=nocontainer"+"&artistString="+mp_artistString+"&addonSourceKey="+mp_addonSourceKey+"&addonSourceTypeId="+mp_addonSourceTypeId+"&addonsProductsFloat="+mp_addonsProductsFloat+"&musicObjectTitle="+mp_musicObjectTitle+"&firstArtistName="+mp_firstArtistName;new Ajax.Request(msgAction,{method:'post',parameters:msgData,onSuccess:function(mktplace){var div=$(mp_DivId);div.innerHTML=mktplace.responseText;visibilitytoggle();if(mp_musicObjectType!="PeoplePerson")
{iTunesScript=document.createElement("script");iTunesScript.setAttribute("type","text/javascript");iTunesScript.setAttribute("src",iTunesSearchScriptURL);document.getElementsByTagName('head')[0].appendChild(iTunesScript);}}});};function Get_Cookie(check_name){var a_all_cookies=document.cookie.split(';');var a_temp_cookie='';var cookie_name='';var cookie_value='';var b_cookie_found=false;for(i=0;i<a_all_cookies.length;i++)
{a_temp_cookie=a_all_cookies[i].split('=');cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,'');if(cookie_name==check_name)
{b_cookie_found=true;if(a_temp_cookie.length>1)
{cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,''));}
return cookie_value;break;}
a_temp_cookie=null;cookie_name='';}
if(!b_cookie_found)
{return null;}}
function Set_Cookie(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires)
{expires=expires*1000*60*60*24;}
var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+
((expires)?";expires="+expires_date.toGMTString():"")+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+
((secure)?";secure":"");}
function Delete_Cookie(name,path,domain){if(Get_Cookie(name))document.cookie=name+"="+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";}
