Don't worry, it's not broken. That's the normal behavior any time you disconnect the battery. Check out your back window. I think you'll find that it isn't working via the remote either.
Here is the procedure to reset it.
Sunroof
-----------
1) Push the reverse arrow and open the roof half way
2) Wait a few seconds
3) Push the forward arrow until the window closes and then pops up. Continue to hold it down for a few seconds (5 maybe?).
That's it. It should work normally now.
Rear window
--------------------
1) Using the dash controls, lower the window all the way
2) Using the dash controls, raise the window all the way
IIRC, it should work now.
Let me know if either of these procedures don't work. In that case, I'll look them up to make sure I gave you the 'exact' right steps. Also, I think this issue was posted here before somewhere so you can try searching if what I said doesn't work.