// Copyright 2007 Adobe Systems Incorporated.  All rights reserved.

<html>
<head>

<script language="javascript">

	function receiveArguments()
	{
		// By convention (for selected image nodes): 
		// Passing attribute HEIGHT with empty value evokes Reset Size To Dimensions Of Original Asset
		// (passing attribute WIDTH with empty value evokes Reset Size (to dimensions of web image))
		dw.getDocumentDOM().setAttributeWithErrorChecking('HEIGHT', '');
		return true;
	}

	function canAcceptCommand()
	{
		var returnValue = false;
		var selection   = dw.getSelection();
		if (!selection)
			return false;
			
		var node = dw.offsetsToNode(selection[0], selection[1]);
		if (!node)
		{
			return false;
		}
		if (node.tagName == undefined)
		{
			return false;
		}
			
		var imageSrc    = node.getAttribute("src");
		var width		= node.getAttribute("width");
		if (!width)
		{
			width = "0";
		}
		var height		= node.getAttribute("height");
		if (!height)
		{
			height = "0";
		}
		var fullPath    = getFullPath(imageSrc);

		var status = dw.getSmartObjectState(fullPath, width, height);

		if ( (((status - 2)%100) == 0) || (((status - 6)%100) == 0) )
			returnValue = true;

		return returnValue;

	}

</script>
</head>
<body>
</body>
</html>
