I always have to google this when my phone needs a complete reset, so for future reference, here it is.
You simply enter the numbers mentioned here like they where a phone number.
From Bjoern at the MobileMedia forum:
Normal Reset (*#7780#) : Restores ini files from rom but preserves user data (photos, 3rd party apps etc)
Deep Reset (*#7370#) : This reformats completely the C: drive. All applications and files stored on this drive will be lost and clean default files will be rewritten.
In both case, the phone will ask you a confirmation and you will have to enter a security code (12345 by default).