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 "H057 - GREY": ao(s, "2XL - $30.59","2XL", x++); ao(s, "3XL - $32.19","3XL", x++); ao(s, "L - $29.39","L", x++); ao(s, "M - $29.39","M", x++); ao(s, "S - $29.39","S", x++); ao(s, "XL - $29.39","XL", x++); ao(s, "XS - $29.39","XS", x++); break; case "H080 - BLACK": ao(s, "2XL - $30.59","2XL", x++); ao(s, "3XL - $32.19","3XL", x++); ao(s, "L - $29.39","L", x++); ao(s, "M - $29.39","M", x++); ao(s, "S - $29.39","S", x++); ao(s, "XL - $29.39","XL", x++); ao(s, "XS - $29.39","XS", x++); break; case "H065 - NAVY": ao(s, "2XL - $30.59","2XL", x++); ao(s, "3XL - $32.19","3XL", x++); ao(s, "L - $29.39","L", x++); ao(s, "M - $29.39","M", x++); ao(s, "S - $29.39","S", x++); ao(s, "XL - $29.39","XL", x++); ao(s, "XS - $29.39","XS", 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;