var Facebook=(function(){var f=false,h=false,a=false,g=false;function i(k){Facebook.log.debug("ensureInitialized()");if(!f){d("api_key is not set")}if(!h){d("crossDomainFile is not set")}if(a){Facebook.log.debug("initialized, calling callback()");k()}else{Facebook.log.debug("before FB_RequireFeatures");FB_RequireFeatures(["Api","Connect"],function(){Facebook.log.debug("start FB_RequireFeatures");try{FB.Facebook.init(f,h);a=true;Facebook.log.debug("end FB_RequireFeatures, before callback");k()}catch(l){}})}}function j(k){if(k){Facebook.log.debug("sessionReady()");swf().loggedIn()}}function d(k){Facebook.log.debug(k)}var c=false;var b=1000;function e(){if(c){$clear(c)}if(document.getElement(".fb_popupContainer")&&document.getElement(".fb_popupContainer").getChildren().length){c=e.delay(b)}else{Facebook.log.debug("checkFbOverlay calling loginCancelled");swf().loginCancelled()}}return{getInitialized:function(){return a},setAPI:function(k){f=k},setXdReceiver:function(k){h=k},showExtPermission:function(k){FB.Connect.showPermissionDialog(k)},log:(function(){var k=[];return{debug:function(l){k.push(new Date()+": "+l)},get:function(){return k},dump:function(){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(k.join("\n"));return}try{var l=window.open("/empty.html","logWindow","toolbar=no,width=500,height=500,resizable=yes,scrollbars=yes");l.document.write(k.join("<br />")+"</body></html>");return false}catch(m){alert(log.join("\n"));return false}return k.join("\n")},clear:function(){k=[]}}})(),login:function(){Facebook.log.debug("login()");i(function(){Facebook.log.debug("login.ensureInitialized()");d("getting session state.");FB.Facebook.get_sessionState().waitUntilReady(function(k){Facebook.log.debug("waitUntilReady()");j(k)});FB.Connect.requireSession(function(){d("sessioned");$clear(c)},false);c=e.delay(b)})},logout:function(){FB.Connect.logout(function(){d("Let flash know we're logged out");swf().loggedOut()})},isConnected:function(){Facebook.log.debug("isConnected()");i(function(){Facebook.log.debug("isConnected.ensureInitialized");d("check if is connected");FB.Connect.ifUserConnected(swf().setConnected,swf().setDisconnected)})}}})();
