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 "NAVY": ao(s, "A2XL - $4.99","A2XL", x++); break; case "HEATHER (GREY)": ao(s, "YS - $4.99","YS", x++); ao(s, "A3XL - $4.99","A3XL", x++); break; case "SCARLET": ao(s, "YS - $4.99","YS", x++); ao(s, "AS - $4.99","AS", x++); ao(s, "A2XL - $4.99","A2XL", x++); break; case "FOREST": ao(s, "YS - $6.99","YS", x++); ao(s, "YM - $6.99","YM", x++); ao(s, "A3XL - $6.99","A3XL", x++); break; case "ORANGE": ao(s, "YS - $6.99","YS", x++); ao(s, "AXL - $6.99","AXL", x++); ao(s, "A2XL - $6.99","A2XL", x++); ao(s, "A3XL - $6.99","A3XL", x++); break; case "ROYAL": ao(s, "YS - $6.99","YS", x++); ao(s, "YM - $6.99","YM", x++); break; case "MAROON": ao(s, "YS - $6.99","YS", x++); ao(s, "YM - $6.99","YM", x++); ao(s, "A2XL - $6.99","A2XL", x++); ao(s, "A3XL - $6.99","A3XL", x++); break; case "ATHLETIC GOLD": ao(s, "YM - $6.99","YM", x++); ao(s, "YL - $6.99","YL", x++); ao(s, "AS - $6.99","AS", x++); ao(s, "A2XL - $6.99","A2XL", x++); ao(s, "A3XL - $6.99","A3XL", x++); break; case "COLUMBIA BLUE": ao(s, "YS - $4.99","YS", x++); ao(s, "YL - $4.99","YL", x++); ao(s, "A2XL - $4.99","A2XL", x++); ao(s, "A3XL - $4.99","A3XL", 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;