Maybe...

Code:
If $day>0		 
$date=DateMath($date, $day)
EndIf



Should be...

Code:
If $day>0		 
$date=DateMath($date, $day)
Else
$date=@date
EndIf