This is actually an Scripts & Popups function and not Developers stuff but it would be nice to show us the code to help you further because now we cannot imagine where is the problem exactly.