// this will simply run a series of checks, if any fail then error
	function CheckDate(TextBox, sMessage, bValueError)
	{
	    bValueError = false;
		if(TextBox.value == '')
		{
			bValueError = false;
			return bValueError;
	    }
		if(TextBox.value.length != 10)
		{
			bValueError = true;
			TextBox.value = '';
			TextBox.focus();
			alert(sMessage);
			return bValueError;
		} // end if 10 chracters long
		
		if((TextBox.value.charAt(2) != '/') || (TextBox.value.charAt(5) != '/'))
		{
			bValueError = true;
			TextBox.value = '';
			TextBox.focus();
			alert(sMessage);
			return bValueError;
		} // end if / not right
	
		month = TextBox.value.substr(0,2);
		day = TextBox.value.substr(3,2);
		year = TextBox.value.substr(6,4);
	
		//this is to check if the expiration date has past the current date
		myDate = new Date();
		currentYear = myDate.getFullYear();
		currentMonth = myDate.getMonth() + 1;
		currentDay = myDate.getDate();
	
		if ((currentYear == year) && (currentMonth > month))
		{
			bValueError = true;
			TextBox.value = '';
			TextBox.focus();
			alert('That date has already passed.');
			return bValueError;
		}
		if ((currentYear == year) && (currentMonth == month) && (currentDay > day))
		{
			bValueError = true;
			TextBox.value = '';
			TextBox.focus();
			alert('That date has already passed.');
			return bValueError;				
		}
		//ending to check if the expiration date has past the current date
			
		if((isNaN(Number(year))) || (year < 0))
		{
			bValueError = true;
			TextBox.value = '';
			TextBox.focus();
			alert(sMessage);
			return bValueError;		
		} // end if year is not a number or not greater that 0
		
		if((isNaN(Number(month))) || (month < 1) || (month > 12))
		{
			bValueError = true;
			TextBox.value = '';
			TextBox.focus();
			alert(sMessage);
			return bValueError;		
		} // end if month is not a number or with in the boundry of 1-12
		
		if(isNaN(Number(day)))
		{
			bValueError = true;
			TextBox.value = '';
			TextBox.focus();
			alert(sMessage);
			return bValueError;		
		} // end if day is not a number
		
		if(month == 2)
		{
			// claculate for leap year
			if (year % 4 != 0)
		    {  FebMax = 28;  }
			else if  (year % 400 == 0)
			{  FebMax = 29;  }
			else if (year % 100 == 0)
			{  FebMax = 28;  }
			else
			{  FebMax = 29;  }
			
			if(FebMax == 28)
			{
				if((day < 1) || (day > 28))
				{
					bValueError = true;
					TextBox.value = '';
					TextBox.focus();
					alert(sMessage);
					return bValueError;		
				}
			}
			else
			{
				if((day < 1) || (day > 29))
				{
					bValueError = true;
					TextBox.value = '';
					TextBox.focus();
					alert(sMessage);
					return bValueError;		
				}
			}
		}
		else if((month == 4) || (month == 6) || (month == 9) || (month == 11))
		{
			if((day < 1) || (day > 30))
			{
				bValueError = true;
				TextBox.value = '';
				TextBox.focus();
				alert(sMessage);
				return bValueError;		
			}
		}
		else
		{
			if((day < 1) || (day > 31))
			{
				bValueError = true;
				TextBox.value = '';
				TextBox.focus();
				alert(sMessage);
				return bValueError;		
			}
		}
	} // end function CheckDate(TextBox,sMessage)
