// JavaScript Document

$().ready(function(){
	init_buttons();		
	if($("#tabbedfeeds").size() > 0){
		jTabber.init("tabtest","a.sel");	
	}//end if
});

function init_buttons(){
	
	$("a[rel=sharebox]").click(function(e) { //button click class name is myDiv
	  e.stopPropagation();
	});
	
	//Share button
	$("a[rel=sharebox]").click(function(){
		var href = $(this).attr("href");
		var id = href.split("=");	
		id = id[1];
		var element = $(this);
		//$(".sharebox").remove();	
		if($("#sharebox_"+id).length == 0){
			$.get(href,function(data){
				element.parent().parent().parent().after(data);	
				//$(".sharebox").fadeIn("slow");
			});
		} else {
			$(".sharebox").fadeOut("slow",function(){$(".sharebox").remove();});
		}//end if
		return false;									
	});
	//close all the opened shareboxes
	$(document).click(function(){	
		$(".sharebox").remove();		
	});
}