// JavaScript Document
$(document).ready(function() {
	$(".newsPlus").click(function () {
		var activeNews = $(this).attr("rel");
		var newsHeight = $(activeNews)[0].scrollHeight;
		
		if($(activeNews).css ("height")==("350px"))
			{
			$(activeNews).animate({ height: newsHeight }, 1500);
			$(this).delay(1500).html('▲  <span class="link">Close</span>');
			}
		else
			{
			$(activeNews).animate({ height: 350 }, 1500);	
			$(this).delay(1500).html('▼ <span class="link">Read more</span>');
			}
		
	});
	
	$(".pageLink").click(function() {
		$("#latestNews").fadeOut();
		
		var target_offset = $("#content").offset();
		var target_top = target_offset.top;
		
		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
		
		var activePage = $(this).attr("href");
	
		$.ajax({
			  url: activePage,
			  cache: false,
			  success: function(html){
				$("#latestNews").html(html).fadeIn();
				$.getScript( '/jscript/pages/about_us.js' );
			  }
			});
		return false;
	});
	
	$(".pageLinkStuds").click(function() {
		$("#studsContainer").fadeOut();
		
		var target_offset = $("#content").offset();
		var target_top = target_offset.top;
		
		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
		
		var activePage = $(this).attr("href");
	
		$.ajax({
			  url: activePage,
			  cache: false,
			  success: function(html){
				$("#studsContainer").html(html).fadeIn();
				$.getScript( '/jscript/pages/about_us.js' );
			  }
			});
		return false;
	});
});
