var t1;
var t2;
var t3;
var t4;
function clearSubNav1(){
	$("#New_Yachts_Subnav").slideUp(100);
}
function clearSubNav2(){
	$("#Brokerage_Subnav").slideUp(100);
}
function clearSubNav3(){	
	$("#Services_Subnav").slideUp(100);
}
function clearSubNav4(){	
	$("#Company_Subnav").slideUp(100);
}
	

$(document).ready(function() {
						   
	$("#NEWYACHTS").hover(
		function() {
			clearTimeout(t1);
			$("#New_Yachts_Subnav").slideDown("fast");
		},
		function() {
			t1 = setTimeout("clearSubNav1()", 100);
		}
	);
	$("#New_Yachts_Subnav").hover(
		function() {
			clearTimeout(t1);
		},
		function() {
			t1 = setTimeout("clearSubNav1()", 100);
		}
	);
	$("#BROKERAGE").hover(
		function() {
			clearTimeout(t2);
			$("#Brokerage_Subnav").slideDown("fast");
		},
		function() {
			t2 = setTimeout("clearSubNav2()", 100);
		}
	);
	$("#Brokerage_Subnav").hover(
		function() {
			clearTimeout(t2);
		},
		function() {
			t2 = setTimeout("clearSubNav2()", 100);
		}
	);
	$("#SERVICES").hover(
		function() {
			clearTimeout(t3);
			$("#Services_Subnav").slideDown("fast");
		},
		function() {
			t3 = setTimeout("clearSubNav3()", 100);
		}
	);
	$("#Services_Subnav").hover(
		function() {
			clearTimeout(t3);
		},
		function() {
			t3 = setTimeout("clearSubNav3()", 100);
		}
	);
	$("#COMPANY").hover(
		function() {
			clearTimeout(t4);
			$("#Company_Subnav").slideDown("fast");
		},
		function() {
			t4 = setTimeout("clearSubNav4()", 100);
		}
	);
	$("#Company_Subnav").hover(
		function() {
			clearTimeout(t4);
		},
		function() {
			t4 = setTimeout("clearSubNav4()", 100);
		}
	);
	
	$("#Flags").toggle(
		function() {
			$("#Translate_Box").fadeIn("fast");
			$("#Flags").html("<img src=\"images/close.png\" alt=\"Close\" title=\"Close\">");
		},
		function() {
			$("#Translate_Box").fadeOut("fast");
			$("#Flags").html("<img src=\"images/flags.gif\" alt=\"Translate This Site\" title=\"Translate This Site\">");
		}
	);
	
	$("#PNWMORE").toggle(
		function() {
			$("#PNW_More_Box").fadeIn("fast");
			$("#PNWMORE").empty();
			$("#PNWMORE").append("<img src=\"images/minus.gif\" alt=\"-\"> close");
		},
		function() {
			$("#PNW_More_Box").fadeOut("fast");
			$("#PNWMORE").empty();
			$("#PNWMORE").append("<img src=\"images/plus.gif\" alt=\"+\"> more...");
		}
	);
	
	$("#WCMORE").toggle(
		function() {
			$("#WC_More_Box").fadeIn("fast");
			$("#WCMORE").empty();
			$("#WCMORE").append("<img src=\"images/minus.gif\" alt=\"-\"> close");
		},
		function() {
			$("#WC_More_Box").fadeOut("fast");
			$("#WCMORE").empty();
			$("#WCMORE").append("<img src=\"images/plus.gif\" alt=\"+\"> more...");
		}
	);
	
	$("#FROMLENGTH").change(
		function() {
			var fromLengthVal = $("#FROMLENGTH").val();
			if(parseInt(fromLengthVal) < 40 || !fromLengthVal){
				$("#FROMLENGTH").val('40');
			}
		}
	);
	
});

function subPNWSearch(){
	document.pnw_search.submit();
}
function subWCSearch(){
	document.wc_search.submit();
}
