$(document).ready(function() {

// START: Search by function
$(".searching").eq(1).hide();
//$(".searching > label").hide();

$(".search_by").click(function() {

	$(".search_by").removeClass("active");
	$(".searching").hide();

	var elName = $(this).attr('name');
	$(this).addClass("active");
	$(".searching." + elName).show();

	$("#search_type").val(elName);

	return false;

});
// END: Search by function


//$("#incidents").click(function() { 
//
//});


//START: Search form on results page
$("body.without_intro.tool #incidents , #search_close").hide();

$("#search_again, #search_again_link").click(function() {
	$("body.without_intro #incidents").fadeIn('medium');
	$("#search_again").fadeOut('fast');
	$("#search_close").fadeIn('medium');
	return false;
});

$("#search_close").click(function() {
	$("body.without_intro #incidents").fadeOut('fast');
	$("#search_again").fadeIn('medium');
	$("#search_close").fadeOut('fast');
	return false;
});

});

$(document).ready(init);
function init()
{

	// OPTIONALLY SET THE DATE FORMAT FOR ALL DATE PICKERS ON THIS PAGE
	$.datePicker.setDateFormat('mdy', '/');
	
	// OPTIONALLY SET THE LANGUAGE DEPENDANT COPY IN THE POPUP CALENDAR
	/*
	$.datePicker.setLanguageStrings(
		['Domingo', 'Lunes', 'Martes', 'Mi�rcoles', 'Jueves', 'Viernes', 'S�bado'],
		['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
		{p:'Anterior', n:'Siguiente', c:'Cierre', b:'Elija la fecha'}
	);
	*/
	
	// DIFFERENT OPTIONS SHOWING HOW YOU MIGHT INITIALISE THE DATE PICKER (UNCOMMENT ONE AT A TIME) //
	
	// all inputs with a class of "date-picker" have a date picker which lets you pick any date in the future
	//$('input.date-picker').datePicker();
	// OR
	// all inputs with a class of "date-picker" have a date picker which lets you pick any date after 05/03/2006
	//$('input.date-picker').datePicker({startDate:'05/03/2006'});
	// OR
	// all inputs with a class of "date-picker" have a date picker which lets you pick any date from today till 05/011/2006
	//$('input.date-picker').datePicker({endDate:'05/11/2006'});
	// OR
	// all inputs with a class of "date-picker" have a date picker which lets you pick any date from 05/03/2006 till 05/11/2006
	//$('input.date-picker').datePicker({startDate:'05/03/2006', endDate:'05/11/2006'});
	// OR 
	// the input with an id of "date" will have a date picker that lets you pick any day in the future...
	$('input#idate_start').datePicker({startDate:'01/01/1992', endDate:'12/30/2007'});
	// ...and the input with an id of "date2" will have a date picker that lets you pick any day between the 02/11/2006 and 13/11/2006
	$('input#idate_end').datePicker({startDate:'01/01/1992', endDate:'12/30/2007'});

	/*
	// testing code to check the change event is fired...
	$('input#date1').bind(
		'change',
		function()
		{
			alert($(this).val());
		}
	);
	*/
	
	// END DIFFERENT OPTIONS //
}
