var checkText = function(what) {document.getElementById(what);
	// Create a new instance of the spell checker (can manage multiple instances per page: ID of spellcheck gif must include field name
	var speller = new spellChecker();
	if(document.getElementById(what).value.length){
		// Create an array and add a reference to each field we wish to check
		textInputs = new Array();
		textInputs.push(document.getElementById(what));
		speller.textInputs = textInputs;
		
		// Open the spell checker
		speller.openChecker();
		} else {
		alert("No text to check.")
	}
		return false;
};

	
window.onload = function() {
	// Add the event to the button
	if(document.getElementById('comments') && document.getElementById('spellCheckComments')) {
		document.getElementById('spellCheckComments').onclick = function(){checkText('comments')};
	} 
	if(document.getElementById('a_content') && document.getElementById('spellCheckA_content')) {
		document.getElementById('spellCheckA_content').onclick = function(){checkText('a_content')};
	}
	if(document.getElementById('key_words') && document.getElementById('spellCheckKeywords')) {
		document.getElementById('spellCheckKeywords').onclick = function(){checkText('key_words')};
	}
			
};
