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 "BLACK": ao(s, "AXS (22-24\") INSEAM 3.5\"","AXS (22-24\") INSEAM 3.5\"", x++); ao(s, "AS (24-26\") INSEAM 4\"","AS (24-26\") INSEAM 4\"", x++); ao(s, "AXL (34\") INSEAM 4.5\"","AXL (34\") INSEAM 4.5\"", x++); ao(s, "AXXS (20-22\") INSEAM 3.5\"","AXXS (20-22\") INSEAM 3.5\"", x++); break; case "ROYAL": ao(s, "A L(30-32\") INSEAM 4.5\"","A L(30-32\") INSEAM 4.5\"", x++); ao(s, "AM (26-28\") INSEAM 4\"","AM (26-28\") INSEAM 4\"", x++); ao(s, "AXL (34\") INSEAM 4.5\"","AXL (34\") INSEAM 4.5\"", 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;