var api_key = '59e966462559f08bca47701e5b8540d1'; var is_initialized = false; var target_page = 'index.php'; /* * Ensure Facebook app is initialized and call callback afterward * */ function ensure_init(callback) { if(!window.api_key) { window.alert("api_key is not set"); } if(window.is_initialized) { callback(); } else { FB_RequireFeatures(["XFBML", "CanvasUtil"], function() { FB.FBDebug.logLevel = 4; FB.FBDebug.isEnabled = true; // xd_receiver.php is a relative path here, because The Run Around // could be installed in a subdirectory // you should prefer an absolute URL (like "/xd_receiver.php") for more accuracy FB.Facebook.init(window.api_key, "xd_receiver.htm"); window.is_initialized = true; callback(); }); } } /* * The facebook_onload statement is printed out in the PHP. If the user's logged in * status has changed since the last page load, then refresh the page to pick up * the change. * * This helps enforce the concept of "single sign on", so that if a user is signed into * Facebook when they visit your site, they will be automatically logged in - * without any need to click the login button. * * @param already_logged_into_facebook reports whether the server thinks the user * is logged in, based on their cookies * */ function facebook_onload(already_logged_into_facebook) { // user state is either: has a session, or does not. // if the state has changed, detect that and reload. ensure_init(function() { FB.Facebook.get_sessionState().waitUntilReady(function(session) { var is_now_logged_into_facebook = session ? true : false; //if the new state is the same as the old (i.e., nothing changed) // then do nothing if (is_now_logged_into_facebook == already_logged_into_facebook) { return; } // otherwise, refresh to pick up the state change refresh_page(); }); }); } /* * "Session Ready" handler. This is called when the facebook * session becomes ready after the user clicks the "Facebook login" button. * In a more complex app, this could be used to do some in-page * replacements and avoid a full page refresh. For now, just * notify the server the user is logged in, and redirect to home. * * @param link_to_current_user if the facebook session should be * linked to a currently logged in user, or used * to create a new account anyway */ function facebook_button_onclick() { ensure_init(function() { FB.Facebook.get_sessionState().waitUntilReady(function() { var user = FB.Facebook.apiClient.get_session() ? FB.Facebook.apiClient.get_session().uid : null; // probably should give some indication of failure to the user if (!user) { return; } // The Facebook Session has been set in the cookies, // which will be picked up by the server on the next page load // so refresh the page, and let all the account linking be // handled on the server side // This could be done a myriad of ways; for a page with more content, // you could do an ajax call for the account linking, and then // just replace content inline without a full page refresh. refresh_page(); }); }); } /* * Do a page refresh after login state changes. * This is the easiest but not the only way to pick up changes. * If you have a small amount of Facebook-specific content on a large page, * then you could change it in Javascript without refresh. */ function refresh_page() { window.location = 'index.php'; } /* * Prompts the user to grant a permission to the application. */ function facebook_prompt_permission(permission) { ensure_init(function() { FB.Connect.showPermissionDialog(permission); }); } /* * Show the feed form. This would be typically called in response to the * onclick handler of a "Publish" button, or in the onload event after * the user submits a form with info that should be published. * */ function facebook_publish_feed_story(form_bundle_id, template_data) { // Load the feed form ensure_init(function() { FB.Connect.showFeedDialog(form_bundle_id, template_data); //FB.Connect.showFeedDialog(form_bundle_id, template_data, null, null, FB.FeedStorySize.shortStory, FB.RequireConnect.promptConnect); // hide the "Loading feed story ..." div //dk commenting out this line //ge('feed_loading').style.visibility = "hidden"; }); } /* * If a user is not connected, then the checkbox that says "Publish To Facebook" * is hidden in the "add run" form. * * This function detects whether the user is logged into facebook but just * not connected, and shows the checkbox if that's true. */ function facebook_show_feed_checkbox() { ensure_init(function() { FB.Connect.get_status().waitUntilReady(function(status) { if (status != FB.ConnectState.userNotLoggedIn) { // If the user is currently logged into Facebook, but has not // authorized the app, then go ahead and show them the feed dialog + upsell checkbox = ge('publish_fb_checkbox'); if (checkbox) { checkbox.style.visibility = "visible"; } } }); }); } function popupRequestForm(locale){ FB.IFrameUtil.CanvasUtilServer.run(true); var fb_div=document.createElement("div"); fb_div.setAttribute("iframeHeight","560px"); fb_div.setAttribute("iframeWidth","630px"); if(locale == 'India'){ fb_div.setAttribute("fbml",""+"\">"+""+""+""); var fb_dialog=new FB.UI.PopupDialog("Invite Your Friends to Connected Weddings",fb_div,false,false); fb_dialog.set_placement(FB.UI.PopupPlacement.center); } if(locale == 'Italy'){ fb_div.setAttribute("fbml",""+"\">"+""+""+""); var fb_dialog=new FB.UI.PopupDialog("Invita i tuoi amici",fb_div,false,false); fb_dialog.set_placement(FB.UI.PopupPlacement.center); } if(locale == 'SpanishApp'){ fb_div.setAttribute("fbml",""+"\">"+""+""+""); var fb_dialog=new FB.UI.PopupDialog("Invita a tus amigos",fb_div,false,false); fb_dialog.set_placement(FB.UI.PopupPlacement.topCenter); } fb_dialog.setContentWidth(630); fb_dialog.setContentHeight(560); fb_dialog.show(); FB_RequireFeatures(["XFBML"],function(){ var fb_serv=new FB.XFBML.ServerFbml(fb_div); FB.XFBML.Host.addElement(fb_serv); }); } function popupWebsiteRequest(url){ FB.IFrameUtil.CanvasUtilServer.run(true); var fb_div=document.createElement("div"); fb_div.setAttribute("iframeHeight","560px"); fb_div.setAttribute("iframeWidth","630px"); fb_div.setAttribute("fbml",""+"\">"+""+""+""); var fb_dialog=new FB.UI.PopupDialog("Invite your friends to view your personal wedding website",fb_div,false,false); fb_dialog.setContentWidth(630); fb_dialog.setContentHeight(560); fb_dialog.set_placement(FB.UI.PopupPlacement.topCenter); pageTracker._setDomainName("none"); pageTracker._setAllowLinker(true); pageTracker._trackPageview("/websiteInvite" ); fb_dialog.show(); FB_RequireFeatures(["XFBML"],function(){ var fb_serv=new FB.XFBML.ServerFbml(fb_div); FB.XFBML.Host.addElement(fb_serv); }); } function closeFbDialog (myBool) { facebook_onload(false); } function popupWelcome(){ var fb_div=document.getElementById("welcome"); fb_div.style.display="block"; //var fb_dialog=new FB.UI.PopupDialog("Welcome to Connected Weddings",fb_div,false,false); fb_dialog=new FB.UI.PopupDialog("Benvenuti al Connected Weddings",fb_div,false,false); fb_dialog.setContentWidth(460); fb_dialog.setContentHeight(260); fb_dialog.set_placement(FB.UI.PopupPlacement.center); fb_dialog.add_closing(function (myBool) { pageTracker._trackPageview("/ItalyWelcomeClosing" ); //facebook_onload(false); return true; window.location = 'index.php'; }); fb_dialog.show(); } function popupLogin(){ var fb_div=document.getElementById("login"); fb_div.style.display="block"; fb_dialog=new FB.UI.PopupDialog("Benvenuti al Connected Weddings",fb_div,false,false); fb_dialog.setContentWidth(460); fb_dialog.setContentHeight(155); fb_dialog.set_placement(FB.UI.PopupPlacement.topCenter); fb_dialog.add_closing(function (myBool) { pageTracker._trackPageview("/ItalyLoginClosing" ); window.location = 'index.php'; }); fb_dialog.show(); } function popupHelp(){ var fb_div = document.createElement('div'); Element.extend(fb_div); fb_div.insert('

Need help building your website or using our tools?

Please email us at help@connectedweddings.com.

We'll get back to you ASAP -- hours not days, as we know your time is precious!

Close
' ); fb_dialog=new FB.UI.PopupDialog("Connected Weddings Help",fb_div,false,false); fb_dialog.setContentWidth(460); //fb_dialog.setContentHeight(260); fb_dialog.set_placement(FB.UI.PopupPlacement.topCenter); pageTracker._setDomainName("none"); pageTracker._setAllowLinker(true); pageTracker._trackPageview("/HelpDialog" ); fb_dialog.show(); } function popupBookmark(){ var fb_div = document.createElement('div'); Element.extend(fb_div); fb_div.insert('

Click the bookmark link in the Facebook application bar. It is located at the bottom left of the screen when you are logged into Facebook.

This is the best way to get back to your wedding planning any time you are ready!

Close
' ); fb_dialog=new FB.UI.PopupDialog("Bookmark Connected Weddings",fb_div,false,false); fb_dialog.setContentWidth(426); //fb_dialog.setContentHeight(265); fb_dialog.set_placement(FB.UI.PopupPlacement.topCenter); pageTracker._setDomainName("none"); pageTracker._setAllowLinker(true); pageTracker._trackPageview("/Bookmark" ); fb_dialog.show(); } function popupReport(forum,discussionID,commentID,userID,path){ var fb_div = document.createElement('div'); Element.extend(fb_div); fb_div.insert('

If you believe this comment is inappropriate in some way please send us your feedback below:

Submit
' ); $('CommentBody_' + commentID).insert(fb_div); $('reportlink_' + commentID).setStyle({ display: 'none' }); var temp = $('closeButton_' + commentID); temp.onclick = function() { new Ajax.Request(path, { method:'get', parameters: $('feedbackForm_' + commentID).serialize(true), onSuccess: function(transport){ $('closeButton_' + commentID).replace('Thanks!'); }, onFailure: function(){ alert('Sorry, there was a problem...') } }); }; } function WeddingVideo(){ popupVideo('Wedding Website Introduction Video', '/WeddingWebsiteVideo','http://www.youtube.com/v/FFDecHf8avA&hl=en&fs=1'); } function popupVideo(title,track,video){ var fb_div = document.createElement('div'); Element.extend(fb_div); fb_div.insert('
' ); fb_dialog=new FB.UI.PopupDialog(title,fb_div,false,false); fb_dialog.setContentWidth(425); fb_dialog.setContentHeight(344); fb_dialog.set_placement(FB.UI.PopupPlacement.topCenter); pageTracker._setDomainName("none"); pageTracker._setAllowLinker(true); pageTracker._trackPageview(track); fb_dialog.show(); } function testFeed(){ facebook_publish_feed_story(43524356293,{"comment-link":"http:\/\/www.connectedweddings.com\/in\/forum\/comments.php?DiscussionID=10&page=1","discussion":"Off beat honeymoon ideas?","full-image":"http:\/\/www.connectedweddings.com\/in\/forum\/themes\/connectedweddings\/styles\/default\/c8.gif","first-comment":"There are so many choices that we can't decide! But we'd like to do something that isn't the same old same old that everyone else does.

Anyone been to someone awesome for a honeymoon that you can recommend?","comment":"test","images":[{"src":"http:\/\/www.connectedweddings.com\/in\/forum\/themes\/connectedweddings\/styles\/default\/c8.gif","href":"http:\/\/www.connectedweddings.com\/in\/forum\/comments.php?DiscussionID=10&page=1"}]}); } function fbs_click(u,t) { window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false; }