var killtimer = '';
	function startup()
	{
		$(".inp").toggleVal("active");
	
		//setup nav hovers
		$(".nav").hover(function() {
			var isrc = $(this).attr("src").replace(".jpg","_on.jpg");
			$(this).attr({"src":isrc});
			popit($(this).attr("id"));
		},function() {
			var isrc = $(this).attr("src").replace("_on.jpg",".jpg");
			$(this).attr({"src":isrc});
			killtimer = setTimeout("killpop()",300);
		});
		
		$("#pop").hover(function() {
			clearTimeout(killtimer);
		},function() {
			killtimer = setTimeout("killpop()",300);
		});
		
		//setup nav clicks
		$(".nav").click(function() {
			var href = $(this).attr("id")+".php";
			window.location = href;
		});
	}
	
	function killpop()
	{
		$("#pop").fadeOut("fast",function() { });
	}
	
	function popit(id)
	{
		if (killtimer != '') clearTimeout(killtimer);
		var x = $("#"+id).position()['left'];
		if (id == 'contact') x = x - 70;
		var y = $("#"+id).position()['top'] - 54;
		var isrc = "images/pop_" + id + ".png";
		$("#pop").css({"left":x,"top":y});
		$("#pop img").attr({"src":isrc});
		$("#pop").fadeIn(100,null);
	}
	
	function sendform()
	{
		//first validate
		var valid = true;
		$(".inp").each(function() {
			var id = $(this).attr("id");
			if ($(this).val() == id) valid = false;
			if (id == 'comments' && $(this).val() == 'questions, concerns, or comments') valid = false;
		});
		
		//if invalid
		if (!valid) 
		{
			$.prompt("Please fill in at least your name and either a phone number or email address so we can get back to you.");
			return false;
		}
		else
		{		
			//now send
			$("#cform").fadeOut("normal",function() {
				var str = $(".inp").serialize();
				$.ajax({
					type:"POST",
					url:"ajax.php",
					data:"action=sendform&"+str,
					success:function(resp) {
						$("#thanks").fadeIn("normal",null);
					}
				});
			});
		}
	}
