var t1;
function clearSubNav1(){
	$("#Services_Sub").slideUp(100);
}
var t2;
function clearSubNav2(){
	$("#About_Sub").slideUp(100);
}

$(document).ready(function() {
						   
	$("#SERV").hover(
		function() {
			clearTimeout(t1);
			var newTop = $(this).position().top + 30;
			var newTopStr = newTop + "px";
			var newLeft = $(this).position().left;
			var newLeftStr = newLeft + "px";
			$("#Services_Sub").css({'top': newTopStr, 'left': newLeftStr});
			$("#Services_Sub").slideDown(250);
		},
		function() {
			t1 = setTimeout("clearSubNav1()", 150);
		}
	);
	$("#Services_Sub").hover(
		function() {
			clearTimeout(t1);
		},
		function() {
			t1 = setTimeout("clearSubNav1()", 150);
		}
	);
	
	$("#ABOUT").hover(
		function() {
			clearTimeout(t2);
			var newTop = $(this).position().top + 30;
			var newTopStr = newTop + "px";
			var newLeft = $(this).position().left;
			var newLeftStr = newLeft + "px";
			$("#About_Sub").css({'top': newTopStr, 'left': newLeftStr});
			$("#About_Sub").slideDown(250);
		},
		function() {
			t2 = setTimeout("clearSubNav2()", 150);
		}
	);
	$("#About_Sub").hover(
		function() {
			clearTimeout(t2);
		},
		function() {
			t2 = setTimeout("clearSubNav2()", 150);
		}
	);
	
	$("#More_Search").toggle(
		function() {
			$("#Hidden_Search").slideDown(400);
			$(this).empty();
			$(this).append("hide extra options");
		},
		function() {
			$("#Hidden_Search").slideUp(400);
			$(this).empty();
			$(this).append("more options");
		}
	);
	
	$("#Make_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Manufacturer or model..."){
				$(this).val("");
			}
		}
	);
	$("#Make_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Manufacturer or model...");
			}
		}
	);
	
	$("#Length1_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Min. length..."){
				$(this).val("");
			}
		}
	);
	$("#Length1_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Min. length...");
			}
		}
	);
	
	$("#Length2_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Max. length..."){
				$(this).val("");
			}
		}
	);
	$("#Length2_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Max. length...");
			}
		}
	);
	
	$("#Price1_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Min. price..."){
				$(this).val("");
			}
		}
	);
	$("#Price1_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Min. price...");
			}
		}
	);
	
	$("#Price2_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Max. price..."){
				$(this).val("");
			}
		}
	);
	$("#Price2_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Max. price...");
			}
		}
	);
	
	$("#Year1_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Min. year..."){
				$(this).val("");
			}
		}
	);
	$("#Year1_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Min. year...");
			}
		}
	);
	
	$("#Year2_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Max. year..."){
				$(this).val("");
			}
		}
	);
	$("#Year2_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Max. year...");
			}
		}
	);
	
	$("#Name_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Name..."){
				$(this).val("");
			}
		}
	);
	$("#Name_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Name...");
			}
		}
	);
	
	$("#Email_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Email..."){
				$(this).val("");
			}
		}
	);
	$("#Email_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Email...");
			}
		}
	);
	
	$("#Message_Input").focus(
		function() {
			var vstr = $(this).val();
			if(vstr == "Message..."){
				$(this).val("");
			}
		}
	);
	$("#Message_Input").blur(
		function() {
			var vstr = $(this).val();
			if(vstr == ""){
				$(this).val("Message...");
			}
		}
	);
	
	$("#About_Tabs a").click(
		function() {
			$("#About_Tabs a").removeClass('active');
			$(this).addClass('active');
			$(".about_pane").hide();
			var paneId = "#" + $(this).attr('rel');
			$(paneId).show();
		}
	);
	
});
