//JQuery Setup
$(function(){
 
//Important functions to fire first!
//-------------------------------------------------------------------------------
  	
	//IE6 duct tape
  	//detects if browser is IE by checking leadingWhitespace property. 
  	//See: http://docs.jquery.com/Utilities/jQuery.support
	var fancyHover = $.support.leadingWhitespace;
	if(fancyHover == false) {//browser is IE, use script
		$('#nav li, #nav2 li').bind('mouseenter mouseleave', function(){
			$(this).toggleClass('sfhover');
		});	
	}
	
//Toggle functions
//---------------------------------------------------------------------------------
	
	// Show only when javascript is available
	$('.toggle-link').css('display','block');

	//hide lists first!
	$('#toggle-content li div').css('display','none');	

	//toggle
	function toggleInfoContent(id){
		if($('#' + id).css('display') != 'none'){
		  $('#' + id).hide();
		}else{
		  $("#toggle-content li div").hide();
		  $('#' + id).show();
		}
	}

//Basic HTML functions
//---------------------------------------------------------------------------------

		// add 'back to top' link when the content is taller than the window
	// this has to be done after flash replacement because the content height changes
	if ($('#main').height() > $(window).height()) {
	$('.top').removeClass('hide');
	}
	
	// Some effects rely on an element to be initially hidden,
	// but we only hide them if the user has javascript
	$('.jshide').addClass('hide');
	
	
	//clear form fields
	$('.clearme').one("focus", function() {
			$(this).val("");
	});

	// Open external links in new windows
	//$('a[href^="http://"]').addClass('external').attr('target', '_blank');
	
	
	// Open pdf links in new windows
	$('a[href$=".pdf"]').addClass('pdf').attr('target', '_blank');

});//end document.ready
