<!-- Copyright [2008] Adobe Systems Incorporated.  All rights reserved. -->
<html xmlns:MMString="http://www.macromedia.com/schemes/data/string/">

<head>
<title><MMString:loadString id="Menus/MM/ccBlogEntryCategories/title" /></title>
<SCRIPT LANGUAGE="javascript" SRC="../../Shared/MM/Scripts/CMN/ccBlogMetaDataStrings.js"></SCRIPT>
<script language="JavaScript">


function showIf()
{
    var entryType = CCWorkspaceManager.getManager(dw.getDocumentDOM()).getCurBlogEntryType();
    if(entryType == 'pages')
    {
        return true;
    }
	return false;
}

function receiveArguments(newOrder)
{        
    var dom = dw.getDocumentDOM();
    
    // update the meta tag value.. 
    metatags = dom.getElementsByTagName("meta");
    count = metatags.length;   
    var PageOrderIndex;
    // find the corresponding meta tag!
	for (PageOrderIndex = 0; PageOrderIndex < count; PageOrderIndex++)
	{ 
		if (metatags[PageOrderIndex].name == TEMPLATE_PAGE_ORDER)
		{
			break;
		}
	}
	// if are recieving the same input .. just return
	if(PageOrderIndex < count)
	{
	    if(metatags[PageOrderIndex].content == newOrder)
	        return;
	}
	else
	 return;
	 
	// validate the input..	   
    var Orderlength = newOrder.length;
    var i = 0;
    var bInvalidEntry = false;
    // Make sure the entry is a numeric one..
    while(i < Orderlength)
    {
        if(newOrder[i] < '0' || newOrder[i] > '9' )
        {
            alert(dw.loadString('Toolbars/Blog_Entry_PageOrder_input_error'));
			CCWorkspaceManager.getManager(dom).updateUI();           
            return;
        }
        i++;
    }// while..
	    
	metatags[PageOrderIndex].content = newOrder;
	return;
}

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

function getCurrentValue()
{
    var dom = dw.getDocumentDOM();
    var value = "";
    metatags = dom.getElementsByTagName("meta");
    count = metatags.length;
    var i;
    var bFound =  false;
    
	for (i = 0; i < count; i++)
	{ 
		if (metatags[i].name == TEMPLATE_PAGE_ORDER)
		{
			value = metatags[i].content;
			bFound = true;
			break;
		}
	}
	
	// It is possible that the corresponding files have been deleted due to a publish 
	// from a different instance of Contribute (like IBE)
	if(!bFound && count > 0)
	{
	    // Insert the meta-tag - This may be a new page!
        dom.insertBlogMetaTag(TEMPLATE_PAGE_ORDER, "0");
        CCWorkspaceManager.getManager(dom).updateUI();
    }
	return value;
}


</script>
</head>

<body>
</body>
</html>

