<!--// hide javascript from old browsers
// formats number - right align, specified digits
function NumberFormat(value, digits)
	{
	value_str = value.toString()
	value_len = value_str.length
	if (digits  < value_len ||
		digits == value_len)
		{
		return value
		}
	else
		{
		new_value = ""
		num_spaces = digits - value_len
		for (i=1; i<=num_spaces; i++)
			{
			new_value = new_value.concat(" ")
			}
		new_value = new_value.concat(value_str)
		}
	return new_value
	}
// rounds floating point value to n decimal points
function Decimals(value, decimal_accuracy)
	{
	if (decimal_accuracy > 0)
		{
		multiplier = 1
		for (loop_multiplier=1; loop_multiplier<=decimal_accuracy; loop_multiplier++)
			multiplier = multiplier * 10
		new_value = StripChars(", ",value.toString())		
		new_value = new_value * multiplier
		new_value = Math.round(new_value)
		new_value = new_value / multiplier
		}
	else
		{
		new_value = Math.round(value)
		}
	return new_value
	}
function StripChars(theFilter,theString)
	{
	var strOut,i,curChar

	strOut = ""
	for (i=0;i < theString.length; i++)
		{		
		curChar = theString.charAt(i)
		if (theFilter.indexOf(curChar) < 0)	// if it's not in the filter, send it thru
		strOut += curChar		
		}	
	return strOut
	}

function Trim(theString)
	{
	var i,firstNonWhite
	
	if (StripChars(" \n\r\t",theString).length == 0 ) return ""
	
	i = -1
	while (1)
		{
		i++
		if (theString.charAt(i) != " ")
		break	
		}
	firstNonWhite = i
	//Count the spaces at the end
	i = theString.length
	while (1)
		{
		i--
		if (theString.charAt(i) != " ")
		break	
		}	
	
	return theString.substring(firstNonWhite,i + 1)
	}

// This function replaces all occurences of a specified CHARACTER
// in string with a specified replacement string.  
// For use with URL strings (or variables to go into URL string)
// ie: spaces to %20 (hex 32)
//     + to %2B (hex 43)
//     & to %26 (hex 38)
function URLEscapeChar(strIn, charReplace, strReplace)
	{
	// var a = " "
	// var b = "%20"
	var a = charReplace
	var b = strReplace
	var c = strIn

	var i = c.indexOf(a);
	var l = b.length;

	while (i != -1)	
		{
		c = c.substring(0,i) + b + c.substring(i + a.length,c.length);
		i = c.indexOf(a,i);
		}
	return c;
	}
function ShowMsg(thismsg)
	{
	alert (thismsg)
	}
function TrimSpaces(txtBuffer)
	{
	// Trim spaces from the left
	iSpace = txtBuffer.indexOf(" ")
	// alert (iSpace)
	while (iSpace == 0)
		{
		txtNewBuffer = txtBuffer.substring(0,iSpace) +
					   txtBuffer.substring(iSpace+1, txtBuffer.length)
		// alert (txtNewBuffer)
		txtBuffer = txtNewBuffer
		iSpace = txtBuffer.indexOf(" ")
		}
	// alert ("done: [" + txtBuffer + "]")
	
	// Trim spaces from the right
	iSpace = txtBuffer.lastIndexOf(" ")
	// alert (iSpace)
	// alert (txtBuffer.length)
	while (iSpace > 0 && iSpace == txtBuffer.length-1)
		{
		txtNewBuffer = txtBuffer.substring(0,iSpace) 
		// alert (txtNewBuffer)
		txtBuffer = txtNewBuffer
		iSpace = txtBuffer.lastIndexOf(" ")
		// alert (iSpace)
		// alert (txtBuffer.length)
		}
	// alert ("done: [" + txtBuffer + "]")
	
	return (txtBuffer)
	}
// -->

