Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function validateForm()
- {
- var tubemat = document.getElementById("tubemat").value;
- var diameter = document.getElementById("diameter").value;
- var medium = document.getElementById("medium").value;
- var agressi = document.getElementById("agressi").value;
- var omgeving = document.getElementById("omgeving").value;
- var run = 1;
- var materials = new Array();
- var diameterA = new Array();
- var split = new Array();
- var mats = new Array();
- var mats2 = new Array();
- var mats3 = new Array();
- var mats4 = new Array();
- var mats5 = new Array();
- var bar;
- //Material, tubematerial, diameter, medium, agressiveness, omgeving
- materials[0] = "PVDF,Plastics,4^6^8^10^12^15^16,Air^Gases^Liquid^Oil,Aggressive^Slightly aggressive^Non-aggressive,Corrosive^Non-corrosive";
- materials[1] = "PA,Plastics,6^8^10^12,Air^Gases,Non-aggressive,Non-corrosive";
- materials[2] = "Flip,Plastics,4^6^8^10^12,Air,Non-aggressive,Non-corrosive";
- materials[3] = "Brass M,Non-ferrous metals^Plastics,2^3^4^6^8^10^12^15^18^22^28^30^35,Air^Gases^Liquid^Oil,Non-aggressive,Non-corrosive";
- materials[4] = "Brass G,Non-ferrous metals^Plastics,4^6^8^10^12^15,Air^Gases^Liquid^Oil,Non-aggressive,Non-corrosive";
- materials[5] = "Brass chem. nickel-plated,Non-ferrous metals^Stainless steel^Plastics,4^6^8^10^12^15^18,Air^Gases^Liquid^Oil,Slightly aggressive^Non-aggressive,Non-corrosive";
- materials[6] = "Stainless Steel,Stainless steel^Plastics,2^3^4^5^6^8^10^12^15^18^22^28,Air^Gases^Liquid^Oil,Aggressive^Slightly aggressive^Non-aggressive,Corrosive^Non-corrosive";
- materials[7] = "Steel,Steel^Plastics,6^8^10^12^15^18^22^28,Air^Gases^Liquid^Oil,Slightly aggressive^Non-aggressive,Non-corrosive";
- //mindia-maxdia,bar^mindia-maxdia,bar^mindia- etc etc
- diameterA["PVDF"] = "4-16,10^";
- diameterA["PA"] = "6-12,10^";
- diameterA["Flip"] = "4-12,10^";
- diameterA["Brass M"] = "2-6,125^6-8,250^8-10,150^10-12,100-125^12-18,40^18-22,25^22-35,16";
- diameterA["Brass G"] = "4-8,125^8-12,100^12-15,64";
- diameterA["Brass chem. nickel-plated"] = "4-6,100^6-8,200^8-10,125^10-12,80^12-18,25";
- diameterA["Stainless Steel"] = "2-5,250^5-8,200^8-12,160^12-18,100^18-22,64^22-28,40";
- diameterA["Steel"] = "6-8,400^8-10,300^10-12,250^12-18,200^18-28,160";
- if(run == 1)
- {
- for(var i = 0; i < materials.length; i++)
- {
- split = materials[i].split(",");
- splittubemat = split[1].split("^");
- if(tubemat != "Unknown")
- {
- for(var it = 0; it < splittubemat.length; it++)
- {
- if(splittubemat[it] == tubemat)
- {
- mats.push(materials[i]);
- }
- }
- }
- else
- {
- mats.push(materials[i]);
- }
- if(i == materials.length-1)
- {
- if(mats.length > 0)
- {
- //alert("materials checked "+mats.length+" materials found");
- for(i = 0; i < mats.length; i++)
- {
- split = mats[i].split(",");
- splitdia = split[2].split("^");
- if(diameter != "Unknown")
- {
- for(var id = 0; id < splitdia.length; id++)
- {
- if(splitdia[id] == parseInt(diameter))
- {
- mats2.push(mats[i]);
- }
- }
- }
- else
- {
- mats2.push(mats[i]);
- }
- if(i == mats.length-1)
- {
- if(mats2.length > 0)
- {
- //alert("diameters checked "+mats2.length+" materials found");
- for(i = 0; i < mats2.length; i++)
- {
- split = mats2[i].split(",");
- splitmediums = split[3].split("^");
- if(medium != "Unknown")
- {
- for(var im = 0; im < splitmediums.length; im++)
- {
- if(splitmediums[im] == medium)
- {
- mats3.push(mats2[i]);
- }
- }
- }
- else
- {
- mats3.push(mats2[i]);
- }
- if(i == mats2.length-1)
- {
- if(mats3.length > 0)
- {
- //alert("mediums checked "+mats3.length+" materials found");
- for(i = 0; i < mats3.length; i++)
- {
- split = mats3[i].split(",");
- splitagressi = split[4].split("^");
- if(agressi != "Unknown")
- {
- for(var ia = 0; ia < splitagressi.length; ia++)
- {
- if(splitagressi[ia] == agressi)
- {
- mats4.push(mats3[i]);
- }
- }
- }
- else
- {
- mats4.push(mats3[i]);
- }
- if(i == mats3.length-1)
- {
- if(mats4.length > 0)
- {
- //alert("agressiveness checked "+mats4.length+" materials found");
- for(i = 0; i < mats4.length; i++)
- {
- split = mats4[i].split(",");
- splitomg = split[5].split("^");
- if(omgeving != "Unknown")
- {
- for(io = 0; io < splitomg.length; io++)
- {
- if(splitomg[io] == omgeving)
- {
- mats5.push(mats4[i]);
- }
- }
- }
- else
- {
- mats5.push(mats4[i]);
- }
- if(i == mats4.length-1)
- {
- if(mats5.length > 0)
- {
- //alert("environment checked "+mats5.length+" materials found");
- document.getElementById("result").innerHTML = "Material(s): ".bold();
- for(i = 0; i < mats5.length; i++)
- {
- split = mats5[i].split(",");
- splitdia2 = diameterA[split[0]].split("^");
- if(diameter != "Unknown")
- {
- for(ib = 0; ib < splitdia2.length; ib++)
- {
- splitdia3 = splitdia2[ib].split(",");
- splitdia4 = splitdia3[0].split("-");
- if(parseInt(diameter) >= parseInt(splitdia4[0]) && parseInt(diameter) < parseInt(splitdia4[1]))
- {
- bar = splitdia3[1];
- }
- }
- }
- else
- {
- bar = 0;
- }
- document.getElementById("result").innerHTML += (split[0]+"("+bar+" bar)"+", ").bold();
- if(i == mats5.length-1)
- {
- run = 0;
- split = [];
- mats = [];
- mats2 = [];
- mats3 = [];
- mats4 = [];
- mats5 = [];
- }
- }
- }
- else if(run == 1)
- {
- run = 0;
- split = [];
- mats = [];
- mats2 = [];
- mats3 = [];
- mats4 = [];
- mats5 = [];
- document.getElementById("result").innerHTML = "Material(s): ".bold();
- alert("Couldn`t find any materials.");
- }
- }
- }
- }
- else if(run == 1)
- {
- run = 0;
- split = [];
- mats = [];
- mats2 = [];
- mats3 = [];
- mats4 = [];
- mats5 = [];
- document.getElementById("result").innerHTML = "Material(s): ".bold();
- alert("Couldn`t find any materials.");
- }
- }
- }
- }
- else if(run == 1)
- {
- run = 0;
- split = [];
- mats = [];
- mats2 = [];
- mats3 = [];
- mats4 = [];
- mats5 = [];
- document.getElementById("result").innerHTML = "Material(s): ".bold();
- alert("Couldn`t find any materials.");
- }
- }
- }
- }
- else if(run == 1)
- {
- run = 0;
- split = [];
- mats = [];
- mats2 = [];
- mats3 = [];
- mats4 = [];
- mats5 = [];
- document.getElementById("result").innerHTML = "Material(s): ".bold();
- alert("Couldn`t find any materials.");
- }
- }
- }
- }
- else if(run == 1)
- {
- run = 0;
- split = [];
- mats = [];
- mats2 = [];
- mats3 = [];
- mats4 = [];
- mats5 = [];
- document.getElementById("result").innerHTML = "Material(s): ".bold();
- alert("Couldn`t find any materials.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement