	function die( msg , focus )	{
		focus.focus();
		if(msg!='')	alert( msg );
		return false;
	}

	function valid_date( year, month, mday, before_today, after_today )	{
		if (!isDate(year,month,mday))
			return false;
		if( before_today && after_today )	return true;
		if( !before_today && !after_today )	return false;
		var today=new Date();
		var tY=today.getFullYear();
		var tM=today.getMonth()+1;
		var tD=today.getDate();
		if( before_today )	{
			if( year>tY ) return false;
			if( year<tY ) return true;
			if( month>tM ) return false;
			if( month<tM ) return true;
			if( mday>tD ) return false;
			if( mday<tD ) return true;
			return true;
		}	else	{
			if( year>tY ) return true;
			if( year<tY ) return false;
			if( month>tM ) return true;
			if( month<tM ) return false;
			if( mday>tD ) return true;
			if( mday<tD ) return false;
			return true;
		}
	}

	function daysInFebruary (year){
		// February has 29 days in any year evenly divisible by four,
		// EXCEPT for centurial years which are not also divisible by 400.
		return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}

	function DaysArray(n) {
		for (var i = 1; i <= n; i++) {
			this[i] = 31
			if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
			if (i==2) {this[i] = 29}
	   } 
	   return this
	}

	function isDate(year,month,day){
		var daysInMonth = DaysArray(12)
		if ( month<1 || month>12){
			return false;
		}
		if ( day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			return false;
		}
		if ( year==0 ){
			return false;
		}
		return true
	}

	function isNumeric(sText)	{
		var ValidChars = "0123456789.";
		var IsNumber=true;
		var Char;
		for (i = 0; i < sText.length && IsNumber == true; i++)
		  {
		  Char = sText.charAt(i);
		  if (ValidChars.indexOf(Char) == -1)
			 {
			 IsNumber = false;
			 }
		  }
		return IsNumber;
	}