$(document).ready(function() {
	$('span').hide();
	
	$('.home-news p').nextAll('p').hide();
	
	//MOUSE OVER MAIN NAVIGATION ANIMATION
	$("#main-content a").not('li a').mouseover(function() {
		var id = '.'+$(this).attr("id");
		$(id).fadeIn(400);
		$().mousemove(function(e){
			var browserW = $('body').outerWidth();
			var spanW = $(id).outerWidth()+50;
			if ((e.pageX + spanW) > browserW) {
				var mouseX =  e.pageX - 239;
			}
			else{
				var mouseX = e.pageX + 10;
			}
			$(id).css("top",e.pageY+5);
			$(id).css("left",mouseX);
		});
	});
	$("#main-content a").mouseout(function() {	
		$("span").fadeOut(400);
	});
	
	//CLICK HOME NEWS FADE CONTROLLS
	$(".home-news ul a").click(function() {
		var nid = $(this).attr("id");
		$('.home-news ul a').removeClass('active');
		$('#'+nid).addClass('active');
		$(".home-news p").hide();
		$('.'+nid).fadeIn(600);
	});
});
