jQuery(document).ready(function(){
	// initilize drop down navigation using superfish plugin
	//$(".nav").superfish();
	
	//initialize login form toggle link
	$("#link_login").click(function () {
		//console.log("show login form");
		$("#form_login").show();
		//$(this).toggleClass("active");
		return false;
	});
	
	$(".accordion").accordion({ header: "h3", autoHeight: false });
	
	// animate nav mouseovers
	$('.nav a').mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500})
		}).mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 -174px)"}, {duration:500})
		});

	//add datepickers for start and end dates for news and calendars
	$("#date_start").datepicker({ dateFormat: $.datepicker.ATOM, showOn: "both", buttonImage: "images/icons/calendar.gif", buttonImageOnly: true });
	$("#date_end").datepicker({ dateFormat: $.datepicker.ATOM, showOn: "both", buttonImage: "images/icons/calendar.gif", buttonImageOnly: true });
	
	//load wymeditor on textarea in CMS
	$(".richtext").wymeditor();
	$('#submit_button').click(function(){
		// the update command gets the 1st wymeditor on the page using (0)
		$.wymeditors(0).update();
		$('#form_admin').submit();
	});
	
	// fix IE CSS hover flicker
	try {
		document.execCommand('BackgroundImageCache', false, true);
	} catch(e) {}

});
