function makeTerminal(a)
{
	// Create the overlay object
	var objBody = $('mainBody');
	var windowHeight = window.getHeight();
	var objOverlay = new Element('div',
	{
		'id' : 'overlay',
		'height' : windowHeight,
		'opacity' : '0'
	}).injectInside('mainBody');
	
	new Fx.Style(objOverlay, 'opacity').start(.8);
	
	// Create terminal window
	var objTerminalWindow = new Element('div').setStyles(
	{
		'position' : 'absolute',
		'top': '130px',
		'left': '50%',
		'width': '600px',
		'display': 'none',
		'height': '300px',
		'opacity': '0',
		'margin-left': '-300px',
		'background-color': '#fff',
		'z-index': '99'
	}).setProperty('id', 'terminal').setHTML('<div id="theAnswer"><img src="spinner.gif" alt="loading..." />&nbsp;&nbsp;&nbsp;<br /> Loading...</div>').injectAfter(objOverlay);

	new Fx.Style(objTerminalWindow, 'opacity',
	{
		'onStart': objTerminalWindow.setStyle('display', 'block'),
		'duration': 1000,
		'onComplete': function()
		{
			linkFade();
			showAnswer(this);
		}.bind(a)
	}).start(.9);
}

function showAnswer(a)
{
	if(a.length > 0)
	{
		var b = a;
		setTimeout(function() { showText(this) }.bind(b), 2212);
	}else
	{
		if(
			($('questionText').value.toLowerCase() == 'who is the biggest tool?') ||
			($('questionText').value.toLowerCase() == 'who is the biggest spring 06 tool?'))
		{
			var b = 'Troy Bolden';
			
			setTimeout(function() {
				showText(this);
				$('Troy').setStyle('display', 'block');
			}.bind(b), 2212);
		}else{
		
			new Ajax('thinkTank.php', {
				'onComplete': showText,
				'method': 'get'
			}).request();
		
		}
	}
}

function showText(a)
{
	new Fx.Style('theAnswer', 'opacity', {duration: 1000, onComplete: function()
		{
			$('theAnswer').setHTML('Jud Answers: ' + this);
			new Fx.Style('theAnswer', 'opacity').start(1);
		}.bind(a)
	}).start(0);
	
	var objNewQuestion = new Element('div').injectInside('terminal').setProperty('id', 'newQuestion').setHTML("<p>New Question</p>").addEvent('click', closeContainer).addEvent('click', clearForm);
    window.addEvent('click', closeContainer).addEvent('click', clearForm);
}

function linkFade()
{
	new Fx.Style('linkUnits', 'opacity', { onStart: $('linkUnits').setStyle('display', 'block').setStyle('opacity', '0'), duration: 800}).start(1);
}

function closeContainer() {
	new Fx.Style('overlay', 'opacity', {onComplete: function() { $('overlay').remove(); }}).start(0);
	new Fx.Style('terminal', 'opacity', {onComplete: function() { $('terminal').remove(); }, duration: 1000}).start(0);
	$('linkUnits').setStyle('display', 'none');
	window.removeEvent('click', closeContainer);
	$('newQuestion').removeEvent('click', closeContainer);
}

function clearForm() {
	a = '';
	b = '';
	clearAll();
	$('askJudForm').reset();
	//$('questionText').disabled = '';
	$('petitionText').disabled = '';
	$('newQuestion').removeEvents('click');
	window.removeEvents('click');
}
/*
                                   
        objNewQuestion = new Element('div').injectInside(this.objTerminalWindow).setProperty('id', 'newQuestion').setHTML("<p>New Question</p>").addEvent('click', this.closeContainer.bind(this)).addEvent('click', this.clearForm);
        window.addEvent('click', this.closeContainer.bind(this)).addEvent('click', this.clearForm);
    },
    closeContainer: function(){
        new Fx.Style(this.objOverlay, 'opacity', {onComplete: function() { this.objOverlay.setStyle('display', 'none'); }.bind(this)}).start(0);
        new Fx.Styles(this.objTerminalWindow, {onComplete: function() { this.objTerminalWindow.setStyle('display', 'none'); }.bind(this), duration: 1000}).start({'height': [400, 0], 'opacity': [1,0]});
        $('linkUnits').setStyle('display', 'none');
        window.removeEvent('click', this.closeContainer.bind(this));
        objNewQuestion.removeEvent('click', this.closeContainer.bind(this));
    },
    clearForm: function(){
        clearAll();
        $('askJudForm').reset();
        //$('questionText').disabled = '';
        $('petitionText').disabled = '';
        objNewQuestion.removeEvents('click');
        window.removeEvents('click');
    },
    linkFade: function(){
        var linkFade = new Fx.Style('linkUnits', 'opacity', { onStart: $('linkUnits').setStyle('display', 'block').setStyle('opacity', '0'), duration: 800}).start(1);
    }
}); */