$(document).ready(function(){
	(function() {
	//settings
	var fadeSpeed = 200, fadeTo = 0.5, topDistance = 30;
	var topbarME = function() { $('#topheader').fadeTo(fadeSpeed,1); }, topbarML = function() { $('#topheader').fadeTo(fadeSpeed,fadeTo); };
	var inside = false;
	//do
	$(window).scroll(function() {
	position = $(window).scrollTop();
	if(position > topDistance && !inside) {
	//add events
	topbarML();
	$('#topheader').bind('mouseenter',topbarME);
	$('#topheader').bind('mouseleave',topbarML);
	inside = true;
	}
	else if (position < topDistance){
	topbarME();
	$('#topheader').unbind('mouseenter',topbarME);
	$('#topheader').unbind('mouseleave',topbarML);
	inside = false;
	}
	});
	})();
});
