$(document).ready(function(){
	//PNG fix for IE >7
	$("#logo").ifixpng();  
    
	//Fix for flickering text in FF2
	jQuery.each(jQuery.browser, function(i, val) {
	  if(i=="mozilla" && jQuery.browser.version.substr(0,3)=="1.8")
		$("#nav").css("opacity", ".9999")
		
	});
	
	//Remove last nav item margin
	$("#nav li:last-child").css("padding-right", "0px");

	//center subnav
	$("#nav li ul").each(function(){
		_width = -($(this).innerWidth() - $(this).parent().innerWidth())/2 +"px";
		$(this).css("left", _width);
	});
	
	//For subnavs	
	$("#nav li:has(ul)[class!='on']").hover(
		function(){			
			$("#nav li ul").fadeOut("fast");
			$(this).find("ul").fadeIn("fast");
		},
		function(){
			$("#nav li[class='on'] ul").fadeIn("fast");
			$(this).find("ul").fadeOut("fast");
		}
	);
	
	//for rounding the corners
	$(".even, #interest_form, #info_form, .calendar h1, .calendar ul, #classes_grid li, h2, h1").corner("7px");
	
	//for event items
	$(".event_item h1").click(function(){
		$(this).parent().toggleClass("on");
		$(this).parent().find(".event_text").slideToggle();
	});
	
	$(".event_item h1").hover(
		function(){			
			$(this).toggleClass("hover");
		},
		function(){
			$(this).toggleClass("hover");
		}
	);
	
	//for calendar
	$(".calendar a").click(function(event){
		event.preventDefault();
		class_date = $(this).attr("class");
		$(".event_item:not(."+class_date+") .event_text:visible").slideUp().parent().removeClass("on"); //close the open events that aren't on that date
		$(".event_item."+class_date+" .event_text:hidden").slideDown().parent().addClass("on"); //open the events on that date
	});
	
	//for the left hand scrollbar
	$('.scrollpane').jScrollPane({scrollbarWidth:5, showArrows:true}); /*hacked showArrows in order to get the bottom border to show up*/
	
});