Notice this line:
alert(id);
What I get is a blank popup window. Shouldn't id be equal to 4? I don't understand it. The reason why this matters is because I need the id for the next three/four lines of code that are commented now.
EDIT:
Now, I'm using valid ids but the alerts are still empty:
photos) > 0): ?>