function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function trim(stringToTest)
{
var kk
var subStart
var subEnd

	if (stringToTest == null)
			return (" ")
	if (stringToTest.length == 0)
return (" ")


subStart = (-1)
for (kk=0;kk<stringToTest.length;kk++)
{
if (stringToTest.charAt(kk) > " ")
{
        subStart = kk
        break;
}
}

for (kk=stringToTest.length;kk>=0;kk--)
{
if (stringToTest.charAt(kk) > " ")
{
        subEnd = kk
        break;
}
}

if (subStart < 0)
return (" ")
return (stringToTest.substr(subStart,subEnd+1))
}

function IsEmail(stringToTest)
{
var AmperAt
var DotAt
	if (trim(stringToTest) == " ")
	{
			return(true)
	}
AmperAt = stringToTest.indexOf("@")
if (AmperAt < 1)
return (false)
DotAt = stringToTest.indexOf(".",AmperAt)
if (DotAt < (AmperAt+2) || DotAt == (stringToTest.length-1))
return (false)
return (true)
}

function isInteger (s)

{   var i;

    if (isEmpty(s))
	return false;
    if (s=="0" | s=="00")
	return false;

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}

// Check whether string s is empty.

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

// Returns true if character c is a digit
// (0 .. 9).

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

// Get checked value from radio button.

function RadioSelected (radio)
{

for (var i = 0; i < radio.length; i++)
    {   if (radio[i].checked)
	{
	return true;
	break;
 	}
    }

    return false
}

function doNothing()
{
	return false;
}
