$(document).ready(function() {
	
	var divFB = document.createElement('div');
		divFB.setAttribute('id','fb-root'); 
	
		document.body.appendChild(divFB);
	
	window.fbAsyncInit = function() {
	        FB.init({
	            appId: '100000194886410', // Your Facebook ID
	            status: true,
	            cookie: true,
	            xfbml: true
	        });
	    };
	    (function() {
	        var e = document.createElement('script'); e.async = true;
	        e.src = document.location.protocol +
	            '//connect.facebook.net/en_US/all.js';
	        document.getElementById('fb-root').appendChild(e);
	    }());
	
	
//	$("#sharePopup").fancybox({
//		autoScale: false,
//		scrolling: 'no'
//	});
//	
//	$("#followPopup").fancybox({
//		autoScale: false,
//		scrolling: 'no'
//	});
	var s = window.location.protocol+"//"+location.host;
	$('#shareLink').append(s);
	
	if(footerTwitterEnabled != undefined) {
		if(footerTwitterEnabled == true) {
			var twitterLi = document.createElement('li');
			var stwitter = document.createElement('span');
			var s = window.location.protocol+"//"+location.host;
			var shareInput = $('#shareInput').val();
			$(stwitter).html("<a href=\"#\"><img onclick=\"javascript:shareTwitter("+"'"+s+"'"+");\" src=\"/static/images/twitter_32.png\" border=\"0\"/></a>");
			$(twitterLi).append(stwitter);
			$('#shareIcon').append(twitterLi);
		}
	}
	
	if(footerFacebookEnabled != undefined) {
		if(footerFacebookEnabled == true) {
			var facebookLi = document.createElement('li');
			var stt = document.createElement('span');
			var s = window.location.protocol+"//"+location.host;
			var shareInput = $('#shareInput').val();
			$(stt).html("<a href =\"#\"><img onclick=\"javascript:shareFacebook("+"'"+s+"'"+");\" src=\"/static/images/facebook_32.png\" border=\"0\"/></a>");
			$(facebookLi).append(stt);
			$('#shareIcon').append(facebookLi);
		}
	}
	
	if(plusEnabled != undefined) {
		if(plusEnabled == true) {
			var plusLi = document.createElement('li');
			var stt = document.createElement('g:plusone');
			var s = window.location.protocol+"//"+location.host;
			stt.setAttribute('href',s );
			$(plusLi).append(stt);
			$('#shareIcon').append(plusLi);
		}
	}
	
	if(likeHomeEnabled != undefined) {
		if(likeHomeEnabled == true) {
			var stt = document.createElement('fb:like');
			var s = window.location.protocol+"//"+location.host+"/index";
			//stt.className = "flike_btn";
			stt.setAttribute('href', s);
			stt.setAttribute('show_faces', 'false');
			stt.setAttribute('width', '70');
			stt.setAttribute('layout', 'button_count');
			stt.setAttribute('font', 'trebuchet');
			if(likeText != undefined) {
				stt.setAttribute('action', likeText);
			}
			//$('#likeLi').append(stt);
		}
	}

});
