// Copyright 2000 Macromedia, Inc. All rights reserved.

function receiveArguments()
{
	dw.saveDocumentAsTemplate(dw.getDocumentDOM());
}

function canAcceptCommand()
{
	return (dw.getFocus() == 'textView' || dw.getFocus(true) == 'html' || dw.getFocus() == 'document') && dw.canSaveDocumentAsTemplate(dw.getDocumentDOM()) && dw.getDocumentDOM() && dw.getDocumentDOM().getParseMode() == 'html';
}

function setMenuText()
{
	var dom = dw.getDocumentDOM();

    // Can't save a frameset as a template, so just show
    // "Save as Template", but gray it out.
	if (dom && dom.getFocus() == 'frameset')
		return MENU_SaveAsTemplate;
    else if (dom && dom.isDocumentInFrame())
		return MENU_SaveFrameAsTemplate;
	else
		return MENU_SaveAsTemplate;
}
