It will be tricky to debug that without the full code. How could we know if your variables are globals, if you're calling the right control vars and so on!?
Anyway, the first thing to do would be to test the value of panAct
var by adding alert(panAct);
instructions just at the beginning of your function.
By the way, it would probably be a great idea to return panAct;
var at the end.