$(document).ready(function(){

	// Define button rollover behaviors
	var image_path = '/wp-content/themes/opennms/images/';
	$('.home #download-now').hover(function(){ $(this).attr('src', image_path + 'download-now-rollover.png'); }, function(){ $(this).attr('src', image_path + 'download-now.png'); });
	$('.page #download-now').hover(function(){ $(this).attr('src', image_path + 'download-now-small-rollover.png'); }, function(){ $(this).attr('src', image_path + 'download-now-small.png'); });
	$('.blog #download-now').hover(function(){ $(this).attr('src', image_path + 'download-now-small-rollover.png'); }, function(){ $(this).attr('src', image_path + 'download-now-small.png'); });
	$('#take-the-tour').hover(function(){ $(this).attr('src', image_path + 'take-the-tour-rollover.png'); }, function(){ $(this).attr('src', image_path + 'take-the-tour.png'); });

	// Define About OpenNMS menu and subsection behavior for the home page
	$('.about-opennms-section').not('.current').css('display', 'none');
	$('#about-opennms-menu li a').click(function(){
		if (!$(this).hasClass('current')){
			$('#about-opennms-menu li a.current').removeClass('current');
			$(this).addClass('current');
			$('.current.about-opennms-section').removeClass('current').fadeOut(500, function(){ $('.current.about-opennms-section').fadeIn(500); });
			$('#about-opennms-' + $(this).text()).addClass('current');
		}
		return false;
	});

	// Redirect when the archive drop-down menu is changed
	$('#archive-drop-down').change(function(){
		var archive_menu = $(this);
		if (archive_menu.attr('options')[archive_menu.attr('selectedIndex')].value != ''){
			document.location.href = archive_menu.attr('options')[archive_menu.attr('selectedIndex')].value;
		}
	});
});
