
function sizePusher() {
	// Basically, size the 'pusher' so that the bottom of it
	// appears at the top of the screen.

	var winTop;
	var pushTop;
	var offset = 10;
	var pusher;

	// Top pixel position displayed.
	winTop = $(document).scrollTop();

	// Top of the pusher.
	// Offset and position seem to be the wrong way around.
	pusher = $('#pusher');
	pushTop = pusher.offset().top;

	// If the top of the pusher is off the screen, then it needs to be resized
	// else make sure it has zero height.
	if (pushTop < winTop) {
		pusher.animate({height: (winTop - pushTop) + offset});
	} else {
		pusher.animate({height: offset});
	}
}

// Show and hide hint text

$(document).ready(function(){
	// Entering an input field.
	$('select').focus(function() {
		$('div.popup-hint-text').hide();
		$('#' + this.id + '_hint').fadeIn("normal");
		sizePusher();
	});
	$('textarea').focus(function() {
		$('div.popup-hint-text').hide();
		$('#' + this.id + '_hint').fadeIn("normal");
		sizePusher();
	});

	$('input').focus(function() {
		$('div.popup-hint-text').not('#' + this.id + '_hint').hide();
		$('#' + this.id + '_hint').fadeIn("normal");
		sizePusher();
	});

	// Hide all pop-up hints at the start.
	$('div.popup-hint-text').hide();
});

