var fadeInTime = 400;
var fadeOutTime = 400;
var menuTop = '45px';
$(document).ready(function() {		
	$("#header").removeClass("noJavascript");
	$("#header .animate").hover(function() {
			// on hovering over, find the element we want to fade *up*
			var fade = $('> span:eq(0)', this);
			// if the element is currently being animated (to a fadeOut)...
			if (fade.is(':animated')) {
				// ...take it's current opacity back up to 1
				fade.stop().fadeTo(fadeInTime, 1);
			} else {
				// fade in quickly
				fade.css({opacity:'', display:'none'});
				fade.fadeIn(fadeInTime);
			}
		}, function () {
			// on hovering out, fade the element out
			var fade = $('> span:eq(0)', this);
			if (fade.is(':animated')) {
				fade.stop().fadeTo(fadeOutTime, 0);
			} else {
				// fade away slowly
				fade.fadeOut(fadeOutTime);
			}
	});
	//$("#header li > ul").each(function(i) { $(this).css({top:45-$(this).height()}); });
	$("#header li").hover(function() {
			var menu = $('> ul', this);
			if(menu) {
				menu.css({display:'block', top:menuTop});
				if (menu.is(':animated')) {
					// ...take it's current opacity back up to 1
					menu.stop().fadeTo(fadeInTime, 1);
					//menu.stop().animate({top:menuTop}, fadeInTime);
				} else {
					// fade in quickly
					menu.css({opacity:'', display:'none'});
					menu.fadeIn(fadeInTime);
				}
				
			}
		}, function() {
			var menu = $('> ul', this);
			if (menu.is(':animated')) {
				menu.stop().fadeTo(fadeOutTime, 0);
			} else {
				// fade away slowly
				menu.fadeOut(fadeOutTime);
			}
		});
	
	//$(".sf-menu").superfish({ animation: {opacity:'show',height:'show'} });
	
	$("a.thumb").fancybox({ 'hideOnContentClick': true }); 
	
	// FIND AND SET EXTERNAL LINKS
	$("a[rel='external']").attr('target', '_blank');
	
});
function e(msg) {
	$("#action").html(msg);
}
