function mainmenu(){
	$(" #topnav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(300);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	});
		
	$("#topnav li a.main").wrapInner( '<span class="out"></span>' ).append( '<span class="bg"></span>' );
	
	// loop each anchor and add copy of text content
	$("#topnav li a.main").each(function() {
		$( '<span class="over">' +  $(this).text() + '</span>' ).appendTo( this );
	});

	$("#topnav li a.main").hover(function() {
		// this function is fired when the mouse is moved over
		$(".out",	this).stop().animate({'top':	'45px'},	300); // move down - hide
		$(".over",	this).stop().animate({'top':	'0px'},		300); // move down - show
		$(".bg",	this).stop().animate({'top':	'0px'},		200); // move down - show
	}, function() {
		// this function is fired when the mouse is moved off
		$(".out",	this).stop().animate({'top':	'0px'},		300); // move up - show
		$(".over",	this).stop().animate({'top':	'-45px'},	300); // move up - hide
		$(".bg",	this).stop().animate({'top':	'-45px'},	200); // move up - hide
		
	});

}

$(document).ready(function(){					
	mainmenu();
});

