function fbs_click(node_title, full_blog_url)
{
  window.open('http://www.facebook.com/sharer.php?u='+full_blog_url+'&amp;t='+node_title,'sharer','toolbar=0,status=0,width=626,height=436');
  return false;
}

$(document).ready(function(){

	$('#socbook_delicious a').click(function(){
		
		var url = 'http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url='+encodeURIComponent(Drupal.settings.sr_share_node_url)+'&amp;title='+encodeURIComponent(Drupal.settings.sr_share_node_title);
		window.open(url, 'delicious','toolbar=no,width=550,height=550'); 	
		return false;
		
	});
	
	$('#socbook_reddit a').click(function(){
		
		var url = encodeURIComponent(Drupal.settings.sr_share_node_url);
		window.location = 'http://www.reddit.com/submit?url='+url;
		return false;
		
	});
    $(".socialtype_javascript").each(function(){
        if($(this).length > 0){
            $(this).find("ul").hide();
            if($("body").hasClass("page-whats-on-video-clips") || $("body").hasClass("node-type-video-clip")){
              // Sort spacing for video pages
              extraSpace = 7;
            }else{
              // sort spacing for all other pages (uses the padding inside the ul)
              extraSpace = parseFloat($(this).find("ul").css("padding-top").substring(0, $(this).find("ul").css("padding-top").length - 2)*2);
            }
            h4_paddingtop = parseFloat($(this).find("h4").css("margin-top").substring(0, $(this).find("h4").css("padding-top").length - 2));
            totalHeight =  extraSpace + h4_paddingtop + $(this).find("ul").height();
            shareTop = $(this).position().top - totalHeight;
            // Below line was for codas, but suddenly, it is no longer needed for some reason (using about page as example)
            /*
            if($(this).parent().parent().parent().parent().attr("class") == "coda_panel"){
                codaNumber = parseFloat($(this).parent().parent().parent().parent().attr("id").substring(5));
                codaTop = $("#coda_" + codaNumber).position().top;
                codaHeight = $("#coda_" + codaNumber).height();
                shareTop = shareTop - codaTop;
                alert(shareTop);
            }
            */
            if($(this).parent().parent().parent().parent().attr("class") == "coda_panel"){
                paddingMargin = $(this).parent().parent().parent().parent().css("padding-top").substring(0, $(this).parent().parent().parent().parent().css("padding-top").length - 2 ) + $(this).parent().parent().parent().parent().parent().parent().parent().css("margin-top").substring(0, $(this).parent().parent().parent().parent().parent().parent().parent().css("margin-top") - 2);
                shareTop = shareTop - paddingMargin + extraSpace;
            }
            $(this).find("ul").css("top", shareTop);
            $(this).find("ul").css("left", ($(this).position().left) + "px");
            $(this).find("ul").css("position", "absolute");
            
            $(this).hover(
                function () {
                    //$(this).find('ul').slideDown('normal');
                    $(this).find("ul").show();
                    $(this).toggleClass('panel_open');
                },
                function () {
                    //$(this).find('ul').slideUp('normal');
                    $(this).find("ul").hide();
                    $(this).toggleClass('panel_open');
                }
            );
        }
    });
});
