<!-- Copyright 2004 Macromedia, Inc. All rights reserved. -->
<html>
<head>
<title>Edit Image Height</title>

<script language="JavaScript">
function showIf() {
        var show = true;
        if (CCWorkspaceManager.getManager(dw.getDocumentDOM()).IsCurrentPageXML()) { show = false; }

        return show;
    }

function receiveArguments(newImageHeight)
{

	var dom = dw.getDocumentDOM();
	if (dom)
	{
		var validNumber = true;	
		var curHeight = dom.getImageHeight();
		var curWidth = dom.getImageWidth();

		//check to see if the border is a valid number. If not, just set the border to "".
		var i;
		for (i = 0; i < newImageHeight.length; i++)
		{
			var c = newImageHeight.charAt(i);
			if (((c < "0") || (c > "9"))) 
			{
				alert(dw.loadString("imageToolbar/invalidDimension"));

				validNumber = false;
				break;
			}
		}
		if (validNumber && newImageHeight != curHeight)
		{
			var aspectRatio = newImageHeight / curHeight;
			dom.resizeWidthHeight(Math.round(curWidth * aspectRatio), newImageHeight);
		}
	}
}

function canAcceptCommand()
{
    //Check for global cache variable, usually set by cctoolbars.xml DW_Image_Resize button.
    //We use this to reduce calls to isEditableImage(), which can be very slow on mac
    if (MM.ImgEditEnabled == null)
    {
      MM.ImgEditEnabled = (dw.getDocumentDOM().isImageSelected() && dw.getDocumentDOM().isEditableImage());
    }

	return (dw.getDocumentDOM() != null && dw.getDocumentDOM().getParseMode() == 'html' && MM.ImgEditEnabled && !dw.getDocumentDOM().isHotSpotSelected());
}

function getCurrentValue()
{
	var height = "";
	var dom = dw.getDocumentDOM(); 
	if (dom)
		height = dom.getImageHeight();	
	return height;
}
</script>
</head>

<body>
</body>
</html>
