/* Generated 2012-02-10 02:32:42*/siteGlobal=function(){var a=jQuery;return{init:function(){a(".quickTool h3, .quickTool .section-header, .quickTool .section-hint").live("click",this.quickTools);a.fn.webService=this.webServiceCall;a.fn.expressionWebService=this.expressionWebServiceCall;a(".mates-show-info, .post-user-name-modal").live("click",this.matesShowInfo);a(".menu-profile-add a, .menu-profile-add-editorial a, .add-as-a-mate").live("click",this.matesAddShowInfo);a(".menu-profile-remove a, .menu-profile-remove-editorial a, .remove-as-a-mate").live("click",this.matesRemoveShowInfo);a("#mystuff-toggle").live("click",this.myStuffProfileBoxToggle);a(".delete-select").click(this.deleteSelect);a(".add-me").live("click",this.addMeRollService);a.fn.inputHints=this.inputHints;siteGlobal.sendMeUpdates();a(".button-view-stats").live("click",this.loadPageStats);siteGlobal.userInfoCard();siteGlobal.helperInfoCard();a("#service-link-finish-updates,.modalCloseImg").live("click",function(){a.modal.close()})},webServiceCall:function(d){d=a.extend({},d);ajaxQueueName=(typeof d.ajaxQueueName!="undefined")?d.ajaxQueueName:"defaultQueue";ajaxQueueMethod=(typeof d.ajaxQueueMethod!="undefined")?d.ajaxQueueMethod:true;ajaxQueueAbort=(typeof d.ajaxQueueAbort!="undefined")?d.ajaxQueueAbort:true;ajaxQueueCache=(typeof d.ajaxQueueCache!="undefined")?d.ajaxQueueCache:false;ajaxQueuePreventDoubleRequests=(typeof d.ajaxQueuePreventDoubleRequests!="undefined")?d.ajaxQueuePreventDoubleRequests:true;ajaxQueueRequests=(typeof d.ajaxQueueRequests!="undefined")?d.ajaxQueueRequests:3;var b=a.manageAjax.create(ajaxQueueName,{queue:ajaxQueueMethod,abortOld:ajaxQueueAbort,cacheResponse:ajaxQueueCache,maxRequests:ajaxQueueRequests,preventDoubleRequests:ajaxQueuePreventDoubleRequests});ajaxTimeout=(typeof d.timeout!="undefined")?d.timeout:5000;ajaxTryCount=(typeof d.tryCount!="undefined")?d.tryCount:0;ajaxRetryLimit=(typeof d.retryLimit!="undefined")?d.retryLimit:0;var c=b.add({type:d.type,url:d.url,data:d.data,timeout:ajaxTimeout,tryCount:ajaxTryCount,retryLimit:ajaxRetryLimit,dataType:d.dataType,beforeSend:function(){var f=d.loadingLocation;if(d.loading==true){if(d.loadingText==true){a(f).fadeIn("slow").append('<div class="preloader">Loading, please wait...</div>')}else{var e=a(f).width();var g=a(f).height();if(g<43){var g=43}a(f).css("position","relative");a(f).prepend("<div class='preLoader-overlay' style='width:"+e+"px;height:"+g+"px;'></div>")}a(f).ajaxStop(function(){if(d.loadingText==true){a(".preloader").remove()}else{a(".preLoader-overlay").remove()}})}},success:d.success,error:d.error,complete:function(f,h){if(h=="error"&&d.errorLocation!=null){switch(f.status){case 404:a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>The requested service is no longer available</p></div>");if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break;case 403:a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>You are not authorized to access this service</p></div>");if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break;case 500:a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>There was an internal server error</p></div>");if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break;case 204:if(d.errorText==true){var g=d.errorTextContent;a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>"+g+"</p></div>")}else{a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>No content</p></div>")}if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break;default:a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>Server Error</p></div>");if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break}if(d.errorFadeOut==true){var e=d.errorLocation+" .ajax-error";setTimeout(function(){a(e).fadeOut("slow",function(){a(this).remove()})},10000)}a(".preLoader-overlay").remove()}if(h=="error"&&d.errorHightLightLocation!=null){a(d.errorHightLightLocation).addClass("ajax-error-hightlight")}if(h=="success"&&d.successText==true){a(d.successTextLocation).fadeIn("slow").html(d.successTextContent)}if(h=="success"){switch(f.status){case 404:a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>The requested service is no longer available</p></div>");if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break;case 403:a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>You are not authorized to access this service</p></div>");if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break;case 500:a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>There was an internal server error</p></div>");if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break;case 204:if(d.errorText==true){var g=d.errorTextContent;a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>"+g+"</p></div>")}else{a(d.errorLocation).fadeIn("slow").prepend("<div class='ajax-error'><p>No content</p></div>")}if(d.debug==true){console.log("Error Code: "+f.status+" "+f.statusText)}break}}if(h=="timeout"){c.abort();if(d.errorLocation!=null){a(d.errorLocation).fadeIn("slow").html("<p>There was an internal server error</p>")}a(".preLoader-overlay").remove()}}});if(d.debug==true){if(console){console.debug(d)}}return this},expressionWebServiceCall:function(e){var f=e.expAction;var j=e.objectId;var c=e.objectType;var d=e.extraParam;var h=e.extraParamValue;var b=e.extraParamType;var i=e.extraParamTypeValue;var k=e.dataType;var g="/services/gateway/";a(this).webService({url:g,dataType:k,success:e.success,loading:e.loading,loadingLocation:e.loadingLocation,data:"service[module]=Expressions&service[action]="+f+"&service[format]="+k+"&params[objectType]="+c+"&params[objectId]="+j+"&params["+d+"]="+h+"&params["+b+"]="+i})},inputHints:function(b){if(!b){b="blur"}return this.each(function(){var g=a(this),e=g.attr("title"),d=a(this.form),f=a(window);function c(){if(g.val()===e&&g.hasClass(b)){g.val("").removeClass(b)}}if(e){g.blur(function(){if(this.value===""){g.val(e).addClass(b)}}).focus(c).blur();d.submit(c);f.unload(c)}})},sendMeUpdates:function(){a("#service-link-send-updates").live("click",function(b){b.preventDefault();if(document.userToken){a("#all-about-alerts-modal").modal({containerCss:{height:330,width:513}});a("#all-about-alerts-modal li").each(function(d){var g=a(this).attr("id");var c=a(this).find("input").attr("name");var f=a("#"+g);var e=".alertcheckBox ."+g;uri="/services/gateway/allabout/"+c+"/"+g+"/hasAlert.json";a(f).addClass("item_loading");a(this).webService({ajaxQueueName:"getAlerts",ajaxQueueMethod:"clear",ajaxQueueRequests:3,type:"get",url:uri,dataType:"json",data:{"user[token]":document.userToken},success:function(h){var i=".alertcheckBox ."+g;if(h.hasAlert==true){a(f).find("input").attr("checked","checked");a(f).css("background-color","#ffe58b");a(f).find("input").attr("disabled",true);a(f).removeClass("add-alert")}a(f).removeClass("item_loading")},error:function(h,j,i){if(j=="timeout"||j=="error"){this.tryCount++;if(this.tryCount<=this.retryLimit){a.ajax(this);return}a(f).append('<span class="item-error">Error, try again later</span>');a(f).removeClass("item_loading");return}}})})}else{loginModal()}});a("#service-link-finish-updates,.modalCloseImg").live("click",function(){a.modal.close()});a(".add-alert").live("click",function(f){var d=a(this).attr("id");var c=a("#"+d);var b=a(c).find("input").attr("name");a(c).find("input").attr("checked","checked");a(c).attr("background-position","45% center");a(c).css("background-color","#ffe58b");a(c).addClass("item_loading");uri="/services/gateway/allabout/"+b+"/"+d+"/addAlert.json";a(this).webService({ajaxQueueName:"postAlerts",ajaxQueueMethod:true,ajaxQueueRequests:3,type:"post",url:uri,dataType:"json",success:function(e){a(c).removeClass("item_loading");a(c).find("input").attr("disabled",true)},errorHightLightLocation:"."+d})})},matesShowInfo:function(){a(".showMatesInfoInModalBox").remove();a(".simplemodal-data").remove();if(a(this).attr("class")=="post-user-name-modal"){var b=a(this).attr("rel")}else{var b=a(this).attr("id")}var c="/services/gateway?service[module]=User&service[action]=UserDetails&service[format]=html&params[userId]="+b;a("#site-footer").append("<div class='showMatesInfoInModalBox'></div>");a(".showMatesInfoInModalBox").webService({type:"post",url:c,dataType:"html",loading:true,loadingText:true,loadingLocation:".showMatesInfoInModalBox",success:function(f){a(".showMatesInfoInModalBox").html(f)}});a(".showMatesInfoInModalBox").modal({overlayClose:true,containerCss:{height:270,width:315}});var e=a(".matesShowProfile .profile-tools-status h3").html();var d=a(".matesShowProfile .img-cont").html();a(".menu-profile-shout a").live("click",function(){var g=a(this).parents(".matesShowProfile").find("h3").html();var f=a(this).parents(".matesShowProfile").find(".img-cont").html();a(this).parents(".matesShowProfile").find(".content").fadeIn("slow").html("<div class='shout-mate profile-tools-status'><a class='shout-profile-link clearfix' href='"+document.siteURL+"/people/"+g+"'><div class='img-cont'>"+f+"</div><span class=shout-text>shout at:</span><h3>"+g+"</h3></a><div class=shoutback-textarea><textarea id=shoutBox_CommentArea></textarea><div class=shoutback-postshout><div class='profile-tools-links'><ul><li class=''><a href='#' class='lightBox-postshout'>Post Shout</a></li></ul></div></div></div>");return false});a(".lightBox-postshout").live("click",function(){var f=a("#shoutBox_CommentArea").attr("value");f=encodeURIComponent(f);var g="/services/gateway/?service[module]=Expressions&service[action]=AddTag&service[format]=JSON&params[userId]="+document.jsItemID+"&params[objectType]=User&params[objectId]="+b+"&params[tagValue]="+f+"&params[tagType]=shoutBox&user[token]="+document.userToken;a(this).webService({url:g,dataType:"json",success:function(h){a(".lightBox-postshout").fadeIn("slow").html("Sent");setTimeout("jQuery.modal.close()",500)}});return false});return false},matesAddShowInfo:function(){if(a(this).attr("class")=="service-action-link add-as-a-mate"||a(this).attr("class")=="button add-as-a-mate"){var c=a("#profileImage").attr("title")}else{var c=a(this).parents(".content").find("h3").html()}var b="/services/gateway/buddies/add/"+c+"?user[token]="+document.userToken;a(this).webService({type:"post",url:b,dataType:"html",successText:true,successTextLocation:this,successTextContent:"Added"});return false},matesRemoveShowInfo:function(){if(a(this).attr("class")=="service-action-link remove-as-a-mate"||a(this).attr("class")=="button remove-as-a-mate"){var c=a("#profileImage").attr("title")}else{var c=a(this).parents(".content").find("h3").html()}var b="/services/gateway/buddies/remove/"+c+"?user[token]="+document.userToken;a(this).webService({type:"post",url:b,dataType:"html",successText:true,successTextLocation:this,successTextContent:"Removed"});return false},userInfoCard:function(g){var f=100;var c=null;var h=15;function d(){a(".infocard-user").remove();if(c){clearTimeout(c)}if(a(this).attr("rel")!=""){var i=a(this).attr("rel")}else{var i=a(this).attr("id")}var k="/services/user/card/"+i+".html";var l=a(this).offset();var j=a(this).width();var e=a(this).height();a("#site-footer").append("<div class='infocard infocard-user'></div>");a(".infocard-user").webService({type:"get",url:k,dataType:"html",loading:true,loadingText:true,loadingLocation:".infocard-user",success:function(n){a(".infocard-user").html(n);var o=a(".infocard-user").height();var m=a(".infocard-user").width();a(".infocard-user").css({left:(l.left-(((m-j)/2)-10))+"px",top:l.top-(o+h)+"px","z-index":100});a(".infocard-user").css("display","block")}})}function b(){if(c){clearTimeout(c)}c=setTimeout(function(){a(".infocard-user").css("display","none")},f)}a(".infocard-user-trigger").live("mouseover",function(){a(this).find("img").attr("title","");if(!a(this).data("init")){a(this).data("init",true);a(this).hoverIntent({over:d,interval:40,out:b});a(this).trigger("mouseover")}});a(".infocard-user").live("mouseover",function(){if(c){clearTimeout(c)}});a(".infocard-user").live("mouseout",function(){if(c){clearTimeout(c)}c=setTimeout(function(){a(".infocard-user").css("display","none")},f)});a(".infocard-user-trigger").live("click",function(i){i.preventDefault()})},helperInfoCard:function(g){var f=100;var c=null;var h=15;function d(j){a("#site-footer").find(".infocard-helper").remove();if(a(j).hasClass("infocard-helper-trigger")){var l=j}else{var l=this}if(c){clearTimeout(c)}var p=a(l).attr("message");var m=a(l).offset();var e=a(l).width();var n=a(l).height();if(typeof p!="undefined"){a("#site-footer").append('<div class="infocard infocard-helper"></div>');a(".infocard-helper").html(p);var o=a(".infocard-helper").height();var k=a(".infocard-helper").width();a(".infocard-helper").css({left:(m.left-(((k-e)/2)- -15))+"px",top:m.top-(o+h)+"px","z-index":100});var i=a(j).attr("id");if(i!=""){if(isHelperActiveForName(i)){a(".infocard-helper").css("display","block");updateHelper(i)}else{a(l).removeClass("infocard-trigger infocard-helper-trigger");a(l).removeAttr("message")}}}}function b(){if(c){clearTimeout(c)}c=setTimeout(function(){a(".infocard-helper").css("display","none")},f)}a(".infocard-helper-trigger").live("click",function(i){i.preventDefault()});a(".infocard-helper").live("mouseover",function(){a(".infocard-helper").css("display","none")});if(a(".infocard-helper-trigger").length){a(".infocard-helper-trigger").appear(function(){d(this);if(c){clearTimeout(c)}c=setTimeout(function(){a(".infocard-helper").css("display","none")},4000)})}},addMeRollService:function(){var b=a(this).parents(".mates-going").attr("id");var d="#"+b;var c="/services/gateway/?service[module]=Expressions&service[action]=AddTag&service[format]=JSON&params[tagValue]=&params[tagType]=calendar&params[objectType]=WhatsOn&params[objectId]="+b+"&user[token]="+document.userToken;a(this).webService({type:"post",url:c,dataType:"html",success:function(g){var f=d+" .mates-going-addme";var e=d+" .mates-going-count";a(f).remove();a(e).prepend("You and ")}});return false},myStuffProfileBoxToggle:function(){a("#block_My_FasterLouder .content").slideToggle("slow");a("#mystuff-toggle").toggleClass("opened");return false},deleteSelect:function(){a(".message-delete").click()},shoutAtMates:function(c){a(".shout-at-profilepic").live("click",function(){var g=a(this).attr("src");var e=a(this).attr("id");var f=a(this).attr("alt");var d=encodeURIComponent(f);a("#breakout-shout-at-a-mate .content").fadeIn("slow").html("<div class=shout-mate><a class='shout-profile-link clearfix mates-show-info' href='#' id="+e+"><img class=shout-image src="+g+"><span class=shout-text>shout at:</span><h3 id="+e+">"+f+"</h3></a><div class=shoutback-textarea><textarea id=shoutBox_CommentArea></textarea><div class=shoutback-postshout><button class=button-postshout>Post Shout</button></div></div>");return false});a(".button-postshout").live("click",function(){var g=getItem("shoutBox_CommentArea").value;var d=a(".shout-profile-link h3").attr("id");g=encodeURIComponent(g);var f="/services/gateway/?service[module]=Expressions&service[action]=AddTag&service[format]=JSON&params[userId]="+document.loggedinUserId+"&params[objectType]=User&params[objectId]="+d+"&params[tagValue]="+g+"&params[tagType]=shoutBox&user[token]="+document.userToken;a(this).webService({type:"POST",url:f,dataType:"html",success:function(h){}});var e="/services/gateway/?service[module]=User&service[action]=getUserBuddies&service[format]=html&service[templateName]=ShoutAtMate&params[userId]="+document.loggedinUserId+"&params[isMe]=true&params[page]=1&params[offset]=7&user[token]="+document.userToken;a(this).webService({type:"POST",url:e,dataType:"html",success:function(h){a("#breakout-shout-at-a-mate .content").html(h)},loading:true,loadingLocation:"#breakout-shout-at-a-mate .content"});return false});a(".listing-button-reply").live("click",function(){if(a(this).hasClass("opened")){}else{var d=a(this).parent().parent().find(".shouter").html();a(this).addClass("opened");a(this).css("padding-bottom","9px");a(this).parent().parent().append("<div class='reply-box'><span>@ "+d+":<input type='text' class='reply-textfield'><button class='listing-button-shout'>Send</button></span></div>")}return false});a(".listing-button-shout").live("click",function(){var d=a(this).parents(".item-shouts").find("h3").attr("class");var f=a(this).parent().children(".reply-textfield").val();f=encodeURIComponent(f);d=d.match(/[0-9]+/);var e="/services/gateway/?service[module]=Expressions&service[action]=AddTag&service[format]=JSON&params[userId]="+document.loggedinUserId+"&params[objectType]=User&params[objectId]="+d+"&params[tagValue]="+f+"&params[tagType]=shoutBox&user[token]="+document.userToken;a(this).webService({type:"POST",url:e,dataType:"html",success:function(g){}});a(this).parent().fadeOut("slow");a(".listing-button-reply").css("padding-bottom","0px");setTimeout(function(){a(".reply-box").remove()},1500);return false});if(a(".matesincommon").length){userId=a(".matesincommon").attr("id");var b="/services/gateway/?service[module]=User&service[action]=GetMatesInCommon&service[format]=html&params[userId]="+userId+"&params[page]=1&user[token]="+document.userToken;a(this).webService({type:"POST",url:b,dataType:"html",success:function(d){if(d=="No mates in common."){a(".matesincommon").html("<div class='no-content'>No mates in common yet</div>")}else{a(".matesincommon").html(d)}},loading:true,loadingLocation:".matesincommon"})}},quickTools:function(b){a(this).parents().find(".quickTool .section-content").slideToggle(150);if(a(this).parent().hasClass("open")){a(this).parent().removeClass("open");a(this).parent().addClass("closed");a(this).attr("title","Click to open area");a(this).parent().addClass("closed");a(this).parent().find(".section-hint").html("+")}else{a(this).parent().removeClass("closed");a(this).parent().addClass("open");a(this).attr("title","Click to close area");a(this).parent().find(".section-hint").html("-")}return false},loadPageStats:function(f){f.preventDefault();a.modal.close();window.setTimeout(c,500);var b=a(this).attr("id");if(document.jsItemID!=""){var d=document.jsItemID}else{var d=a(this).attr("value")}a("#statsArea").html("Loading stats data...");a("#statsArea").load("/services/graph/"+b+"/"+d);function c(){a("#statsArea").modal({autoResize:true,containerCss:{height:400,width:545},overlayClose:true})}},interStitialInit:function(d){var c=d.config.bg;var b=d.config.top+"px";a("#interstitial-cont").css({"background-color":c}).scrollTop(0).show();a("body").css("width","100%");a("#site").css("width","100%");a("#ad-close strong").click(this.interStitialClose);if(d.config.adTimer){adTimer=d.config.adTimer;this.interStitialTimer()}},interStitialTimer:function(){if(adTimer==0){this.interStitialClose()}else{if(a.isReady){}a("#ad-timer").html('this ad will close in&nbsp;<em style="color:#7d7d7d;font-size:14px;font-weight:bold">'+adTimer+"</em>&nbsp;seconds");adTimer--;adCountDown=setTimeout("flGlobal.interStitialTimer()",1250)}},interStitialClose:function(b){a("body").css("width","990px");a("#site").css("width","990px");clearTimeout(adCountDown);a("#video-player").css("visibility","visible");a("#interstitial-cont").hide();a("#interstitial-ad").hide()}}}();jQuery(document).ready(function(){siteGlobal.init()});
