/*
This does rollovers on images that have a class of "rollover".
The rollover image URL is stored in the "name" attribute and 
swapped with the SRC attribute. I did this because it's one of the
only ways to store the image URL and still have valid HTML. 
*/

$(function() {
	$('.rollover').hover(
	function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('name'));
		$(this).attr('name', currentImg);
	}, 
	function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('name'));
		$(this).attr('name', currentImg);
	}
	);
});

/*
This is a toss-in function that performs the cover prev/next 
display function on /admissions/college/curriculum.php
*/
$(document).ready(function(){
	var $curr = $("#layer0");
	$("a#button_prev").click(function() {
		if($curr.is(":first-child")) {
			$curr = $("#covers div").eq(($("#covers div").length)-1);
		} else { 
			$curr = $curr.prev();
		}		
		$("#covers div").css("display", "none");
		$curr.css("display", "block");
	});
	$("a#button_next").click(function() {
		if($curr.is(":last-child")) {
			$curr = $("#layer0");
		} else { 
			$curr = $curr.next();
		}
		$("#covers div").css("display", "none");
		$curr.css("display", "block");
	});
});

/*
This enables Cufon for all page titles. Other styles can be
added here as well. 
*/

if (Drupal.jsEnabled) {
	$(document).ready(function() {
		Cufon.replace('h1.title', { fontFamily: 'MrsEaves' });
	});
}
