function spell_check(form_name, field_name, url, window_name, window_parameters)
{
	var new_window = '';
	
	var form_text = self.document[form_name][field_name].value;
	form_text = form_text.replace(/^\s+|\s+$/g,"");
	
	if(form_text.length == 0)
	{
		alert('You have not entered any text to spellcheck');
	}
	else
	{
		new_window = window.open(url, window_name, window_parameters, "no");
		
		self.document.hidden_form.form_name.value = form_name;
		self.document.hidden_form.field_name.value = field_name; 
		self.document.hidden_form.form_text.value = form_text;
		self.document.hidden_form.submit();	
		
		new_window.focus();
	}
}

function process_correction(field_name, form_text)
{
	//alert(field_name);
	eval('document.questionnaire_form.' + field_name + '.value = form_text');
}

function getElementHeight(Elem) 
{
	//alert(Elem + ' // ' + document.getElementById(Elem));
	if(document.getElementById) 
	{
		var elem = document.getElementById(Elem);
	} 
	else if (document.all)
	{
		var elem = document.all[Elem];
	}
	xPos = elem.offsetHeight;
	
	return xPos;
}

function shuffle_heights()
{
	var nav_height = getElementHeight('MainNav');
	var page_height = getElementHeight('Page');
	
	if(page_height > nav_height)
	{
		if (document.layers)
		{
			document.layers['MainNav'].height = page_height - 220 + 'px';
		}
		else if (document.all)
		{
			document.all['MainNav'].style.height = page_height - 220 + 'px';
		}
		else if (document.getElementById)
		{
			document.getElementById('MainNav').style.height = page_height - 220 + 'px';
		}
	}
}

$(function(){

	$('.FAQToggle').click(function () 
	{
		var ResultID = this.id.replace('more_', '');
		$('#detail_'+ResultID+'').slideToggle('fast');
		
		$( this ).toggleClass('FAQCollapse');
	}),

	$('.FAQToggleAll').click(function () 
	{
		$('.FAQAnswer').show('fast');
		$('.FAQToggle').addClass('FAQCollapse');
		
		$( this ).hide();
		$('.FAQCollapseAll').show();
	}),

	$('.FAQCollapseAll').click(function () 
	{
		$('.FAQAnswer').hide('fast');
		$('.FAQToggle').removeClass('FAQCollapse');
		
		$( this ).hide();
		$('.FAQToggleAll').show();
	})
});