
(function($){
	$(document).ready(function() {
		var options = {};
	
		function callback(sb,sc,si) {
			if (sb.css('display') == 'none') {
				sc.css({'margin-bottom' : '10px'});
				si.attr({'src' : 'http://jeremy.bohain.free.fr/blog/wp-content/plugins/wp-special-textboxes/images/show.png', 'title' : 'Show'});
							}
			else {
				si.attr({'src' : 'http://jeremy.bohain.free.fr/blog/wp-content/plugins/wp-special-textboxes/images/hide.png', 'title' : 'Hide'});
			}
		
			$(this).parent().parent().children('#caption').css({'margin-bottom' : '10px'});
			return false;
		}
	
		$(".stb-tool").bind("click", function() {
			id = $(this).attr('id').split('-');
      idn = id[2];
      sb = $('#stb-body-box-'+idn);
			sc = $('#stb-caption-box-'+idn);
      si = $('#stb-toolimg-'+idn);
			if (sb.css('display') != 'none')	{				
				sb.hide('blind',options,500, function() {callback(sb,sc,si);});
			}
			else {
				sb.show('blind',options,500,function() {callback(sb,sc,si);});
				sc.css({'margin-bottom' : '0px'});			
							}
			return false;
		});
		return false;
	});
})(jQuery)