var TYPE = " Select strType category:";
var CLASS = "Z";
var SearchPage;

//FindCenter(screen,win) ===============================================
//	Purpose: Locates the center of the screen, used to ensure that child windows are centered
//	Inputs: screen - The screen dimension (window.screen.width or window.screen.height)
//			win - The desired window dimension (width or height)
//	Outputs: center - The x or y coordinate for the upper left corner of the new window
//	Created: 6/15/00
//======================================================================
function FindCenter(screen,win){
	var center = screen / 2;
	center -= win/2;
	return center;
}

//window_onload()
//	Purpose: Initializes the right page of the stockbook to the "WelcomPage" string
//		which contains instructions for its use.
//	Inputs: None
//	Outputs: None
//	Created: 6/15/00
//======================================================================
function window_onload(){
	SearchPage = document.getElementById("RightPage").innerHTML;
	var WelcomPage = "<table class=ProductList bgcolor='white'><tr><td>";
	WelcomPage += "In order to begin browsing the Stockbook, simply ";
	WelcomPage += "choose and click a category on the left, and you will ";
	WelcomPage += "be presented with a list of types within that category.";
	WelcomPage += "<p>Click on the type you are looking for, and you will see ";
	WelcomPage += "boxes allowing you to narrow your search by specifying dimensions. ";
	WelcomPage += "Leaving these blank will return all the items under that type.</p>";
	WelcomPage += "<p>Then, click on the link to view the results. That link will open ";
	WelcomPage += "a new window on your screen, containing the results of your search.</p>";
	WelcomPage += "</td></tr></table>"
	document.getElementById("RightPage").innerHTML = WelcomPage;
}

