/* --------------------------------------------------------------------
	Input help text
	by Joe Lencioni, http://webservices.blog.gustavus.edu/2008/06/23/text-input-example-text-with-jquery/
-------------------------------------------------------------------- */
	
function switchText() {
	if ($(this).val() == $(this).attr('title')) {
		$(this).val('').removeClass('hint');
	} else if ($.trim($(this).val()) == '') {
		$(this).addClass('hint').val($(this).attr('title'));
	}
}
	
function setupInputHinting(base) {

	$('input[type=text][title!=""]', base).each(function() {
		if ($.trim($(this).val()) == '') $(this).val($(this).attr('title'));
		if ($(this).val() == $(this).attr('title')) $(this).addClass('hint');
	}).focus(switchText).blur(switchText);
	
	$('form', base).submit(function() {
		$(this).find('input[type=text][title!=""]').each(function() {
			if ($(this).val() == $(this).attr('title')) $(this).val('');
		});
	});
}

$(document).ready(function() {
	setupInputHinting($("#main"));
	setupInputHinting($("#header"));
});
