HELP with Infrared emitter + sensor problems

Well, you haven't declared "val", so we'll assume it is an "int".
If you read an analogue pin, unless it is nailed to ground, it will almost certainly read > 0, so that might need some attention too.

The infrared LED is hooked up to digital pin 13

...via a suitable resistor, I assume?

I have the regular LED attached to digital pin 12

...ditto.

I think you may be a little optimistic expecting a 20cm range.