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 "Galvanized Steel Pipe Legs/Aluminum Plank": ao(s, "12 FT - BEPD12 - $191.99","12 FT - BEPD12", x++); ao(s, "15 FT - BEPD15 - $209.99","15 FT - BEPD15", x++); ao(s, "21 FT - BEPD21 - $269.99","21 FT - BEPD21", x++); ao(s, "24 FT - BEPD24 - $311.99","24 FT - BEPD24", x++); ao(s, "6 FT - BEPD06 - $137.99","6 FT - BEPD06", x++); ao(s, "8 FT - BEPD08 - $143.99","8 FT - BEPD08", x++); break; case "All Aluminum Legs & Plank": ao(s, "12 FT - BEDD12 - $155.99","12 FT - BEDD12", x++); ao(s, "15 FT - BEDD15 - $173.99","15 FT - BEDD15", x++); ao(s, "21 FT - BEDD21 - $221.99","21 FT - BEDD21", x++); ao(s, "24 FT - BEDD24 - $251.99","24 FT - BEDD24", x++); ao(s, "6 FT - BEDD06 - $107.99","6 FT - BEDD06", x++); ao(s, "8 FT - BEDD08 - $119.99","8 FT - BEDD08", 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;