$(document).ready(function(){
	if($("#scrollerText").height() == 0){
		$("#scrollerText").parent().hide();
		$notice = false;
	}
	/*else{
		$velocity = 15000;
		$("#scrollerText").animate({top: $("#scrollerText").parent().height() - ($("#scrollerText").height() + $("#scrollerText").parent().height() + 7) },$velocity);
		$notice = true;
	}
	
	if($notice)
		setInterval(function(){
			$("#scrollerText").css("top","71px");
			$("#scrollerText").animate({top: $("#scrollerText").parent().height() - ($("#scrollerText").height() + $("#scrollerText").parent().height() + 7) },$velocity);
			return false;
	},15000);*/

	/* // Varsity and Recreation animation Menu
	$("#recreation-menu").hide();
	$("#interuniversity-menu").hide();
	
	$("#varsity_menu").bind("mouseenter mouseleave", function(){
		$("#interuniversity-menu").slideToggle(700);
	});
	$("#recreation_menu").bind("mouseenter mouseleave", function(){
		$("#recreation-menu").slideToggle(700);
	}); */
	
	// Varsity and Recreation Background Image amination 
	/*$("#varsity_menu a").mouseover(function(){
		$index = $(this).attr("value");
		$("#varsity_menu").css("background-image", "URL(" + changeBgImage($index, 1) + ")");
	});
	$("#recreation_menu a").mouseover(function(){
		$index = $(this).attr("value");
		$("#recreation_menu").css("background-image", "URL(" + changeBgImage($index, 2) + ")");
	});
	*/
	$("#interuniversity-menu").mouseout(function(){
		$("#varsity_menu").css("background-image", "URL(/sites/all/themes/geegees/geegee-images/varsity_bg.jpg)");
	});
	$("#recreation-menu").mouseout(function(){
		$("#recreation_menu").css("background-image", "URL(/sites/all/themes/geegees/geegee-images/recreation_bg.jpg)");
	});
	
	$("#btn-news-bg1").css("background-image", "URL(/sites/all/themes/geegees/geegee-images/btn.gif)");
	
	for($i = 1; $i <= 5; $i++){
		$("#btn-news-bg" + $i).click(function(){
			$continue = false;
			if($continue == false){
					if($("#news-img" + $counter).is(":animated")){
						$("#news-img" + $counter).stop(true,true);
						$("#news" + $counter).stop(true,true);
						$("#news" + $counter).hide();
					}
					if($("#news-img" + ($counter-1)).is(":animated")){
						$("#news-img" + ($counter-1)).stop(true,true);
						$("#news" + ($counter-1)).stop(true,true);
						$("#news" + ($counter-1)).hide();
					}
			}
			$("#btn-news-bg" + ($counter)).css("background-image", "URL(/sites/all/themes/geegees/geegee-images/btn2.gif)");
		});
	}
	
	$continue = true;
	$counter = 1;
	setInterval(function(){
		if($continue){
			$('#news-img' + $counter).fadeOut(5000);
			$('#news' + $counter).slideToggle(2500);
						
			if($counter == 5) $counter = 1;
			else $counter++;
			
			$('#news-img' + $counter).fadeIn(5000);
			$('#news' + $counter).slideToggle(2500);
			
			if($counter == 1)
				$("#btn-news-bg5").css("background-image", "URL(/sites/all/themes/geegees/geegee-images/btn2.gif)");
			else
				$("#btn-news-bg" + ($counter - 1)).css("background-image", "URL(/sites/all/themes/geegees/geegee-images/btn2.gif)");
			$("#btn-news-bg" + $counter).css("background-image", "URL(/sites/all/themes/geegees/geegee-images/btn.gif)");
		}
		return false;
	},10000);
});
	
function changeBgImage($index, $flag){
	// $flag = 1 : change image for interuniversity menus
	// $flag = 2 : change image for recreation menus
	if($flag == 1) $path = "/sites/all/themes/geegees/geegee-images/menuImages/varsity_bg" + $index + ".jpg";
	else if($flag == 2) $path = "/sites/all/themes/geegees/geegee-images/menuImages/recreation_bg" + $index + ".jpg";
	return $path;
}


