function isDate( s ){    
    var sDay, sMonth, sYear, nMonth, nDay, nYear, nSep1, nSep2;
    nSep1 = s.indexOf( "/" );	if ( nSep1 < 0 ) return false;
    nSep2 = s.lastIndexOf( "/" );	if ( nSep2 < 0 ) return false;
    if ( nSep1 == nSep2 ) return false;

    sMonth= s.substring( 0, nSep1  );
    sDay = s.substring( nSep1 + 1, nSep2 );
    sYear = s.substring( nSep2+1 );
    if ( !sMonth.length || !sDay.length || !sYear.length ) return false;
    // isNaN(empty) is false
    if ( isNaN(sMonth) || isNaN(sDay) || isNaN(sYear) ) return false;
    nMonth = parseInt(sMonth,10); nDay = parseInt(sDay,10); nYear = parseInt(sYear,10);
    if ( nMonth<=0 || nDay<=0 || nYear<=0 ) return false;
    if ( nMonth > 12 ) return false;
    if (nMonth==1 || nMonth==3 || nMonth==5 || nMonth==7 || nMonth==8 || nMonth==10 || nMonth==12 )
	if ( nDay > 31 ) return false; 
    if (nMonth==4 || nMonth==6 || nMonth==9 || nMonth==11 )
	if ( nDay > 30 ) return false; 
    if (nMonth==2) {
	   if ( (nYear % 4 == 0) && (nYear % 100 != 0)) { // leap year
		if ( nDay > 29 ) return false;
	} else if ( nDay > 28 ) return false;
}
return true;
}