//ChangeProductType(type):
//	Purpose: Changes the list items in "lstProductSubGroup" - the subtypes for a particular 
//		type. Also clears the dimensions.
//	Inputs: type - The new product type
//	Outputs: The appropriate subtypes (in lstProductsSubGroup)
//	Created: 6/15/00
//======================================================================
function ChangeProductType(type){
	document.getElementById("RightPage").innerHTML = SearchPage;
	document.getElementById("spnProductSubGroupLabel").innerHTML = document.getElementById("spnProductSubGroupLabel").innerHTML.replace(/strType/g,type);
	
	switch(type){
		case "plate":
			document.getElementById("nptType").value = "P";
			//load product group list with stuff from plate group
			
var v1 = document.getElementById("lstProductSubGroup");
var v2 = document.getElementById("lstProductSubGroup").options;
v2.length = 0;
			
v1[v2.length] = new Option('Carbon - Hot Rolled', '0001CBHR')
v1[v2.length] = new Option('Carbon - Hot Rolled (AISI)', '0001CBHRAISI')
v1[v2.length] = new Option('Carbon - Floor Plate',  '0001CBFP')
v1[v2.length] = new Option('Carbon - Floor Sheet',  '0001CBFS')
v1[v2.length] = new Option('Carbon - High Strength Alloy',  '0001CBHSA')
v1[v2.length] = new Option('Carbon - Abrasion Resisting', '0001CBAR')
v1[v2.length] = new Option('Stainless - Hot Rolled, Annealed and Pickled',  '0001SSHR')
v1[v2.length] = new Option('Aluminum - Plate',  '0001ALMFP')
v1[v2.length] = new Option('Aluminum - Precision Cast Tooling Plate',  '0001ALPCP')
v1[v2.length] = new Option('Aluminum - Tread Plate',  '0001ALTBP')
			
			break
		case "sheet & coil":
			document.getElementById("nptType").value = "SC";
			//load product group list with stuff from sheet & coil group
var v1 = document.getElementById("lstProductSubGroup");
var v2 = document.getElementById("lstProductSubGroup").options;
v2.length = 0;
v1[v2.length] = new Option('Carbon Sheet - Hot Rolled', '0002CBHRS');
v1[v2.length] = new Option('Carbon Sheet - Cold Rolled', '0002CBCRS');
v1[v2.length] = new Option('Carbon Sheet - Coated, Galvanized', '0002CBCSZ');
v1[v2.length] = new Option('Carbon Sheet - Coated, Galvannealed', '0002CBCSL');
v1[v2.length] = new Option('Carbon Sheet - Aluminized', '0002CBALS');
v1[v2.length] = new Option('Carbon Coil - Hot Rolled Plate', '0002CBHRPC');
v1[v2.length] = new Option('Carbon Coil - Hot Rolled Sheet', '0002CBHRSC');
v1[v2.length] = new Option('Carbon Coil - Floor Plate', '0002CBFPC');
v1[v2.length] = new Option('Carbon Coil - Floor Sheet', '0002CBFSC');
v1[v2.length] = new Option('Carbon Coil - Cold Rolled', '0002CBCRC');
v1[v2.length] = new Option('Carbon Coil - Coated, Galvanized', '0002CBCCZ');
v1[v2.length] = new Option('Carbon Coil - Coated, Galvannealed', '0002CBCCL');
v1[v2.length] = new Option('Carbon Coil - Aluminized', '0002CBALC');
v1[v2.length] = new Option('Stainless Sheet - Cold Rolled, Annealed and Pickled', '0002SSCRS');
v1[v2.length] = new Option('Stainless Coil - Hot Rolled, Annealed and Pickled', '0002SSHRC');
v1[v2.length] = new Option('Stainless Coil - Cold Rolled, Annealed and Pickled', '0002SSCRC');
v1[v2.length] = new Option('Aluminum Sheet - Mill Finish', '0002ALMFS');
v1[v2.length] = new Option('Aluminum Coil - Mill Finish', '0002ALMFC');
v1[v2.length] = new Option('Aluminum Sheet & Coil - Stucco Embossed', '0002ALSESC');
v1[v2.length] = new Option('Aluminum Coil - Tread Brite', '0002ALTBC');
			break
		case "structural shape":
			document.getElementById("nptType").value = "SS";
			//load product group list with stuff from structural shape group
var v1 = document.getElementById("lstProductSubGroup");
var v2 = document.getElementById("lstProductSubGroup").options;
v2.length = 0;
v1[v2.length] = new Option('W Beams - Wide Flange', '0003WBM');
v1[v2.length] = new Option('S Beams - Standard', '0003SBM');
v1[v2.length] = new Option('M Beams - Miscellaneous', '0003MBM');
v1[v2.length] = new Option('C Channels - Standard', '0003CCH');
v1[v2.length] = new Option('MC Channels - Ship and Car', '0003MCCH');
v1[v2.length] = new Option('Channels - Bar size', '0003BCH');
v1[v2.length] = new Option('Angles - Bar size', '0003BAN');
v1[v2.length] = new Option('Angles - Structural',  '0003SAN');
v1[v2.length] = new Option('TEES', '0003TES');
v1[v2.length] = new Option('Stainless - Angles', '0003SSAN');
v1[v2.length] = new Option('Aluminum - Angles', '0003ALAN');
v1[v2.length] = new Option('Aluminum - Channels', '0003ALCH');
v1[v2.length] = new Option('Aluminum - H Beams', '0003ALHBM');
v1[v2.length] = new Option('Aluminum - I Beams', '0003ALIBM');
v1[v2.length] = new Option('Aluminum - Tees', '0003ALTES');
			break
		case "hot rolled bar":
			document.getElementById("nptType").value = "HRB";
			//load product group list with stuff from hot rolled bar group
var v1 = document.getElementById("lstProductSubGroup");
var v2 = document.getElementById("lstProductSubGroup").options;
v2.length = 0;
v1[v2.length] = new Option('Carbon - Flats', '0004CBFT');
v1[v2.length] = new Option('Carbon - Rounds', '0004CBRD');
v1[v2.length] = new Option('Carbon - Squares', '0004CBSQ');
v1[v2.length] = new Option('Carbon - Reinforcing bars', '0004CBRB');
v1[v2.length] = new Option('Stainless - Flats', '0004SSFT');
v1[v2.length] = new Option('Stainless - Rounds', '0004SSRD');
v1[v2.length] = new Option('Aluminum - Round Rod', '0004ALRD');
v1[v2.length] = new Option('Aluminum - Square Bar', '0004ALSQ');
v1[v2.length] = new Option('Aluminum - Rectangular Bar', '0004ALRB');
			break
		case "cold finished bar":
			document.getElementById("nptType").value = "CFB";
			//load product group list with stuff from cold finished bar group
var v1 = document.getElementById("lstProductSubGroup");
var v2 = document.getElementById("lstProductSubGroup").options;
v2.length = 0;
v1[v2.length] = new Option('Carbon - Rounds', '0005CBRD');
v1[v2.length] = new Option('Carbon - Rounds, Machining Grades', '0005CBRMG');
v1[v2.length] = new Option('Carbon - Turned, Ground, and Polished Rounds', '0005CBTGP');
v1[v2.length] = new Option('Carbon - Chrome Plated', '0005CBCP');
v1[v2.length] = new Option('Carbon - Flats', '0005CBFT');
v1[v2.length] = new Option('Carbon - Hexagons', '0005CBHX');
v1[v2.length] = new Option('Carbon - Squares', '0005CBSQ');
v1[v2.length] = new Option('Aluminum - Hexagon Bar', '0005ALHX');
v1[v2.length] = new Option('Aluminum - Rounds', '0005ALRD');
v1[v2.length] = new Option('Aluminum - Square', '0005ALSQ');
			break
		case "alloy bar":
			document.getElementById("nptType").value = "AB";
			//load product group list with stuff from alloy bar group
var v1 = document.getElementById("lstProductSubGroup");
var v2 = document.getElementById("lstProductSubGroup").options;
v2.length = 0;
v1[v2.length] = new Option('Low Carbon Rounds', '0006LCRD');
v1[v2.length] = new Option('Medium Carbon Rounds', '0006MCRD');
v1[v2.length] = new Option('Medium Carbon Heat Treated Rounds', '0006MCHT');
v1[v2.length] = new Option('Medium Carbon Flats', '0006MCFT');
			break
		case "tubing or pipe":
			document.getElementById("nptType").value = "TP";
			//load product group list with stuff from tubing & pipe group
var v1 = document.getElementById("lstProductSubGroup");
var v2 = document.getElementById("lstProductSubGroup").options;
v2.length = 0;
v1[v2.length] = new Option('Carbon - Mechanical Tubing', '0007CBMT');
v1[v2.length] = new Option('Carbon - Welded Mechanical Tubing', '0007CBWMT');
v1[v2.length] = new Option('Carbon - Square and Rectangular', '0007CBSR');
v1[v2.length] = new Option('Carbon - Hollow Structural', '0007CBHS');
v1[v2.length] = new Option('Carbon - Pipe, Seamless and Welded', '0007CBSW');
v1[v2.length] = new Option('Stainless - Pipe', '0007SSP');
v1[v2.length] = new Option('Stainless - Round Ornamental Tubing', '0007SSOTR');
v1[v2.length] = new Option('Stainless - Square Ornamental Tubing', '0007SSOTS');
v1[v2.length] = new Option('Stainless - Rectangular Ornamental Tubing', '0007SSOTC');
v1[v2.length] = new Option('Aluminum - Round Tubing', '0007ALRT');
v1[v2.length] = new Option('Aluminum - Square Tubing', '0007ALST');
v1[v2.length] = new Option('Aluminum - Rectangular Tubing', '0007ALRCT');
v1[v2.length] = new Option('Aluminum - Pipe', '0007ALP');
			break
		case "grating, expanded metal, or safety product":
			document.getElementById("nptType").value = "GEMSP";
			//load product group list with stuff from grating, expanded metal, & safety product group
var v1 = document.getElementById("lstProductSubGroup");
var v2 = document.getElementById("lstProductSubGroup").options;
v2.length = 0;
v1[v2.length] = new Option('Carbon - 19W4 Grating', '0008CB194');
v1[v2.length] = new Option('Carbon - 19W2 Grating', '0008CB192');
v1[v2.length] = new Option('Carbon - 15W4 Grating', '0008CB154');
v1[v2.length] = new Option('Carbon - 15W2 Grating', '0008CB152');
v1[v2.length] = new Option('Carbon - 11W4 Grating', '0008CB114');
v1[v2.length] = new Option('Carbon - 11W2 Grating', '0008CB112');
v1[v2.length] = new Option('Carbon - 7W4 Grating', '0008CB7W4');
v1[v2.length] = new Option('Carbon - 7W2 Grating', '0008CB7W2');
v1[v2.length] = new Option('Aluminum - 19S4 Grating', '0008AL194');
v1[v2.length] = new Option('Aluminum - 19S2 Grating', '0008AL192');
v1[v2.length] = new Option('Aluminum - 15S4 Grating', '0008AL154');
v1[v2.length] = new Option('Aluminum - 15S2 Grating', '0008AL152');
v1[v2.length] = new Option('Aluminum - 11S4 Grating', '0008AL114');
v1[v2.length] = new Option('Aluminum - 11S2 Grating', '0008AL112');
v1[v2.length] = new Option('Aluminum - 7S4 Grating', '0008AL7S4');
v1[v2.length] = new Option('Aluminum - 7S2 Grating', '0008AL7S2');
v1[v2.length] = new Option('Carbon - Stair Treads', '0008CBST');
v1[v2.length] = new Option('Carbon - Heavy Duty Grating', '0008CBHDG');
v1[v2.length] = new Option('Carbon - Grip Strut Safety Grating', '0008CBGSG');
v1[v2.length] = new Option('Carbon - Expanded Metal', '0008CBEM');
v1[v2.length] = new Option('Carbon - Galvanized Expanded Metal', '0008CBGEM');
v1[v2.length] = new Option('Carbon - Flattened Expanded Metal', '0008CBFEM');
v1[v2.length] = new Option('Carbon - Flattened Galvanized Expanded Metal', '0008CBFGEM');
v1[v2.length] = new Option('Carbon - Expanded Metal Grating', '0008CBEMG');
v1[v2.length] = new Option('Carbon - Galvanized Expanded Metal Grating', '0008CBGEMG');
v1[v2.length] = new Option('Carbon - Expanded Metal Grating Treads', '0008CBEMGT');
v1[v2.length] = new Option('Aluminum - Expanded Metal', '0008ALEM');
v1[v2.length] = new Option('Aluminum - Flattened Expanded Metal', '0008ALFEM');
v1[v2.length] = new Option('Stainless - Expanded Metal', '0008SSEM');
v1[v2.length] = new Option('Stainless - Flattened Expanded Metal', '0008SSFEM');
v1[v2.length] = new Option('Fiberglass - Molded Grating', '0008FGMG');
v1[v2.length] = new Option('Fiberglass - Pultruded Grating', '000FGPG');
	}
	//clear dimension table
	var tblRows = document.getElementById("tblDimensions").rows.length;
	for (i=0; i<tblRows; i++)
		document.getElementById("tblDimensions").deleteRow();
	CLASS = "Z";

}

