Sorry, but we can't help with homework. One thing I will say is that most browsers have an option to open a console or other descriptive error dialogue on javascript errors using that will give you fair insight into whats going wrong.
EDIT: that might be a little harsh... you should check the casing on your variables. If necessary you could use an alert to show where your code is getting up to.