<!--
function isblank(s)
{
	if (s == null) return false;
	
	for (var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if ((c != ' ') && (c != '\n') && (c != '\t'))
		{
			return false;
		}
	}
	return true;
}

//-------------------------------------------------------------------------------------------------------------------------

function isInteger(s)
{
	if (s == null) return false;
	if (s == "") return false;
	
	for (var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if ((c != '0') && (c != '1') && (c != '2') && (c != '3') && (c != '4') && (c != '5') && (c != '6') && (c != '7') && (c != '8') && (c != '9'))
		{
			return false;
		}
	}
	return true;
}

//-------------------------------------------------------------------------------------------------------------------------

function isFloat(s)
{
	if (s == null) return false;
	if (s == "") return false;
	
	for (var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if ((c != '0') && (c != '1') && (c != '2') && (c != '3') && (c != '4') && (c != '5') && (c != '6') && (c != '7') && (c != '8') && (c != '9') && (c != '.'))
		{
			return false;
		}
	}
	return true;
}
//-------------------------------------------------------------------------------------------------------------------------
function isCurrency(s)
{
	var decimal_bln = false
	var decimal_digits = 0
	if (s == null) return false;
	if (s == "") return false;
	
	for (var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if ((c != '0') && (c != '1') && (c != '2') && (c != '3') && (c != '4') && (c != '5') && (c != '6') && (c != '7') && (c != '8') && (c != '9') && (c != '.'))
		{
			return false;
		}
		
		if (decimal_bln)
		{
			if (c == '.')
			{
				return false
			}
					
			decimal_digits = decimal_digits + 1		
		}
		
		if (decimal_digits > 2)
		{
			return false
		}
				
		if (c == '.')
		{
			decimal_bln = true
		}				
	}
	return true;
}
//-------------------------------------------------------------------------------------------------------------------------

//returns true if a date is valid.
//checks for proper number of days in month including leap years.
//expects date in the format of m/d/yyyy.
//can be modified to accept month, day, and year as seperate variables,
//just remove the date parsing section
function isDateValid(pDate)
{
	if (pDate == null) return false;
	
	var m,d,y;
	var slash1, slash2;

	slash1 = pDate.indexOf('/',0);
	slash2 = pDate.indexOf('/',slash1 +1);
	
	//checks to see if the date is formatted properly
	if (slash1 == -1 || slash2 == -1)
		{return false}
	//parses the month day and year into seperate variables		
	m = pDate.substr(0,slash1);
	d = pDate.substr(slash1 + 1, slash2 - slash1 - 1 );
	y = pDate.substr(slash2 + 1, pDate.length - slash2 - 1);
		
	// month has either one or two digits
	if (m.length < 1 || m.length > 2)
		{return false}		
	// day has either one or two digits
	if (d.length < 1 || d.length > 2)
		{return false}
	// year must have 4 digits
	if (y.length != 4)
		{return false}
	
	m = m - 0; //casts the month as an integer
	d = d - 0; //casts the day as an integer
	y = y - 0; //casts the year as an integer
	
	if (d<1 || d>31) 
		{return false}
	if (m<1 || m>12)
		{return false}	
	if (m==4 || m==6 || m==9 || m==11) //these months only have 30 days
		{
			if (d==31) 
				{return false}
		}
	if (m==2) //check leap year days
  	{
  		var x = parseInt(y/4);
		if (isNaN(x)) 
			{return false}
		if (d>29)     
			{return false}
		if (d==29 & ((y/4)!=parseInt(y/4)))
			{return false}
	}	
	return true;
}
//-------------------------------------------------------------------------------------------------------------------------
function isChecked(group)
{
	if (group.length == null) 
	{
		if (group.checked)
		{
			return true
		}
		else
		{
			return false
		}
	}
	
	for (var i = 0; i < group.length; i++)
	{		
		if (group[i].checked) 
		{	
			return true
		}
	}	
	return false
}

//-------------------------------------------------------------------------------------------------------------------------
function getCheckedValue(group)
{
	if (group.length == null) 
	{
		if (group.checked)
		{
			return group.value
		}
		else
		{
			return null
		}
	}
	
	for (var i = 0; i < group.length; i++)
	{		
		if (group[i].checked) 
		{	
			return group[i].value
		}
	}	
	return false
}

//-------------------------------------------------------------------------------------------------------------------------
function getSelectedValue(group)
{
	return group.options[group.selectedIndex].value
}