//ChangeDimensions(subType):
//	Purpose: Changes the available dimensions based on the subtype chosen
//	Inputs: subType - The clicked product subType
//	Outputs: The appropriate dimensions (in document.getElementById("tblDimensions").
//	Author: Jeff Baker
//	Created: 6/15/00
//======================================================================
function ChangeDimensions(subType){
	//clear dimension table
	var table = document.getElementById("tblDimensions");
    var rows = table.rows; 
    while(rows.length) // length=0 -> stop 
        table.deleteRow(rows.length-1); 
switch (subType) {
		//Thickness, Width
		case "0001CBHR":
		case "0001CBHRAISI":
		case "0001CBFP":
		case "0001SSHR":
		case "0002CBHRPC":
		case "0002CBFPC":
		case "0002ALMFC":
		case "0002ALTBC":
		case "0004CBFT":
		case "0004SSFT":
		case "0004ALRB":
		case "0005CBFT":
		case "0006MCFT":
		case "0007CBSR":
		case "0007CBHS":
		case "0007ALST":
		case "0007ALRCT":
		case "0008CB194":
		case "0008CB192":
		case "0008CB154":
		case "0008CB152":
		case "0008CB114":
		case "0008CB112":
		case "0008CB7W4":
		case "0008CB7W2":
		case "0008AL194":
		case "0008AL192":
		case "0008AL154":
		case "0008AL152":
		case "0008AL114":
		case "0008AL112":
		case "0008AL7S4":
		case "0008AL7S2":
		case "0008CBST":
		case "0008CBHDG":
		//create new row in the table for each dimension
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Thickness (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtThickness onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Width (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtWidth onkeypress='CheckInput(this)'>";
	CLASS = "A";
	break
	//Thickness
		case "0004CBRD":
		case "0004SSRD":
		case "0004ALRD":
		case "0005CBRD":
		case "0005CBRMG":
		case "0005CBTGP":
		case "0005CBCP":
		case "0005CBHX":
		case "0005ALHX":
		case "0005ALRD":
		case "0006LCRD":
		case "0006MCRD":
		case "0006MCHT":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Thickness (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtThickness onkeypress='CheckInput(this)'>";
		
		CLASS = "B";
		
		break;
		//Thickness, Number
		case "0008CBEM":
		case "0008CBGEM":
		case "0008CBFEM":
		case "0008CBFGEM":
		case "0008CBEMG":
		case "0008CBGEMG":
		case "0008CBEMGT":
		case "0008ALEM":
		case "0008ALFEM":
		case "0008SSEM":
		case "0008SSFEM":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Thickness (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtThickness onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Number :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtNumber onkeypress='CheckInput(this)'>";
	
		CLASS = "C"
		
		break;
		//Thickness, Width, Length
		case "0001CBHSA":
		case "0001CBAR":
		case "0001ALMFP":
		case "0001ALPCP":
		case "0001ALTBP":
		case "0002ALMFS":
		case "0002ALSESC":
		case "0008FGMG":
		case "0008FGPG":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Thickness (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtThickness onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Width (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtWidth onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Length (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtLength onkeypress='CheckInput(this)'>";
	
		CLASS = "D";
		
		break;
		//Gauge, Width
		case "0001CBFS":
		case "0002CBHRSC":
		case "0002CBFSC":
		case "0002CBCRC":
		case "0002CBCCZ":
		case "0002CBCCL":
		case "0002CBALC":
		case "0002SSHRC":
		case "0002SSCRC":

	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Gauge :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtGauge onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Width (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtWidth onkeypress='CheckInput(this)'>";
	
		CLASS = "E";
			
		break;
		//Depth, Flange Width, Flange Thickness
		case "0003BCH":
		case "0003BAN":
		case "0003SAN":
		case "0003TES":
		case "0003SSAN":
		case "0003ALAN":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Depth :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtDepth onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Flange Width (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtFWidth onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Flange Thickness (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtFThickness onkeypress='CheckInput(this)'>";
	
		CLASS = "F";
		
		break;
		//Gauge, Width, Length
		case "0002CBHRS":
		case "0002CBCRS":
		case "0002CBCSZ":
		case "0002CBCSL":
		case "0002CBALS":
		case "0002SSCRS":

	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Gauge :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtGauge onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Width (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtWidth onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Length (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtLength onkeypress='CheckInput(this)'>";
	
		CLASS = "G";
		
		break;
		//Depth, Pounds per Foot
		case "0003WBM":
		case "0003SBM":
		case "0003MBM":
		case "0003CCH":
		case "0003MCCH":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Depth (in.) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtDepth onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Pounds per Foot :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtWeight onkeypress='CheckInput(this)'>";
		
		CLASS = "H";
		
		break;
		//O.D., Gauge
		case "0007SSOTR":
		case "0007SSOTS":
		case "0007SSOTC":
		case "0007ALP":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "O.D. :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtOD onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Gauge :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtGauge onkeypress='CheckInput(this)'>";
	
		CLASS = "I";
		
		break;
		//Width
		case "0004CBSQ":
		case "0004ALSQ":
		case "0005CBSQ":
		case "0005ALSQ":

	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Width (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtWidth onkeypress='CheckInput(this)'>";
	
		CLASS = "J";
		
		break;
		//O.D., Schedule
		case "0007CBSW":
		case "0007SSP":
		case "0007ALRT":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "O.D. :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtOD onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Schedule :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtSchedule onkeypress='CheckInput(this)'>";
	
		CLASS = "K";
		
		break;
		//Depth
		case "0003ALCH":
		case "0003ALHBM":
		case "0003ALIBM":

	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Depth (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtDepth onkeypress='CheckInput(this)'>";
		
		CLASS = "L";
		
		break;
		//O.D.
		case "0007CBMT":
		case "0007CBWMT":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "O.D. :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtOD onkeypress='CheckInput(this)'>";
	
		CLASS = "M";
		
		break;
		//Flange
		case "0003ALTES":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Flange (in) :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtFlange onkeypress='CheckInput(this)'>";
		
		CLASS = "N";
		
		break;
		//Number
		case "0004CBRB":
		
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Number :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtNumber onkeypress='CheckInput(this)'>";
		
		CLASS = "O";

		break;
		//Width, Height
		case "0008CBGSG":
			
	var tbl = document.getElementById("tblDimensions");
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Width :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtWidth onkeypress='CheckInput(this)'>";
	
	var newRow = tbl.insertRow(tbl.rows.length);
	var newCell = newRow.insertCell(0);
	newCell.ClassName = "DimensionLabel";
	newCell.innerHTML = "Height :";
	var newCell = newRow.insertCell(1);
	newCell.ClassName = "DimensionInput";
	newCell.innerHTML = "<INPUT class=DimensionInput id=txtHeight onkeypress='CheckInput(this)'>";
	
	}
}

//CheckInput():
//	Purpose: Rejects non-numeric input on the dimensions fields with the exception of 
//		"/" and " " (for fractional input)
//	Inputs: window.event.keycode - the key pressed
//	Outputs: Numeric data
//	Author: Jeff Baker
//	Created: 6/15/00
//======================================================================
function CheckInput(){
	if (window.event.keyCode < 48 || window.event.keyCode > 57)
		if(window.event.keyCode != 13 && window.event.keyCode != 46 && window.event.keyCode != 47 && window.event.keyCode != 32)
			window.event.keyCode = 0
}

//Dec():
//	Purpose: Converts fractional input to decimal values
//	Inputs: value - the data to check and convert if it's fractional
//	Outputs: decimal data
//	Author: Jeff Baker
//	Created: 6/15/00
//======================================================================
function Dec(value){
	var whole = 0;
	if (value.lastIndexOf("/") != -1){
		if (value.lastIndexOf(" ") != -1){
			whole = value.slice(0,value.lastIndexOf(' '));
			value = value.slice(value.lastIndexOf(' ')+1);
		}
		value = parseInt(whole) + parseFloat(value.slice(0,value.lastIndexOf('/')) / value.slice(value.lastIndexOf('/')+1));
	}
	return value;
}

//ShowStockBookPage:
//	Purpose: Displays the results of the stockbook search, sending the product type, 
//		subtype, and appropriate dimensions
//	Inputs: None
//	Outputs: None
//	Author: Jeff Baker
//	Created: 6/15/00
//======================================================================
function ShowStockBookPage(){
	var Page;
	var sThickness, sWidth, sLength;
	var sNumber, sGauge, sDepth;
	var sFWidth, sFThickness, sWeight;
	var sOD, sSchedule, sFlange, sHeight;
	
	if (CLASS == "Z"){
		alert("You must choose a type to view results");
		return;
	}
	
	Page = 'StockBookPages.asp?Type=' + document.getElementById("nptType").value;
	Page += '&SubType=' + document.getElementById("lstProductSubGroup").value.substr(4,8);

	if (CLASS == "A" || CLASS == "B" || CLASS == "C" || CLASS == "D" && document.getElementById("txtThickness").value != '')
		Page += '&Thickness=' + Dec(document.getElementById("txtThickness").value);
	if (CLASS == "A" || CLASS == "D" || CLASS == "E" || CLASS == "G" || CLASS == "J" || CLASS == "P" && document.getElementById("txtWidth").value != '')
		Page += '&Width=' + Dec(document.getElementById("txtWidth").value);
	if (CLASS == "C" || CLASS == "O" && document.getElementById("txtNumber").value !== '')
		Page += '&Number=' + Dec(document.getElementById("txtNumber").value);
	if (CLASS == "D" || CLASS == "G" && document.getElementById("txtLength").value != '')
		Page += '&Length=' + Dec(document.getElementById("txtLength").value);
	if (CLASS == "E" || CLASS == "G" || CLASS == "I" && document.getElementById("txtGauge").value != '')
		Page += '&Gauge=' + Dec(document.getElementById("txtGauge").value);
	if (CLASS == "F" || CLASS == "H" || CLASS == "L" && document.getElementById("txtDepth").value != '')
		Page += '&Depth=' + Dec(document.getElementById("txtDepth").value);
	if (CLASS == "F" && document.getElementById("txtFWidth").value != '')
		Page += '&FWidth=' + Dec(document.getElementById("txtFWidth").value);
	if (CLASS == "F" && document.getElementById("txtFThickness").value != '')
		Page += '&FThickness=' + Dec(document.getElementById("txtFThickness").value);
	if (CLASS == "H" && document.getElementById("txtWeight").value != '')
		Page += '&Weight=' + Dec(document.getElementById("txtWeight").value);
	if (CLASS == "I" || CLASS == "K" || CLASS == "M" && document.getElementById("txtOD").value != '')
		Page += '&OD=' + Dec(document.getElementById("txtOD").value);
	if (CLASS == "K" && document.getElementById("txtSchedule").value != '')
		Page += '&Schedule=' + Dec(document.getElementById("txtSchedule").value);
	if (CLASS == "N" && document.getElementById("txtFlange").value != '')
		Page += '&Flange=' + Dec(document.getElementById("txtFlange").value);
	if (CLASS == "P" && document.getElementById("txtHeight").value != '')
		Page += '&Height=' + Dec(document.getElementById("txtHeight").value);
		
	window.open(Page,null, "height=400,left="+FindCenter(window.screen.width,625)+",top="+FindCenter(window.screen.height,400)+",width=625,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no,resizable=yes");
}