    
    // helper function for getting DOM element
    function $(id) { return document.getElementById(id); }
    
    
    // method that replaces a user's information section on their
    // facebook page
    function renderProfileBox(fb_uid)
    {
        
        //FB.XFBML.Host.autoParseDomTree = false; 
        //FB.XFBML.Host.addElement(new FB.XFBML.UserLink($("userName_"+fb_uid))); 
        //FB.XFBML.Host.addElement(new FB.XFBML.ProfilePic($("userProfilePic_"+fb_uid))); 
        //FB.XFBML.Host.addElement(new FB.XFBML.UserStatus($("userStatus_"+fb_uid))); 
    
        //renderFriends(fb_uid);
    }
    
    
    
    // helper method to run an FQL and get the total number of friends
    // that a user has
    function renderFriends(fb_uid)
    {

        var fbApiClient = new FB.ApiClient('9031635bd9a2abbed0e52a073ac4cda2');
        var numFriends = 0;
    
        fbApiClient.fql_query("SELECT uid2 FROM friend WHERE uid1 = 12808610",function(result,exception){ $("userFriendCount_"+fb_uid).innerHTML = "<a href='#'>" + (result.length+1) + "</a> friends";});
    }
    
    
    //function to prompt the user to connect to 4tay
    //a cookie is set if this is shown so that the user isn't
    //bugged by it
    function fbConnect_showJoinPopup()
    {
        var mypopup = new FB.UI.FBMLPopupDialog('Connect your facebook account to 4tay.com','<div style="padding:10px;">' +
        'Dear 4tay.com visitor,<br><br>'+
        '4tay.com is proud to announce that we are now using the facebook connect libraries to provide a simpler user experience for facebook users who visit 4tay.com.<br><br>'+
        'Facebook users who connect their accounts with 4tay.com will be able to post comments as themselves every time they come back to visit 4tay.com.<br><br>4tay.com does not store your facebook information and updates back to facebook require your approval.<br><br>'+
        '<center><a href="http://www.4tay.com/NewAccount.php?FacebookConnect=true">click here to connect your facebook profile to 4tay.com</a></center><br><br><sub>you will be prompted again to connect in 30 days</sub></div>',true,true);
        mypopup.show();
    }
	
	
	
	function shareProjectOnFacebook(domainURL, blogTitle, blogURL, commentText, blogURL)
	{
		var fbApiClient = new FB.ApiClient('9031635bd9a2abbed0e52a073ac4cda2');
		if(fbApiClient != null)
		{
			var template_data = {"domainURL":domainURL, "blogTitle":blogTitle,"blogURL":blogURL,"commentText":commentText,"blogURL":blogURL}
			//template_data =     {"title":"test title", "quicksummary":"this is a quick summary for testing purposes", "link":"http://www.cbcojones.com/BrightFuse/profile.php","images":[{"src":"http://pad.thedigitalmovement.com/_blaise/2007-06-15-dgen-breakfast.jpg", "href":"http://www.facebook.com"}, {"src": "http://pad.thedigitalmovement.com/_blaise/2007-06-13-roger-waters.jpg", "href":"http://www.facebook.com"}]};
			FB.Connect.showFeedDialog(50725218840, template_data, '','body general', FB.FeedStorySize.fullStory, FB.RequireConnect.promptConnect, function(){});
		}else{
		}
		
	}
	
	function shareBlogOnFacebook(domainURL, blogURL, blogTitle, blogText, blogID)
	{
		var fbApiClient = new FB.ApiClient('9031635bd9a2abbed0e52a073ac4cda2');
		if(fbApiClient != null)
		{
			var template_data = {"domainURL":domainURL,"blogURL":blogURL,"blogTitle":blogTitle,"blogText":blogText}
			
			FB.Connect.showFeedDialog(50861673840, template_data, '','', FB.FeedStorySize.full, FB.RequireConnect.promptConnect, function(){if(confirm('Mark this post as \'Share on Facebook\'?')){makeAjaxCall(domainURL + '/ajax/MarkFacebookPost.php?BlogID=' + blogID,null , null);}});
			
			return true;
		}else{
			return false;
		}
		
	}
	shareBlogOnFacebook
    
