﻿		function updateWidth()
		{
			document.Form1.thewidth.onkeyup = updateWidth ;
		    document.Form1.theheight.onkeyup = updateHeight ;

			if ( isNaN(document.Form1.thewidth.value))
			{
			// recover
				if (document.Form1.thewidth.value.length==1)
				{
					document.Form1.thewidth.value = '';
					document.Form1.theheight.value = '';
				}
				else
				{
				    document.Form1.thewidth.value = parseFloat(document.Form1.thewidth.value);
				}
			}
			else
			{
				if ( document.Form1.maintainAspect.value=="1" ) {
				    document.Form1.theheight.value = parseFloat(1.0 * document.Form1.thewidth.value * document.Form1.aspectRatio.value);
					if (document.Form1.theheight.value=="0")
						document.Form1.theheight.value="1"
				}
			}
		}
		function updateHeight()
		{
			if ( isNaN(document.Form1.theheight.value))
			{
			// recover
				if (document.Form1.theheight.value.length==1)
				{
					document.Form1.theheight.value = '';
					document.Form1.thewidth.value = '';
				}
				else
				{
				    document.Form1.theheight.value = parseFloat(document.Form1.theheight.value);
				}
			}
			else
			{
				if ( document.Form1.maintainAspect.value=="1" ) 
				{
					document.Form1.thewidth.value =  parseFloat( 1.0*document.Form1.theheight.value * 1.0/document.Form1.aspectRatio.value );
					if (document.Form1.thewidth.value=="0")
						document.Form1.thewidth.value="1"
				}
			}
		}



