$(document).ready(function(){

	$("ul.topnav li.main").mouseover(function() {

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).find("ul.subnav").show(); //Drop down the subnav on click
/*		if(!$(this).hasClass('main-selected')){
			$(this).find("img").attr('src', '/images/subnav-selected.gif');
		}
*/

		$(this).hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").hide(); //When the mouse hovers out of the subnav, move it back up
			if(!$(this).hasClass('main-selected')){
				$(this).find("img").attr('src', '/images/subnav.gif');
			}
			$(this).find("a").removeClass('over');
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("over"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

	$("ul.topnav li.main ul.subnav li.arrow").mouseover(function() {

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).find("ul.subnav2").show();
		//$(this).find("ul.subnav2").parent().find("a").addClass('over');

		$(this).hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav2").hide(); //When the mouse hovers out of the subnav, move it back up
			$(this).find("a").removeClass('over');
		});
	});

});

