		
jQuery(document).ready(function(){ 
	
	// set vars for IE
	if (jQuery.browser.msie) {
	  if(parseInt(jQuery.browser.version) == 8) {
			var isIE8 = true;
		}
		if(parseInt(jQuery.browser.version) == 6) {
			var isIE6 = true;
		}
	  
	}
	
	// Don't apply styledSelect to IE8
	// Backburner - need to find solution for this (possible bug in the styled select code)
	if (!isIE8 && !isIE6){
			jQuery('form#quick_links_form select').styledSelect({
				selectClass: 'asmp_select',
				deactiveOnBackgroundClick: true
		  });
	}
	
	jQuery("ul.nice-menu a").removeAttr("title");
	jQuery("ul.nice-menu li ul li:last-child").addClass("no_bg");
	
	jQuery("ul.nice-menu li ul li").hover(function(){
		jQuery(this).parent("ul").parent("li").find("a:first").addClass("red-hover");
	}, function (){
		jQuery(this).parent("ul").parent("li").find("a:first").removeClass("red-hover");
	});

	jQuery('div#block-menu-menu-news-sidebar div.content ul li ul')
			.parent('li').children('a')
			.css({'cursor':'default'})
			.click(function(e){ e.preventDefault();});
		
	equalHeight(jQuery("div.home_column"));
	
	jQuery('a[href^="http://"]')
	  .attr({
	    target: "_blank"
	 });

	jQuery('a[href^="http://asmp.org"]').removeAttr('target');

	// Menu offset - MJD 6/8/2009
	// Updated by JK 6/16/2009
	// determine if the <ul> element has
	// children "below the fold", and if so, sets a negative top offset (margin-top)
	var smart_menus_enabled = true;
	
	if ( smart_menus_enabled ) {
	
		jQuery('#main_menu_container .menuparent').hover(
			function(){
			
				//if(jQuery(this).children('ul').children('li:last:below-the-fold').length > 0) {
				//alert( jQuery(this).attr('class') );
					
				jQuery(this).children('ul').each(
					function() {
						var offset = jQuery(this).offset();
						
						//34px is just a magic margin number right now --
						// there's probably a more slick way to do this
						if ( (offset.top + jQuery(this).height()) > jQuery(document).scrollTop() + jQuery(window).height() ) {
							// ensure the computed negative margin wont put the menu out of the viewport
							if( !((offset.top - (jQuery(this).height() + 34)) < 0) ) {
								jQuery(this).css('margin-top', 0 - jQuery(this).height() + 34 );
							}
						}
						
					}
				);

			},
			function()  {
			}
		);
	}	
		
}); 
	
	function equalHeight(group) {
		tallest = 0;
		group.each(function() {
			thisHeight = jQuery(this).height();
			if(thisHeight > tallest) {
				tallest = thisHeight;
			}
		});
		group.height(tallest);
		group.wrap("<div class='wrap1'><div class='wrap2'></div></div>").after("<div class='clear'></div>");
		
	}
