function ao(c,txt,val,idx){ c.options[idx] = new Option(txt,val); } function setSizes(c, s){ var id; var x=0; var opt; if (!s || !c) return; if (c.selectedIndex < 1){ clearSizes(); return; } id = c.options[c.selectedIndex].value; s.options.length = 0; opt = new Option('Please select a size', ''); s.options[x++] = opt; switch(id){ case "ALL ALUMINUM": ao(s, "12 FT - BEDGS12 - $465.79","12 FT - BEDGS12", x++); ao(s, "15 FT - BEDGS15 - $505.99","15 FT - BEDGS15", x++); ao(s, "21 FT - BEDGS21 - $676.49","21 FT - BEDGS21", x++); ao(s, "24 FT - BEDGS24 - $786.49","24 FT - BEDGS24", x++); ao(s, "6 FT - BEDGS06 - $287.49","6 FT - BEDGS06", x++); ao(s, "8 FT - BEDGS08 - $327.79","8 FT - BEDGS08", x++); break; } } function initSizes (){ var s, c, f=document.frmOrder; if ( !f ) return; s = f.sizes; c = f.colors; if (!c || !s) return; if (c.selectedIndex > 0){ setSizes(c, s); } else { s.options.length = 0; var opt = new Option('Please select a color first', ''); s.options[0] = opt; } } function clearSizes (){ var s, c, f=document.frmOrder; if ( !f ) return; s = f.sizes; c = f.colors; if (!c || !s) return; if (c.selectedIndex > 0) return; s.options.length = 0; var opt = new Option('Please select a color first', ''); s.options[0] = opt; } window.onload = initSizes;