//-------------------------------------------------------------------------------------------------------------------------
//allows numbers 0-9 and a single decimal point
function isFloatOrBlank(s)
{
	if (s == null) return true;
	if (s == '') return true;
	
	var decimal_found = false;
	
	for (var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if ((c != '0') && (c != '1') && (c != '2') && (c != '3') && (c != '4') && (c != '5') && (c != '6') && (c != '7') && (c != '8') && (c != '9') && (c != '.'))
		{
			return false;
		}
		
		if (decimal_found)
		{
			if (c=='.')
			{
				return false
			}
		}		
		
		if (c=='.')
		{
			decimal_found = true
		}
	}
	return true;
}
//-------------------------------------------------------------------------------------------------------------------------
function isCurrencyOrBlank(s)
{
	if (s == null) return true;
	if (s == '') return true;
	var decimal_bln = false
	var decimal_digits = 0
	
	
	for (var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if ((c != '0') && (c != '1') && (c != '2') && (c != '3') && (c != '4') && (c != '5') && (c != '6') && (c != '7') && (c != '8') && (c != '9') && (c != '.'))
		{
			return false;
		}
		
		if (decimal_bln)
		{
			if (c == '.')
			{
				return false
			}
					
			decimal_digits = decimal_digits + 1		
		}
		
		if (decimal_digits > 2)
		{
			return false
		}
				
		if (c == '.')
		{
			decimal_bln = true
		}				
	}
	return true;
}
//-------------------------------------------------------------------------------------------------------------------------

//returns true if a date is valid or is blank
//checks for proper number of days in month including leap years.
//expects date in the format of m/d/yyyy.
//can be modified to accept month, day, and year as seperate variables,
//just remove the date parsing section
function isDateValidOrBlank(pDate)
{
	if (pDate == '') return true;
	if (pDate == null) return true;
	
	var m,d,y;
	var slash1, slash2;

	slash1 = pDate.indexOf('/',0);
	slash2 = pDate.indexOf('/',slash1 +1);
	
	//checks to see if the date is formatted properly
	if (slash1 == -1 || slash2 == -1)
		{return false}
	//parses the month day and year into seperate variables		
	m = pDate.substr(0,slash1);
	d = pDate.substr(slash1 + 1, slash2 - slash1 - 1 );
	y = pDate.substr(slash2 + 1, pDate.length - slash2 - 1);
		
	// month has either one or two digits
	if (m.length < 1 || m.length > 2)
		{return false}		
	// day has either one or two digits
	if (d.length < 1 || d.length > 2)
		{return false}
	// year must have 4 digits
	if (y.length != 4)
		{return false}
	
	m = m - 0; //casts the month as an integer
	d = d - 0; //casts the day as an integer
	y = y - 0; //casts the year as an integer
	
	if (d<1 || d>31) 
		{return false}
	if (m<1 || m>12)
		{return false}	
	if (m==4 || m==6 || m==9 || m==11) //these months only have 30 days
		{
			if (d==31) 
				{return false}
		}
	if (m==2) //check leap year days
  	{
  		var x = parseInt(y/4);
		if (isNaN(x)) 
			{return false}
		if (d>29)     
			{return false}
		if (d==29 & ((y/4)!=parseInt(y/4)))
			{return false}
	}	
	return true;
}
//-------------------------------------------------------------------------------------------------------------------------

function isIntegerOrBlank(s)
{
	if (s == null) return true;
	if (s == '') return true;
	
	for (var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if ((c != '0') && (c != '1') && (c != '2') && (c != '3') && (c != '4') && (c != '5') && (c != '6') && (c != '7') && (c != '8') && (c != '9'))
		{
			return false;
		}
	}
	return true;
}

//-------------------------------------------------------------------------------------------------------------------------

function checkExtension(filename,extension)
{
	var file_extension = filename.substr(filename.length - extension.length)
	
	if ((file_extension == extension) && (filename.length > extension.length))
	{	
		return true
	}
	else
	{		
		return false
	}
}

//----------------------------------------------------------------------------------------
function subtractWorkingDays(iDate, workingDays)
{
	
	var MINUTE = 60 * 1000
	var HOUR = MINUTE * 60
	var DAY = HOUR * 24	
	
	var totalDays = 0				
	var i = 0
	var tempDate = new Date(iDate)
	
	while (i != workingDays)
	{
		totalDays++		
		
		tempDate.setTime(tempDate.getTime() - DAY)
		
		if ((tempDate.getDay() != 0) && (tempDate.getDay() != 6))
		{			
			i++		
		}
	}
	
	var FinalDate = new Date(new Date(iDate).getTime() - (DAY * totalDays))
	
	var FinalDate_str = (FinalDate.getMonth() + 1) + "/" + FinalDate.getDate() + "/" + FinalDate.getFullYear() 
		
	return FinalDate_str
}

//------------------------------------------------------------------------------------------------
//compares two dates
//dates should be in the format of m/d/yyyy
// returns: 
//	    -1 if date1 is less than date2
//       0 if date1 is equal to date2
//       1 if date1 is greater than date2
function DateCompare(pDate1, pDate2)
{
	var dt1, dt2, ms1, ms2;
	
	dt1 = new Date(pDate1);
	dt2 = new Date(pDate2);
	
	ms1 = dt1.getTime()
	ms2 = dt2.getTime()
	
	//alert(ms1 + " " + ms2)
	
	if (ms1 < ms2) return -1
	
	if (ms1 == ms2) return 0
	
	if (ms1 > ms2) return 1	
}

// -->
