function initAutoComplete() {

	var sports = [
	{sport: "Aquatics", alt: "swimming"}, 
	{sport: "Basketball"},
	{sport: "Bocce"},
	{sport: "Bowling"},
	{sport: "Cycling"},
	{sport: "Equestrian", alt: "horseback riding"},
	{sport: "Figure Skating"},
	{sport: "Flag Football"},
	{sport: "Golf"},
	{sport: "Long Distance Running/Walking"},
	{sport: "Powerlifting"},
	{sport: "Roller Skating"},
	{sport: "Skiing, Alpine"},
	{sport: "Skiing, Nordic"},
	{sport: "Snowshoeing"},
	{sport: "Soccer"},
	{sport: "Softball"},
	{sport: "Tennis"},
	{sport: "Track & Field"},
	{sport: "Volleyball"}
	];
	$("#sports").autocomplete(sports, {
		minChars: 0, max: 5, delay: 250, matchContains: true, autoFill:false, selectFirst: false, highlight:false,
		formatItem: function(row) {return row.sport; },
	    formatMatch: function(row) {return row.sport + row.alt; },
	    formatResult: function(row) {return row.sport; }
	});

	var statesabbv = [
	{abbv: "AL", name: "Alabama"}, 
	{abbv: "AK", name: "Alaska"}, 
	{abbv: "AR", name: "Arkansas"}, 
	{abbv: "AZ", name: "Arizona"}, 
	{abbv: "CA", name: "California"}, 
	{abbv: "CO", name: "Colorado"}, 
	{abbv: "CT", name: "Connecticut"}, 
	{abbv: "DE", name: "Delaware"}, 
	{abbv: "FL", name: "Florida"}, 
	{abbv: "GA", name: "Georgia"}, 
	{abbv: "HI", name: "Hawaii"}, 
	{abbv: "ID", name: "Idaho"}, 
	{abbv: "IL", name: "Illinois"}, 
	{abbv: "IN", name: "Indiana"}, 
	{abbv: "IA", name: "Iowa"}, 
	{abbv: "KS", name: "Kansas"}, 
	{abbv: "KY", name: "Kentucky"},
	{abbv: "LA", name: "Louisiana"}, 
	{abbv: "ME", name: "Maine"}, 
	{abbv: "MD", name: "Maryland"}, 
	{abbv: "MA", name: "Massachusetts"}, 
	{abbv: "MI", name: "Michigan"}, 
	{abbv: "MN", name: "Minnesota"}, 
	{abbv: "MS", name: "Mississippi"}, 
	{abbv: "MO", name: "Missouri"}, 
	{abbv: "MT", name: "Montana"}, 
	{abbv: "NE", name: "Nebraska"}, 
	{abbv: "NV", name: "Nevada"}, 
	{abbv: "NH", name: "New Hampshire"}, 
	{abbv: "NJ", name: "New Jersey"}, 
	{abbv: "NM", name: "New Mexico"}, 
	{abbv: "NY", name: "New York"}, 
	{abbv: "NC", name: "North Carolina"}, 
	{abbv: "ND", name: "North Dakota"}, 
	{abbv: "OH", name: "Ohio"}, 
	{abbv: "OK", name: "Oklahoma"}, 
	{abbv: "OR", name: "Oregon"}, 
	{abbv: "PA", name: "Pennsylvania"}, 
	{abbv: "RI", name: "Rhode Island"}, 
	{abbv: "SC", name: "South Carolina"}, 
	{abbv: "SD", name: "South Dakota"}, 
	{abbv: "TN", name: "Tennessee"}, 
	{abbv: "TX", name: "Texas"}, 
	{abbv: "UT", name: "Utah"}, 
	{abbv: "VT", name: "Vermont"}, 
	{abbv: "VA", name: "Virginia"}, 
	{abbv: "WA", name: "Washington"}, 
	{abbv: "WV", name: "West Virginia"}, 
	{abbv: "WI", name: "Wisconsin"}, 
	{abbv: "WY", name: "Wyoming"}
	];
	//$("#state").autocomplete(stateabbv);
	$(".state").autocomplete(statesabbv, {
		minChars: 0, max: 5, delay: 250, matchContains: false,  autoFill:false,
		formatItem: function(row) {return row.name; },
	    formatMatch: function(row) {return row.abbv + row.name; },
	    formatResult: function(row) {return row.abbv; }
	});

}

function initArchiveMenu() {
	$('.archive-menu ul').hide();
	$('.archive-menu ul.current').show();
	$('.archive-menu li a').click(
	    function() {
	      var checkElement = $(this).next();
	      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
	        $('.archive-menu ul:visible').slideUp('normal');
	        return false;
	        }
	      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
	        $('.archive-menu ul:visible').slideUp('normal');
	        checkElement.slideDown('normal');
	        return false;
	        }
	      }
	);
}
function initSideColMenuOne() {
	$('ul.navcol li ul').hide();
	$('ul.navcol li.here ul').show();
	$('ul.navcol li ul li.here').parent().show();
//	$('ul.navcol li a').click(
//	    function() {
//	      var checkElement = $(this).next();
//	      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
//	        $('ul.navcol li ul:visible').slideUp('normal');
//	        return false;
//	        }
//	      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
//	        $('ul.navcol li ul:visible').slideUp('normal');
//	        checkElement.slideDown('normal');
//	        return false;
//	        }
//	      }
//	);
}

function setCalendar(){
	$('#calendar').height(540);
	$('#calendar').width(845);
	
	function setEqualHeight(rows,columns) {
		var tallestcolumn = 85;
		var numberofrows = 0;
		rows.each( function() {
			numberofrows += 1;
			if(numberofrows == 6) {
				tallestcolumn = 70;
			}
		});
		columns.each( function() {
			currentHeight = $(this).height();
			if(currentHeight > tallestcolumn) {
				tallestcolumn2 = currentHeight;
			}
		});
		columns.height(tallestcolumn);
	}
	setEqualHeight($(".calendarRow"),$(".calendarRow > div.calendarCell"));
}


function initBigTargets() {
	$("div.bigTarget p a").bigTarget({
		hoverClass: 'over', // CSS class applied to the click zone onHover
		clickZone : 'div:eq(0)' // jQuery parent selector
	});		
	$("div.bigTarget h3 a").bigTarget({
		hoverClass: 'over', // CSS class applied to the click zone onHover
		clickZone : 'div:eq(0)' // jQuery parent selector
	});		
	$("div.bigTarget h5 a").bigTarget({
		hoverClass: 'over', // CSS class applied to the click zone onHover
		clickZone : 'div:eq(0)' // jQuery parent selector
	});		
}
function initMegaDrops() {
	function addMega(){
		$(this).addClass("hovering");
	}
	function removeMega(){
		$(this).removeClass("hovering");
	}
	var megaConfig = {
		interval: 500,
		sensitivity: 4,
		over: addMega,
		timeout: 500,
		out: removeMega
	};
	$("li.mega").hoverIntent(megaConfig)
}

$(document).ready(function() {
	initAutoComplete();
	initArchiveMenu();
	initSideColMenuOne();
	setCalendar();
	initBigTargets();
	initMegaDrops();
	});
