<!--
/*func for adding 2 floating-point numbers together*/
function addFloat( num1, num2 ){
	var dec1 = 0;
	var dec2 = 0;
	var i;
	var numsign1 = false;
	var numsign2 = false;
	var signsym1, signsym2;

	//get the length of the integer section before the decimal place.

	//this is the first number
	var strnum1 = new String( num1 );

	//check for any sign at the begining of the number and remove it.
	if( strnum1.substr( 0, 1 ) == "-" || strnum1.substr( 0, 1 ) == "+" ){
		signsym1 = strnum1.substr( 0, 1 );
		strnum1 = strnum1.substr( 1 );
		numsign1 = true;
	}

	//record position of decimal place in first number ( if no decimal place append ".0" to end of num string, if num equals ".x" (ie. ".5") add preceeding zero)
	dec1 = strnum1.lastIndexOf( '.' );
	if( dec1 == -1 ){ strnum1 += ".00"; dec1 = strnum1.lastIndexOf( '.' ); }
	if( dec1 == 0 ){ strnum1 = "0" + strnum1; dec1 = 1; }

	// this is the second number		
	var strnum2 = new String( num2 );
	if( strnum2.substr( 0, 1 ) == "-" || strnum2.substr( 0, 1 ) == "+" ){ 
		signsym2 = strnum2.substr( 0, 1 );
		strnum2 = strnum2.substr( 1 );
		numsign2 = true;
	}

	//record position of decimal place in second number ( if no decimal place append ".0" to end of num string, if num equals ".x" (ie. ".5") add preceeding zero)
	dec2 = strnum2.lastIndexOf( '.' );
	if( dec2 == -1 ){ strnum2 += ".00"; dec2 = strnum2.lastIndexOf( '.' ); }
	if( dec2 == 0 ){ strnum2 = "0" + strnum2; dec2 = 1; }

	var decimalp = Math.max( dec1, dec2 );

	//get the length of the longest trailing floating point section
	var float1 = strnum1.substr( dec1 + 1 );
	var float2 = strnum2.substr( dec2 + 1 );

	if( float1.length > float2.length ){
		var diff = float1.length - float2.length;
		var floatsection = float2;
		var section = 2;
	}
	else{
		var diff = float2.length - float1.length;
		var floatsection = float1;
		var section = 1;
	}

	//pad the shortest floating point section with trailing zeros.	
	for( i=0; i<diff; i++ ){ 
		floatsection += "0"; 
	}

	var integersection1 = strnum1.substr( 0, dec1 );
	var integersection2 = strnum2.substr( 0, dec2 );

	if( section == 1 ){
		var number1 = integersection1 + floatsection;
		var number2 = integersection2 + float2;
	}
	else{
		var number1 = integersection1 + float1;
		var number2 = integersection2 + floatsection;
	}
		
	var orglength = Math.max( number1.length, number2.length );
		
	if( numsign1 == true ){ number1 = signsym1 + number1; }	
	if( numsign2 == true ){ number2 = signsym2 + number2; }

	//calculate result
	var result = new String( parseFloat( number1 ) + parseFloat( number2 ) );
	if( result == 0 ){ return 0; };		//if result is zero, return zero now, preventing func from doing any more processing
	
	var offsetdp = result.length - orglength;
	var totaldp = decimalp + offsetdp;
		
	var newresult = result.substr( 0, totaldp ) + "." + result.substr( totaldp );
	return ( newresult );
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*func for multiplying two 2 decimal-point precision floating-point numbers together
	PLEASE NOTE: That this function will only work with numbers rounded to 2 or less decimal places's*/
function multiplyFloat2dp( num1, num2 ){
	var dec1 = 0;
	var dec2 = 0;
	var i;
	var numsign1 = false;
	var numsign2 = false;
	var signsym1, signsym2;

	//get the length of the integer section before the decimal place.

	//this is the first number
	var strnum1 = new String( num1 );

	//check for any sign at the begining of the number and remove it.
	if( strnum1.substr( 0, 1 ) == "-" || strnum1.substr( 0, 1 ) == "+" ){
		signsym1 = strnum1.substr( 0, 1 );
		strnum1 = strnum1.substr( 1 );
		numsign1 = true;
	}

	//record position of decimal place in first number ( if no decimal place append ".0" to end of num string, if num equals ".x" (ie. ".5") add preceeding zero)
	dec1 = strnum1.lastIndexOf( '.' );
	if( dec1 == -1 ){ strnum1 += ".00"; dec1 = strnum1.lastIndexOf( '.' ); }
	if( dec1 == 0 ){ strnum1 = "0" + strnum1; dec1 = 1; }

	//this is the second number
	var strnum2 = new String( num2 );
	if( strnum2.substr( 0, 1 ) == "-" || strnum2.substr( 0, 1 ) == "+" ){
		signsym2 = strnum2.substr( 0, 1 );
		strnum2 = strnum2.substr( 1 );
		numsign2 = true;
	}

	//record position of decimal place in second number ( if no decimal place append ".0" to end of num string, if num equals ".x" (ie. ".5") add preceeding zero)
	dec2 = strnum2.lastIndexOf( '.' );
	if( dec2 == -1 ){ strnum2 += ".00"; dec2 = strnum2.lastIndexOf( '.' ); }
	if( dec2 == 0 ){ strnum2 = "0" + strnum2; dec2 = 1; }

	var decimalp = Math.max( dec1, dec2 );

	//get the length of the longest trailing floating point section
	var float1 = strnum1.substr( dec1 + 1 );
	var float2 = strnum2.substr( dec2 + 1 );

	if( float1.length > float2.length ){
		var diff = float1.length - float2.length;
		var floatsection = float2;
		var section = 2;
	}
	else{
		var diff = float2.length - float1.length;
		var floatsection = float1;
		var section = 1;
	}

	//pad the shortest floating point section with trailing zeros.	
	for( i=0; i<diff; i++ ){ 
		floatsection += "0"; 
	}

	var integersection1 = strnum1.substr( 0, dec1 );
	var integersection2 = strnum2.substr( 0, dec2 );

	if( section == 1 ){
		var number1 = integersection1 + floatsection;
		var number2 = integersection2 + float2;
	}
	else{
		var number1 = integersection1 + float1;
		var number2 = integersection2 + floatsection;
	}
		
	var orglength = Math.max( number1.length, number2.length );
		
	if( numsign1 == true ){ number1 = signsym1 + number1; }	
	if( numsign2 == true ){ number2 = signsym2 + number2; }

	//calculate result
	var result = new String( parseFloat( number1 ) * parseFloat( number2 ) );
	if( result == 0 ){ return 0; };		//if result is zero, return zero now, preventing func from doing any more processing

	//need to check for decimal points and remove them, because of divide by 100 (above - "var result = new String( ( parseFloat(number1) * parseFloat(number2) ) / 100 );")
	var reStr = new RegExp( "[\.]{1}" );						//reg exp for checking if user already entered decimal point
	var bIsStrValid = reStr.test( result );						//check if user already entered decimal point
	if( bIsStrValid ){ result = result.replace('.', ''); }		//get rid of dec point
	
	var offsetdp = result.length - orglength;
	var totaldp = (decimalp + offsetdp) - 2;	

	var newresult = result.substr( 0, totaldp ) + "." + result.substr( totaldp );	
	return ( newresult );
}//multiplyFloat
////////////////////////////////////////////////////////////////////////////////////////////////


/*func for multiplying 2 floating-point numbers together*/
function multiplyFloat( num1, num2 ){
	var dec1 = 0;
	var dec2 = 0;
	var i;
	var numsign1 = false;
	var numsign2 = false;
	var signsym1, signsym2;

	//get the length of the integer section before the decimal place.

	//this is the first number
	var strnum1 = new String( num1 );

	//check for any sign at the begining of the number and remove it.
	if( strnum1.substr( 0, 1 ) == "-" || strnum1.substr( 0, 1 ) == "+" ){
		signsym1 = strnum1.substr( 0, 1 );
		strnum1 = strnum1.substr( 1 );
		numsign1 = true;
	}

	//record position of decimal place in first number ( if no decimal place append ".0" to end of num string, if num equals ".x" (ie. ".5") add preceeding zero)
	dec1 = strnum1.lastIndexOf( '.' );
	if( dec1 == -1 ){ strnum1 += ".00"; dec1 = strnum1.lastIndexOf( '.' ); }
	if( dec1 == 0 ){ strnum1 = "0" + strnum1; dec1 = 1; }

	//this is the second number		
	var strnum2 = new String( num2 );
	if( strnum2.substr( 0, 1 ) == "-" || strnum2.substr( 0, 1 ) == "+" ){ 
		signsym2 = strnum2.substr( 0, 1 );
		strnum2 = strnum2.substr( 1 );
		numsign2 = true;
	}

	//record position of decimal place in second number ( if no decimal place append ".0" to end of num string, if num equals ".x" (ie. ".5") add preceeding zero)
	dec2 = strnum2.lastIndexOf( '.' );
	if( dec2 == -1 ){ strnum2 += ".00"; dec2 = strnum2.lastIndexOf( '.' ); }
	if( dec2 == 0 ){ strnum2 = "0" + strnum2; dec2 = 1; }

	var decimalp = Math.max( dec1, dec2 );

	//get the length of the longest trailing floating point section
	var float1 = strnum1.substr( dec1 + 1 );
	var float2 = strnum2.substr( dec2 + 1 );

	if( float1.length > float2.length ){
		var diff = float1.length - float2.length;
		var floatsection = float2;
		var section = 2;
	}
	else{
		var diff = float2.length - float1.length;
		var floatsection = float1;
		var section = 1;
	}

	//pad the shortest floating point section with trailing zeros.	
	for( i=0; i<diff; i++ ){ 
		floatsection += "0"; 
	}

	var integersection1 = strnum1.substr( 0, dec1 );
	var integersection2 = strnum2.substr( 0, dec2 );

	if( section == 1 ){
		var number1 = integersection1 + floatsection;
		var number2 = integersection2 + float2;
	}
	else{
		var number1 = integersection1 + float1;
		var number2 = integersection2 + floatsection;
	}
		
	var orglength = Math.max( number1.length, number2.length );
		
	if( numsign1 == true ){ number1 = signsym1 + number1; }	
	if( numsign2 == true ){ number2 = signsym2 + number2; }

	//calculate result
	var result = new String( parseFloat( number1 ) * parseFloat( number2 ) );
	if( result == 0 ){ return 0; };		//if result is zero, return zero now, preventing func from doing any more processing

	//need to check for decimal points and remove them, because of divide by 100 (above - "var result = new String( ( parseFloat(number1) * parseFloat(number2) ) / 100 );")
	var reStr = new RegExp( "[\.]{1}" );						//reg exp for checking if user already entered decimal point
	var bIsStrValid = reStr.test( result );						//check if user already entered decimal point
	if( bIsStrValid ){ result = result.replace('.', ''); }		//get rid of dec point

	var offsetdp = result.length / orglength;
	var totaldp = decimalp * offsetdp;
		
	var newresult = result.substr( 0, totaldp ) + "." + result.substr( totaldp );	
	return ( newresult );
}//multiplyFloat

/*func for subtracting 1 floating-point number from another*/
function minusFloat( num1, num2 ){
	var dec1 = 0;
	var dec2 = 0;
	var i;
	var numsign1 = false;
	var numsign2 = false;
	var signsym1, signsym2;

	// get the length of the integer section before the decimal place.

	// this is the first number
	var strnum1 = new String( num1 );

	//check for any sign at the begining of the number and remove it.
	if( strnum1.substr( 0, 1 ) == "-" || strnum1.substr( 0, 1 ) == "+" ){
		signsym1 = strnum1.substr( 0, 1 );
		strnum1 = strnum1.substr( 1 );
		numsign1 = true;
	}

	//record position of decimal place in first number ( if no decimal place append ".0" to end of num string, if num equals ".x" (ie. ".5") add preceeding zero)
	dec1 = strnum1.lastIndexOf( '.' );
	if( dec1 == -1 ){ strnum1 += ".00"; dec1 = strnum1.lastIndexOf( '.' ); }
	if( dec1 == 0 ){ strnum1 = "0" + strnum1; dec1 = 1; }

	// this is the second number		
	var strnum2 = new String( num2 );
	if( strnum2.substr( 0, 1 ) == "-" || strnum2.substr( 0, 1 ) == "+" ){ 
		signsym2 = strnum2.substr( 0, 1 );
		strnum2 = strnum2.substr( 1 );
		numsign2 = true;
	}

	//record position of decimal place in second number ( if no decimal place append ".0" to end of num string, if num equals ".x" (ie. ".5") add preceeding zero)
	dec2 = strnum2.lastIndexOf( '.' );
	if( dec2 == -1 ){ strnum2 += ".00"; dec2 = strnum2.lastIndexOf( '.' ); }
	if( dec2 == 0 ){ strnum2 = "0" + strnum2; dec2 = 1; }

	var decimalp = Math.max( dec1, dec2 );

	//get the length of the longest trailing floating point section
	var float1 = strnum1.substr( dec1 + 1 );
	var float2 = strnum2.substr( dec2 + 1 );

	if( float1.length > float2.length ){
		var diff = float1.length - float2.length;
		var floatsection = float2;
		var section = 2;
	}
	else{
		var diff = float2.length - float1.length;
		var floatsection = float1;
		var section = 1;
	}

	//pad the shortest floating point section with trailing zeros.	
	for( i=0; i<diff; i++ ){ 
		floatsection += "0"; 
	}

	var integersection1 = strnum1.substr( 0, dec1 );
	var integersection2 = strnum2.substr( 0, dec2 );

	if( section == 1 ){
		var number1 = integersection1 + floatsection;
		var number2 = integersection2 + float2;
	}
	else{
		var number1 = integersection1 + float1;
		var number2 = integersection2 + floatsection;
	}
		
	var orglength = Math.max( number1.length, number2.length );
		
	if( numsign1 == true ){ number1 = signsym1 + number1; }	
	if( numsign2 == true ){ number2 = signsym2 + number2; }

	//calculate result
	var result = new String( parseFloat( number1 ) - parseFloat( number2 ) );
	if( result == 0 ){ return 0; };		//if result is zero, return zero now, preventing func from doing any more processing
	
	var offsetdp = result.length - orglength;
	var totaldp = decimalp + offsetdp;
		
	var newresult = result.substr( 0, totaldp ) + "." + result.substr( totaldp );
	return ( newresult );
}
//-->