jQuery(
	function()
	{
		jQuery('#headerSearchForm').submit(
			function()
			{
				var zip = jQuery.trim(jQuery("#headerZipBox").val());
				jQuery("#headerZipBox").val(zip);
				var RE = /^\d{5}$/;
				if(!RE.test(zip))
				{
					jQuery("#zipText").addClass("error");
					return false;
				}
			}
		);

		var initialValue = $('#headerSearchBox').val();

		// Query clearing, ala aroundme
		$('#headerSearchBox').focus(function()
		{
			if ($(this).val() == initialValue)
			{
				$(this).val("");
			}
		});

		$('#headerSearchBox').blur(function()
		{
			if ($(this).val() == "")
			{
				$(this).val(initialValue);
			}
		});

		$(".school_info_fancybox").fancybox({
			'autoDimensions' : false,
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade',
			'width'			: 600,
			'height'		: 650,
			ajax : {
				type	: "GET"
			}

		});

		$(".prog_desc_fancybox").fancybox({
			'hideOnContentClick': true,
			'autoDimensions' : false,
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade',
			'width'			: 600,
			'height'		: 650,
			ajax : {
				type	: "GET"
			}

		});

		// Display a fancybox explaining why we need correct zip codes,
		// if the entered zip contains non-numeric characters
		$('#headerZipBox').change(
			function(event) {
				var zip = jQuery.trim(jQuery("#headerZipBox").val());

				var RE = /^\d{5}$/;
				if(!RE.test(zip))
				{
					$('#zipTextCell').fancybox({
						'hideOnContentClick': true,
						'autoDimensions' : false,
						'transitionIn'	: 'fade',
						'transitionOut'	: 'fade',
						'width'			: 300,
						'height'		: 100,
						'onClosed'		: function(){
							$("#headerZipBox").focus();
						},
						'content': '<span id="zipError" style="font-size: 14px;">Please enter your correct five-digit U.S. zip code.  Program offerings may differ by geographic location; this helps us find the right program for you.</span>'
					});
					$('#zipTextCell').trigger('click');
				}
		});
	}
);

var lead_values = {};

function ajax_question(question_id)
{
	$.ajax({
		type: "POST",
		url: "/ajax/set_question.php",
		data: "phpsessionid="+phpsessionid+"&q="+question_id,
		success: function(msg){}
	});
}
