swapDepth problem

Hello,

I was wondering if someone could help me with a script that I am trying to get to work properly in the main shell for a clients website. The script works by itself just fine, but when I have the script load in the main shell, the speed of the script greatly increases.

Any help would be great, the following is a link to the files, http://www.jvsdesigns.com/swapDepth.zip

Thanks,
-Jason