$(document).ready(function() {
var temp = 'Enter Coach Name';
	//This will remove the input text on focus and return it on blur
	$('#searchBox').focus(function()
	{
		$(this).val('');
	})
	
	$('#searchBox').blur(function()
	{
		$(this).val(temp);
	})


	//updates the search text box every time the radio changes
$("input[type='radio']").change(function()
{
	if($(this).val() == 'school' && $('#searchBox').text()=='')
	{
		temp = 'Enter School or University'
		$('#searchBox').val(temp);
	}
	
	if($(this).val() == 'name' && $('#searchBox').text()=='')
	{
		temp = 'Enter Coach Name';
		$('#searchBox').val(temp);
	}

})

/*
function hideLoader()
{
	$('#livesearch').css('background-image','none');
}

function showLoader()
{
	$('#livesearch').css('background-image', "url('../images/loader.gif')");
}




	$("#livesearch").keyup(function(event){
		liveSearch('query='+$(this).val()+'&cat='+$('input:radio[name=category]:checked').val());
		

	});
	
	$("#submitbutton").click(function(){
	
		getResults();
	
	});

//prevents the form from being submitted, gets the search category, replaces spaces with _ and submits it to proper
//searching function	
$('#search').submit(function(e) {
	e.preventDefault();

	window.location = 'search/'+$('input:radio[name=category]:checked').val()+'/'+$('#livesearch').val().replace(/ /gi,'_');
 	return false;
});
	
function liveSearch(liveQuery)
{
	showLoader();
		$.post("search/livesearch", liveQuery,
		   function(data){
		   if(data==null)
		   {
		   	$("#liveSearchResults").hide();
		   	hideLoader();
		   	}
		   	else
		   	{
		   $("#liveSearchResults").css('visibility','visible').html(data).hide().fadeIn(function(){
		   hideLoader();
		   });
		   
		  }
		  });
}	


$("#userTestingForm").submit(function(e)
{
	e.preventDefault();
	$.post("home/userTestingSignUp", $(this).serialize(), function(data){
	alert("Thanks for your support "+data+"!");
	$("#userTesting").hide();
	});
})
*/

});
