$(window).load(function() {
	// this is needed for the IE 6 pseudo hover class bug
	$(".links li").hover(function () {
		$(this).addClass("hover");
	},function () {
		$(this).removeClass("hover");
	});

	$(".navtop > li").hover(function () {
		if($(this).children("ul.mouseoff").length == 0) {
			$(this).children("ul").slideDown();
		}
	},function () {
		$(this).children("ul").addClass("mouseoff");
		$(this).children("ul").slideUp(function () {
			$(this).removeClass("mouseoff");
		});
	});
	
	// quote image hover fade area
	$(".hoverarea").hover(function () {
		$(this).siblings(".quotetext").fadeIn();
		$(this).siblings(".quoteimage").fadeOut();
	},function () {
		$(this).siblings(".quotetext").fadeOut();
		$(this).siblings(".quoteimage").fadeIn();
	});
	
	// expanding content areas (spotlight, etc.)
	$(".more a").click(function () {
		if($(this).html().indexOf('more') < 0) {
			inner = $(this).parent().parent().children(".inner");
			if($(this).parents("#spotlight").length > 0) {
				heightinner = 132;
				//$("#spotlight .begin").hide();
			}
			//if($(this).parents("#groups").length > 0) heightinner = 23;
			if($(this).parents("#newsitem").length > 0) heightinner = 197;
			inner.animate({height: heightinner+'px'});
			$(this).html("more &gt;&gt;");
		}
		else {
			inner = $(this).parent().parent().children(".inner");
			heightinner = inner[0].scrollHeight;
			inner.animate({height: heightinner+'px'});
			$(this).html("&lt;&lt; less");
			if($(this).parents("#spotlight").length > 0) {
				//$("#spotlight .begin").show();
			}
		}
		return false;
	});
	
	// apply to all png images 
	$('img[@src$=.png], div.quotetext, .navtop li a').ifixpng(); 
});

// get a random number function
function getRandNum(max) {
	return Math.floor( Math.random() * max );
}
