$(document).ready(function() {

	var timer;
	var timer2;
	
	$('a.new-window').attr("target", "_blank");
	$('#socialmedia').hide();
	$('#socialmedia').fadeIn(2000);
   
   $("#logo .presspage").hide();
   
	$("#logo .logo").hover(function(){
		$("#logo .presspage").slideDown();
		clearTimeout(timer);
		clearTimeout(timer2);
	});
	
	$("#logo .logo").mouseout(function(){
		timer = setTimeout("checkHovered();", 1500);
	});
	
	$("#logo .presspage").hover(function(){
		clearTimeout(timer);
		clearTimeout(timer2);
		$("#logo .presspage").addClass("hovered");
	});
	
	$("#logo .presspage").mouseout(function(){
		$("#logo .presspage").removeClass("hovered");
		timer2 = setTimeout('$("#logo .presspage").slideUp()', 1500);
	});
	
	$(function() {
		/*
			Task	: Swap formfield
			Usage	: applies to all formfield with specific classname.
		*/
		swapValues = [];
		$("#search .query").each(function(i){
			swapValues[i] = $(this).val();
			$(this).focus(function(){
				$(this).css("color", "#3d3d3d");
				if ($(this).val() == swapValues[i]) {
					$(this).val("");
				}
			}).blur(function(){
				if ($.trim($(this).val()) == "") {
					$(this).val(swapValues[i]);
					$(this).css("color", "#BBBBBB");
				}
			});
		});
	});

});

  function checkHovered() { 
		if(!$("#logo .presspage").hasClass("hovered")) {
			$("#logo .presspage").slideUp(); 
		}
	}