function emulateDisabled(selectBox) {
 for (var i=0, option; option = selectBox.options[i]; i++) {
        if (option.disabled) {
               option.style.color = "graytext";
        }else{
               option.style.color = "menutext";
        }
 }
}
function restoreEmulateDisabled(selectBox) {
 for (var i=0, option; option = selectBox.options[i]; i++) {
        if(option.selected && option.disabled){
               option.selected=false;
        }
 }
}
function addEmulation(selectBox){
 window.select_current = new Array();
 selectBox.onfocus = function(){ window.select_current[this.id] = this.selectedIndex; }
 selectBox.onchange = function(){ restoreEmulateDisabled(this); }
}

function optionEmulationInit() {
 if (document.getElementsByTagName) {
        var s = document.getElementsByTagName("select");
        if (s.length > 0) {
               window.select_current = new Array();
               for (var i=0, select; select = s[i]; i++) {
                      select.onfocus = function(){ window.select_current[this.id] = this.selectedIndex; }
                      select.onchange = function(){ restoreEmulateDisabled(this); }
                      emulateDisabled(select);
               }
        }
 }
}
