Courtesy of the Gregg Reference Manual:

When an if clause states a condition that is highly improbable, doubtful, or contrary to fact, the verb in the if clause requires special treatment: to express present time, use the past tense; to express past time, use the past perfect tense.

EG: If I were you, I would take the job.
If I had been in your shoes, I would have taken the job.

When an if clause states a condition that is possible or likely, the verb requires no special treatment.

SO: If I go to San Francisco (and I probably will), I will want you to go with me.

If I were going to San Francisco (but I probably won't), I would want you to go with me.

The same treatment of verbs applies to with clauses as does to improbable contingencies.