function Update(){
	//alert("Update");
	
	var p = document.sockUlator;
	   var stdRatio = 2.25; // use to change ratio of length to width.

	   // guess for foot length based on shoe size.   
		var extra;
		calculate=1;
		warning="";
		
		// not custom size
		if(p.range.selectedIndex !=3){
			if(p.range.selectedIndex == 0){extra = 2;}
			else if(p.range.selectedIndex == 1){ extra = 0;}
			else if (p.range.selectedIndex == 2) {extra = -12; }


			if(isNaN(p.size.value)){p.size.value = 1;}
			else{p.size.value = Math.round(2*eval(p.size.value))/2;}
			
			var normSize= eval(p.size.value)+extra;		
			stdLength = Math.round( 100*(6.8 + normSize/3) ) /100;
			stdWidth= Math.round( 200* stdLength/stdRatio)/100;
			
			
			p.stdLength.value = stdLength; 
			p.stdWidth.value = stdWidth;
			p.ankleWidth.value = stdWidth;
			
		}

		// custom size	-- with non-calc flags
		else{ 
			if(isNaN(p.stdLength.value)){	p.stdLength.value = "enter"; calculate=0;}	
			if(isNaN(p.stdWidth.value)){	p.stdWidth.value = "enter"; calculate=0; }
			if(isNaN(p.ankleWidth.value)){	p.stdWidth.value = "enter"; calculate=0; }		
		}
	// set flags to not calculate.
		
		if(isNaN(p.stGauge.value)){p.stGauge.value="enter";		calculate=0;}
		if(isNaN(p.rowGauge.value)){p.rowGauge.value="enter";		calculate=0;}
		
		if(calculate==1){
			stGauge = eval(p.stGauge.value);
			rowGauge=eval(p.rowGauge.value);
			stdWidth = eval(p.stdWidth.value);
			stdLength = eval(p.stdLength.value);
			
			footStitches=Math.round(mult(stdWidth,stGauge)/4)*4; 
			halfFootStitches=footStitches/2; 
			if(halfFootStitches < 9){ warning="Use finer yarn to knit this sock.";}
			else{warning="The yarn gauge seems ok for this size sock.";}
			
			p.warning.value=warning;

		}//  calculate==1
	}// javascript function
		
