jQuery(function ($) {
	$.facebox.settings.opacity = .3;
	$('#newsletter-opener').click( function () {
		$.facebox($('#newsletter-wrap').html());
		return false;
	});
	
	$(document).bind('reveal.facebox', function () {
		$('p.submit-line a', '#facebox').bind('click', function () {
			$(document).trigger('close.facebox');
			return false;
		});		
	});
	
	
	/*	- Quicksearch label hider
	 ----------------------------------*/
	var $quickSearch = $('#q', '#quicksearch');
	
	if ($quickSearch.length > 0) {	
		// On page load
		if ($quickSearch.val().length === 0) {
			$quickSearch.removeClass('focus');
		} else {
			$quickSearch.addClass('focus');
		}
		
		// On focus
		$quickSearch.focus( function () {
			$(this).addClass('focus');
		}).blur( function () {
			if ($quickSearch.val().length === 0) {
				$quickSearch.removeClass('focus');
			}
		});
	}
	
	// IE6 Sucks!
	if (typeof document.body.style.maxHeight === 'undefined') {
		$('#nav > ul > li').hover( function () {
			var $this = $(this);
			if (!$this.hasClass('expanded') && !$this.hasClass('selected')) {
				$(this).addClass('hover');
			}
		}, function () {
			$(this).removeClass('hover');
		});
	}
	
});