jQuery(document).ready(
    function(){
	//////////Top Banner
	jQuery("#big-banner img").first().show();

	setInterval("rotateBanner()", 8000);

	//////////Right sidebar tabs
	jQuery("ul.tabs li:first").addClass("active");
	jQuery(".tab-content:last").hide();

	jQuery(".linktab:first").click(
	    function () {
		jQuery(".tabs li").removeClass("active", 500);
		jQuery(".tabs li:first").addClass("active", 500);
		jQuery(".more-content").hide();
		jQuery(".tab-content:first").fadeIn(500);
		jQuery(".tab-content:last").hide();
	    });

	jQuery(".linktab:last").click(
	    function () {
		jQuery(".tabs li").removeClass("active", 500);
		jQuery(".tabs li:last").addClass("active", 500);
		jQuery(".more-content").hide();
		jQuery(".tab-content:first").hide();
		jQuery(".tab-content:last").fadeIn(500);
	    });

	//////////less/more tabs in the Student Voices/Meet our Teachers page
	jQuery(".more-content-link").each(
	    function () {
		jQuery(this).click(
		    function () { 
			jQuery(this).siblings(".more-content").toggle();
			if (jQuery(this).html().search("more") > 0) 
			    jQuery(this).html(jQuery(this).html()
					      .replace("more", "less")
					      .replace("»", "«"));
			else 
			    jQuery(this).html(jQuery(this).html()
					      .replace("less", "more")
					      .replace("«", "»"));
		    });
	    });

	jQuery(".tab_container .more-content-link").click(                                                                                                                                                   
            function () {                                                                                                                                                                                    
                jQuery(".page").css({"min-height": jQuery(".right-sidebar").height() + 450 + "px"});                                                                                                         
            });

	//////////Academic Purposes/Writing pages
	jQuery('#toggle-view li').click(
	    function () {
		var $text = jQuery(this).children('div');
		var $btn = jQuery(this).find('span');
		if ($text.is(':hidden')) {
		    $text.slideDown('200');
		    $btn.text('[close]');		
		} else {
		    $text.slideUp('200');
		    $btn.text('[more]');		
		}
	    });
    });

var current_image = 1;
function rotateBanner () {
    jQuery("#big-banner img")
	.fadeOut(500)
	.eq(current_image).fadeIn(1000);
    current_image++;
    if (current_image==jQuery("#big-banner img").length) current_image = 0;
}
