$(document).ready(function(){

	//network sites list drop down
	$("#network-sites").hide();
	$("li#kmn, div#network-sites").hover(
		function () {
		$("div#network-sites").show();
	}, 
		function () {
		$("div#network-sites").hide();
	});

	//get the first paragraph from a featured article, and move it into the big image header
	$("#post-single-featured-content p:first").addClass("featured-intro");
	$("#post-single-featured-header header").append( $("#post-single-featured-content p:first") );
	
	
	//login drop down
//	$("form#network-login-form").hide();
//	$("a#network-login").click(function(e) {
//		e.preventDefault();
//		$("form#network-login-form").toggle();
//		$(this).toggleClass("menu-open");
//	});

//	$("form#network-login-form").mouseup(function() {
//		return false
//	});
//	$(document).mouseup(function(e) {
//		if($(e.target).parent("a#network-login").length==0) {
//			$("a#network-login").removeClass("menu-open");
//			$("form#network-login-form").hide();
//		}
//	});	

	//lazyload of images
	$("img").not("#network-sites img, .scrollable img").lazyload({ 
		placeholder : "../images/lazyloader.gif",
		effect : "fadeIn"
	});

	//tabs - scraped without dignity from http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery/ - couldn't be arsed to write a tab system for the 9th time.
	//When page loads...
	$(".tab").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li a").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).parent().addClass("active"); //Add "active" class to selected tab
		$(".tab").hide(); //Hide all tab content

		var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).slideDown(); //Fade in the active ID content
		return false;
	});
	
	
	//internal ads scroller, using jQueryTools
	$(".scrollable").scrollable({circular: true }).navigator().autoscroll({ interval: 3000 });
	
	//round corners with http://www.bram.us/sandbox/roundedcorners/ from Bram Van Damme
	$('.roundme').wrap(function() {
		return '<span style="background-image:url(' + $(this).attr('src') + '); height: '+ $(this).height() + 'px; width: '+ $(this).width() + 'px;" class="rounded" />';
	});
	


});

// @JohnONolan: "Internet Explorer 6 IS a disease."
