// code for navigation

$(document).ready(function() {
	$(".nav").ready(function() { // scan the page for any navigations
		
		$(".sub").parent().mouseover(function(){
			$(this).children(".sub").show(); // show the sub menu
		});

		$(".sub").parent().mouseout(function(){
			$(this).children(".sub").hide(); // hide the sub menu
		});

		$(".subthird").parent().mouseover(function(){
			$(this).children(".subthird").show(); // show the sub menu
		});
		
		$(".subthird").parent().mouseout(function(){
			$(this).children(".subthird").hide(); // hide the sub menu
		});


	});
		
	$(".main-op h4").click(function(){
		//$("#careers-op").removeClass("active");
		//$(this).parent(".main-op").addClass("active");
		//$(this).find(".main-op-body").show();
		
		if (! $(this).closest('.main-op').hasClass('active'))
		{ 

			var filename = $('.active img:first').attr('src');
			filename = filename.substr(0, filename.length-11);
			$('.active img:first').attr('src', filename + ".gif");
			$('#careers-op .main-op-body').slideUp();
			$('#careers-op .main-op').removeClass('active');
			$(this).siblings('.main-op-body').slideDown();
			$(this).closest('.main-op').addClass('active');
			filename = $('.active img:first').attr('src');
			filename = filename.substr(0, filename.length-4);
			$('.active img:first').attr('src', filename + "_active.gif");
		}
		
		
	});

	$(".secNav").ready(function() {
		$(".sub2").hide(); // hide the sub menus
		
		$(".active .sub2").show(); //show the sub menu in the active LI		
		
		/*
		$(".sub2").parent().click(function(){
			$(this).children(".sub2").show(); // show the sub menu
		});
		*/
	});


	
});

