	function IsRadio(Obj)
	{
		for(var i= 0; i<Obj.length; i++) {
	 	    if(Obj[i].checked) 
				return true;
		}
		return false;
	}
	
	function IsAlphaNum( str ) 
	{
		// Return immediately if an invalid value was passed in
		if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
			return false;

		var isValid = true;
	
		// convert to a string for performing string comparisons.
   		str += "";	

		// Loop through length of string and test for any alpha numeric 
		// characters
   		for (i = 0; i < str.length; i++)
   		{
			// Alphanumeric must be between "0"-"9", "A"-"Z", "a"-"z", or space between two words
      		if (!(((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) || 
      			((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) ||
				((str.charAt(i) == "_")) || ((str.charAt(i) == "*" ))
				((str.charAt(i) == "/")) || ((str.charAt(i) == "-"))
				((str.charAt(i) == ")")) || ((str.charAt(i) == "("))
				((str.charAt(i) == ",")) || ((str.charAt(i) == "%"))
				((str.charAt(i) == " "))))
			{
				isValid = false;
				break;
			}	
   		} // END for   
   
   		return isValid;
	}  // end IsAlphaNum
	
	function IsInt( numstr, allowNegatives ) {
		// Return immediately if an invalid value was passed in
		if (numstr+"" == "undefined" || numstr+"" == "null" || numstr+"" == "")	
			return false;

		// Default allowNegatives to true when undefined or null
		if (allowNegatives+"" == "undefined" || allowNegatives+"" == "null")	
			allowNegatives = true;

		var isValid = true;

		// convert to a string for performing string comparisons.
		numstr += "";	

		// Loop through string and test each character. If any
		// character is not a number, return a false result.
 		// Include special case for negative numbers (first char == '-').   
		for (i = 0; i < numstr.length; i++) {
    		if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9") || (numstr.charAt(i) == "-"))) {
       			isValid = false;
       			break;
			} else if ((numstr.charAt(i) == "-" && i != 0) || (numstr.charAt(i) == "-" && !allowNegatives)) 
			{
       			isValid = false;
       			break;
      		}
         	         	       
   		} // END for   
   
   		return isValid;
	}  // end IsInt

	function IsNum( numstr ) 
	{
		// Return immediately if an invalid value was passed in
		if (numstr+"" == "undefined" || numstr+"" == "null" || numstr+"" == "")	
			return false;

		var isValid = true;
		var decCount = 0;		// number of decimal points in the string

		// convert to a string for performing string comparisons.
		numstr += "";	

		// Loop through string and test each character. If any
		// character is not a number, return a false result.
 		// Include special cases for negative numbers (first char == '-')
		// and a single decimal point (any one char in string == '.').   
		for (i = 0; i < numstr.length; i++) 
		{
			// track number of decimal points
			if (numstr.charAt(i) == ".")
				decCount++;

    		if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9") || (numstr.charAt(i) == "."))) 
			{
       			isValid = false;
       			break;
			} else if ((numstr.charAt(i) == "." && numstr.length == 1) ||
			  		(numstr.charAt(i) == "." && decCount > 1)) {
       			isValid = false;
       			break;
      		}         	         	       
			//if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9")) || 
   		} // END for   
   		return isValid;
	}  // end IsNum
	
	function IsValidMoney( numstr ) 
	{
	    var isValid = true;
		var temp = "";
	    if (IsNum(numstr))
		{				
			temp = numstr.substring(numstr.indexOf(".")+1,numstr.length);	
			if(temp.length > 2)
			  isValid = false;
		} 
		else
		{
		   isValid = false;
		} 
   		return isValid;
	}  // end IsNum


	function IsAmount( Obj )
	{
		temp = new String(Obj.value);
		temp = temp.substring(temp.indexOf("$")+1,temp.length);
		temp = parseFloat(temp);
		temp = Math.floor(100 * temp)/100;
		temp = String(temp);
		if(temp.indexOf(".") == -1)
		{
			temp = temp + ".00";
		}
		if(temp.indexOf(".") == temp.length - 2)
		{
			temp = temp + "0";
		}
		if(temp == "0.00")
		{
			temp = "";
		}

		return true;
	}
	
	function Trim( str ) 
	{
		var resultStr = "";
	
		resultStr = TrimLeft(str);
		resultStr = TrimRight(resultStr);
	
		return resultStr;
	} // end Trim

	function TrimLeft( str ) 
	{
		var resultStr = "";
		var i = len = 0;

		// Return immediately if an invalid value was passed in
		if (str+"" == "undefined" || str == null)	
			return null;

		// Make sure the argument is a string
		str += "";

		if (str.length == 0) 
			resultStr = "";
		else {	
  			// Loop through string starting at the beginning as long as there
  			// are spaces.
			//	  	len = str.length - 1;
			len = str.length;
		
  			while ((i <= len) && (str.charAt(i) == " "))
				i++;

   			// When the loop is done, we're sitting at the first non-space char,
 			// so return that char plus the remaining chars of the string.
  			resultStr = str.substring(i, len);
  		}

  		return resultStr;
	} // end TrimLeft

	function TrimRight( str ) 
	{
		var resultStr = "";
		var i = 0;

		// Return immediately if an invalid value was passed in
		if (str+"" == "undefined" || str == null)	
			return null;

		// Make sure the argument is a string
		str += "";
	
		if (str.length == 0) 
			resultStr = "";
		else {
  			// Loop through string starting at the end as long as there
  			// are spaces.
  			i = str.length - 1;
  			while ((i >= 0) && (str.charAt(i) == " "))
 				i--;
 			
 			// When the loop is done, we're sitting at the last non-space char,
 			// so return that char plus all previous chars of the string.
  			resultStr = str.substring(0, i + 1);
  		}
  	
  		return resultStr;  	
	} // end TrimRight


	
	function IsNumAmount( numstr ) 
	{
		// Return immediately if an invalid value was passed in
		if (numstr+"" == "undefined" || numstr+"" == "null" || numstr+"" == "")	
			return false;

		var isValid = true;
		var decCount = 0;		// number of decimal points in the string
		var decPos = 0;

		// convert to a string for performing string comparisons.
		numstr += "";	

		// Loop through string and test each character. If any
		// character is not a number, return a false result.
 		// Include special cases for negative numbers (first char == '-')
		// and a single decimal point (any one char in string == '.').   
		for (i = 0; i < numstr.length; i++) 
		{
			// track number of decimal points
			if (numstr.charAt(i) == ".")
				decCount++;

    		if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9") || (numstr.charAt(i) == "."))) 
			{
       			isValid = false;
       			break;
			} else if ((numstr.charAt(i) == "." && numstr.length == 1) ||
			  		(numstr.charAt(i) == "." && decCount > 1)) {
       			isValid = false;
       			break;
      		} 
   		} // END for   
		decPos=numstr.indexOf(".");		
		cnt=0;
		for(j=decPos+1; j<numstr.length; j++)
		{
			cnt++;
		}		
		if(cnt != 2)		
		  isValid=false;			
   		return isValid;
	}  
	
	
	
/* ======================================================================
FUNCTION:   isMMDDYYYY

INPUT:      s (String) - the string that will be tested to ensure that 
                the value is mm/dd/yyyy

RETURN:     true, if the string matches the format mm/dd/yyyy 
						for example, 06/04/1998;
====================================================================== */
function isMMDDYYYY( s ) {
	var isValid = true;
	var i = 0;
	var mmStr = "";
	var ddStr = "";
	var yyyyStr = "";

	/* loop through the string and test each character */
	for (i = 0; i < s.length; i++) 
	{
		/* the character must be a number, a forward slash or a dash */
		if (!((s.charAt(i) >= "0") && (s.charAt(i) <= "9") || 
			(s.charAt(i) == "/")))
		{
			return false
		} 
	} // end for loop
	
	/* Handles case of mm/dd/yyyy  or mm-dd-yyyy*/
	if (s.length == 10) 
	{
		mmStr = s.substring(0, 2);
		ddStr = s.substring(3, 5);
		yyyyStr = s.substring(6, 10);	
	} 
	else 
		return false
     
	/* there are only 12 months in a year */
	if (!((eval(mmStr) >= 1) && (eval(mmStr) <= 12))) 
		isValid = false;
	
	/* there are a maximum of 31 days in a month */
	if (!((eval(ddStr) >= 1) && (eval(ddStr) <= 31))) 
		isValid = false;

	/* test to see that year string is a valid integer;  will throw exception if not */
	if (eval(yyyyStr) < 1900)
	    isValid = false;
	return isValid;
} // end isMMDDYYYY

/* ======================================================================
FUNCTION:   isMMDDYY

INPUT:      s (String) - the string that will be tested to ensure that 
                the value is mm/dd/yy

RETURN:     true, if the string matches the format mm/dd/yy
						for example, 06/04/1998;
====================================================================== */
function isMMDDYY( s ) {
	var isValid = true;
	var i = 0;
	var mmStr = "";
	var ddStr = "";
	var yyStr = "";

	/* loop through the string and test each character */
	for (i = 0; i < s.length; i++) 
	{
		/* the character must be a number, a forward slash or a dash */
		if (!((s.charAt(i) >= "0") && (s.charAt(i) <= "9") || 
			(s.charAt(i) == "/")))
		{
			return false
		} 
	} // end for loop
	
	/* Handles case of mm/dd/yyyy  or mm-dd-yyyy*/
	if (s.length == 8) 
	{
		mmStr = s.substring(0, 2);
		ddStr = s.substring(3, 5);
		yyStr = s.substring(6, 8);	
	} 
	else 
		return false
     
	/* there are only 12 months in a year */
	if (!((eval(mmStr) >= 1) && (eval(mmStr) <= 12))) 
		isValid = false;
	
	/* there are a maximum of 31 days in a month */
	if (!((eval(ddStr) >= 1) && (eval(ddStr) <= 31))) 
		isValid = false;

	/* test to see that year string is a valid integer;  will throw exception if not 
	if (eval(yyyyStr) < 1900)
	    isValid = false;*/
	return isValid;
} // end isMMDDYY

/* ======================================================================
FUNCTION:  	IsValidPhone
 
INPUT:    	str (string) - an phone number to be tested
				incAreaCode (boolean) - if true, area code is included (10-digits);
												if false or undefined, area code not included

RETURN:  	true, if the string contains a 7-digit phone number and incAreaCode == false
				or is undefined
				true, if the string contains a 10-digit phone number and incAreaCode == true
				false, otherwise

CALLS:		StripNonNumeric(), which is defined elsewhere in the Script Library

PLATFORMS:	Netscape Navigator 3.01 and higher,
			  	Microsoft Internet Explorer 3.02 and higher,
			  	Netscape Enterprise Server 3.0,
			  	Microsoft IIS/ASP 3.0.
====================================================================== */
function IsValidPhone( str, incAreaCode ) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	// Set default value for incAreaCode to false, if undefined or null
	if (incAreaCode+"" == "undefined" || incAreaCode+"" == "null")	
		incAreaCode = false;

	var isValid = true;

	str += "";

	// After stripping out non-numeric characters, such as dashes, the
	// phone number should contain 7 digits (no area code) or 10 digits (area code)
	str = StripNonNumeric(str+"");
	if (incAreaCode && str.length != 10)
		isValid = false;
   if (!incAreaCode && str.length != 7)
		isValid = false;

   	return isValid;
} // end IsValidPhone


/* ======================================================================
FUNCTION:	StripNonNumeric
 
INPUT:  		str (string) - a string to be altered

RETURN: 		a string containing only numeric characters 0-9;
				returns null if invalid arguments were passed

DESC:			This function removes all non-numeric characters from a given
				string.  It is useful for removing dashes, parentheses, etc. from input 
				strings such as credit card numbers or phone nubmers.
====================================================================== */
function StripNonNumeric( str ) {
	var 	resultStr = "";

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";

	// Loop through entire string, adding each character from the original
	// string if it is a number
	for (var i=0; i < str.length; i++)
	{
   	if ( (str.charAt(i) >= "0") && (str.charAt(i) <= "9") )
      			resultStr = resultStr + str.charAt(i);
 
   } // end for loop      

   return resultStr;
}  // end StripNonNumeric

function chkdate(objName) {

var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
strDate = datefield;
if (strDate.length < 1) {
return false;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
}
else {
datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
function doDateCheck(from, to) {
if (Date.parse(from.value) <= Date.parse(to.value)) {
alert("The dates are valid.");
}
else {
if (from.value == "" || to.value == "") 
alert("Both dates must be entered.");
else 
alert("To date must occur after the from date.");
   }
}
