$(document).ready( function() {

	//hide all sub-blog roll links on page load
	$(".linkcat ul").each( function() {
		$(this).hide();
	});
	
	$(".linkcat h2 a").bind("click", function() {
		
		var links = $(this).parent().parent().children("ul");
		
		if( links.css("display") == "none" ){
			links.slideDown("slow");
			$(this).parent("h2").attr("class", "active");
		}else{
			links.slideUp("slow");
			$(this).parent("h2").attr("class","");
		}
		
		return false;
	});
	
	$(".linkcat h2:first").attr("class", "active")
	$(".linkcat ul:first").slideDown("slow");
	
	
	var hostname = window.location.hostname;
	hostname = hostname.replace("www.","").toLowerCase();
	$('a').each( function() {
		var href = $(this).attr("href")
		if( href ){
			href = href.toLowerCase();
			if(href.indexOf("http://") != -1 && href.indexOf(hostname) == -1){
				$(this).attr("target", "_blank");
			}
		}
		
		
	});
});