/* Generated 2012-01-29 15:35:45*/jQuery(document).ready(function(){jQuery("#allabout-search-field").autocomplete("/index.php?module=AllAbout&action=SearchString&format=json&state=1&object="+jQuery("#allabout-search-field").parent("fieldset").attr("title"),{selectFirst:false,cacheLength:20,minChars:3,max:20,parse:function(data){return $.map(eval(data),function(row){return{data:row,value:row.data,result:row.display}})},formatItem:function(item){return item.display}}).result(function(event,item){location.href=item.url});jQuery(".stats-hint-toggle").click(function(){jQuery(this).next(".stats-hint").slideFadeToggle()});if(document.userToken&&jQuery(".allabout-view").length){getManageTools()}if(document.loggedinUserName!=null){getFollowButton()}$(".button-follow").live("click",function(e){e.preventDefault();if(document.loggedinUserName!=null){var allAboutType=document.jsItemTypeName;var allAboutId=document.jsItemID;var currentCount=parseInt($("#followers-count span").html());$().webService({type:"POST",url:"/services/gateway/allabout/"+allAboutType+"/"+allAboutId+"/addAlert.json",dataType:"html",loading:true,loadingLocation:"#followers-count",success:function(data){$("#followers-button").html('<p class="button-sprite button-following">Following</p>');$("#followers-count span").html(currentCount+1);$("#followers-list-latest").fadeIn("slow").prepend('<li class="clearfix" id="follower-'+document.loggedinUserId+'"><a href="/people/'+document.loggedinUserName+'"><img src="http://ic.i.tsatic-cdn.net/people/'+document.loggedinUserName+'/avatar-45x45"></a><h4>You</h4><h5>now</a>')}})}else{loginModal()}});$(".button-unfollow").live("click",function(e){e.preventDefault();var currentCount=parseInt($("#followers-count span").html());var fanUnId=$(this).attr("rel");$(this).expressionWebService({expAction:"RemoveTag",objectId:document.jsItemID,objectType:document.jsItemType,extraParamBoolean:true,extraParam:"unId",extraParamValue:fanUnId,extraParamType:"tagType",extraParamTypeValue:"fan",dataType:"json",loading:false,success:function(data){$("#followers-count span").html(currentCount-1);$("#followers-button").html('<a class="button-sprite button-follow" href="#">Follow</a>');$("#followers-list-latest").find("#follower-"+document.loggedinUserId).fadeOut("slow");$("#followers-list-all").find("#follower-"+document.loggedinUserId).fadeOut("slow")}})});$("#followers-list-options-all").live("click",function(e){e.preventDefault();$("#followers-list-all").show();$("#followers-list-latest").hide();if($("#followers-list-all li").length==0){loadFans(1)}$(this).addClass("selected");$("#followers-list-options-latest").removeClass("selected");$("#followers-list-more").show()});$("#followers-list-options-latest").live("click",function(e){e.preventDefault();$(this).addClass("selected");$("#followers-list-options-all").removeClass("selected");$("#followers-list-latest").show();$("#followers-list-all").hide();$("#followers-list-more").hide()});$("#followers-list-more a").live("click",function(e){e.preventDefault();var page=$(this).attr("rel");loadFans(page)});jQuery(".allabout-following").live("click",function(e){e.preventDefault();var allAboutType="eventname";if(jQuery(this).attr("rel")!=null){var allAboutId=jQuery(this).attr("rel");jQuery(this).addClass(allAboutId);jQuery(this).parents(".festival-followers").addClass("following-"+allAboutId)}else{var allAboutId=jQuery(this).attr("id")}addFollow(allAboutType,allAboutId)});if(jQuery(".events-tickets-listing").length&&document.userToken){jQuery(".events-tickets-listing .event-detail-attending a").live("click",function(e){e.preventDefault();if(jQuery(this).hasClass("event-addme")){eventID=jQuery(this).parents(".event-item").attr("id");eventCount=parseInt(jQuery(this).siblings(".event-counter").text());eventAddMe(eventID,eventCount)}else{if(jQuery(this).hasClass("event-removeme")){eventID=jQuery(this).parents(".event-item").attr("id");eventCount=parseInt(jQuery(this).siblings(".event-counter").text());eventUnID=jQuery(this).siblings(".event-counter").attr("id");eventRemoveMe(eventID,eventCount,eventUnID)}}})}jQuery("#friends-more a").live("click",function(e){e.preventDefault();jQuery("#friends-more").hide();jQuery("#friends-other").show()});if(jQuery(".event-add-me").length){eventAddInvite.init()}});function loadFans(a){if(a==""){a=1}$().webService({type:"GET",url:"/services/gateway/",dataType:"html",data:"service[module]=AllAbout&service[action]=GetFansBlock&service[format]=html&params[tagType]=fan&params[page]="+a+"&params[offset]=30&params[objectType]="+document.jsItemType+"&params[groupName]="+document.jsGroupName+"&params[objectId]="+document.jsItemID+"&params[var]=attributeFan",loading:true,loadingLocation:"#followers-list-all",success:function(c){$("#followers-list-all").append(c);var d=$(c).length;if(d==59){var b=parseInt(a)+1;$("#followers-list-more").html('<a rel="'+b+'" href="#">show more</a>')}else{$("#followers-list-more").html("");$("#followers-list-more").hide()}}})}function getFollowButton(){jQuery().webService({type:"GET",url:"/services/gateway/",dataType:"html",data:"service[module]=AllAbout&service[action]=GetImAFanBlock&service[format]=html&params[itemId]="+document.jsItemID+"&params[itemType]="+document.jsItemType,success:function(a){if($("#follow").length){jQuery("#follow").html(a)}if($("#followers-button").length){jQuery("#followers-button").html(a)}}})}function getManageTools(){jQuery().webService({type:"GET",url:"/services/gateway/",dataType:"html",data:"service[module]=AllAbout&service[action]=SmallManageToolsBlock&service[format]=html&params[attributeType]="+document.jsItemTypeName+"&params[attributeId]="+document.jsItemID,success:function(a){jQuery("#manage-tools").html(a)}})}function addFollow(a,b){if(document.userToken){jQuery().webService({type:"GET",url:"/services/gateway/allabout/"+a+"/"+b+"/addAlert.json",dataType:"html",loading:true,loadingLocation:"#follow .button",success:function(g){jQuery(".button-fans-action").html("<span>unfollow</span>");jQuery(".button-fans-action").attr("name","remove");var e="."+b;if(jQuery(e).length){if(jQuery(".item-counter-additional").length){var c=".item-counter-additional "+e;var f=".following-"+b+" .item-counter-number";var d=parseInt(jQuery(f).html());jQuery(f).html(d+1);jQuery(c).html("Following")}}}})}else{loginModal()}}function eventAddMe(b,c){if(document.userToken){var a=c+1;jQuery(this).expressionWebService({expAction:"AddTag",objectId:b,objectType:"WhatsOn",extraParamBoolean:true,extraParamType:"tagType",extraParamTypeValue:"calendar",dataType:"json",loading:false,success:function(d){jQuery("#"+b+" .event-counter").html(a);jQuery("#"+b+" .event-detail-attending").addClass("attending-added");jQuery("#"+b+" .event-detail-attending").removeClass("attending-yes");jQuery("#"+b+" .event-detail-attending").removeClass("attending-no")}})}}function eventRemoveMe(c,d,a){if(document.userToken){var b=d-1;jQuery(this).expressionWebService({expAction:"RemoveTag",objectId:c,objectType:"WhatsOn",extraParamBoolean:true,extraParam:"unId",extraParamValue:a,extraParamType:"tagType",extraParamTypeValue:"calendar",dataType:"json",loading:false,success:function(e){jQuery("#"+c+" .event-counter").html(b);jQuery("#"+c+" .event-detail-attending").removeClass("attending-yes");jQuery("#"+c+" .event-detail-attending").addClass("attending-no")}})}};
