var wall=new Array();
wall[0]='4.8 mm (3/16")';
wall[1]='3.2 mm (1/8")';
wall[2]='2.4 mm (3/32")';
wall[3]='1.6 mm (1/16")';

function changewall(){
i=document.step1.id_list.selectedIndex;
if((i==1)||(i==2)){
document.step1.wall_list.length="2";
document.step1.wall_list.options[1].text=wall[0];
}else if(i==3){
document.step1.wall_list.length="3";
document.step1.wall_list.options[1].text=wall[0];
document.step1.wall_list.options[2].text=wall[1];
}else if(i==4){
document.step1.wall_list.length="2";
document.step1.wall_list.options[1].text=wall[1];
}else if(i==5){
document.step1.wall_list.length="4";
document.step1.wall_list.options[1].text=wall[1];
document.step1.wall_list.options[2].text=wall[2];
document.step1.wall_list.options[3].text=wall[3];
}else if((i==6)||(i==7)){
document.step1.wall_list.length="3";
document.step1.wall_list.options[1].text=wall[2];
document.step1.wall_list.options[2].text=wall[3];
}
changefittings();
}

function changelength(){
document.step2.length.length="1";
var id_value=document.step1.id_list.selectedIndex;
var wall_thick=document.step1.wall_list.selectedIndex;
wall_thick=document.step1.wall_list.options[wall_thick].text;

if((id_value==1)&&(wall_thick==wall[0])){
document.step2.length.length="4";
document.step2.length.options[1].text="380 mm (standard)";
document.step2.length.options[2].text="432 mm";
document.step2.length.options[3].text="610 mm";
}else if((id_value==2)&&(wall_thick==wall[0])){
document.step2.length.length="4";
document.step2.length.options[1].text="380 mm (standard)";
document.step2.length.options[2].text="432 mm";
document.step2.length.options[3].text="610 mm";
}else if((id_value==3)&&(wall_thick==wall[0])){
document.step2.length.length="4";
document.step2.length.options[1].text="380 mm (standard)";
document.step2.length.options[2].text="432 mm";
document.step2.length.options[3].text="610 mm";
}else if((id_value==3)&&(wall_thick==wall[1])){
document.step2.length.length="3";
document.step2.length.options[1].text="305 mm";
document.step2.length.options[2].text="483 mm";
}else if((id_value==4)&&(wall_thick==wall[1])){
document.step2.length.length="3";
document.step2.length.options[1].text="305 mm";
document.step2.length.options[2].text="483 mm";
}else if((id_value==4)&&(wall_thick==wall[2])){
document.step2.length.length="2";
document.step2.length.options[1].text="355 mm";
}else if((id_value==5)&&(wall_thick==wall[1])){
document.step2.length.length="3";
document.step2.length.options[1].text="305 mm";
document.step2.length.options[2].text="483 mm";
}else if((id_value==5)&&(wall_thick==wall[2])){
document.step2.length.length="4";
document.step2.length.options[1].text="150 mm";
document.step2.length.options[2].text="305 mm";
document.step2.length.options[3].text="355 mm";
}else if((id_value==5)&&(wall_thick==wall[3])){
document.step2.length.length="4";
document.step2.length.options[1].text="150 mm";
document.step2.length.options[2].text="305 mm";
document.step2.length.options[3].text="355 mm";
}else if((id_value==6)&&(wall_thick==wall[2])){
document.step2.length.length="3";
document.step2.length.options[1].text="150 mm";
document.step2.length.options[2].text="305 mm";
}else if((id_value==6)&&(wall_thick==wall[3])){
document.step2.length.length="3";
document.step2.length.options[1].text="150 mm";
document.step2.length.options[2].text="305 mm";
}else if((id_value==7)&&(wall_thick==wall[2])){
document.step2.length.length="3";
document.step2.length.options[1].text="150 mm";
document.step2.length.options[2].text="305 mm";
}else if((id_value==7)&&(wall_thick==wall[3])){
document.step2.length.length="3";
document.step2.length.options[1].text="150 mm";
document.step2.length.options[2].text="305 mm";
}
}
function changefittings(){
document.step2.end1.length="1";
var f=document.step1.id_list.selectedIndex;
if(f==1){
document.step2.end1.length="15";
document.step2.end1.options[1].text="Sanitary";
document.step2.end1.options[2].text='    1" Tri-clamp';
document.step2.end1.options[3].text="Threaded";
document.step2.end1.options[4].text="    Male NPT";
document.step2.end1.options[5].text="    Female NPT";
document.step2.end1.options[6].text="    Female J.I.C.";
document.step2.end1.options[7].text="Cam + Grove";
document.step2.end1.options[8].text="    Male Cam";
document.step2.end1.options[9].text="    Female Swivel";
document.step2.end1.options[10].text="Compression";
document.step2.end1.options[11].text="    Tube Adapter";
document.step2.end1.options[12].text="Flanged";
document.step2.end1.options[13].text="    316L Backer";
document.step2.end1.options[14].text="none";
document.step2.end2.length="15";
document.step2.end2.options[1].text="Sanitary";
document.step2.end2.options[2].text='    1" Tri-clamp';
document.step2.end2.options[3].text="Threaded";
document.step2.end2.options[4].text="    Male NPT";
document.step2.end2.options[5].text="    Female NPT";
document.step2.end2.options[6].text="    Female J.I.C.";
document.step2.end2.options[7].text="Cam + Grove";
document.step2.end2.options[8].text="    Male Cam";
document.step2.end2.options[9].text="    Female Swivel";
document.step2.end2.options[10].text="Compression";
document.step2.end2.options[11].text="    Tube Adapter";
document.step2.end2.options[12].text="Flanged";
document.step2.end2.options[13].text="    316L Backer";
document.step2.end2.options[14].text="none";
}else if(f==2){
document.step2.end1.length="16";
document.step2.end1.options[1].text="Sanitary";
document.step2.end1.options[2].text="    Mini Tri-clamp";
document.step2.end1.options[3].text='    1" Tri-clamp';
document.step2.end1.options[4].text="Threaded";
document.step2.end1.options[5].text="    Male NPT";
document.step2.end1.options[6].text="    Female NPT";
document.step2.end1.options[7].text="    Female J.I.C.";
document.step2.end1.options[8].text="Cam + Grove";
document.step2.end1.options[9].text="    Male Cam";
document.step2.end1.options[10].text="    Female Swivel";
document.step2.end1.options[11].text="Compression";
document.step2.end1.options[12].text="    Tube Adapter";
document.step2.end1.options[13].text="Flanged";
document.step2.end1.options[14].text="    316L Backer";
document.step2.end1.options[15].text="none";
document.step2.end2.length="16";
document.step2.end2.options[1].text="Sanitary";
document.step2.end2.options[2].text="    Mini Tri-clamp";
document.step2.end2.options[3].text='    1" Tri-clamp';
document.step2.end2.options[4].text="Threaded";
document.step2.end2.options[5].text="    Male NPT";
document.step2.end2.options[6].text="    Female NPT";
document.step2.end2.options[7].text="    Female J.I.C.";
document.step2.end2.options[8].text="Cam + Grove";
document.step2.end2.options[9].text="    Male Cam";
document.step2.end2.options[10].text="    Female Swivel";
document.step2.end2.options[11].text="Compression";
document.step2.end2.options[12].text="    Tube Adapter";
document.step2.end2.options[13].text="Flanged";
document.step2.end2.options[14].text="    316L Backer";
document.step2.end2.options[15].text="none";
}else if(f==3){
document.step2.end1.length="16";
document.step2.end1.options[1].text="Sanitary";
document.step2.end1.options[2].text="    Mini Tri-clamp";
document.step2.end1.options[3].text='    1" Tri-clamp';
document.step2.end1.options[4].text="Threaded";
document.step2.end1.options[5].text="    Male NPT";
document.step2.end1.options[6].text="    Female NPT";
document.step2.end1.options[7].text="    Female J.I.C.";
document.step2.end1.options[8].text="Cam + Grove";
document.step2.end1.options[9].text="    Male Cam";
document.step2.end1.options[10].text="    Female Swivel";
document.step2.end1.options[11].text="Compression";
document.step2.end1.options[12].text="    Tube Adapter";
document.step2.end1.options[13].text="Flanged";
document.step2.end1.options[14].text="    316L Backer";
document.step2.end1.options[15].text="none";
document.step2.end2.length="16";
document.step2.end2.options[1].text="Sanitary";
document.step2.end2.options[2].text="    Mini Tri-clamp";
document.step2.end2.options[3].text='    1" Tri-clamp';
document.step2.end2.options[4].text="Threaded";
document.step2.end2.options[5].text="    Male NPT";
document.step2.end2.options[6].text="    Female NPT";
document.step2.end2.options[7].text="    Female J.I.C.";
document.step2.end2.options[8].text="Cam + Grove";
document.step2.end2.options[9].text="    Male Cam";
document.step2.end2.options[10].text="    Female Swivel";
document.step2.end2.options[11].text="Compression";
document.step2.end2.options[12].text="    Tube Adapter";
document.step2.end2.options[13].text="Flanged";
document.step2.end2.options[14].text="    316L Backer";
document.step2.end2.options[15].text="none";
}else if(f==4){
document.step2.end1.length="13";
document.step2.end1.options[1].text="Sanitary";
document.step2.end1.options[2].text="    Mini Tri-clamp";
document.step2.end1.options[3].text="Barb";
document.step2.end1.options[4].text="    PFA Monobarb";
document.step2.end1.options[5].text="    316L Monobarb";
document.step2.end1.options[6].text="Threaded";
document.step2.end1.options[7].text="    Male NPT";
document.step2.end1.options[8].text="    Female NPT";
document.step2.end1.options[9].text="    Female J.I.C.";
document.step2.end1.options[10].text="Compression";
document.step2.end1.options[11].text="    Tube Adapter";
document.step2.end1.options[12].text="none";
document.step2.end2.length="13";
document.step2.end2.options[1].text="Sanitary";
document.step2.end2.options[2].text="    Mini Tri-clamp";
document.step2.end2.options[3].text="Barb";
document.step2.end2.options[4].text="    PFA Monobarb";
document.step2.end2.options[5].text="    316L Monobarb";
document.step2.end2.options[6].text="Threaded";
document.step2.end2.options[7].text="    Male NPT";
document.step2.end2.options[8].text="    Female NPT";
document.step2.end2.options[9].text="    Female J.I.C.";
document.step2.end2.options[10].text="Compression";
document.step2.end2.options[11].text="    Tube Adapter";
document.step2.end2.options[12].text="none";
}else if(f==5){
document.step2.end1.length="13";
document.step2.end1.options[1].text="Sanitary";
document.step2.end1.options[2].text="    Mini Tri-clamp";
document.step2.end1.options[3].text="Barb";
document.step2.end1.options[4].text="    PFA Monobarb";
document.step2.end1.options[5].text="    316L Monobarb";
document.step2.end1.options[6].text="Threaded";
document.step2.end1.options[7].text="    Male NPT";
document.step2.end1.options[8].text="    Female NPT";
document.step2.end1.options[9].text="    Female J.I.C.";
document.step2.end1.options[10].text="Compression";
document.step2.end1.options[11].text="    Tube Adapter";
document.step2.end1.options[12].text="none";
document.step2.end2.length="13";
document.step2.end2.options[1].text="Sanitary";
document.step2.end2.options[2].text="    Mini Tri-clamp";
document.step2.end2.options[3].text="Barb";
document.step2.end2.options[4].text="    PFA Monobarb";
document.step2.end2.options[5].text="    316L Monobarb";
document.step2.end2.options[6].text="Threaded";
document.step2.end2.options[7].text="    Male NPT";
document.step2.end2.options[8].text="    Female NPT";
document.step2.end2.options[9].text="    Female J.I.C.";
document.step2.end2.options[10].text="Compression";
document.step2.end2.options[11].text="    Tube Adapter";
document.step2.end2.options[12].text="none";
}else if(f==6){
document.step2.end1.length="5";
document.step2.end1.options[1].text="Barb";
document.step2.end1.options[2].text="    PFA Monobarb";
document.step2.end1.options[3].text="    316L Monobarb";
document.step2.end1.options[4].text="none";
document.step2.end2.length="5";
document.step2.end2.options[1].text="Barb";
document.step2.end2.options[2].text="    PFA Monobarb";
document.step2.end2.options[3].text="    316L Monobarb";
document.step2.end2.options[4].text="none";
}else if(f==7){
document.step2.end1.length="5";
document.step2.end1.options[1].text="Barb";
document.step2.end1.options[2].text="    PFA Monobarb";
document.step2.end1.options[3].text="    316L Monobarb";
document.step2.end1.options[4].text="none";
document.step2.end2.length="5";
document.step2.end2.options[1].text="Barb";
document.step2.end2.options[2].text="    PFA Monobarb";
document.step2.end2.options[3].text="    316L Monobarb";
document.step2.end2.options[4].text="none";
}
}

