﻿var FacebookHelper = {
    //Initialize facebook
    Init: function(app_id) {
        /*** Facebook JS for Like Button ***/
        window.fbAsyncInit = function() {
            FB.init({
                appId: app_id, //Unique by product
                status: true,
                cookie: true,
                xfbml: true,
                channelUrl: "http://joybauer.com/channel.html"
                
            });
        };
    }
};

//Load facebook all.js only when the like button exists in the page.
jQuery(document).ready(function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
    '//connect.facebook.net/en_US/all.js#xfbml=1';

    if (document.getElementsByTagName('fb:like') != null &&
        document.getElementsByTagName('fb:like').length > 0) {
        document.getElementsByTagName("head")[0].appendChild(e);
    }
});

var fbapp_id = jQuery("meta[property=fb:app_id]");

if (fbapp_id != null)
    FacebookHelper.Init(jQuery(fbapp_id).attr("content"));

/*
//For EH
if (document.domain.indexOf('everydayhealth.com')) {
FacebookHelper.Init('135346036490186');
}

//For WTE
if (document.domain.indexOf('wahttoexpect.com')) 
FacebookHelper.Init('138668756159179');
*/
