function resetfields (  ) {  document.whatamess.modelpick.selectedIndex = 0;  document.whatamess.colorpick.selectedIndex = 0;// BEG: hack for NN 4.x  obliterate( document.whatamess.colorpick );// END: hack for NN 4.x}function buildlist ( inselect, optionlist ) { var cloc, cloc2 = 0; var portion     = ''; while ( optionlist.length > 0 ) {  cloc = optionlist.indexOf( '|' );  if ( cloc == -1 ) { cloc = optionlist.length; }  portion = optionlist.substring( 0, cloc );  cloc2   = portion.indexOf( ':' );  var foo = new Option( portion.substring( (cloc2 + 1), portion.length ), portion.substring( 0, cloc2 ) );  inselect.options[inselect.options.length] = foo;  if ( optionlist.indexOf ( '|' ) != -1 ) { optionlist = optionlist.substring( ( cloc + 1 ), optionlist.length ); }  else { optionlist = ''; }} }function obliterate ( inselect ) { if ( inselect.options.length > 1 ) {  while ( inselect.length > 1 ) { inselect.options[1] = null; }  inselect.selectedIndex = 0;} }function generateColors ( inselect ) {	obliterate( document.whatamess.colorpick );	var thismodel = inselect.options[inselect.selectedIndex].value;	var choices = '';	if( thismodel == '1' ) {		choices = 'Blue:Blue|Green:Green|White:White|Pink:Pink|Yellow:Yellow|Bronze:Bronze';	} else if( thismodel == '2') {		choices = 'Blue:Blue|Green:Green|Pink:Pink|Black:Black';	}		buildlist( document.whatamess.colorpick , choices);}	function generate_fields ( inform ) {  var thismodel = inform.modelpick.options[inform.modelpick.selectedIndex].value;  var thiscolor = inform.colorpick.options[inform.colorpick.selectedIndex].value;  var sku       = '';  // a conditional H*A*C*K - array not worth the effort   if( thismodel == '1') {	if (thiscolor == 'Blue') { sku = '13183:1,'; }	else if (thiscolor == 'Green') { sku = '13185:1,'; }	else if (thiscolor == 'White') { sku = '13182:1,'; }	else if (thiscolor == 'Pink') { sku = '13184:1,'; }	else if (thiscolor == 'Yellow') { sku = '13181:1,'; }	else if (thiscolor == 'Bronze') { sku = '13186:1,'; }   } else if ( thismodel == '2') {	if (thiscolor == 'Blue') { sku = '13356:1,'; }	else if (thiscolor == 'Green') { sku = '13358:1,'; }	else if (thiscolor == 'White') { sku = '13355:1,'; }	else if (thiscolor == 'Pink') { sku = '13357:1,'; }	else if (thiscolor == 'Black') { sku = '13359:1,'; }   }		if (inform.add_portectorz.checked == true) {		sku += '13616:1,';	}		if (inform.add_clearcal.checked == true) {		sku += '13190:1,';	}	if (inform.add_armband.checked == true) {		sku += '13141:1,';	}  inform.ProdList.value = sku;}function handleform ( inform ) { var errmsg = '';// NB: secondary conditional statements below are due to NN 4.x hack if ( inform.colorpick.options[inform.colorpick.selectedIndex].value == '') { errmsg += 'Please Select a color before trying to purchase.'; } if ( errmsg ) { alert (errmsg); return false; } else { generate_fields( inform ); return true; }}