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 "659-MAROON": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", x++); break; case "486-ROYAL": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", x++); break; case "301-FOREST": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", x++); break; case "511-SKY": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", x++); break; case "317-ORANGE": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", x++); break; case "107-NAVY": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", x++); break; case "26-BLACK": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", x++); break; case "148-RED": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", x++); break; case "544-PINK": ao(s, "16\" X 10\" X 18\"","16\" X 10\" X 18\"", 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;