// Generic form functions / events / behaviors
$(document).ready(function() {
	update_fields();
	
	$('#search_ride_date').attr('autocomplete','off');
	
	$('a.tip.clicktip').click(function() {
      $(this).removeClass('clicktip');
      $(this).blur( function() { $(this).addClass('clicktip')});
      return false;
    });

});

// This makes this global and callable from other functions
var update_fields = function(){
	// Look for any text fields that should maintain some default value
	$(".text_default").each(function(){
		// This is a weird check because if we use override, then we could have an empty 
		// field (in the case of an error on a reload)..
		if($(this).val() == ''){
			$(this).addClass('text-input-help');
			$(this).val($(this).attr('refid'));
		}
	});
	$(".text_default").blur(function(){
		if($(this).val() == ''){
			$(this).addClass('text-input-help');
			$(this).val($(this).attr('refid'));
		}
	});
	$(".text_default").bind('focus', function(){
		if($(this).val() == $(this).attr('refid')){
			$(this).removeClass('text-input-help');
			$(this).val('');
		}
		return true;
	});
	// Hook up the text_default form button to clear the text_default fields so the vals don't get submitted
	var el=$(".text_default:first").parents('form');
	
	$(el).bind('submit', function(){ clear_all_text_default_fields() });
}


	