// Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved.

function receiveArguments()
{
	
	var dom = dw.getDocumentDOM();
	var itemID = arguments[0];

	// We have only one option replace the word with itemID.
	dom.replaceCurrentWord(itemID);

}

function canAcceptCommand()
{
	var itemID = arguments[0];
	if( itemID == "CC:Spell:NoSuggestions")
	{
		return false;
	}

	return true;
}


function getDynamicContent()
{
	var result = new Array;
	var resultIndex = 0;
	var dom = dw.getDocumentDOM();

	// first check whether the word has errors.
	if(dom && dom.isCurrentWordHasSpellingError())
	{
		var spellSuggestions = dom.getSpellingSuggestions();


		if (!spellSuggestions )
			return 0;


		if (spellSuggestions.length > 0)
		{

			var i;
			for (i = 0; i < spellSuggestions.length; i ++)
			{
				result[resultIndex++] = spellSuggestions[i] + ";id='" + spellSuggestions[i] + "'";
			}
			
		}
		else
		{
			result[resultIndex++] = MENU_strSpellNoSuggestions + ";id='CC:Spell:NoSuggestions'";
		}
	}
	else
	{		
		result[resultIndex++] = MENU_strSpellNoSuggestions + ";id='CC:Spell:NoSuggestions'";
	}	

	return result;
}
