$(document).ready(function(){
	/*AdminBar*/
	$("#wpabar div ul li ul").hide();
	$("#wpabar div ul > li > a").hover(function(){$(this).next("ul").fadeIn("slow");},
	function(){$(this).next("ul").hide();});
	$("#wpabar div ul li ul").hover(function(){$(this).show();},
	function(){$(this).hide();});

	$("ol.commentlist li").each(function(x, el){
		var ID = $(el).attr("id");
		var author = $(el).find("div.comment-author span").text();
		var meta = $(el).find("div.comment-meta");
		$(meta).append('<span class="meta-sep">|</span> <a class="respond-link" href="#respond">Responder</a>');
		$(el).find(".respond-link").bind("click", function(){
			var link = $(this);
			var oldText = $("textarea#comment").val();
			if(oldText!='') oldText = oldText + '\n\n';
			var newText = '<a rel="reply-comment" href="#'+ ID +'">@' + author +"</a>: "+ $(this).prev().val();
			$("textarea#comment").val(oldText + newText);
			return false;
		});
	});
  
	// Animated Scrolling with jQuery 1.2 by Karl Swedberg
	// http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target
			|| $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body')
				.animate({scrollTop: targetOffset}, 1000);
				return false;
			}
		}
	});
});

