$(document).ready(function() {
	$("ul.nav").superfish();
	$("#login-link").click(function() {
		$('#login').slideToggle(100);
    	return false;
  	});
	if($('#login-link-aux').length) {
		$('#login-link-aux').click(function() {
			$('#login-aux').slideToggle(100);
			return false;
		});
	}
});

//liRotator is required for the DEER FACT Plug-In
var liRotator = {
	container : "rotate",
	init: function() {
		this.container = "."+this.container;
		this.items = this.container+" li";
		this.itemsObj = jQuery.makeArray($(this.items)).reverse();
		$(this.container).empty()
		$(this.container).append(liRotator.itemsObj);
		$(this.items).css( { 'position' : 'absolute' } );
	
		this.itemsLength = $(this.items).length;
		this.counter = 3;
		if(this.itemsLength > 1){
			this.p1 = liRotator.items+":lt(";
			this.index = liRotator.itemsObj.length-1;
			this.p2 = ")";
			var obj = this.p1+this.index+this.p2;
			$(obj).hide();
			setTimeout("liRotator.rotate();", 5000);
			this.setHeight();
		}
	},
	
	setHeight: function() {
		var heights = new Array();
		jQuery.each(this.itemsObj, function() {
			heights.push($(this).height());
		});
		
		heights.sort().reverse();
		var tallest = { height : heights[0] }
		$(liRotator.container).css(tallest);
	},
	
	rotate: function() {
		$("ul.rotating-facts li:last").fadeOut(2000, function callback() {
			setTimeout("liRotator.rotate();", 5000);
		});
			var pop = $("ul.rotating-facts li:last");
			$(liRotator.items+":last").remove();
			$(liRotator.container).prepend(pop);
    	
			this.p1 = liRotator.items+":eq("
			this.index = liRotator.itemsObj.length-1
			this.p2 = ")";
			var obj = this.p1+this.index+this.p2;
			obj
			$(obj).fadeIn(2000);
	}
	
}