<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<html xmlns:MMString="http://www.macromedia.com/schemes/data/string/">
<head>
<title><MMString:loadString id="Toolbars/MM/ccBlogEntryAllowComments/title" /></title>
<SCRIPT LANGUAGE="javascript" SRC="../../Shared/MM/Scripts/CMN/ccBlogMetaDataStrings.js"></SCRIPT>
<script language="JavaScript">

	// do these need to be localized?

function showIf()
{
    return true;
}
function receiveArguments()
{
	var foundIt = false;
	var dom = dw.getDocumentDOM();
	
	//get all meta tags
	var metaTags = dom.getElementsByTagName("meta");
	
	var i			// use for indexing
	var resultComments = false;
	//look for meta tag which has name called "allow comments"
	for (i = 0; i < metaTags.length; i++)
	{ 
		if (metaTags[i].getAttribute("name") == TEMPLATE_ALLOW_COMMENTS)
		{
			//element found
			foundIt = true;
			
			//set attribute based on argument
			if(metaTags[i].getAttribute("content") == "true")
			{
				metaTags[i].setAttribute("content","false"); 
				resultComments = false;
			}
			else
			{
				metaTags[i].setAttribute("content","true");
				resultComments = true;
			}
						
			break;
		}
	}	
	
	// Add the meta tag for allow comments if its not there and argument is true
	if(foundIt == false){
		//var insertString = '<meta name="'+ TEMPLATE_ALLOW_COMMENTS +'" content="true">';
		//dom.insertHTML(insertString,0);
		dw.getDocumentDOM().insertBlogMetaTag(TEMPLATE_ALLOW_COMMENTS,"true");
		resultComments = true;
		
	}
	if(resultComments && 
	    !CCWorkspaceManager.getManager(dw.getDocumentDOM()).isSecondaryMetaVisible())
	{
	    CCWorkspaceManager.getManager(dw.getDocumentDOM()).toggleSecondaryMeta();
	}			
	if(CCWorkspaceManager.getManager(dw.getDocumentDOM()) != null)
		CCWorkspaceManager.getManager(dw.getDocumentDOM()).updateUI();
	return;
}

function canAcceptCommand()
{
	return (dw.getDocumentDOM() != null &&	dw.getFocus() == 'document' &&
		CCWorkspaceManager.getManager(dw.getDocumentDOM()).isBlogSite() && 
		CCWorkspaceManager.getManager(dw.getDocumentDOM()).isCommentsSupported());
}

function getCurrentValue()
{
	var value = "";
	return value;
}

function isCommandChecked(){
	
	//alert('Hell I am from isCommandChecked()');
	var dom = dw.getDocumentDOM();
	
	//get all meta tags
	var metaTags = dom.getElementsByTagName("meta");
	
	var i			// use for indexing
	
	//look for meta tag which has name called "allow comments"
	for (i = 0; i < metaTags.length; i++)
	{ 
		if (metaTags[i].getAttribute("name") == TEMPLATE_ALLOW_COMMENTS)
		{
			//set attribute based on argument
			return metaTags[i].getAttribute("content");
			
		}
	}	
	//if tag not found
	return false;
}

function getDynamicContent()
{
	var items = new Array;
	return items;
}

</script>
</head>

<body>
</body>
</html>


