function handleTextFocus(thisControl) {
    //console.log('question has ' + $(thisControl).val());
    //console.log('question default is: ' + $(thisControl).attr('Hint'));
    //safelog('handle focus');
    if ($(thisControl).val() == $(thisControl).attr('Hint')) {
	$(thisControl).val('');
	$(thisControl).removeClass('noFocus');
	$(thisControl).addClass('hasFocus');
    }	
}

function handleTextBlur(thisControl) {
    $('.errorBorder').removeClass('errorBorder');
    //safelog('handle blur ' + $(thisControl).attr('id'));
    if ($(thisControl).val() == '') {
	$(thisControl).removeClass('hasFocus');
	$(thisControl).addClass('noFocus');
	$(thisControl).val($(thisControl).attr('Hint'));
    }
}

function resetAllHints(elementTags) {
    //safelog('resetallhints');
    $(elementTags).focus(function() { handleTextFocus(this);  return true; });
    $(elementTags).blur(function() { handleTextBlur(this); });
    $(elementTags).each(function() { handleTextBlur(this); }); // reset them all initially
}

