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 "003-BLACK": ao(s, "AS - $16.29","AS", x++); ao(s, "AM - $16.29","AM", x++); ao(s, "AL - $16.29","AL", x++); ao(s, "AXL - $16.29","AXL", x++); ao(s, "AXXL - $16.29","AXXL", x++); ao(s, "AXXXL - $17.99","AXXXL", x++); break; case "G41-VIBE NAVY": ao(s, "AS - $16.29","AS", x++); ao(s, "AM - $16.29","AM", x++); ao(s, "AL - $16.29","AL", x++); ao(s, "AXL - $16.29","AXL", x++); ao(s, "AXXL - $16.29","AXXL", x++); ao(s, "AXXXL - $17.99","AXXXL", x++); break; case "045-WHITE": ao(s, "AS - $16.29","AS", x++); ao(s, "AM - $16.29","AM", x++); ao(s, "AL - $16.29","AL", x++); ao(s, "AXL - $16.29","AXL", x++); ao(s, "AXXL - $16.29","AXXL", x++); ao(s, "AXXXL - $17.99","AXXXL", x++); break; case "BR4-STONE GRAY": ao(s, "AS - $16.29","AS", x++); ao(s, "AM - $16.29","AM", x++); ao(s, "AL - $16.29","AL", x++); ao(s, "AXL - $16.29","AXL", x++); ao(s, "AXXL - $16.29","AXXL", x++); ao(s, "AXXXL - $17.99","AXXXL", 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;