/*    HTTP Host:  b.static.ak.fbcdn.net                                        */
/*    Generated:  March 10th 2010 6:17:50 PM PST                               */
/*      Machine:  10.16.140.105                                                */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/e2iq7pq6sbkgg4kg.pkg.js                                   */

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/e2iq7pq6sbkgg4kg.pkg.js"]); }

function fbpage_set_fan_status(c,f,a,h,g,d,e){g=g?g:function(j){_fbpage_show_change_status_feedback(c,j.getPayload());};var b={fbpage_id:f,add:a,reload:h};if(e!=null)copy_properties(b,e);var i=new AsyncRequest().setURI('/ajax/pages/fan_status.php').setData(b).setHandler(g);if(d)i.setErrorHandler(d);i.send();return false;}function fbpage_set_favorite_status(d,e,a){var f=function(){_fbpage_show_change_status_feedback(d,this.getUserData());};var c={fbpage_id:e,add:a};var b=new AsyncRequest().setMethod('POST').setURI('/ajax/pages/favorite_status.php').setData(c);new Dialog().setAsync(b).setCloseHandler(f).show();return false;}function _fbpage_show_change_status_feedback(b,a){if(!a||!b)return;if(a.reload){fbpage_reload_on_fan_status_changed(a.preserve_tab);}else fbpage_redraw_on_fan_status_changed(a.feedback);}function fbpage_reload_on_fan_status_changed(a){var b=URI.getRequestURI();if(a)if(!b.getQueryData().v&&window.profile_tab_controller)b.addQueryData({v:window.profile_tab_controller.currentView});goURI(b,true);}function fbpage_redraw_on_fan_status_changed(a){if(!a)return;var c=document.createElement('span');c.innerHTML=a;CSS.setClass(c,'fan_status_inactive');elem.parentNode.replaceChild(c,elem);var b=function(){if(data.can_repeat_action)c.parentNode.replaceChild(elem,c);};animation(c).duration(3000).checkpoint().to('backgroundColor','#FFFFFF').duration(1000).ondone(b).go();}
function ConnectWidget(f,d,a){copy_properties(this,{button:$(a),profile_id:d,viewer_id:f,status:null,popup:null,busy:false,new_fan:null});this.popup_uri=new URI('/login.php');this.popup_uri.addQueryData({connect_id:this.profile_id,popup:true});this.button=$(a);this.button.listen('click',this.connectClickHandler.bind(this));this.fan_hidden=[];this.fan_shown=[];var b=DOM.scry(document,'div.connections');if(b.length>0){b=b[0];this.new_fan=DOM.find(b,'div.grid_item_plus');this.fan_shown.push(this.new_fan);this.fan_shown.push(DOM.find(b,'span.total_plus'));var e=DOM.scry(b,'span.total');var c=DOM.scry(b,'div.grid_item');if(c.length>1)this.fan_hidden.push(c[1]);this.fan_hidden.push(e[e.length-1]);}ConnectWidget.instances[a]=this;}ConnectWidget.instances={};ConnectWidget.prototype.setLoggedIn=function(a){this.viewer_id=a;return this;};ConnectWidget.prototype.connectClickHandler=function(a){a.kill();if(this.viewer_id!=0){this.connect();}else this.popUpLogin();};ConnectWidget.prototype.connect=function(){if(!this.busy){this.busy=true;fbpage_set_fan_status(this.button,this.profile_id,true,false,this.connectDoneHandler.bind(this),this.connectErrorHandler.bind(this),this.getAsyncData());}};ConnectWidget.prototype.disconnect=function(){if(!this.busy){this.busy=true;fbpage_set_fan_status(this.button,this.profile_id,false,false,this.connectUndoneHandler.bind(this),function(){},this.getAsyncData());}};ConnectWidget.prototype.getAsyncData=function(){var a={source:'connect'};if(ge('post_form_id'))a.post_form_id=$('post_form_id').value;if(ge('fb_dtsg'))a.fb_dtsg=$('fb_dtsg').value;return a;};ConnectWidget.prototype.popUpLogin=function(){window.open(this.popup_uri.toString(),'_blank','toolbar=0,status=0,width=626,height=400');};ConnectWidget.prototype.connectErrorHandler=function(b){if(b.error==kError_Async_NotLoggedIn){this.viewer_id=0;this.popUpLogin();}else if(b.error==kError_Async_PopUpCaptchaRequired){hide(this.button);var a=$N('a',{href:DOM.find(document,'div.name_block a').href,target:'_blank'},_tx("Verification is needed to connect."));this.status=$N('span',{className:'connect_span'},a);DOM.insertAfter(this.button,this.status);}else{hide(this.button);if(b.error==kError_ProfileConnect_AlreadyConnected){this.status=$N('span',{className:'connect_span'},_tx("You are a Fan."));}else this.status=$N('span',{className:'connect_span'},b.getErrorSummary()+': '+b.getErrorDescription());animation(this.status).from('opacity',0).to('opacity',1).go();DOM.insertAfter(this.button,this.status);}this.busy=false;};ConnectWidget.prototype.connectDoneHandler=function(c){var b=c.getPayload();if(!b||!b.feedback)return;this.status=$N('span',{className:'connect_span'},HTML(b.feedback));var d=$N('a',{className:'undo'},_tx("Undo"));d.listen('click',function(e){e.kill();this.disconnect();}.bind(this));DOM.appendContent(this.status,d);animation(this.status).from('opacity',0).to('opacity',1).go();DOM.insertAfter(this.button,this.status);hide(this.button);if(this.new_fan!=null&&b.connect_fan_div){var a=$N('div',{},HTML(b.connect_fan_div));DOM.setContent(this.new_fan,DOM.find(a,'a'));}this.fan_shown.forEach(function(e){animation(e).from('opacity',0).to('opacity',1).go();CSS.removeClass(e,'hidden');});this.fan_hidden.forEach(function(e){CSS.addClass(e,'hidden');});this.busy=false;};ConnectWidget.prototype.connectUndoneHandler=function(b){var a=b.getPayload();DOM.remove(this.status);animation(this.button).from('opacity',0).to('opacity',1).go();show(this.button);this.fan_shown.forEach(function(c){CSS.addClass(c,'hidden');});this.fan_hidden.forEach(function(c){CSS.removeClass(c,'hidden');});this.busy=false;};ConnectWidget.loadStream=function(b,a){new AsyncRequest().setMethod('GET').setURI('/ajax/connect/connect_widget.php').setData({id:b}).setReadOnly(true).setErrorHandler(function(){}).setTransportErrorHandler(function(){}).setHandler(function(c){payload=c.getPayload();DOM.setContent($(a),HTML(payload.stream_markup));}.bind(this)).send();};ConnectWidget.loggedIn=function(c,a){if(ge('post_form_id')){DOM.replace($('post_form_id'),HTML(a));}else DOM.appendContent(DOM.find(document,'body'),HTML(a));for(var b in ConnectWidget.instances){ConnectWidget.instances[b].setLoggedIn(c);ConnectWidget.instances[b].connect();}};

if (window.Bootloader) { Bootloader.done(["js\/e2iq7pq6sbkgg4kg.pkg.js"]); }