function obliterate ( inselect ) { if ( inselect.options.length > 1 ) {  while ( inselect.length > 1 ) { inselect.options[1] = null; }  inselect.selectedIndex = 0;} }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 handlestyle ( inselect ) {	obliterate( document.whatamess.colorpick );	var thisstyle = inselect.options[inselect.selectedIndex].value;	var thissize= document.whatamess.sizepick.options[document.whatamess.sizepick.selectedIndex].value;	var choices = '';	if ( thisstyle == '2' ) {		if (thissize == '2G') {			choices = '3:Frost White|5:Green|6:Orange';		}		else {			choices = '3:Frost White|5:Green|6:Orange';		}	}	else if ( thisstyle == '1' ) {		if (thissize == '2G') {			choices = '1:Blue|2:Green|3:Pink|4:Bronze';		}		else {			choices = '1:Blue|3:Red|4:Pink|6:White|7:Bronze|8:Black';		}	}		buildlist( document.whatamess.colorpick,choices);}function resetfields (  ) {  document.whatamess.stylepick.selectedIndex = 0;  document.whatamess.colorpick.selectedIndex = 0;}function generate_fields ( inform ) {  var thiscolor = inform.colorpick.options[inform.colorpick.selectedIndex].value;  var thissize  = inform.sizepick.options[inform.sizepick.selectedIndex].value;  var thisstyle  = inform.stylepick.options[inform.stylepick.selectedIndex].value;  var sku = '';  // a conditional H*A*C*K - array not worth the effort  	if (thisstyle == '1') {   		if (thissize == '2G') {			if (thiscolor == '1') { sku = '13159:1,'; }				if (thiscolor == '2') { sku = '13169:1,'; }				if (thiscolor == '3') { sku = '13160:1,'; }				if (thiscolor == '4') { sku = '13170:1,'; }	  		}  		else {			if (thiscolor == '1') { sku = '13145:1,'; }				if (thiscolor == '2') { sku = '13148:1,'; }				if (thiscolor == '3') { sku = '13146:1,'; }				if (thiscolor == '4') { sku = '13144:1,'; }				if (thiscolor == '5') { sku = '13147:1,'; }				if (thiscolor == '6') { sku = '13143:1,'; }				if (thiscolor == '7') { sku = '13149:1,'; }				if (thiscolor == '8') { sku = '13150:1,'; }	  		} 	} 	 	else if (thisstyle == '2') {   		if (thiscolor == '1') { sku = '13195:1,'; }	  		if (thiscolor == '2') { sku = '13196:1,'; }	  		if (thiscolor == '3') { sku = '13194:1,'; }	  		if (thiscolor == '4') { sku = '13199:1,'; }	  		if (thiscolor == '5') { sku = '13197:1,'; }	  		if (thiscolor == '6') { sku = '13198:1,'; }	 	}	if (inform.add_armband.checked == true) {		sku += '13334:1,';	} 	if (inform.add_clearcal.checked == true) {		sku += '13193:1,';	}		if (inform.add_portectorz.checked == true) {		sku += '13616:1,';	}  inform.ProdList.value = sku;  }function handleform ( inform ) { var errmsg = '';  if ( inform.sizepick.options[inform.sizepick.selectedIndex].value == '' ) { errmsg += '\n   - Size'; }  if ( inform.stylepick.options[inform.stylepick.selectedIndex].value == '' ) { errmsg += '\n   - Style'; }  if ( inform.colorpick.options[inform.colorpick.selectedIndex].value == '' ) { errmsg += '\n   - Color'; }// NB: secondary conditional statements below are due to NN 4.x hack if ( errmsg ) { alert ('Please choose the following before purchasing:' + errmsg); return false; } else { generate_fields( inform ); return true; }}
