Is this electrical junction up to code?
At first glance, I see several problems:


The junction should be in a junction box.
Is there even an electrical nut on the live wires?  Hard to tell under all that electrical tape, but it doesn't look as if there's room for one.
Is the neutral from the red wire at top going into that tangle of lives?  If it's carrying live, it should be tagged to indicate that.
The red wire to the right shouldn't be running along the top of the ceiling joist.  If you can, run it along the middle of one of the sides.
Ideally, the yellow wire at bottom would pass through a hole drilled through the joist.  Failing that, there should be furring strips either side to prevent you from stepping on it.
The electrical tape on the neutral and ground wires isn't strictly necessary for code, but if it's there, it's customary to have it go around the nut to help hold it in place.
Thanks to @tester101: different sheath colors indicates different gauge wires.  Check that your circuit breaker has the appropriate amperage rating.
Staples: if you run wires across the joists, they should be stapled to keep them in place between the furring strips (that you also need; see #5).  You'll also need them along the length of the wires that run along the joists, and it might be a good idea to have one near where the wire drops down through the 2x4 header (given the quality of the rest of the job, whoever did this may not have used staples when running the wire through the wall cavity).
It looks as if you might have a lot of slack in those wires.  Wiring shouldn't be piano-wire taut, but you don't want enough slack that you can trip over it.


Just because the inspector didn't mention it, doesn't mean it's OK.  They're human, so they can miss things, especially in an attic where the lighting isn't good.