title: Unable to set selection in select drop-down with javascript in IE8
body: <p>Given the the following javascript function,</p>
  
  <pre><code>function switch_plug_drop_down(plug_id) {
        selector = document.getElementById('group_1');
        if (plug_id == "1") {selector.options['product_253'].selected = true;}
        if (plug_id == "2") {selector.options['product_217'].selected = true;}
        if (plug_id == "3") {selector.options['product_254'].selected = true;}
        if (plug_id == "4") {selector.options['product_255'].selected = true;}
        if (plug_id == "5") {selector.options['product_256'].selected = true;}
    }
  </code></pre>
  
  <p>and the following HTML select element (generated by cs-cart)</p>
  
  <pre><code>&lt;select name="product_data[245][configuration][1]" id="group_1" onchange="fn_check_exceptions(245);fn_check_compatibilities(1,'select','S');"&gt; 
      &lt;option id="product_255" value="255"  &gt;Power Adapter Plug Choice AUS&lt;span class="price"&gt;&lt;/span&gt;&lt;/option&gt; 
      &lt;option id="product_217" value="217"  &gt;Power Adapter Plug Choice EURO&lt;span class="price"&gt;&lt;/span&gt;&lt;/option&gt; 
      &lt;option id="product_256" value="256"  &gt;Power Adapter Plug Choice JAPAN&lt;span class="price"&gt;&lt;/span&gt;&lt;/option&gt; 
      &lt;option id="product_254" value="254"  &gt;Power Adapter Plug Choice UK&lt;span class="price"&gt;&lt;/span&gt;&lt;/option&gt; 
      &lt;option id="product_253" value="253" selected="selected"} &gt;Power Adapter Plug Choice USA / Canada&lt;span class="price"&gt;&lt;/span&gt;&lt;/option&gt; 
  &lt;/select&gt; 
  </code></pre>
  
  <p>This works fine in FF 3.6.8, Chrome 5.0.375, but fails in IE 8 (browser mode 8, document mode IE8 Standard)</p>
  
  <p>I am getting an error in IE 8's javascript debugger : </p>
  
  <pre><code>'selector.options.product_217' is null or not an object
  </code></pre>
  
  <p>and this corresponds to <code>selector.options['product_217'].selected = true;</code> in the js code above.</p>
  
  <p>Also, jQuery 1.3.n is on the site and works fine.</p>
  
  <p>Does anybody know what is going on and how to fix it? </p>
  
  <p>UPDATE:</p>
  
  <p>I implemented Tim's solution, but had the values loaded on automatically:</p>
  
  <pre><code>selector = document.getElementById('group_1');
  for (var i = 0; i &lt; selector.children.length; ++i) {
      var child = selector.children[i];
      if (child.tagName == 'OPTION') optionIndicesByPlugId[child.value]=''+i;
  }
  </code></pre>
  
  <p>(this code came from <a href="https://stackoverflow.com/questions/3231539/get-options-of-a-select-box-in-internet-explorer">this SO question's first answer</a>)</p>
  
  <p>and the plug_id that is passed to the <code>switch_plug_drop_down</code> function is not a 1-5 number anymore but the value in the select. </p>