function generatepart(){
partnum="SST-";
var b=document.step1.id_list.selectedIndex;
var c=document.step1.wall_list.selectedIndex;
var d=document.step2.end1.selectedIndex;
var e=document.step2.length.selectedIndex;
var g=document.step2.end2.selectedIndex;
if(b==1){ 
  partnum+="16-";
  if(c==1){
	partnum+="D-PE-";
  }
  if(d==2) partnum+="10-";
  else if(d==4) partnum+="03-";
  else if(d==5) partnum+="06-";
  else if(d==6) partnum+="02-";
  else if(d==8) partnum+="17-";
  else if(d==9) partnum+="16-";
  else if(d==11) partnum+="32-";
  else if(d==13){
  partnum+="12-";
  }
  if(g==2) partnum+="10-";
  else if(g==4) partnum+="03-";
  else if(g==5) partnum+="06-";
  else if(g==6) partnum+="02-";
  else if(g==8) partnum+="17-";
  else if(g==9) partnum+="16-";
  else if(g==11) partnum+="32-";
  else if(g==13){
  partnum+="12-";
  }
  if(e==1){
  partnum+="380";
  }else if(e==2){
  partnum+="432";
  }else if(e==3){
  partnum+="610";
  }
}else if(b==2){
  partnum+="12-";
  if(c==1){
	partnum+="D-PE-";
  }
  if(d==2) partnum+="10-";
  else if(d==3) partnum+="11-";
  else if(d==5) partnum+="03-";
  else if(d==6) partnum+="06-";
  else if(d==7) partnum+="02-";
  else if(d==9) partnum+="17-";
  else if(d==10) partnum+="16-";
  else if(d==12) partnum+="32-";
  else if(d==14) partnum+="12-";

  if(g==2) partnum+="10-";
  else if(g==3) partnum+="11-";
  else if(g==5) partnum+="03-";
  else if(g==6) partnum+="06-";
  else if(g==7) partnum+="02-";
  else if(g==9) partnum+="17-";
  else if(g==10) partnum+="16-";
  else if(g==12) partnum+="32-";
  else if(g==14) partnum+="12-";

  if(e==1) partnum+="380";
  else if(e==2) partnum+="432";
  else if(e==3) partnum+="610";

}else if(b==3){
  partnum+="08-";
  if(c==1){
	partnum+="D-PE-";
  }else if(c==2){
	partnum+="C-";
  }
  if(d==2) partnum+="10-";
  else if(d==3) partnum+="11-";
  else if(d==5) partnum+="03-";
  else if(d==6) partnum+="06-";
  else if(d==7) partnum+="02-";
  else if(d==9) partnum+="17-";
  else if(d==10) partnum+="16-";
  else if(d==12) partnum+="32-";
  else if(d==14) partnum+="12-";

  if(g==2) partnum+="10-";
  else if(g==3) partnum+="11-";
  else if(g==5) partnum+="03-";
  else if(g==6) partnum+="06-";
  else if(g==7) partnum+="02-";
  else if(g==9) partnum+="17-";
  else if(g==10) partnum+="16-";
  else if(g==12) partnum+="32-";
  else if(g==14) partnum+="12-";
  
  if(c==1){
	if(e==1) partnum+="380";
      else if(e==2) partnum+="432";
	else if(e==3) partnum+="610";
  }else if(c==2){
	if(e==1) partnum+="305";
	else if(e==2) partnum+="355";
	else if(e==3) partnum+="432";
  }
}else if(b==4){
  partnum+="06-";
  if(c==1){
	partnum+="C-";
  }
  if(d==2) partnum+="11-";
  else if(d==4) partnum+="98-";
  else if(d==5) partnum+="99-";
  else if(d==7) partnum+="03-";
  else if(d==8) partnum+="06-";
  else if(d==9) partnum+="02-";
  else if(d==11) partnum+="32-";

  if(g==2) partnum+="11-";
  else if(g==4) partnum+="98-";
  else if(g==5) partnum+="99-";
  else if(g==7) partnum+="03-";
  else if(g==8) partnum+="06-";
  else if(g==9) partnum+="02-";
  else if(g==11) partnum+="32-";
  
  if(e==1) partnum+="305";
  if(e==2) partnum+="355";
  if(e==3) partnum+="432";
}else if(b==5){
  partnum+="04-";
  if(c==1){
	partnum+="C-";
  }else if(c==2){
	partnum+="B-";
  }else if(c==3){
	partnum+="A-";
  }
  if(d==2) partnum+="11-";
  else if(d==4) partnum+="98-";
  else if(d==5) partnum+="99-";
  else if(d==7) partnum+="03-";
  else if(d==8) partnum+="06-";
  else if(d==9) partnum+="02-";
  else if(d==11) partnum+="32-";

  if(g==2) partnum+="11-";
  else if(g==4) partnum+="98-";
  else if(g==5) partnum+="99-";
  else if(g==7) partnum+="03-";
  else if(g==8) partnum+="06-";
  else if(g==9) partnum+="02-";
  else if(g==11) partnum+="32-";

  if(c==1){
	if(e==1) partnum+="305";
	else if(e==2) partnum+="355";
      else if(e==3) partnum+="432";
  }else if(c==2){
	if(e==1) partnum+="150";
	if(e==2) partnum+="305";
	if(e==3) partnum+="355";
  }else if(c==3){
	if(e==1) partnum+="150";
	if(e==2) partnum+="305";
	if(e==3) partnum+="355";	
  }
}else if(b==6){
  partnum+="03-";
  if(c==1){
	partnum+="B-";
  }else if(c==2){
	partnum+="A-";
  }
  if(d==2) partnum+="98-";
  else if(d==3) partnum+="99-";

  if(g==2) partnum+="98-";
  else if(g==3) partnum+="99-";
  
  if(c==1){
	if(e==1) partnum+="150";
	else if(e==2) partnum+="305";
  }else if(c==2){
	if(e==1) partnum+="150";
	else if(e==2) partnum+="305";
  }
}else if(b==7){
  partnum+="02-";
  if(c==1){
	partnum+="B-";
  }else if(c==2){
	partnum+="A-";
  }
  if(d==2) partnum+="98-";
  else if(d==3) partnum+="99-";

  if(g==2) partnum+="98-";
  else if(g==3) partnum+="99-";
  if(c==1){
	if(e==1) partnum+="150";
	else if(e==2) partnum+="305";
  }else if(c==2){
	if(e==1) partnum+="150";
	else if(e==2) partnum+="305";
  }
}
document.order.box8.value="";    
document.order.box8.value=partnum;
document.step2.partdisplay.value="";
document.step2.partdisplay.value=partnum;
}

function checkform(){
var partcomplete=true;
if(document.step1.id_list.selectedIndex=="0") partcomplete=false;
if(document.step1.wall_list.selectedIndex=="0") partcomplete=false;
if(document.step2.end1.selectedIndex=="0") partcomplete=false;
if(document.step2.length.selectedIndex=="0") partcomplete=false;
if(document.step2.end2.selectedIndex=="0") partcomplete=false;
return partcomplete;
}

function checkorder(){
var ordercomplete=true;
if(document.order.box1.value=="") ordercomplete=false;
if(document.order.box3.value=="") ordercomplete=false;
if(document.order.box8.value=="") ordercomplete=false;
if(document.order.box9.value=="") ordercomplete=false;

if(ordercomplete==true){
	return true;
}else{
	alert("You must fill out all required fields before submitting this form");
	return false;
}
}
