So I've got this "nice" Drupal 7 site and there is a node with a large (70is) fields that the user fills in. There is a script that hides and shows certain questions depending on the previous answer. It works fine in IE9, FF, Chrome and Safari but in IE8 it gives this error:

> 
> A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer might become unresponsive.
> 
> 
> Stop running script? YES/NO
> 
> 
> 

There are only around 10 lines of my code being run, the rest is written out by Drupal. Is there a way to split up the script or speed it up? Or should I avoid using Drupal to write javascript and custom code it?

**EXAMPLE**

In the node/add I have code like this:

```
$form['group_section_one']['field_permit_number']['#states'] = array(
        'visible' => array(
            ':input[name="field_do_you_have_a_permit[und]"]' => array('value' => '1'),
        )
    );

```

To show the "permit number" field if they answer Yes to "Do you have a permit?". I do a similar thing for another 60 fields sometimes they depend on up to 4 field values.

That then writes out javascript which equates to around 100 lines all up. I wouldn't have thought that would freeze up the browser though...