// JavaScript Document

window.calcLength = 1.50;
			window.calcWidth = 1.00;
			
			function increase_length(){
				var length = document.getElementById( "lwLengthField" );
				
				window.calcLength += 0.10;
				if( length && window.calcLength < 6.00 ){
					length.value = window.calcLength.toFixed(3);
				} else {
					clear_automatic();
				}
			}
			
			function decrease_length(){
				var length = document.getElementById( "lwLengthField" );
				
				if( length && window.calcLength > 1.50 ){
					window.calcLength -= 0.10;
					length.value = window.calcLength.toFixed(3);
				} else {
					clear_automatic();
				}
			}
			
			function increase_width(){
				var width = document.getElementById( "lwWidthField" );
				
				window.calcWidth += 0.10;				
				if( width && window.calcWidth < 5.50 ){
					width.value = window.calcWidth.toFixed(3);
				} else {
					clear_automatic();
				}
			}
			
			function decrease_width(){
				var width = document.getElementById( "lwWidthField" );
				
				if( width && window.calcWidth > 1.00 ){
					window.calcWidth -= 0.1;
					width.value = window.calcWidth.toFixed(3);
				} else {
					clear_automatic();
				}
			}
			
			function calculate_weight(){
								
				var postIt = new Object();
	
				postIt.length = window.calcLength;
				postIt.width = window.calcWidth;
				
				
				HTTP.post( "apComputeWeight.php", postIt, update_weight, content_error );
				
			}
			
			function update_weight( content, source ){
			//alert( content );
				var weight = document.getElementById( "lwWeight" );
				
				if( weight && content ){
					weight.innerHTML = content;
				}
			}
			
			//onmouseover="automatic( increase_width );" onmouseout="clear_automatic();"
			
			window.autoIntervalId = null;
			function automatic( func ){
			
			//alert( "auto" );
				if( window.autoIntervalId ){
					window.clearInterval( window.autoIntervalId );
				}
				
				window.autoIntervalId = window.setInterval( func, 170 );
			}
			
			function clear_automatic(){
				if( window.autoIntervalId ){
					window.clearInterval( window.autoIntervalId );
				}
			}