You have to download the firmware from this site in the downloads section and do a shift + hold home button on the iphone to go into recovery mode. Then hold shift and click restore, and the pc will let you choose the file, route to the firmware file you just downloaded. This will take you back to out of the box state.

Then you activate your phone BEFORE jailbreak, as long as you going to use at&t.