function getQueryString(){var B={};var E,A=/\+/g,C=/([^&=]+)=?([^&]*)/g,F=function(G){return decodeURIComponent(G.replace(A," "))},D=window.location.search.substring(1);while(E=C.exec(D)){B[F(E[1])]=F(E[2])}return B}function createCookie(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{var A=""}document.cookie=C+"="+D+A+"; path=/"}function setFBCookie(A){if(A.authResponse){createCookie("fbCookie",A.authResponse.userID,1)}else{createCookie("fbCookie","",-1)}}function escapeReturnUrl(A){if(A&&A.length>0){if(A.charAt(A.length-1)=="/"){A=A.substring(0,A.length-1)}return encodeURIComponent(A)}return""}function fbGetIdForUrl(A,B){FB.api({method:"fql.query",query:"SELECT url, type,site, id FROM object_url WHERE url = '"+A+"'"},function(C){B(C[0].id)})}function fbPostComment(){FB.ui({method:"feed",name:"Facebook Dialogs",link:"https://developers.facebook.com/docs/reference/dialogs/",picture:"http://fbrell.com/f8.jpg",caption:"Reference Documentation",description:"Dialogs provide a simple, consistent interface for applications to interface with users.",message:"Facebook Dialogs are easy!"},function(A){if(A&&A.post_id){alert("Post was published.")}else{alert("Post was not published.")}})}function facebookUpdateLoginStatus(B){setFBCookie(B);if(B.authResponse){var D=(document.getElementById("imowLogoutBox")!=null);jQuery("#imowLogoutBox").hide();var C=null;var E=null;var A=getQueryString();if(A.returnURL&&A.returnURL.length>0){E=A.returnURL}else{if(A.ReturnUrl&&A.ReturnUrl.length>0){E=A.ReturnUrl}}if(E!=null){C="/login/facebookLogin?returnURL="+escapeReturnUrl(E)}else{C="/login/facebookLogin?returnURL="+escapeReturnUrl(window.location.href)}jQuery.getJSON(C,function(F){if(F.success){if(E!=null){window.location.href=E}else{window.location.reload(true)}}else{if(F.error){window.location.href=F.error+"?returnURL="+escapeReturnUrl(window.location.href)}}})}else{}}function fbOnLogout(A){setFBCookie(A);window.location.href="/login/logout?returnURL="+escapeReturnUrl(window.location.href)}function fbOnIsLoggedIn(A){setFBCookie(A);if(A.authResponse){jQuery("#imowLogoutBox").hide()}};
