//Search used to display the sub search located to the top right of the title
var timer_input;
function hideSearchBackground() {
	$("#sub-navigation-search-input").hide();
}
function disableSearchInput() {
	$("#sub-navigation-text").html("");
	$("#sub-navigation-search").animate({ 'width' : '40px' }, 150, null, null);
	$("#sub-navigation-search-input").animate({ 'width' : '40px' }, 150, null, function() {hideSearchBackground()} );
}
$(document).ready(function() {
	$("#sub-navigation-links").show();
	$('#sub-nav-search-btn').show();
	$('#sub-navigation-search-input').hide();
	$("#rural-search").hover(
		function() {
			clearTimeout(timer_input);
			$("#sub-navigation-search-cover").css({ 'display' : 'none' });
			$("#sub-navigation-search").animate({ 'width' : '240px' }, 150, null, null);
			
			$("#sub-navigation-search-input").show();
			
			$("#sub-navigation-search-input").animate({ 'width' : '240px' }, 150, null, null);
		}, function () {
			timer_input = setTimeout("disableSearchInput()", 1000);
		}
	);
	$("#sub-navigation-search-input").hover(
		function() {
			clearTimeout(timer_input);
		}, function() {
			timer_input = setTimeout("disableSearchInput()", 1000);
		}
	);
});
