Does anyone see a problem with the following code that might have an impact on SEO or the way that google parses our website?

After using this code we noticed a significant drop in traffic and we noticed that google suddenly stopped listing many of the pages on our site and instead began listing the page that we are redirecting to.

Any thoughts would be appreciated.

<script type="text/javascript"> if (typeof(toStaticHTML)=="function"){alert('Message goes here');window.location = ""}</script>