function streamPublishCallback(b,d,a,e,c){if(b){fb_result=b}else{fb_result=d}storeFbTracking(a,e,c,fb_result)}function checkFbPmUser(a){returnStatus=false;var b=new Ajax.Request(a+"/schedule/ajaxCheckFbPmUser",{asynchronous:false,method:"post",postBody:"",onSuccess:function(c){if(c.responseText=="diff"){returnStatus=true}},onFailure:function(c){}});return returnStatus}function callPublish(a,c,b,e,d,f){diffUsers=checkFbPmUser(a);if(diffUsers){FB.Connect.logout(function(){streamPublishWrapper(a,c,b,e,d,f)})}else{streamPublishWrapper(a,c,b,e,d,f)}}function streamPublishWrapper(a,c,b,e,d,f){FB.ensureInit(function(){FB.Connect.streamPublish("",d,f,"",e,function(g,h){streamPublishCallback(g,h,a,c,b)})})}function grantPermission(a,c,b){FB.ensureInit(function(){FB.Connect.showPermissionDialog("publish_stream",function(d){storeFbTracking(a,c,b,d)},false,null)})}function storeFbTracking(a,c,b,d){var e=new Ajax.Request(a+"/schedule/ajaxFBTrack?source_url="+c+"&fb_action="+b+"&fb_result="+d,{asynchronous:false,method:"post",postBody:"",onSuccess:function(f){},onFailure:function(f){}})}function storeFbLogin(b,c,a){var d=new Ajax.Request(b+"/schedule/ajaxStoreFBLogin?url="+c+"&fb_login_action="+a,{asynchronous:false,method:"post",postBody:"",onSuccess:function(e){},onFailure:function(e){}})};
