Javascript error in Blog Types plugin

Blog types seems to load some of it’s javascript all the time (setup_subtypes_box() is attached to the wp_head action). The problem is that this javascript has a function called setup_subtypes_box() that does this:

var types_box = document.getElementById('blog_type');

var types_box_value = types_box.options[types_box.selectedIndex].value;

Since the element with the id ‘blog_type’ does not alway exist, one of two things needs to happen:

1) Conditionally load the javascript only if the element it written out (this would be best)

2) Adjust the code to avoid the error like this:

var types_box = document.getElementById('blog_type');

if ( ! types_box ) {

return;

}

var types_box_value = types_box.options[types_box.selectedIndex].value;