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

var helpDoc = MM.HELP_objEditAnchor;

function receiveArguments()
{
}

function canAcceptCommand()
{
	if ( dw.getDocumentDOM().getCCSharedSetting_TextOnlyInNonTemplates() )
		return false;
	return true;
}

function commandButtons()
{
/*   return new Array(MM.BTN_OK,         "run()",
                    MM.BTN_Cancel,     "window.close()",
                    MM.BTN_Help,       "displayHelp()" );
*/

	return new Array( "PutButtonsOnBottom", "OkButton", MM.BTN_OK, "run()",
					  "PutButtonOnLeft", MM.BTN_Help,    "displayHelp()",
					  "CancelButton", MM.BTN_Cancel,  "window.close()");


}

function initializeUI()
{
	node = dw.getDocumentDOM().getSelectedNode();
	//document.theForm.aname.value = node.name;
	document.theForm.aname.value = unescape(node.name);
}

function run()
{
	var errStr = CheckEditAnchor( node.name, document.theForm.aname.value );
	if ( errStr.length < 1 )
	{
		node = dw.getDocumentDOM().getSelectedNode();
		//node.name = document.theForm.aname.value;
		node.name = dw.doURLEncoding(document.theForm.aname.value);
		window.close();
	}
	else
	{
		alert( errStr );
		document.theForm.aname.focus();
	}
}
