jQuery.fn.topLink = function(settings) {
  settings = jQuery.extend({
    min: 1,
    fadeSpeed: 200
  }, settings);
  return this.each(function() {
    //listen for scroll
    var el = $(this);
    el.hide(); //in case the user forgot
    $(window).scroll(function() {
      if($(window).scrollTop() >= settings.min)
      {
        el.fadeIn(settings.fadeSpeed);
      }
      else
      {
        el.fadeOut(settings.fadeSpeed);
      }
    });
  });
};

$(document).ready(function() {
	/*
	$('li#menu').mouseover(function() {
		$(this).nextAll('li').toggle();
	});
	*/
	$('li#submenu').mouseover(function() {
		$(this).children('.orange').css('color','red');
	});
	$('li#submenu').mouseout(function() {
		$(this).children('.orange').css('color','orange');
	});
	
	$('a[href=#topscroll]').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	});
	$('#top-link').topLink({
		min: 400,
		fadeSpeed: 500
	});
});
