$(document).ready(function(){
						   
	$("#mainnav li a").hover(function() {
	  $(this).next("div.hilite").animate({marginTop: "0px"}, "fast");
	}, function() {
	  $(this).next("div.hilite").animate({marginTop: "20px"}, "fast");
	});
	
	$("a.info").click(function () {
      $(this).parents("div.portitem").find("div.info").slideToggle("fast");
	  $(this).parents("div.portitem").siblings().find("div.info").hide("fast");
    });

	$("ul.posts li:last").css("border-bottom", "none");
	
	$("a.c_reply").click(function() {
	 var author = $(this).parents("li").find("span a").html();
	 var authlink = $(this).parents("li").attr("id");
	 var text = $("textarea#commentbox").attr("value");
	 $('textarea#commentbox').attr("value",text+"<a href='#"+authlink+"'>@"+author+"</a>").focus();
	});
	$("a.c_quote").click(function() {
	 var author = $(this).parents("li").find("span a").html();
	 var authlink = $(this).parents("li").attr("id");
	 var text = $("textarea#commentbox").attr("value");
	 var quote = $(this).parents("li").find('p').text();
		if (window.getSelection)
			var selection = window.getSelection();
		else if (document.getSelection)
			var selection = document.getSelection();
		else if (document.selection) {
			var selection = document.selection.createRange().text; }        
		if(selection!="") quote = selection;
	 $('textarea#commentbox').attr("value",text+"<a href='#"+authlink+"'>@"+author+'</a><cite>"'+quote+'"</cite>').focus();
	});

	$("ol li ul").find("li:first").css("border-top", "none");
	$("ol li ul").find("li:last").css("border-bottom", "none");
	
	$("ol li").hover(function() {
	  $(this).find("div.menu div").animate({marginTop: "0px"}, "fast");
	}, function() {
	  $(this).find("div.menu div").animate({marginTop: "-25px"}, "fast");
	});
	
	$(".socialmenu li").hover(function() {
	  $(this).find("div.bubble").animate({opacity: "show"}, "fast");
	}, function() {
	  $(this).find("div.bubble").animate({opacity: "hide"}, "fast");
	});
	
  	$('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}, 600);
   				 return false;
  			}
		}
	});
});
	 
 