function moveArrow() {
	chosen = $(this);
	position = chosen.position();
	arrow = $("div#header-arrow");
	arrow.clearQueue();
	toMove = position.left + chosen.width()/2 - 5;  // offset from the size of the arrow 5
	arrow.animate({left: toMove}, "fast");
	submenu = $("div#header-navigation");
	if(chosen.index()==1)
		submenu.slideDown("fast");
	else
		submenu.slideUp("fast");
}

function clearInput() {
	input = $(this);
	input.val('');
	input.unbind("click");	
}

jQuery.fn.tabs = function() {
    var o = $(this[0]);
	o.find('li a').each(function() {
		$(this).click(function() {
			clicked = $(this);
			if(clicked.attr("href").length<=1)
				return true;
			o.find("li.active").removeClass("active");
			clicked.parent().addClass("active");
			o.find("div.body-tab").hide();
			$("div"+clicked.attr("href"),o).show();
		});		
	});
	o.find("li a").eq(0).trigger("click");
};

$(function() {
	$("ul#menu").children().each(function() 
	{
		$(this).mouseover(function()
		{
			chosen = $(this);
			position = chosen.position();
			arrow = $("div#header-arrow");
			arrow.clearQueue();
			toMove = position.left + chosen.width()/2 - 5;  // offset from the size of the arrow 5
			arrow.animate({left: toMove}, "fast");
			var submenu = $("div#header-navigation");
			if(chosen.index()==1)
				submenu.slideDown("fast");
			else
				submenu.slideUp("fast");	
		}						   							   
	);
		
		
	});
	$("ul#menu").children("li.active").trigger("mouseover");
	
	$('div#header-search input[type="text"]').each(function() {
		$(this).click(clearInput);	
	});
	
//	$("div#body-tabs").tabs();
});
