are ECU's interchangeable?

So I've googled until my eyes were gonna fall out and I can't seem to find a specific answer for what I'm looking for. I have an 02 Toyota Celica GT with what I THINK is a bad ECU (runs until it warms up, shuts down, won't start again until cooled down) so my questions are:

[*]will an '01 GT ECU fit in my '02 GT? (it's an automatic 1.8L 1zz)
[*]where exactly is the ECU located in an '02 (I've heard both under the Hood and under the glovebox, and I really don't want to tear anything apart without being for sure)
[*]and lastly what's the likelihood of my problem (with the stalling out until cooled down business) being the ECU? (because I've also been told it could be the crankshaft sensor?)

Thank you for any and all help you can give!