//JQuery Setup
$(function(){
 
//Important functions to fire first!
//-------------------------------------------------------------------------------

	//IE6 duct tape
	$('#nav ul li, #utility-nav ul li').bind('mouseenter mouseleave', function(){
		$(this).toggleClass('sfhover');
	});
	


	//cookies
	
	//set cookie handler
	var displayAlertBox = $.cookie('iealert');
	//if cookie val 'false' then hide message - user has already seen this message!
	if(displayAlertBox == 'false')
	{
		$('#ie_alert').css('display', 'none');
	}
	else
	{
		$('#ie_alert').css('display', 'block');
	}
	//click to close behavior
	$('.ie-alert-link').click(function(){
		$('#ie_alert').slideToggle("slow");
		$.cookie('iealert', 'false', { expires: 14 });
	});
	
	
	//png fix
	//must reference jquery.pngFix1.2.js in order to work
	$(document).pngFix();


//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 ($('#content').height() > $(window).height()) {
		$('.back-to-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://"]').not('[href*="goldmansofflorida.com"]').addClass('external').attr('target', '_blank');
	
	// Open pdf links in new windows
	$('a[href$=".pdf"]').addClass('pdf').attr('target', '_blank');


	//Form Functions
	//---------------------------------------------------------------------------------


});//end document.ready