var question_submitting = false;
function ask()
{
	if (question_submitting) return false;
	question_submitting = true;
	var msg = '';
	var success = false;
	$('askq_sending').show();
	
	new Ajax.Request(TEMPLATEPATH+'/ask-question.php', {
		parameters: { askq_name: $LF('askq_name'), askq_email: $LF('askq_email'), askq_question: $LF('askq_question'), ajax: 'yes' },
		onSuccess: function(transport) {
			if (transport.responseText == 'success') {
				msg = 'Your question has been successfully submitted.';
				success = true;
			} else {
				msg = transport.responseText;
				success = false;
			}
		},
		onFailure: function(transport) {
			msg = 'There was a problem communicating with the server. It may be temporarily down or there may be a problem with your internet connection.';
			success = false;
		},
		onComplete: function(transport) {
			if (msg != '')
			{
				$('askq-pop-msg').update(msg);
				if (success) { 
					$('hooray').show(); 
					$('oops').hide(); 
					new Effect.Fade('askq-popup', { duration:0.5, delay:4 });
				}
				else { 
					$('oops').show(); $('hooray').hide(); }
					
				new Effect.Appear('askq-popup', { duration:0.2 });
				if (!ie6)
				{
					$('clickoff').style.height = document.viewport.getHeight() + 'px';
					$('clickoff').show().onclick = function ()
					{
						if ($('askq-popup').visible()) new Effect.Fade('askq-popup', { duration:0.5 });
						$(this).hide();
					};
				}
			}
			question_submitting = false;
			$('askq_sending').hide();
		}
	});
	
	return false;
}

function fixfooter()
{
	var docheight = document.viewport.getHeight();
	var footerbot = $('footer').cumulativeOffset().top + $('footer').getHeight();
	if (docheight > footerbot)
	{
		var newheight = ($('pagebody').getHeight() + (docheight - footerbot)) + 'px';
		if (ie6) $('pagebody').style.height = newheight;
		else $('pagebody').style.minHeight = newheight;
	}
}
Event.observe(window, 'load', function() { fixfooter(); });