Share={type:null,typeId:null,redMessage:false,titleText:false,overlay:true,token:false,busy:false,onClose:null,messageLimit:140,validMessageLength:true,image:null,caption:null,defaultMessage:null,pollingInterval:2,pollingTimeout:30,isAuthenticated:{facebook:false,twitter:false,myspace:false},isActive:{facebook:true,twitter:true,myspace:true,myyearbook:true},getAjaxUrl:function(){return SITE_URL+'apps/share/'},showOverlay:function(destination,start,e){if(Share.token===false){return}if(typeof start=='undefined'){var start=''}if(typeof e!='undefined'){var form=$(e.target).siblings('form');if(form.length===1){Share.overlay=true;Share.type=form.find('[name=type]').val();Share.typeId=form.find('[name=typeId]').val();Share.redMessage=form.find('[name=redMessage]').val();Share.titleText=form.find('[name=title]').val();Share.image=form.find('[name=image]').val();Share.caption=form.find('[name=caption]').val();Share.defaultMessage=form.find('[name=default]').val()}}if(Share.overlay==true){var action='overlay'}else{var action='inline'}if(typeof destination=='string'){$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action='+action+'&destination='+destination+'&start='+start+'&type='+Share.type+(Share.type=='sticker'?'&noMessage=1':'')})}},overlayCallback:function(result){if(typeof result.markup=='string'){$('div.shareContentOverlay').remove();if(Share.overlay==true){shareContentOverlay=$('<div class="shareContentOverlay" />')}else{shareContentOverlay=$('<div class="shareContentInline" />')}shareContentOverlay.html(result.markup);if(typeof result.type!='undefined'){shareContentOverlay.find('table.shareOverlay').addClass(result.type)}if(Share.redMessage){shareContentOverlay.find('div.redMessage').text(Share.redMessage)}if(Share.titleText){shareContentOverlay.find('div.titleText').text(Share.titleText)}if(Share.image){shareContentOverlay.find('img.previewPhoto').attr('src',Share.image);shareContentOverlay.find('input[name=image]').val(Share.image)}if(Share.caption){shareContentOverlay.find('#previewText').text(Share.caption)}if(Share.defaultMessage){shareContentOverlay.find('textarea').val(Share.defaultMessage)}if(Share.type){shareContentOverlay.find('input[name=type]').val(Share.type)}if(Share.typeId){shareContentOverlay.find('input[name=typeId]').val(Share.typeId)}if(Share.overlay===true){shareContentOverlay.css({'z-index':9999}).appendTo('body').centerOnScreen();if(typeof result.type!='undefined'&&result.type=='battle'){shareContentOverlay.css({'margin-left':'-100px'});$('select').addClass('hidden').css('visibility','hidden')}else if(typeof SERVICE_NAME!='undefined'&&SERVICE_NAME=='chatter'){shareContentOverlay.css({'margin-left':'-100px'});$('select').addClass('hidden').css('visibility','hidden')}else{$('iframe:visible, select').addClass('hidden').css('visibility','hidden')}}else{Share.overlay.html(shareContentOverlay);shareContentOverlay.find("img.close").hide()}if(typeof result.type!='undefined'){shareContentOverlay.find('table.shareOverlay').addClass(result.type);if(result.type=='battle'){$('form.sharePopupVoteForm label').click(function(){var form=$(this).parent();var battler=form.find('input:checked').val();var firstName=form.find('input.'+battler+'UserName').val();var image=form.find('input.'+battler+'Image').val();var previewDiv=$(this).parent().parent();previewDiv.find('span.shareFirstName').html(firstName);$('#shareContentPopupPreview img.previewPhoto').attr('src',image);$('#shareContentPopupPreview form.shareData input[name=battler]').val(battler)})}else if(result.type=='connect'){Share.bindConnectEvents()}}shareMessageNode=shareContentOverlay.find('textarea.messageInput');shareMessageNode.keydown(function(){return Share.limitMessageLength()});shareMessageNode.keyup(function(){Share.displayMessageLength()}).trigger('keyup');shareMessageNode.mouseup(function(){Share.displayMessageLength()});$('table.shareOverlay img.close').click(function(){var service=$('table.shareOverlay').attr('data-service');if(Share.onClose){Share.onClose()}$('div.shareContentOverlay').remove();$('iframe.hidden, select.hidden').removeClass('hidden').css('visibility','visible');if(service=='feed'&&$('div.shareContent').length>0){Share.displayConnect('feed',$('div.shareContent'),$(this).parents('table.shareOverlay').attr('data-display-type'))}});$('table.shareOverlay #stickerDontShow').click(function(){$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=optout&type=sticker'});$('div.shareContentOverlay').remove();$('iframe.hidden, select.hidden').removeClass('hidden').css('visibility','visible');if(Share.onClose){Share.onClose()}return false});this.bindEvents(['share']);if(typeof result.authenticated!='undefined'){for(var destination in result.authenticated){if(result.authenticated[destination]=='maintenance'){this.enableMaintenance(destination)}else{Share.isAuthenticated[destination]=result.authenticated[destination]}}}if(typeof result.start!='undefined'){if(typeof result.authenticated!='undefined'&&result.authenticated[result.start]==true){switch(result.start){case'facebook':ShareFacebook.share();break;case'twitter':ShareTwitter.share();break;case'myspace':ShareMyspace.share();break}}}}},bindConnectEvents:function(){$('#shareConnectArea img.notconnected').unbind('click').bind('click',function(){if($(this).attr('data-destination')=='facebook'){var image='btn_connecting_fb.gif';ShareFacebook.timeoutCount=0;ShareFacebook.pollConnection($('table.shareOverlay').attr('data-service'))}else if($(this).attr('data-destination')=='twitter'){var image='btn_connecting_tw.gif';ShareTwitter.timeoutCount=0;ShareTwitter.pollConnection($('table.shareOverlay').attr('data-service'))}else if($(this).attr('data-destination')=='myspace'){var image='btn_connecting_ms.gif';ShareMyspace.timeoutCount=0;ShareMyspace.pollConnection($('table.shareOverlay').attr('data-service'))}else{return false}$(this).attr('src',IMAGE_URL+'/share/'+image)});$('#shareConnectArea img.disabled').unbind('click').bind('click',function(){if($(this).attr('data-destination')=='facebook'){var image='btn_connected_fb.png'}else if($(this).attr('data-destination')=='twitter'){var image='btn_connected_tw.png'}else if($(this).attr('data-destination')=='myspace'){var image='btn_connected_ms.png'}else{return false}$(this).attr('src',IMAGE_URL+'/share/'+image).removeClass('disabled').addClass('enabled');Share.bindConnectEvents();$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=enablesharing&destination='+$(this).attr('data-destination')+'&service='+$(this).parents('table.shareOverlay ').attr('data-service')})});$('#shareConnectArea img.enabled').unbind('click').bind('click',function(){if($(this).attr('data-destination')=='facebook'){var image='btn_disabled_fb.png'}else if($(this).attr('data-destination')=='twitter'){var image='btn_disabled_tw.png'}else if($(this).attr('data-destination')=='myspace'){var image='btn_disabled_ms.png'}else{return false}$(this).attr('src',IMAGE_URL+'/share/'+image).removeClass('enabled').addClass('disabled');Share.bindConnectEvents();$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=disablesharing&destination='+$(this).attr('data-destination')+'&service='+$(this).parents('table.shareOverlay ').attr('data-service')})})},limitMessageLength:function(){var msgLength=shareMessageNode.val().length+shareContentOverlay.find('#previewText').text().length+shareContentOverlay.find('#previewLink').text().length;var availableLength=this.messageLimit-msgLength;if(availableLength<0){}return true},disallowClick:function(selector,cursor){$(selector).unbind('click').click(function(e){e.preventDefault();e.stopPropagation()}).css('cursor',(typeof cursor=='string'?cursor:'default'))},displayMessageLength:function(){var msgLength=shareMessageNode.val().length+shareContentOverlay.find('#previewText').text().length+shareContentOverlay.find('#previewLink').text().length;var availableLength=this.messageLimit-msgLength;if(availableLength<0){if(this.validMessageLength===true){this.validMessageLength=false;if(ShareFacebook.isComplete===false){Share.disallowClick('a.shareContentFacebook','not-allowed')}if(ShareTwitter.isComplete===false){Share.disallowClick('a.shareContentTwitter','not-allowed')}if(ShareMyspace.isComplete===false){Share.disallowClick('a.shareContentMyspace','not-allowed')}}var customLength=this.messageLimit-$('table.shareOverlay div.previewText').text().length;}else{if(this.validMessageLength===false){this.validMessageLength=true;if(ShareFacebook.isComplete===false){this.bindEvents(['shareFacebook']);$('a.shareContentFacebook').css('cursor','pointer')}if(ShareTwitter.isComplete===false){this.bindEvents(['shareTwitter']);$('a.shareContentTwitter').css('cursor','pointer')}if(ShareMyspace.isComplete===false){this.bindEvents(['shareMyspace']);$('a.shareContentMyspace').css('cursor','pointer')}}}var countNode=$('.shareOverlay .messageCount');if(countNode.length>0){countNode.text(availableLength);if(availableLength<10){countNode.css('color','#f00')}else if(availableLength<20){countNode.css('color','#600')}else{countNode.css('color','#ccc')}}},updateIsAuthenticated:function(result){if(typeof result.maintenance!='undefined'){this.enableMaintenance(result.destination)}if(result.authenticated&&result.destination){Share.isAuthenticated[result.destination]=result.authenticated}},enableMaintenance:function(destination){if(destination=='facebook'){$(document).ready(function(){$('img.shareContentFacebook').attr('src',IMAGE_URL+'/share/btn_maint_fb.png');Share.disallowClick('a.shareContentFacebook')})}else if(destination=='twitter'){$(document).ready(function(){$('img.shareContentTwitter').attr('src',IMAGE_URL+'/share/btn_maint_twitter.png');Share.disallowClick('a.shareContentTwitter')})}else if(destination=='myspace'){$(document).ready(function(){$('img.shareContentMyspace').attr('src',IMAGE_URL+'/share/btn_maint_ms.png');Share.disallowClick('a.shareContentMyspace')})}else if(destination=='myyearbook'){$(document).ready(function(){$('img.shareContentMyyearbook, img.shareContentMYBDummy').attr('src',IMAGE_URL+'/share/btn_maint_myb.png').unbind('click').click(function(e){e.preventDefault();e.stopPropagation()}).css('cursor','default')})}else{return}Share.isActive[destination]=false},recordTimeout:function(type,destination){$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=timeout&destination='+destination+'&type='+type})},showFacebook:function(e){Share.showOverlay('facebook',false,e)},showTwitter:function(e){Share.showOverlay('twitter',false,e)},showMySpace:function(e){Share.showOverlay('myspace',false,e)},shareFacebook:function(e){if(Share.isAuthenticated.facebook){e.preventDefault();e.stopPropagation()}ShareFacebook.share()},shareTwitter:function(e){if(Share.isAuthenticated.twitter){e.preventDefault();e.stopPropagation()}ShareTwitter.share()},shareMySpace:function(e){if(Share.isAuthenticated.myspace){e.preventDefault();e.stopPropagation()}ShareMyspace.share()},bindEvents:function(types){for(var i=0;i<types.length;i++){if(types[i]=='popup'||types[i]=='popupFacebook'){$('img.sharePopup.facebook').unbind('click').click(Share.showFacebook)}if(types[i]=='popup'||types[i]=='popupTwitter'){$('img.sharePopup.twitter').unbind('click').click(Share.showTwitter)}if(types[i]=='popup'||types[i]=='popupMyspace'){$('img.sharePopup.myspace').unbind('click').click(Share.showMySpace)}if(types[i]=='share'||types[i]=='shareFacebook'){$('a.shareContentFacebook').unbind('click').bind('click',Share.shareFacebook)}if(types[i]=='share'||types[i]=='shareTwitter'){$('a.shareContentTwitter').unbind('click').bind('click',Share.shareTwitter)}if(types[i]=='share'||types[i]=='shareMyspace'){$('a.shareContentMyspace').unbind('click').bind('click',Share.shareMySpace)}if(types[i]=='share'||types[i]=='shareMyyearbook'){$('img.shareContentMyyearbook').unbind('click').bind('click',function(e){ShareMyyearbook.share()})}if(types[i]=='manageSharing'){$('div.shareContent img.connectPopup, div.shareContent a.manageSharing').unbind('click').click(function(){Share.getConnectPopup(false,$(this));return false});$('div.shareContent div.shareDisconnected a.closeMessage').click(function(){$(this).parent().remove();$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=hidedisconnectedmessage'});return false});$('div.shareContent div.shareIncentive a.closeMessage').click(function(){$(this).parent().remove();$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=hideincentivemessage'});return false});$('div.shareContent div.shareDisconnected a.connectPopup, div.shareContent div.shareIncentive a.connectPopup').click(function(){Share.getConnectPopup(false,$(this));return false})}}},loggedOutCallback:function(result){if(typeof result.redirect!='undefined'){window.location.href=result.redirect}},maintenanceCallback:function(result){$.dragonAlert(result.errorMessage)},getConnectPopup:function(showOptOut,callingObject){if(typeof showOptOut=='undefined'){showOptOut=false}var displayType='chatter';if(typeof callingObject==='object'){if(typeof callingObject.data('displayType')==='string'){displayType=callingObject.data('displayType')}}shareContentOverlay=$('<div class="shareContentOverlay" />');shareContentOverlay.html('<table cellspacing="0" cellpadding="0" class="shareOverlay"><tr><td class="topTranslucent" colspan="3"></td></tr><tr><td class="sideTranslucent"></td><td><div class="centerArea"><img src="'+IMAGE_URL+'/updateicons/notifications_x.gif" class="close" alt="Close"/><div style="text-align:center;height:400px;background:transparent url('+IMAGE_URL+'/images/loading/ffffff-transparent-circle_ball.gif) no-repeat scroll center center;"> </div></div></td><td class="sideTranslucent"></td></tr><tr><td class="topTranslucent" colspan="3"></td></tr></table>');shareContentOverlay.css({'z-index':9999}).appendTo('body').centerOnScreen();if(typeof SERVICE_NAME!='undefined'&&SERVICE_NAME=='chatter'){shareContentOverlay.css({'margin-left':'-100px'});$('select').addClass('hidden').css('visibility','hidden')}$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=connectpopup&type=connect&optout='+showOptOut+'&displayType='+displayType})},displayConnect:function(service,element,displayType){Share.connectDisplayElement=element;Share.connectDisplayType=displayType;$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=connectoptions&service='+service})},displayConnectCallback:function(result){if(result.success==true){$('body').trigger('shareDisplay.update',result);if(typeof Share.connectDisplayElement=='object'){Share.updateShareDisplay(Share.connectDisplayElement,result);Share.bindEvents(['manageSharing'])}}},updateShareDisplay:function(obj,result){var allowIncentiveAndConnect=true;var allowClose=true;var displayOptions={};if(typeof obj.data('displayOptions')!=='undefined'){displayOptions=obj.data('displayOptions')}if(displayOptions.allowIncentiveAndConnect===false){allowIncentiveAndConnect=false}if(displayOptions.allowClose===false){allowClose=false}var html='<div class="fLeft shareText">';var notSharing=true;if(allowIncentiveAndConnect===true||(result.disconnected==false&&result.incentive==false)){if((result.facebook||result.twitter||result.myspace)&&!result.privacy){html+='Sharing on: '+(result.facebook?'<img class="connectPopup facebook" alt="" src="'+IMAGE_URL+'/share/fb_mini.gif" />':'')+(result.twitter?'<img class="connectPopup twitter" alt="" src="'+IMAGE_URL+'/share/twitter_mini.gif" />':'')+(result.myspace?'<img class="connectPopup myspace" alt="" src="'+IMAGE_URL+'/share/ms_mini.gif" />':'')+'<span class="gray"> (</span><a href="#" class="manageSharing normaltextlink">Manage</a><span class="gray">)</span>';var notSharing=false}else{html+='Connect: '+'<img class="connectPopup facebook" alt="" src="'+IMAGE_URL+'/share/fb_mini.gif" />'+'<img class="connectPopup twitter" alt="" src="'+IMAGE_URL+'/share/twitter_mini.gif">'+'<img class="connectPopup myspace" alt="" src="'+IMAGE_URL+'/share/ms_mini.gif">'}}html+='</div>';if(result.disconnected&&$('#HALFeed.HALObject_narrow').length<1){html+='<div class="fRight shareDisconnected">';if(allowClose){html+='<a href="#" class="fRight closeMessage">X</a><strong>'}html+='Sharing disabled. <a href="#" class="connectPopup">Reconnect</a>.</strong></div>'}else if(result.incentive&&$('#HALFeed.HALObject_narrow').length<1){html+='<div class="fLeft shareIncentive">';if(allowClose){html+='<a href="#" class="fRight closeMessage">X</a>'}if((typeof Share.connectDisplayType=='string'&&Share.connectDisplayType=='askMe')||$('div.HALThreeColumn').length>0){var incentiveText='Connect to Facebook, MySpace, or Twitter.'}else{var incentiveText='Connect Now! Update Everywhere!'}html+='<strong><a href="#" class="connectPopup normaltextlinkbold">'+incentiveText+'</a></strong></div>'}html+='<div class="clear"></div>';if(!notSharing||$('.AskMe_Interstitial_SharingBox').length<1){obj.html(html)}if(notSharing){if(typeof Share.connectDisplayType=='string'&&Share.connectDisplayType=='askMe'){var incentiveText='Connect to Facebook, MySpace, or Twitter.'}else{var incentiveText='Connect Now! Update Everywhere!'}var content='<div class="fLeft shareIncentive"><strong><a href="#" class="connectPopup normaltextlinkbold">'+incentiveText+'</a></strong></div>'}else{var content='<div class="fLeft shareText">Sharing on: '+(result.facebook?'<img class="connectPopup facebook" alt="" src="'+IMAGE_URL+'/share/fb_mini.gif" />':'')+(result.twitter?'<img class="connectPopup twitter" alt="" src="'+IMAGE_URL+'/share/twitter_mini.gif" />':'')+(result.myspace?'<img class="connectPopup myspace" alt="" src="'+IMAGE_URL+'/share/ms_mini.gif" />':'')+'<span class="gray"> (</span><a href="#" class="manageSharing normaltextlink">Manage</a><span class="gray">)</span></div>'}$('#answerThisPopup').find('div.shareContent').html(content);if(typeof Share.connectDisplayType=='string'){$('div.shareContent div.shareDisconnected a.connectPopup, div.shareContent div.shareIncentive a.connectPopup, div.shareContent img.connectPopup, div.shareContent a.manageSharing').each(function(){$(this).data('displayType',Share.connectDisplayType)})}},checkConnectionAuthentication:function(destination,service){$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=checkconnection&destination='+destination+'&service='+service})},checkConnectionCallback:function(result){if(result.authenticated===true){if(result.destination=='facebook'){if(typeof facebookTimeout!='undefined'){clearTimeout(facebookTimeout);delete facebookTimeout}$('#shareConnectArea table.facebook img.notconnected').attr('src',IMAGE_URL+'/share/btn_connected_fb.png').removeClass('notconnected').addClass('enabled').parent().attr({href:'#',onclick:'return false;'})}else if(result.destination=='twitter'){if(typeof twitterTimeout!='undefined'){clearTimeout(twitterTimeout);delete twitterTimeout}$('#shareConnectArea table.twitter img.notconnected').attr('src',IMAGE_URL+'/share/btn_connected_tw.png').removeClass('notconnected').addClass('enabled').parent().attr({href:'#',onclick:'return false;'})}else if(result.destination=='myspace'){if(typeof myspaceTimeout!='undefined'){clearTimeout(myspaceTimeout);delete myspaceTimeout}$('#shareConnectArea table.myspace img.notconnected').attr('src',IMAGE_URL+'/share/btn_connected_ms.png').removeClass('notconnected').addClass('enabled').parent().attr({href:'#',onclick:'return false;'})}Share.bindConnectEvents();$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=enablesharing&service='+result.service+'&destination='+result.destination})}else{if(result.destination=='facebook'){ShareFacebook.pollConnection($('table.shareOverlay ').attr('data-service'))}else if(result.destination=='twitter'){ShareTwitter.pollConnection($('table.shareOverlay ').attr('data-service'))}else if(result.destination=='myspace'){ShareMyspace.pollConnection($('table.shareOverlay ').attr('data-service'))}}},enableSharingCallback:function(result){if(result.success!==true){return false}if(result.reward==true){var lmDiv=$('table.'+result.destination+' div.earn');if(lmDiv.length>0){lmDiv.html(result.rewardText).css('color','#f00')}}}};ShareFacebook={timeoutCount:0,isComplete:false,share:function(){if(Share.busy===true){return false}this.timeoutCount=0;Share.busy=true;$('img.shareContentFacebook').attr('src',IMAGE_URL+'/share/btn_fb_sharing.gif');var formData=$('form.shareData').serialize();$.ajax({url:Share.getAjaxUrl()+'facebook',type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=share&'+formData})},shareCallback:function(result){Share.busy=false;if(result.success!==true){$('img.shareContentFacebook').attr('src',IMAGE_URL+'/share/btn_share_fb.png');alert('An error occurred while trying to share this content');return}$('div.shareError').remove();if(typeof result.error!='undefined'){if(typeof result.stop=='undefined'){$('div.shareFacebook, div.shareWithFriends td.middleArea').append('<div class="shareError">An error occurred while connecting with Facebook.</div>')}$('img.shareContentFacebook').attr('src',IMAGE_URL+'/share/btn_share_fb.png');if(typeof facebookTimeout!='undefined'){clearTimeout(facebookTimeout);delete facebookTimeout}return}if(typeof result.maintenance!='undefined'){Share.enableMaintenance('facebook');return}if(result.authenticated===true){if(typeof facebookTimeout!='undefined'){clearTimeout(facebookTimeout);delete facebookTimeout}$('img.shareContentFacebook').attr('src',IMAGE_URL+'/share/btn_share_fb_complete.png');$('a.shareContentFacebook').unbind('click').click(function(e){e.preventDefault();e.stopPropagation()}).css('cursor','default');this.isComplete=true}else{if(ShareFacebook.timeoutCount++>(Share.pollingTimeout/Share.pollingInterval)){$('img.shareContentFacebook').attr('src',IMAGE_URL+'/share/btn_share_fb.png');Share.recordTimeout(result.type,'facebook')}else{facebookTimeout=setTimeout('ShareFacebook.share();',(Share.pollingInterval*1000))}}},pollConnection:function(service){if(typeof service=='undefined'){return false}if(ShareFacebook.timeoutCount++>(Share.pollingTimeout/Share.pollingInterval)){$('#shareConnectArea table.facebook img.notconnected').attr('src',IMAGE_URL+'/share/btn_connect_fb.png')}else{facebookTimeout=setTimeout('Share.checkConnectionAuthentication( "facebook", "'+service+'" );',(Share.pollingInterval*1000))}}};ShareTwitter={timeoutCount:0,isComplete:false,share:function(){if(Share.busy===true){return false}this.timeoutCount=0;Share.busy=true;$('img.shareContentTwitter').attr('src',IMAGE_URL+'/share/btn_tweeting.gif');var formData=$('form.shareData').serialize();$.ajax({url:Share.getAjaxUrl()+'twitter',type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=share&'+formData})},shareCallback:function(result){Share.busy=false;if(result.success!==true){$('img.shareContentTwitter').attr('src',IMAGE_URL+'/share/btn_share_twitter.png');alert('An error occurred while trying to share this content');return}$('div.shareError').remove();if(typeof result.error!='undefined'){if(typeof result.stop=='undefined'){$('div.shareTwitter, div.shareWithFriends td.middleArea').append('<div class="shareError">An error occurred while connecting with Twitter.</div>')}$('img.shareContentTwitter').attr('src',IMAGE_URL+'/share/btn_share_twitter.png');if(typeof twitterTimeout!='undefined'){clearTimeout(twitterTimeout);delete twitterTimeout}return}if(typeof result.maintenance!='undefined'){Share.enableMaintenance('twitter');return}if(result.authenticated===true){if(typeof twitterTimeout!='undefined'){clearTimeout(twitterTimeout);delete twitterTimeout}$('img.shareContentTwitter').attr('src',IMAGE_URL+'/share/btn_share_twitter_complete.png');$('a.shareContentTwitter').unbind('click').click(function(e){e.preventDefault();e.stopPropagation()}).css('cursor','default');this.isComplete=true;if(typeof ShareTwitter.completionHook=='function'){ShareTwitter.completionHook(result)}}else{if(ShareTwitter.timeoutCount++>(Share.pollingTimeout/Share.pollingInterval)){$('img.shareContentTwitter').attr('src',IMAGE_URL+'/share/btn_share_twitter.png');Share.recordTimeout(result.type,'twitter')}else{twitterTimeout=setTimeout('ShareTwitter.share();',(Share.pollingInterval*1000))}}},pollConnection:function(service){if(typeof service=='undefined'){return false}if(ShareTwitter.timeoutCount++>(Share.pollingTimeout/Share.pollingInterval)){$('#shareConnectArea table.twitter img.notconnected').attr('src',IMAGE_URL+'/share/btn_connect_tw.png')}else{twitterTimeout=setTimeout('Share.checkConnectionAuthentication( "twitter", "'+service+'" );',(Share.pollingInterval*1000))}}};ShareMyspace={timeoutCount:0,isComplete:false,share:function(){if(Share.busy===true){return false}this.timeoutCount=0;Share.busy=true;$('img.shareContentMyspace').attr('src',IMAGE_URL+'/share/btn_ms_sharing.gif');var formData=$('form.shareData').serialize();$.ajax({url:Share.getAjaxUrl()+'myspace',type:'GET',dataType:'jsonp',data:'token='+Share.token+'&action=share&'+formData})},shareCallback:function(result){Share.busy=false;if(result.success!==true){$('img.shareContentMyspace').attr('src',IMAGE_URL+'/share/btn_share_ms'+(Share.isAuthenticated.myspace===true?'':'_0')+'.png');alert('An error occurred while trying to share this content');return}$('div.shareError').remove();if(typeof result.error!='undefined'){if(typeof result.stop=='undefined'){$('div.shareMySpace, div.shareWithFriends td.middleArea').append('<div class="shareError">An error occurred while connecting with MySpace.</div>')}$('img.shareContentMyspace').attr('src',IMAGE_URL+'/share/btn_share_ms'+(Share.isAuthenticated.myspace===true?'':'_0')+'.png');if(typeof myspaceTimeout!='undefined'){clearTimeout(myspaceTimeout);delete myspaceTimeout}return}if(typeof result.maintenance!='undefined'){Share.enableMaintenance('myspace');return}if(result.authenticated===true){if(typeof myspaceTimeout!='undefined'){clearTimeout(myspaceTimeout);delete myspaceTimeout}$('img.shareContentMyspace').attr('src',IMAGE_URL+'/share/btn_share_ms_complete.png');$('a.shareContentMyspace').unbind('click').click(function(e){e.preventDefault();e.stopPropagation()}).css('cursor','default');this.isComplete=true}else{if(ShareMyspace.timeoutCount++>(Share.pollingTimeout/Share.pollingInterval)){$('img.shareContentMyspace').attr('src',IMAGE_URL+'/share/btn_share_ms_id.png');Share.recordTimeout(result.type,'myspace')}else{myspaceTimeout=setTimeout('ShareMyspace.share();',(Share.pollingInterval*1000))}}},pollConnection:function(service){if(typeof service=='undefined'){return false}if(ShareMyspace.timeoutCount++>(Share.pollingTimeout/Share.pollingInterval)){$('#shareConnectArea table.myspace img.notconnected').attr('src',IMAGE_URL+'/share/btn_connect_ms.png')}else{myspaceTimeout=setTimeout('Share.checkConnectionAuthentication( "myspace", "'+service+'" );',(Share.pollingInterval*1000))}}};ShareMyyearbook={share:function(clickedElement){if(Share.busy===true){return false}Share.busy=true;$('img.shareContentMyyearbook').attr('src',IMAGE_URL+'/share/btn_myb_sharing.gif');if(typeof clickedElement!='undefined'){var formData=$(clickedElement).siblings('form.shareData').serialize()}else{var formData=$('img.shareContentMyyearbook').siblings('form.shareData').serialize()}$.ajax({url:Share.getAjaxUrl()+'myyearbook',type:'GET',dataType:'jsonp',data:formData+'&token='+Share.token})},shareCallback:function(result){Share.busy=false;if(typeof result.maintenance!='undefined'){Share.enableMaintenance('myyearbook');return}$('img.shareContentMyyearbook, img.shareContentMYBDummy').attr('src',IMAGE_URL+'/share/btn_share_myb_complete.png').unbind('click').css('cursor','default')}};$(document).ready(function(){if(Share.token===false){if($('#token').length>0){Share.token=$('#token').val()}else if(typeof TOKEN!='undefined'){Share.token=TOKEN}else if(typeof stok!='undefined'){Share.token=stok}else if(typeof tok!='undefined'){Share.token=tok}}Share.bindEvents(['popup','share','manageSharing']);if(Share.isActive.facebook&&$('img.shareContentFacebook').length>0){$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'action=isauthenticated&destination=facebook&token='+Share.token})}if(Share.isActive.twitter&&$('img.shareContentTwitter').length>0){$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'action=isauthenticated&destination=twitter&token='+Share.token})}if(Share.isActive.myspace&&$('img.shareContentMyspace').length>0){$.ajax({url:Share.getAjaxUrl(),type:'GET',dataType:'jsonp',data:'action=isauthenticated&destination=myspace&token='+Share.token})}});