$(document).ready(function(){
  $('#topmenu').css({
	'position':'absolute',
	'bottom':'0px',
	'margin-top':'0',
	'margin-right':'0',
	'margin-bottom':'0',
	'margin-left':'0',	
    'font-family':'Swis721 Blk BT',
    'text-transform':'uppercase',
    'font-size':'14px',
	'padding-top':'0',
	'padding-right':'10px',
	'padding-bottom':'10px',
	'padding-left':'10px'
  });
  $('.submenu').css({
	'position':'absolute',
	'bottom':'0px',
	'margin-top':'0',
	'margin-right':'0',
	'margin-bottom':'0',
	'margin-left':'0',
    'font-family':'Swis721 Lt BT',
    'text-transform':'uppercase',
    'font-size':'10px',
	'padding-top':'0',
	'padding-right':'10px',
	'padding-bottom':'10px',
	'padding-left':'10px'
  });
  $('#topmenu li, .submenu li').css({
	'list-style':'none',
	'display':'inline'
  });
  $('.submenu').each(function(){
	this.parentNode.submenu=this;
	$(this).detach();
	$('#menu').append(this);
  });
  $('.active').css('cursor','pointer');
  $('.active').click(function(){
  	$('.active').each(function(){
		this.current=false;
	});
  	this.current=true;
  	$('.active').each(function(){
		if(!this.current){
			$(this.parentNode.submenu).fadeOut(600);
		}
	});
	$(this.parentNode.submenu).fadeIn(600);
	$('#topmenu').animate({
		bottom:$(this.parentNode.submenu).height()+'px'
	},300);
  });
  $('.submenu').fadeOut(0);
  $('.active').each(function(){
	if($(this).hasClass('current')){
		$(this.parentNode.submenu).fadeIn(0);
		$('#topmenu').css('bottom',$(this.parentNode.submenu).height()+'px');
	}
  });
  $('.submenu li a').each(function(){
    if($(this).hasClass('current')){
      $(this.parentNode.parentNode).fadeIn(0);
      $('#topmenu').css('bottom',$(this.parentNode.parentNode).height()+'px');
    }
  });							 
});