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/PINK HEART & SWIRL GRAPHIC": ao(s, "1 - $22.49","1", x++); ao(s, "1.5 - $21.39","1.5", x++); ao(s, "10 JUNIOR - $22.49","10 JUNIOR", x++); ao(s, "10.5 JUNIOR - $21.39","10.5 JUNIOR", x++); ao(s, "11 JUNIOR - $22.49","11 JUNIOR", x++); ao(s, "11.5 JUNIOR - $21.39","11.5 JUNIOR", x++); ao(s, "12 JUNIOR - $22.49","12 JUNIOR", x++); ao(s, "12.5 JUNIOR - $22.49","12.5 JUNIOR", x++); ao(s, "13 JUNIOR - $22.49","13 JUNIOR", x++); ao(s, "13.5 JUNIOR - $22.49","13.5 JUNIOR", x++); ao(s, "2 - $22.49","2", x++); ao(s, "2.5 - $21.39","2.5", x++); ao(s, "3 - $21.39","3", x++); ao(s, "3.5 - $21.39","3.5", x++); ao(s, "4 - $21.39","4", x++); ao(s, "4.5 - $21.39","4.5", x++); ao(s, "5 - $21.39","5", x++); ao(s, "5.5 - $21.39","5.5", x++); ao(s, "6 - $21.39","6", x++); ao(s, "8 JUNIOR - $21.39","8 JUNIOR", x++); ao(s, "9 JUNIOR - $22.49","9 JUNIOR", 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;