$(document).ready(function(){
	$('li.has_children').hover(
		function() { $(this).children("ul").stop(true, true).fadeIn(); },
		function() { $(this).children("ul").stop(true, true).fadeOut(); }
	);
	$('div.primary_links ul li').hover(
		function() { $(this).addClass('menu_hover'); },
		function() { $(this).removeClass('menu_hover'); }
	);
	
	
	$("ul.submenuclass li:first-child").addClass('first');

	// Fix IE7 z-index bug
	$(function() {
		var zIndexNumber = 1000;
		$('div').each(function() {
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
	});
	
	// Hack to work around an absolutely positioned content div, which itself was a hack
	// to work around an IE7 float bug
	var maxHeight = $("#sidebar1").height();
	if ($("#sidebar2").height() > maxHeight) maxHeight = $("#sidebar2").height();
	if ($("#mainContent").height() > maxHeight) maxHeight = $("#mainContent").height();
	$("#sidebar2").height(maxHeight);
/*
	$("#sidebar1 h3").each(function(index) {
		$(this).addClass('expandable');
    	$(this).next('ul').hide();
    	$(this).click(
    		function() { 
    		    $(this).next('ul').slideToggle();
			}
    	);
  	});
*/	
	$("#search-box").focus(function(){
		if ($(this).val() == "search") {
			$(this).val("");
		}
	});
	$("#search-box").blur(function(){
		if ($(this).val() == "") {
			$(this).val("search");
		}
	});
});
