/* General Config */
/* *********************************************************************************/

var BASE_URL = '';

/* Window onload events */
/* *********************************************************************************/

$(window).load(function(){

	// Label new window links
	$('a.newwindow').each(function(){
		var append = '(This link opens in a new window)';
		if ($(this).attr('title')) append = $(this).attr('title') + ' ' + append;
		$(this).attr('title', append);
	});
	
});

$(function(){
	
	// .newwindow links to open in new window
	$('a.newwindow').live('click', function(){
		window.open(this.href);
		return false;
	});
	
	// remove input error class, if set
	$('input, textarea').live('focus', function(){
		$(this).removeClass('error');
	});
	
	// focus sign-up form (if visible on page load)
	$('#sign-up.visible input').first().focus();
	
	// show/hide sign-up form within main navigation
	$('.sign-up a, #sign-up h5').live('click', function(){
		$('#sign-up').toggleClass('visible');
		$('#sign-up input').first().focus();
		return false;
	});
	
	if(!$('.subnav li ul:visible').length)
	{
		showHideSubNav();
	}
	
});

function showHideSubNav() {
	$('.subnav li').live('click',function() {
		if($(this).children('ul:visible').length === 0)
		{
			$(this).children('ul').slideDown();
		}
		else
		{
			$(this).children('ul').slideUp();
		}
	});
}
