if (self != top) { setTimeout("top.location = self.location;",3333); }


setTimeout("breakout()",3333);
function breakout() {
if (self != top) {top.location = self.location;}
}

nn4 = (document.layers ? true : false);
ie4 = (document.all ? true : false);

vinChars = "ABCDEFGHJKLMNPRSTUVWXYZ1234567890";
vinValues = new Array (1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0);
vinWeights = new Array (8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2);

randomModelArray = new Array (
	new Array ('E','M','F'),
	new Array ('E','M','F','G'),
	new Array ('E','M','F','G'),
	new Array ('E','M','F','G'),
	new Array ('E','G','X')
);

// maximum Fiero sequence numbers
FieroSequenceMaxArray = new Array (336840,276371,283974,246581,226402);

// Object: vin code, name
function codeNameO(code,name) {
	this.code = code;
	this.name = name;
}
// Range object: vin code, name
function codeNameR(codeBegin,codeEnd,name) {
	this.codeBegin = codeBegin;
	this.codeEnd = codeEnd;
	this.name = name;
}

// VIN position 1, geographical regions
regionArray = new Array (
	new codeNameR ("A","H","Africa"),
	new codeNameR ("J","R","Asia"),
	new codeNameR ("S","Z","Europe"),
	new codeNameR ("1","5","North America"),
	new codeNameR ("6","7","Oceania"),
	new codeNameR ("8","0","South America")
);

// VIN positions 1-2, manufacturing countries
nationArray = new Array (
	new codeNameR ("AA","AH","South Africa"),
	new codeNameR ("AJ","AN","Cote D'Ivoire"),
	new codeNameR ("BA","BE","Angola"),
	new codeNameR ("BF","BK","Kenya"),
	new codeNameR ("BL","BR","Tanzania"),
	new codeNameR ("CA","CE","Benin"),
	new codeNameR ("CF","CK","Malagasy"),
	new codeNameR ("CL","CR","Tunisia"),
	new codeNameR ("DA","DE","Egypt"),
	new codeNameR ("DF","DK","Morocco"),
	new codeNameR ("DL","DR","Zambia"),
	new codeNameR ("EA","EE","Ethiopia"),
	new codeNameR ("EF","EK","Mozambique"),
	new codeNameR ("FA","FE","Ghana"),
	new codeNameR ("FF","FK","Nigeria"),
	new codeNameR ("JA","J0","Japan"),
	new codeNameR ("KA","KE","Sri Lanka"),
	new codeNameR ("KF","KK","Israel"),
	new codeNameR ("KL","KR","South Korea"),
	new codeNameR ("LA","L0","China"),
	new codeNameR ("MA","ME","India"),
	new codeNameR ("MF","MK","Indonesia"),
	new codeNameR ("ML","MR","Thailand"),
	new codeNameR ("NF","NK","Pakistan"),
	new codeNameR ("NL","NR","Turkey"),
	new codeNameR ("PA","PE","Philippines"),
	new codeNameR ("PF","PK","Singapore"),
	new codeNameR ("PL","PR","Malaysia"),
	new codeNameR ("RA","RE","United Arab Emirates"),
	new codeNameR ("RF","RK","Taiwan"),
	new codeNameR ("RL","RR","Vietnam"),
	new codeNameR ("SA","SM","United Kingdom"),
	new codeNameR ("SN","ST","Germany"),
	new codeNameR ("SU","SZ","Poland"),
	new codeNameR ("TA","TH","Switzerland"),
	new codeNameR ("TJ","TP","Czechoslovakia"),
	new codeNameR ("TR","TV","Hungary"),
	new codeNameR ("TW","T1","Portugal"),
	new codeNameR ("UH","UM","Denmark"),
	new codeNameR ("UN","UT","Ireland"),
	new codeNameR ("UV","UZ","Romania"),
	new codeNameR ("U5","U7","Slovak Republic"),
	new codeNameR ("VA","VE","Austria"),
	new codeNameR ("VF","VR","France"),
	new codeNameR ("VS","VW","Spain"),
	new codeNameR ("VX","V2","Yugoslavia"),
	new codeNameR ("V3","V5","Croatia"),
	new codeNameR ("V6","V0","Estonia"),
	new codeNameR ("WA","W0","Germany"),
	new codeNameR ("XA","XE","Bulgaria"),
	new codeNameR ("XF","XK","Greece"),
	new codeNameR ("XL","XR","The Netherlands"),
	new codeNameR ("XS","XW","USSR"),
	new codeNameR ("XX","X2","Luxembourg"),
	new codeNameR ("X3","X0","Russia"),
	new codeNameR ("YA","YE","Belgium"),
	new codeNameR ("YF","YK","Finland"),
	new codeNameR ("YL","YR","Malta"),
	new codeNameR ("YS","YW","Sweden"),
	new codeNameR ("YX","Y2","Norway"),
	new codeNameR ("Y3","Y5","Belarus"),
	new codeNameR ("Y6","Y0","Ukraine"),
	new codeNameR ("ZA","ZR","Italy"),
	new codeNameR ("ZX","Z2","Slovenia"),
	new codeNameR ("Z3","Z5","Lithuania"),
	new codeNameR ("1A","10","United States"),
	new codeNameR ("2A","20","Canada"),
	new codeNameR ("3A","3W","Mexico"),
	new codeNameR ("3X","37","Costa Rica"),
	new codeNameR ("4A","40","United States"),
	new codeNameR ("5A","50","United States"),
	new codeNameR ("6A","6W","Australia"),
	new codeNameR ("7A","7E","New Zealand"),
	new codeNameR ("8A","8E","Argentina"),
	new codeNameR ("8F","8J","Chile"),
	new codeNameR ("8L","8R","Ecuador"),
	new codeNameR ("8S","8W","Peru"),
	new codeNameR ("8X","82","Venezuela"),
	new codeNameR ("9A","9E","Brazil"),
	new codeNameR ("9F","9J","Colombia"),
	new codeNameR ("9L","9R","Paraguay"),
	new codeNameR ("9S","9W","Uruguay"),
	new codeNameR ("9X","92","Trinidad and Tobago"),
	new codeNameR ("93","99","Brazil")
);

// VIN positions 1-3: WMI codes for GM passenger cars
GMcarVin3Array = new Array (
	"1G1","1G2","1G3","1G4","1G5","1G6","1G7","1G8","1Y1",
	"2C1","2G1","2G2","2G3","2G4","2G7","3G1","3G2","3G4",
	"4G1","4G2","JG1","J81","J87","KL2","KL7"
);

// VIN positions 1-2, GM manufacturer names
GMmanufacturerArray = new Array (
	new codeNameO ("1G","General Motors"),
	new codeNameO ("1Y","NUMMI (GM with Toyota)"),
	new codeNameO ("2C","CAMI (GM with Suzuki)"),
	new codeNameO ("2G","General Motors"),
	new codeNameO ("3G","General Motors"),
	new codeNameO ("4G","General Motors"),
	new codeNameO ("JG","Suzuki for GM"),
	new codeNameO ("J8","Isuzu for GM"),
	new codeNameO ("KL","Daewoo for GM")
);

// VIN position 3: GM passenger car makes
GMcarMakeArray = new Array (
	"Chevrolet","Pontiac","Oldsmobile","Buick",
	"Pontiac","Cadillac","GM of Canada","Saturn"
);

// VIN position 3: GM light truck makes
GMtruckMakeArray = new Array (
	"Chevrolet bus","Chevrolet incomplete","Chevrolet truck",
	"GMC incomplete","Cadillac incomplete","Cadillac incomplete coaches",
	"Oldsmobile MPV - Silhouette","GMC bus","GMC MPV","Buick incomplete",
	"Pontiac MPV - Trans Sport, Montana","Chevrolet MPV - Lumina",
	"GMC truck","Pontiac truck"
);

// VIN position 4 for 1984 and earlier
// VIN position 7 for 1987 and later
// restraint systems
restraintArray = new Array (
	"manual belts, no airbags",
	"manual belts with driver & passenger airbags",
	"manual belts with driver airbag",
	"automatic belts, no airbags",
	"automatic belts with driver airbag",
	"automatic belts with driver & passenger airbags"
);

// carline Object: carline codes for 1986-1995 and carline name
function carlineO(y86,y87,y88,y89,y90,y91,y92,y93,y94,y95,name) {
	this.code = new Array (y86,y87,y88,y89,y90,y91,y92,y93,y94,y95);
	this.name = name;
}
// Saturn carline Object: carline codes for 1991-1995 and carline name
function carlineS(y91,y92,y93,y94,y95,name) {
	this.code = new Array (y91,y92,y93,y94,y95);
	this.name = name;
}
carlineArray = new Array(
	new Array (  // Chevrolet
		new carlineO ("--","--","LV","LV","LV","LV","LV","LV","LV","LV","Beretta"),
		new carlineO ("--","--","--","LW","LW","LW","LW","LW","--","--","Beretta GT"),
		new carlineO ("--","--","--","--","--","LZ","LZ","LZ","--","--","Beretta GTZ"),
		new carlineO ("--","--","--","--","--","--","--","--","LW","LW","Beretta Z26"),
		new carlineO ("FS","--","--","--","--","--","--","--","--","--","Camaro Berlinetta"),
		new carlineO ("FP","FP","--","--","--","--","--","FP","--","--","Camaro Sport Coupe"),
		new carlineO ("--","--","FP","FP","FP","FP","FP","--","FP","FP","Camaro Sport Coupe & Conv."),
		new carlineO ("--","BL","BL","BL","BL","BL","--","--","--","--","Caprice"),
		new carlineO ("--","--","--","--","--","--","BL","BL","BL","--","Caprice & Caprice Wagon"),
		new carlineO ("--","BU","BU","BU","BU","--","--","--","--","--","Caprice Brougham"),
		new carlineO ("BN","BN","BN","BN","BN","BN","BN","--","--","--","Caprice Classic"),
		new carlineO ("--","--","--","--","--","--","--","--","--","BL","Caprice Classic & Wagon & Impala SS"),
		new carlineO ("--","--","--","--","--","--","--","--","BN","--","Caprice Classic LS"),
		new carlineO ("--","--","--","--","--","--","--","BN","--","--","Caprice Classic LS & LTZ"),
		new carlineO ("JC","JC","JC","JC","JC","--","--","--","--","JC","Cavalier"),
		new carlineO ("--","--","--","--","--","JC","--","--","--","--","Cavalier & Conv."),
		new carlineO ("JD","JD","JD","--","--","--","--","--","--","--","Cavalier CS"),
		new carlineO ("--","--","JE","--","--","--","--","--","--","--","Cavalier RS"),
		new carlineO ("--","JE","--","--","--","--","--","--","--","--","Cavalier RS & Conv."),
		new carlineO ("JE","--","--","--","--","--","--","--","--","--","Cavalier Type 10 & Conv."),
		new carlineO ("--","--","--","--","JF","JF","--","--","--","--","Cavalier Z24"),
		new carlineO ("--","--","JF","JF","--","--","JF","JF","JF","--","Cavalier Z24 & Conv."),
		new carlineO ("--","--","--","--","--","--","--","--","--","JF","Cavalier Z24, LS, Conv."),
		new carlineO ("--","--","--","--","--","--","JC","JC","JC","--","Cavalier, Conv., Wagon"),
		new carlineO ("AW","AW","AW","AW","AW","--","--","--","--","--","Celebrity"),
		new carlineO ("TB","TB","--","--","--","--","--","--","--","--","Chevette CS"),
		new carlineO ("TJ","--","--","--","--","--","--","--","--","--","Chevette Scooter"),
		new carlineO ("--","--","--","--","--","--","--","BB","BB","--","Commercial Chassis"),
		new carlineO ("--","--","LT","LT","LT","--","--","--","LD","LD","Corsica"),
		new carlineO ("--","--","--","--","--","LT","LT","LT","--","--","Corsica LT"),
		new carlineO ("--","--","--","LZ","--","--","--","--","--","--","Corsica LTZ"),
		new carlineO ("--","--","--","--","LZ","--","--","--","--","--","Corsica LTZ & Beretta GTZ"),
		new carlineO ("YY","YY","YY","YY","YY","YY","--","--","--","--","Corvette"),
		new carlineO ("--","--","--","--","--","--","YY","YY","YY","YY","Corvette & Conv."),
		new carlineO ("--","--","--","YZ","YZ","YZ","YZ","YZ","YZ","YZ","Corvette ZR1"),
		new carlineO ("--","--","--","MS","MS","--","--","--","--","--","Geo Metro"),
		new carlineO ("--","--","--","--","--","--","--","MR","MR","MR","Geo Metro & LSi"),
		new carlineO ("--","--","--","--","--","--","--","MR","MR","--","Geo Metro & LSi (& GSi Canada)"),
		new carlineO ("--","--","--","--","MR","MR","MR","--","--","--","Geo Metro LSi & Conv."),
		new carlineO ("--","--","--","MR","--","--","--","--","--","--","Geo Metro LSi (& Sprint CL export)"),
		new carlineO ("--","--","--","--","--","MS","MS","MS","MS","--","Geo Metro XFi"),
		new carlineO ("--","--","--","SK","SK","SK","SK","SK","SK","SK","Geo Prizm"),
		new carlineO ("--","--","--","--","SL","SL","SL","--","--","--","Geo Prizm GSi"),
		new carlineO ("--","--","--","RE","--","--","--","--","--","--","Geo Spectrum"),
		new carlineO ("--","--","--","RF","--","--","--","--","--","--","Geo Spectrum Coupe"),
		new carlineO ("--","--","--","RG","--","--","--","--","--","--","Geo Spectrum Sedan"),
		new carlineO ("--","--","--","--","RF","RF","RF","RF","--","--","Geo Storm"),
		new carlineO ("--","--","--","--","RT","RT","RT","RT","--","--","Geo Storm GSi"),
		new carlineO ("BL","--","--","--","--","--","--","--","--","--","Impala"),
		new carlineO ("--","--","--","--","WL","WL","WL","WL","--","--","Lumina"),
		new carlineO ("--","--","--","--","--","--","--","--","WM","--","Lumina (Coupe)"),
		new carlineO ("--","--","--","--","--","--","--","--","WL","WL","Lumina (Sedan)"),
		new carlineO ("--","--","--","--","WN","WN","WN","WN","WN","--","Lumina Euro"),
		new carlineO ("--","--","--","--","--","--","--","--","--","WN","Lumina LS"),
		new carlineO ("--","--","--","--","--","WP","WP","WP","WP","--","Lumina Z34"),
		new carlineO ("GZ","GZ","GZ","--","--","--","--","--","--","--","Monte Carlo"),
		new carlineO ("--","--","--","--","--","--","--","--","--","WW","Monte Carlo LS"),
		new carlineO ("--","--","--","--","--","--","--","--","--","WX","Monte Carlo Z34"),
		new carlineO ("SK","SK","SK","--","--","--","--","--","--","--","Nova"),
		new carlineO ("--","RF","RF","--","--","--","--","--","--","--","Spectrum Coupe"),
		new carlineO ("RF","--","--","--","--","--","--","--","--","--","Spectrum Level I"),
		new carlineO ("RG","--","--","--","--","--","--","--","--","--","Spectrum Level II"),
		new carlineO ("--","RG","RG","--","--","--","--","--","--","--","Spectrum Sedan"),
		new carlineO ("MR","MR","MR","--","--","--","--","--","--","--","Sprint"),
		new carlineO ("--","--","--","MT","MT","MT","MT","--","--","--","Sprint (export)"),
		new carlineO ("--","MS","MS","--","--","--","--","--","--","--","Sprint ER")),
	new Array (  // Pontiac
		new carlineO ("TL","TL","--","--","--","--","--","--","--","--","1000"),
		new carlineO ("AF","AF","AF","AF","--","--","--","--","--","--","6000"),
		new carlineO ("AG","AG","AG","AG","AF","AF","--","--","--","--","6000 LE"),
		new carlineO ("--","AE","AE","AE","AJ","AJ","--","--","--","--","6000 SE"),
		new carlineO ("AH","AH","AH","AH","--","--","--","--","--","--","6000 STE"),
		new carlineO ("--","HX","--","--","--","--","--","--","--","--","Bonneville"),
		new carlineO ("GN","--","--","--","--","--","--","--","--","--","Bonneville"),
		new carlineO ("GR","--","--","--","--","--","--","--","--","--","Bonneville Brougham"),
		new carlineO ("--","HZ","HX","HX","HX","HX","--","--","--","--","Bonneville LE"),
		new carlineO ("GS","--","--","--","--","--","--","--","--","--","Bonneville LE"),
		new carlineO ("--","--","HZ","HZ","HZ","HZ","HX","HX","HX","HX","Bonneville SE"),
		new carlineO ("--","--","HY","HY","HY","HY","HZ","HZ","HZ","HZ","Bonneville SSE"),
		new carlineO ("--","--","--","--","--","--","HY","HY","--","--","Bonneville SSEi"),
		new carlineO ("PE","PE","PE","--","--","--","--","--","--","--","Fiero"),
		new carlineO ("PG","PG","PG","--","--","--","--","--","--","--","Fiero GT"),
		new carlineO ("PF","PF","--","--","--","--","--","--","--","--","Fiero SE"),
		new carlineO ("PM","PM","--","--","--","--","--","--","--","--","Fiero Sport"),
		new carlineO ("FS","FS","FS","FS","FS","FS","--","FS","FS","--","Firebird"),
		new carlineO ("--","--","--","--","--","--","FS","--","--","FS","Firebird & Conv."),
		new carlineO ("--","--","--","--","--","--","--","--","FV","FV","Firebird Formula, Conv., Trans Am"),
		new carlineO ("--","--","--","--","--","--","--","FV","--","--","Firebird Formula/Trans Am"),
		new carlineO ("FX","--","--","--","--","--","--","--","--","--","Firebird SE"),
		new carlineO ("FW","FW","FW","FW","FW","FW","--","--","--","--","Firebird Trans Am"),
		new carlineO ("--","--","--","--","--","--","FW","--","--","--","Firebird Trans Am & Conv."),
		new carlineO ("--","MR","MR","MR","MT","MR","MR","--","--","--","Firefly"),
		new carlineO ("--","--","--","--","MR","--","--","--","--","--","Firefly LE/Turbo"),
		new carlineO ("NE","NE","NE","--","--","NG","--","--","--","--","Grand Am"),
		new carlineO ("--","--","--","--","--","--","NW","NW","NW","NW","Grand Am GT"),
		new carlineO ("NV","NV","NV","NE","NE","NE","--","--","--","--","Grand Am LE"),
		new carlineO ("--","NW","NW","NW","NW","NW","NE","NE","NE","NE","Grand Am SE"),
		new carlineO ("--","--","WJ","WJ","--","--","--","--","--","--","Grand Prix"),
		new carlineO ("GJ","GJ","--","--","--","--","--","--","--","--","Grand Prix"),
		new carlineO ("GP","GP","--","--","--","--","--","--","--","--","Grand Prix Brougham"),
		new carlineO ("--","--","--","--","--","WP","--","--","--","--","Grand Prix GT"),
		new carlineO ("--","--","--","--","--","--","WP","WP","--","--","Grand Prix GT/GTP"),
		new carlineO ("--","--","WK","WK","WJ","WH","WH","WH","--","--","Grand Prix LE"),
		new carlineO ("GK","GK","--","--","--","--","--","--","--","--","Grand Prix LE"),
		new carlineO ("--","--","WP","WP","WP","WJ","WJ","WJ","WJ","WJ","Grand Prix SE"),
		new carlineO ("--","--","--","--","WT","WT","WT","WT","--","--","Grand Prix STE"),
		new carlineO ("--","--","TN","TN","TN","--","TX","TX","--","--","LeMans"),
		new carlineO ("--","--","--","TX","TX","TX","--","--","--","--","LeMans Aero Coupe"),
		new carlineO ("--","--","TX","--","--","--","--","--","--","--","LeMans Coupe"),
		new carlineO ("--","--","TS","TS","TS","--","--","--","--","--","LeMans GSE"),
		new carlineO ("--","--","--","--","--","TN","--","--","--","--","LeMans LE"),
		new carlineO ("--","--","TR","TR","--","--","--","--","--","--","LeMans SE"),
		new carlineO ("--","--","--","--","--","--","TN","TN","--","--","LeMans SE, Aero Coupe, Sedan"),
		new carlineO ("--","--","--","--","--","--","--","--","--","--","Ny tma re"),
		new carlineO ("BL","--","--","--","--","--","--","--","--","--","Parisienne"),
		new carlineO ("BT","--","--","--","--","--","--","--","--","--","Parisienne Brougham"),
		new carlineO ("--","BL","BL","BL","--","--","--","--","--","--","Safari Wagon"),
		new carlineO ("JB","JB","JB","JB","--","JC","--","--","--","--","Sunbird"),
		new carlineO ("--","JU","JU","JU","JU","JU","JD","JD","--","--","Sunbird GT"),
		new carlineO ("JC","--","--","--","JB","JB","JC","JC","--","--","Sunbird LE"),
		new carlineO ("--","--","--","--","--","--","--","--","JB","--","Sunbird LE & Conv."),
		new carlineO ("JD","JD","JD","JD","JD","JD","--","--","JL","--","Sunbird SE"),
		new carlineO ("--","--","--","--","--","--","JB","JB","--","--","Sunbird SE & Conv."),
		new carlineO ("--","--","--","--","--","--","RT","--","--","--","Sunfire (Canada only)"),
		new carlineO ("--","--","--","--","--","--","--","--","--","JD","Sunfire GT"),
		new carlineO ("--","--","--","--","--","--","--","--","--","JB","Sunfire SE & Conv."),
		new carlineO ("--","--","--","--","--","--","--","LT","--","--","Tempest (export only)")),
	new Array (  // Oldsmobile
		new carlineO ("--","--","--","--","--","--","NL","NL","NL","NL","Achieva S"),
		new carlineO ("--","--","--","--","--","--","NF","NF","--","--","Achieva SL"),
		new carlineO ("--","--","--","--","--","--","--","--","NF","NF","Achieva SL & SC"),
		new carlineO ("NF","NF","--","--","--","--","--","--","--","--","Calais"),
		new carlineO ("NT","NT","--","--","--","--","--","--","--","--","Calais Supreme"),
		new carlineO ("BP","BP","BP","BP","BP","BP","BP","--","--","--","Custom Cruiser Wagon"),
		new carlineO ("--","--","WS","--","--","--","--","--","--","--","Cutlass Brougham"),
		new carlineO ("--","--","NF","NL","NL","NL","--","--","--","--","Cutlass Calais"),
		new carlineO ("--","--","NK","NK","NK","NK","--","--","--","--","Cutlass Calais International Series"),
		new carlineO ("--","--","--","NF","NF","NF","--","--","--","--","Cutlass Calais S"),
		new carlineO ("--","--","NT","NT","NT","NT","--","--","--","--","Cutlass Calais SL"),
		new carlineO ("--","--","--","--","AL","AL","--","--","--","--","Cutlass Ciera"),
		new carlineO ("--","--","--","--","--","--","AJ","--","--","--","Cutlass Ciera & Cruiser S Wagon"),
		new carlineO ("--","--","AJ","AJ","--","--","--","--","--","--","Cutlass Ciera & Cruiser Wagon"),
		new carlineO ("AM","AM","--","--","--","--","--","--","--","--","Cutlass Ciera Brougham"),
		new carlineO ("--","--","AM","AM","--","--","--","--","--","--","Cutlass Ciera Brougham & SL"),
		new carlineO ("--","--","AS","AS","AS","--","--","--","--","--","Cutlass Ciera International Series"),
		new carlineO ("AJ","AJ","--","--","--","--","--","--","--","--","Cutlass Ciera LS & Cruiser Wagon"),
		new carlineO ("--","--","--","--","--","--","AL","AG","AG","--","Cutlass Ciera S"),
		new carlineO ("--","--","--","--","--","AJ","--","--","--","--","Cutlass Ciera S & Cruiser S Wagon"),
		new carlineO ("--","--","--","--","AJ","--","--","--","--","--","Cutlass Ciera S & Cruiser Wagon"),
		new carlineO ("--","--","--","--","--","--","--","AJ","AJ","--","Cutlass Ciera S Wagon"),
		new carlineO ("--","--","--","--","AM","AM","AM","AM","--","--","Cutlass Ciera SL & Cruiser SL Wagon"),
		new carlineO ("--","--","--","--","--","--","--","--","--","AJ","Cutlass Ciera SL & Wagon"),
		new carlineO ("GK","GK","--","--","--","--","--","--","--","--","Cutlass Salon Coupe"),
		new carlineO ("--","--","WH","WH","WH","WH","--","--","--","--","Cutlass Supreme"),
		new carlineO ("GR","GR","--","--","--","--","--","--","--","--","Cutlass Supreme"),
		new carlineO ("GM","GM","--","--","--","--","--","--","--","--","Cutlass Supreme Brougham"),
		new carlineO ("--","--","GR","--","--","--","--","--","--","--","Cutlass Supreme Classic"),
		new carlineO ("--","--","GM","--","--","--","--","--","--","--","Cutlass Supreme Classic Brougham"),
		new carlineO ("--","--","--","--","WT","WT","WT","WT","WT","WT","Cutlass Supreme Conv."),
		new carlineO ("--","--","--","WR","WR","WR","WR","WR","--","--","Cutlass Supreme International Series"),
		new carlineO ("--","--","--","--","--","--","WH","WH","WH","--","Cutlass Supreme S"),
		new carlineO ("--","--","--","WS","WS","WS","--","--","--","WH","Cutlass Supreme SL"),
		new carlineO ("HN","HN","HN","HN","--","--","--","--","--","--","Delta 88 Royale"),
		new carlineO ("HY","HY","HY","HY","--","--","--","--","--","--","Delta 88 Royale Brougham"),
		new carlineO ("--","--","--","--","HN","HN","HN","HN","HN","HN","Eighty Eight Royale"),
		new carlineO ("--","--","--","--","HY","HY","--","--","--","--","Eighty Eight Royale Brougham"),
		new carlineO ("--","--","--","--","--","--","HY","HY","HY","HY","Eighty Eight Royale LS"),
		new carlineO ("JC","JC","JC","--","--","--","--","--","--","--","Firenza"),
		new carlineO ("JD","--","--","--","--","--","--","--","--","--","Firenza Brougham"),
		new carlineO ("--","JD","--","--","--","--","--","--","--","--","Firenza LC/LX/GT"),
		new carlineO ("CX","CX","CX","CX","CX","CX","CX","CX","CX","--","Ninety Eight Regency"),
		new carlineO ("CW","CW","CW","CW","CW","--","--","--","--","--","Ninety Eight Regency Brougham"),
		new carlineO ("--","--","--","--","--","CW","CW","CW","CW","CX","Ninety Eight Regency Elite"),
		new carlineO ("--","--","CV","CV","CV","CV","CV","CV","--","--","Ninety Eight Touring Sedan"),
		new carlineO ("--","--","WR","--","--","--","--","--","--","--","Sport Coupe/ES Sedan"),
		new carlineO ("--","--","EZ","EZ","EZ","EZ","EZ","--","--","--","Toronado"),
		new carlineO ("EZ","EZ","--","--","--","--","--","--","--","--","Toronado Brougham"),
		new carlineO ("--","--","--","EV","EV","EV","EV","--","--","--","Toronado Trofeo"),
		new carlineO ("--","--","EV","--","--","--","--","--","--","--","Trofeo")),
	new Array (  // Buick
		new carlineO ("--","--","--","--","--","--","AG","--","--","--","Century"),
		new carlineO ("AH","AH","AH","AH","AH","AH","--","--","AH","AH","Century Custom"),
		new carlineO ("--","--","--","--","--","--","AH","AH","--","--","Century Custom & Wagon"),
		new carlineO ("AL","--","--","--","--","AL","--","AL","--","--","Century Limited"),
		new carlineO ("--","AL","AL","AL","AL","--","--","--","--","--","Century Limited & Estate Wagon"),
		new carlineO ("--","--","--","--","--","--","AL","--","--","--","Century Limited & Wagon"),
		new carlineO ("--","--","--","--","--","--","--","AG","AG","AG","Century Special & Wagon"),
		new carlineO ("AG","AG","--","--","--","--","--","--","--","--","Century T-type"),
		new carlineO ("--","--","--","--","BB","BB","--","--","BB","--","Coachbuilder Wagon"),
		new carlineO ("CX","--","--","--","--","--","--","--","--","--","Electra"),
		new carlineO ("--","CX","--","--","--","--","--","--","--","--","Electra 380"),
		new carlineO ("BV","BV","BV","BV","--","--","--","--","--","--","Electra Estate Wagon"),
		new carlineO ("--","--","CX","CX","CX","--","--","--","--","--","Electra Limited"),
		new carlineO ("CW","CW","CW","CW","CW","--","--","--","--","--","Electra Park Avenue"),
		new carlineO ("--","--","--","CU","CU","--","--","--","--","--","Electra Park Avenue Ultra"),
		new carlineO ("CF","CF","CF","CF","CF","--","--","--","--","--","Electra T-type"),
		new carlineO ("--","--","--","--","BR","--","--","--","--","--","Estate Wagon"),
		new carlineO ("--","HH","--","--","--","--","--","--","--","--","Le Sabre"),
		new carlineO ("HP","HP","HP","HP","HP","HP","HP","HP","HP","HP","Le Sabre Custom"),
		new carlineO ("BR","BR","BR","BR","--","--","--","--","--","--","Le Sabre Estate Wagon"),
		new carlineO ("HR","HR","HR","HR","HR","HR","HR","HR","HR","HR","Le Sabre Limited"),
		new carlineO ("--","--","--","--","--","CW","CW","CW","CW","CW","Park Avenue"),
		new carlineO ("--","--","--","--","--","CU","CU","CU","CU","CU","Park Avenue-Ultra"),
		new carlineO ("--","--","EC","EC","EC","EC","--","--","--","--","Reatta"),
		new carlineO ("GJ","GJ","--","--","--","--","--","--","--","--","Regal"),
		new carlineO ("--","--","WB","WB","WB","WB","WB","WB","WB","--","Regal Custom"),
		new carlineO ("--","--","--","--","--","--","--","--","--","WB","Regal Custom & Gran Sport (2-door)"),
		new carlineO ("--","--","--","--","--","--","WF","WF","WF","--","Regal Gran Sport"),
		new carlineO ("--","--","--","--","--","--","--","--","--","WF","Regal Gran Sport (4-door)"),
		new carlineO ("GM","GM","--","--","--","--","--","--","--","--","Regal Limited"),
		new carlineO ("--","--","WD","WD","WD","WD","WD","WD","WD","WD","Regal Limited"),
		new carlineO ("GK","GK","--","--","--","--","--","--","--","--","Regal T-type"),
		new carlineO ("--","--","--","EZ","EZ","EZ","--","EZ","--","--","Riviera"),
		new carlineO ("EZ","EZ","EZ","--","--","--","EZ","--","--","--","Riviera Luxury"),
		new carlineO ("EY","EY","--","--","--","--","--","--","--","--","Riviera T-type"),
		new carlineO ("--","--","--","--","--","--","BN","BN","BN","BN","Roadmaster"),
		new carlineO ("--","--","--","--","--","BR","BR","BR","BR","BR","Roadmaster Estate Wagon"),
		new carlineO ("--","--","--","--","--","--","BT","--","--","--","Roadmaster ITT Limited"),
		new carlineO ("--","--","--","--","--","--","--","BT","BT","BT","Roadmaster Limited"),
		new carlineO ("--","--","--","JS","--","--","--","--","--","--","Skyhawk"),
		new carlineO ("JS","JS","--","--","--","--","--","--","--","--","Skyhawk Custom"),
		new carlineO ("JT","JT","--","--","--","--","--","--","--","--","Skyhawk Limited"),
		new carlineO ("--","--","JS","--","--","--","--","--","--","--","Skyhawk Sport"),
		new carlineO ("JE","JE","--","--","--","--","--","--","--","--","Skyhawk T-type"),
		new carlineO ("--","--","--","--","NV","NV","--","--","--","--","Skylark"),
		new carlineO ("--","--","--","--","--","--","NJ","--","NV","--","Skylark Custom"),
		new carlineO ("--","--","NJ","NJ","NJ","NJ","--","--","--","--","Skylark Custom (2-door)"),
		new carlineO ("--","--","NC","NC","NC","NC","--","--","--","--","Skylark Custom (4-door)"),
		new carlineO ("--","--","--","--","--","--","--","--","--","NV","Skylark Custom/LTD/Gran Sport"),
		new carlineO ("--","--","--","--","--","--","--","NM","NM","--","Skylark Gran Sport"),
		new carlineO ("--","--","--","--","--","--","NM","--","--","--","Skylark Grand Sport"),
		new carlineO ("--","--","--","--","NM","NM","--","--","--","--","Skylark Grand Sport (2-door)"),
		new carlineO ("--","--","--","--","--","--","--","NJ","NJ","--","Skylark Limited"),
		new carlineO ("--","--","NM","NM","--","--","--","--","--","--","Skylark Limited (2-door)"),
		new carlineO ("--","--","ND","ND","ND","--","--","--","--","--","Skylark Limited (4-door)"),
		new carlineO ("--","--","--","--","--","ND","--","--","--","--","Skylark Luxury (4-door)"),
		new carlineO ("--","NJ","--","--","--","--","--","--","--","--","Somerset Custom"),
		new carlineO ("--","NM","--","--","--","--","--","--","--","--","Somerset Limited"),
		new carlineO ("NJ","--","--","--","--","--","--","--","--","--","Somerset Regal"),
		new carlineO ("NM","--","--","--","--","--","--","--","--","--","Somerset Regal Limited"),
		new carlineO ("--","NK","--","--","--","--","--","--","--","--","Somerset T-type")),
	new Array (  // Pontiac incomplete
		new carlineO ()),
	new Array (  // Cadillac
		new carlineO ("--","VR","VR","VR","--","--","--","--","--","--","Allante"),
		new carlineO ("--","--","--","--","VR","VR","VR","--","--","--","Allante (Conv. Hardtop)"),
		new carlineO ("--","--","--","--","VS","VS","VS","VS","--","--","Allante (Conv.)"),
		new carlineO ("--","DW","DW","DW","DW","DW","DW","--","--","--","Brougham"),
		new carlineO ("JG","JG","JG","--","--","--","--","--","--","--","Cimarron"),
		new carlineO ("--","--","--","--","--","CZ","--","--","--","--","Commercial Chassis"),
		new carlineO ("--","--","--","--","--","--","--","--","DH","--","Commercial Chassis (RWD)"),
		new carlineO ("--","--","--","--","--","--","--","--","KF","KF","Concours"),
		new carlineO ("--","CD","CD","CD","CD","CD","CD","CD","--","--","Deville"),
		new carlineO ("--","--","--","--","--","--","--","--","KD","KD","Deville"),
		new carlineO ("CD","--","--","--","--","--","--","--","--","--","Deville (FWD)"),
		new carlineO ("--","--","--","--","--","--","CT","CT","--","--","Deville Touring Sedan"),
		new carlineO ("EL","EL","EL","EL","EL","EL","EL","EL","EL","EL","Eldorado"),
		new carlineO ("--","--","--","--","--","--","--","--","ET","ET","Eldorado Touring"),
		new carlineO ("--","--","--","--","CB","CB","CB","--","--","--","Fleetwood"),
		new carlineO ("--","--","--","--","--","--","--","--","DW","DW","Fleetwood"),
		new carlineO ("CB","--","--","--","--","--","--","--","--","--","Fleetwood (FWD)"),
		new carlineO ("--","--","--","--","--","--","--","DW","--","--","Fleetwood Brougham"),
		new carlineO ("DW","--","--","--","--","--","--","--","--","--","Fleetwood Brougham (RWD)"),
		new carlineO ("--","CB","CB","CB","--","--","--","--","--","--","Fleetwood D'Elegance"),
		new carlineO ("CH","--","--","--","--","--","--","--","--","--","Fleetwood Limousine (FWD)"),
		new carlineO ("--","--","CS","CS","CS","CG","CG","--","--","--","Fleetwood Sixty Special"),
		new carlineO ("--","CH","--","--","--","--","--","--","--","--","Limousine"),
		new carlineO ("KS","KS","KS","KS","KS","KS","KS","KS","--","KS","Seville"),
		new carlineO ("--","--","--","--","--","--","--","--","KS","--","Seville (SLS)"),
		new carlineO ("--","--","--","--","--","--","--","--","KY","--","Seville (STS)"),
		new carlineO ("--","--","--","--","KY","KY","KY","KY","--","KY","Seville Touring Sedan"),
		new carlineO ("--","--","--","--","--","--","--","CB","--","--","Sixty Special")),
	new Array (  // GM of Canada
		new carlineO ("TB","TB","--","--","--","--","--","--","--","--","Acadian"),
		new carlineO ("TJ","--","--","--","--","--","--","--","--","--","Acadian Scooter"),
		new carlineO ("--","--","--","--","--","--","--","RT","--","--","Asona Sunfire"),
		new carlineO ("MR","MR","MR","MR","MR","MT","--","--","MR","MR","Firefly"),
		new carlineO ("--","--","--","--","MT","--","--","--","--","--","Firefly LE"),
		new carlineO ("--","--","--","--","--","MR","--","--","--","--","Firefly LE Turbo"),
		new carlineO ("--","--","TX","TX","TX","TX","--","--","--","--","Optima"),
		new carlineO ("--","--","TR","TR","TR","--","--","--","--","--","Optima GLS"),
		new carlineO ("--","--","TS","TS","TS","TS","--","--","--","--","Optima GSi"),
		new carlineO ("--","--","TN","TN","TN","TN","--","--","--","--","Optima LS"),
		new carlineO ("--","--","--","--","--","RT","--","--","--","--","Stylus (4-door) & Impulse (2-door)"),
		new carlineO ("RF","--","--","--","--","--","--","--","--","--","Sunburst"),
		new carlineO ("--","RF","--","--","--","--","--","--","--","--","Sunburst Coupe"),
		new carlineO ("RG","--","--","--","--","--","--","--","--","--","Sunburst LE"),
		new carlineO ("--","RG","RG","--","--","--","--","--","--","--","Sunburst Sedan"),
		new carlineO ("--","LT","LT","LT","LT","LT","--","--","--","--","Tempest")),
	new Array (  // Saturn
		new carlineS ("ZB1","ZB1","---","---","---","SC"),
		new carlineS ("ZG1","ZG1","---","---","---","SC"),
		new carlineS ("ZH1","ZH1","---","---","---","SC"),
		new carlineS ("---","---","ZE1","ZE1","ZE1","SC1"),
		new carlineS ("---","---","ZF1","ZF1","ZF1","SC1"),
		new carlineS ("---","---","ZG1","ZG1","ZG1","SC2"),
		new carlineS ("---","---","ZH1","ZH1","ZH1","SC2"),
		new carlineS ("---","---","ZF5","ZF5","ZF5","SL"),
		new carlineS ("ZB5","ZB5","---","---","---","SL1"),
		new carlineS ("ZF5","ZF5","---","---","---","SL1"),
		new carlineS ("ZG5","ZG5","ZG5","ZG5","ZG5","SL1"),
		new carlineS ("ZH5","ZH5","ZH5","ZH5","ZH5","SL1"),
		new carlineS ("ZD5","ZD5","---","---","---","SL2"),
		new carlineS ("ZJ5","ZJ5","ZJ5","ZJ5","ZJ5","SL2"),
		new carlineS ("ZK5","ZK5","ZK5","ZK5","ZK5","SL2"),
		new carlineS ("---","---","ZG8","ZG8","ZG8","SW1"),
		new carlineS ("---","---","ZH8","ZH8","ZH8","SW1"),
		new carlineS ("---","---","ZJ8","ZJ8","ZJ8","SW2"),
		new carlineS ("---","---","ZK8","ZK8","ZK8","SW2"))
);


// VIN positions 6-7 for 1986 and earlier, GM body types
bodyType1986Array = new Array (
	new codeNameO ("07","coupe - 2-door plain back (hatchback)"),
	new codeNameO ("08","sedan - 2-door plain back (hatchback)"),
	new codeNameO ("11","sedan - 2-door notchback"),
	new codeNameO ("19","sedan - 4-door 6-window notchback"),
	new codeNameO ("23","sedan - 4-door 6-window notchback auxiliary seat"),
	new codeNameO ("27","coupe - 2-door notchback"),
	new codeNameO ("33","sedan - 4-door 6-window notchback auxiliary seat (center partition)"),
	new codeNameO ("35","station wagon - 4-door 2-seat"),
	new codeNameO ("37","coupe - 2-door notchback special"),
	new codeNameO ("47","coupe - 2-door notchback special"),
	new codeNameO ("57","coupe - 2-door notchback special"),
	new codeNameO ("67","coupe - 2-door convertible"),
	new codeNameO ("68","sedan - 4-door 6-window plain back hatchback"),
	new codeNameO ("69","sedan - 4-door window notchback"),
	new codeNameO ("77","coupe - 2-door plain back hatchback"),
	new codeNameO ("80","pick-up delivery"),
	new codeNameO ("87","coupe - 2-door plain back special"),
	new codeNameO ("90","short sill cowls/funeral coach"),
	new codeNameO ("97","coupe - 2-door notchback sport (fastback)")
);

// VIN position 6 for 1987 and later: GM body types
bodyTypeArray = new Array (
	"2-door coupe/sedan (GM styles 11,27,37,47,57,97)",
	"2-door hatchback/liftback (GM styles 07,08,77,87)",
	"2-door convertible (GM style 67)",
	"2-door station wagon (GM style 15)",
	"4-door sedan (GM styles 19,23,33,69)",
	"4-door hatchback/liftback (GM style 68)",
	"4-door liftback (GM styles 29,68)",
	"4-door station wagon (GM style 35)"
);

// VIN position 11, GM manufacturing plants
plantArray = new Array (
	new Array (  // U.S. passenger car
		new codeNameO ("A","Lakewood, GA"),
		new codeNameO ("B","Lansing, MI (GM33)"),
		new codeNameO ("C","Lansing, MI (B)"),
		new codeNameO ("D","Doravilla, GA"),
		new codeNameO ("E","Linden, NJ"),
		new codeNameO ("F","Fairfax, KS (II)"),
		new codeNameO ("G","Framingham, MA"),
		new codeNameO ("H","Flint, MI"),
		new codeNameO ("J","Janesville, WI"),
		new codeNameO ("K","Leeds, MO"),
		new codeNameO ("L","Van Nuys, CA"),
		new codeNameO ("M","Lansing, MI (A)"),
		new codeNameO ("N","Norwood, OH"),
		new codeNameO ("P","Pontiac, MI"),
		new codeNameO ("R","Arlington, TX"),
		new codeNameO ("T","Tarrytown, NY"),
		new codeNameO ("U","Hamtramck, MI"),
		new codeNameO ("W","Willow Run, MI"),
		new codeNameO ("X","Fairfax, KS (I)"),
		new codeNameO ("Y","Wilmington, DE"),
		new codeNameO ("Z","Fremont, CA"),
		new codeNameO ("1","Wentzville, MO"),
		new codeNameO ("4","Orion, MI"),
		new codeNameO ("5","Bowling Green, KY"),
		new codeNameO ("6","Oklahoma City, OK"),
		new codeNameO ("7","Lordstown, OH"),
		new codeNameO ("9","Detroit, MI (CAD)")),
	new Array (  // Canada
		new codeNameO ("1","Oshawa, ON #2"),
		new codeNameO ("2","Ste. Therese, PQ"),
		new codeNameO ("3","St. Eustache, PQ"),
		new codeNameO ("4","Scarborough, ON"),
		new codeNameO ("5","London, ON"),
		new codeNameO ("6","Ingersoll, ON"),
		new codeNameO ("9","Oshawa, ON #1"),
		new codeNameO ("-","Tillsonburg, ON (Canexpo)")),  // duplicate 9?
	new Array (  // Mexico
		new codeNameO ("M","Mexico City, Mexico"),
		new codeNameO ("S","Ramos Arizpe, Mexico")),
	new Array (  // Japan
		new codeNameO ("K","Kosai, Japan"),
		new codeNameO ("W","Iwata, Japan"),
		new codeNameO ("3","Kawasaki, Japan"),
		new codeNameO ("7","Fujisawa, Japan"),
		new codeNameO ("8","Fujisawa, Japan")),
	new Array (  // Korea
		new codeNameO ("B","Pupyong, South Korea")),
	new Array (  // Saturn
		new codeNameO ("Z","Spring Hill, TN")),
	new Array (  // U.S. light truck
		new codeNameO ("B","Baltimore, MD (T&B)"),
		new codeNameO ("E","Pontiac, MI (T&B)"),
		new codeNameO ("F","Flint, MI (T&B)"),
		new codeNameO ("J","Janesville, WI (T&B)"),
		new codeNameO ("K","Linden, NJ (T&B)"),
		new codeNameO ("S","St. Louis, MO (T&B)"),
		new codeNameO ("V","Pontiac, MI (T&B)"),
		new codeNameO ("Z","Fort Wayne, IN (T&B)"),
		new codeNameO ("0","Pontiac, MI (T&B)"),
		new codeNameO ("1","Oshawa, ON (T&B)"),
		new codeNameO ("2","Moraine, OH (T&B)"),
		new codeNameO ("3","Detroit, MI (T&B)"),
		new codeNameO ("7","Lordstown, OH (T&B)"),
		new codeNameO ("8","Shreveport, LA (T&B)"))
);



function focusvin() {
	document.decodeForm.entervin.focus();
	document.decodeForm.entervin.select();
}



function checkDigitCalc (vin) {
	badvin = "error";
	if (vin.length!=17) return badvin;  // if VIN length is invalid then abort
	vinProblem = false;
	sum = 0;
	for (i=0; i<17; ++i) {
		valid = vinChars.indexOf(vin.charAt(i));
		if (valid<0) {  // if invalid character found in VIN then abort
			vinProblem = true;
			break;
		}
		// multiply value of VIN character times weight of its position in VIN
		// add them all up
		sum += (vinValues[valid] * vinWeights[i]);
	}
	if (vinProblem==true) return badvin;
	// divide the total by 11 and use the remainder
	remainder = sum%11;
	// if the remainder is 10, the check digit is X
	if (remainder==10)
		return 'X';
	// otherwise the remainder becomes the check digit of 0-9
	else
		return remainder.toString();
}



function decodeVin(vin,vinLabel) {
	vinOutput = "<BR>";
	// eliminate any leading spaces
	while (vin.charAt(0)==' ')
		vin = vin.substring(1);
	// eliminate any trailing spaces
	while (vin.charAt(vin.length-1)==' ')
	vin = vin.substring(0,vin.length-1);
	// convert to upper case
	vin=vin.toUpperCase();

	fatal = false;
	// check for illegal characters
	for (i=0; i<vin.length; i++) {
		vinchar = vin.charAt(i);
		if ( !((vinchar>='0' && vinchar<='9') || (vinchar>='A' && vinchar<='Z')) ) {
			vinOutput += '<span class="imp">At position <B>' + (i+1) + '</B>, the character <B>' + vinchar + '</B> is not valid.</span><BR>\n';
			fatal = true;
		}
	}
	if (vin.length<11) {
		vinOutput += '<span class="imp"><B>' + vin.length + '</B> characters is not enough, need at least <B>11</B> characters of a <B>17</B>-character VIN.</span><BR>\n';
		fatal = true;
	}
	if (fatal==true) {
		vinOutput += "No decoding.<BR>\n";
	} else {
		if (vin.length<17) {
			vinOutput += '<span class="imp">Length is only <B>' + vin.length + '</B> characters, should be <B>17</B>.</span><BR>\n';
		}
		// replace any I,O,Q characters (non-fatal) and warn
		for (i=0; i<vin.length; i++) {
			vinchar = vin.charAt(i);
			assumedchar = null;
			if (vinchar=='I') assumedchar='1';
			if (vinchar=='O' || vinchar=='Q') assumedchar='0';
			if (assumedchar) {
				vinOutput += '<span class="imp">At position <B>' + (i+1) + '</B>, the letter <B>' + vinchar + '</B> is not a valid character.  Let\'s assume it should be the number <B>' + assumedchar + '</B>.</span><BR>\n';
				vin = vin.substring(0,i) + assumedchar + vin.substring(i+1,vin.length);
			}
		}
		if (vin.length>17) {
			vinOutput += '<span class="imp"><B>' + vin.length + '</B> characters is too many; truncating to <B>17</B>.</span><BR>\n';
			vin = vin.substring(0,17);
		}
		// display (modified) VIN
		vinOutput += "" + vinLabel + "VIN: <B>" + vin + "</B><BR><BR>\n";

		checkDigit = vin.charAt(8);
		calculatedCheckDigit = checkDigitCalc(vin);
		if (vin.length<17) {
			checkDigitTableText = 'not calculateable';
		} else if (calculatedCheckDigit=="error")	{
			vinOutput += '<span class="imp">Error calculating the check digit.</span><BR>\n';
			checkDigitTableText = 'error';
		} else if (calculatedCheckDigit!=checkDigit) {
			vinOutput += '<span class="imp">Check digit <B>' + checkDigit + '</B> does not match calculated check digit <B>' + calculatedCheckDigit + '</B>.</span><BR>\n';
			checkDigitTableText = 'does not match';
		} else {
			checkDigitTableText = 'matches';
		}
		if ("0123456789X".indexOf(checkDigit)<0) {
			vinOutput += '<span class="imp"><B>' + checkDigit + '</B> is not a valid check digit character.</span><BR>\n';
			checkDigitTableText += '<BR>invalid character';
		}
		if (checkDigitTableText!='matches')
			vinOutput += '<BR>\n';

		vinTable = '<TABLE cellspacing="0" style="margin:0px;">\n';

		modelYearIndex = "ABCDEFGHJKLMNPRSTVWXY123456789".indexOf(vin.charAt(9));
		modelYear = modelYearIndex+1980;
		plantCode = vin.charAt(10);

		region = "?";
		nation = "?";
		manufacturer = "?";
		make = "?";

		nationCode1 = vin.charAt(0);
		nationCode2 = vin.charAt(1);
		for (i=0; i<regionArray.length; ++i) {
			if (vinChars.indexOf(nationCode1)>=vinChars.indexOf(regionArray[i].codeBegin) && vinChars.indexOf(nationCode1)<=vinChars.indexOf(regionArray[i].codeEnd)) {
				region = regionArray[i].name;
				break;
			}
		}
		for (i=0; i<nationArray.length; ++i) {
			if ( nationCode1==nationArray[i].codeBegin.charAt(0) && vinChars.indexOf(nationCode2)>=vinChars.indexOf(nationArray[i].codeBegin.charAt(1)) && vinChars.indexOf(nationCode2)<=vinChars.indexOf(nationArray[i].codeEnd.charAt(1)) ) {
				nation = nationArray[i].name;
				break;
			}
		}
		if ( i==nationArray.length || !(nationArray[i].codeBegin.charAt(1)=='A' && nationArray[i].codeEnd.charAt(1)=='0') )
			nationCode1 += nationCode2;

		GMcar = false;
		GMcarVin3 = vin.substring(0,3);
		for (i=0; i<GMcarVin3Array.length; ++i) {
			if (GMcarVin3==GMcarVin3Array[i]) {
				GMcar = true;
				GMcarVin2 = vin.substring(0,2);
				for (j=0; j<GMmanufacturerArray.length; ++j) {
					if (GMcarVin2==GMmanufacturerArray[j].code) {
						manufacturer = GMmanufacturerArray[j].name;
						break;
					}
				}
				makeIndex = "12345678".indexOf(vin.charAt(2));
				make = GMcarMakeArray[makeIndex];
				if (GMcarVin3=="3G5" && modelYear>=1994)
					make = "Mexico Domestic";
				break;
			}
		}
		if (vin.charAt(2)==9)
			make = "less than 500 vehicles per year";

		vinTable += '<TR><TD>1<BR>2<BR>3</TD><TD>Region<BR>Country<BR>Manufacturer<BR>Make</TD><TD>' + vin.charAt(0) + '<BR>' + vin.charAt(1) + '<BR>' + vin.charAt(2) + '</TD><TD>' + vin.charAt(0) + ' = ' + region + '<BR>' + nationCode1 + ' = ' + nation + '<BR>' + vin.substring(1,3) + ' = ' + manufacturer + '<BR>';
		if (make!="?")
			vinTable += '' + vin.charAt(2) + ' = ' + make;
		vinTable += '</TD></TR>\n<TR><TD>';

		carline = "?";
		bodyType = "?";
		restraint = "?";
		engine = "?";
		plant = "?";

		if (GMcar==true && modelYearIndex>=0) {
			if (modelYear<=1984) {
				restraintCode = vin.charAt(3);
				restraint = restraintArray["A--BC-".indexOf(restraintCode)];
				vinTable += '4</TD><TD>Restraints</TD><TD>' + vin.charAt(3) + '</TD><TD>' + restraint + '</TD>\n<TR><TD>';
				vinTable += '5</TD><TD>Carline</TD><TD>' + vin.charAt(4);
			} else
				vinTable += '4<BR>5</TD><TD>Carline</TD><TD>' + vin.charAt(3) + '<BR>' + vin.charAt(4);
			carlineCode = null;
			if (makeIndex==7) {  // Saturn
				tempModelYearFloor = 1991;
				if (modelYear>=1987)
					carlineCode = vin.substring(3,6);  // 3 characters including body
			} else {  // all other makes
				tempModelYearFloor = 1986;
				if (modelYear>=1985)
					carlineCode = vin.substring(3,5);  // 2 characters
				else if (modelYear==1984 && plantCode=='P' && (vin.charAt(4)=='E' || vin.charAt(4)=='F' || vin.charAt(4)=='M'))  //1984 Fiero
					carlineCode = 'P'+vin.charAt(4);
			}
			tempModelYearIndex = (modelYear<tempModelYearFloor ? 0 : (modelYear>1995 ? 9 : modelYear-tempModelYearFloor));
			if ( carlineCode ) {
				for (i=0; i<carlineArray[makeIndex].length; ++i) {
					if (carlineCode==carlineArray[makeIndex][i].code[tempModelYearIndex]) {
						carline = carlineArray[makeIndex][i].name;
						break;
					}
				}
			}
			if ( !carlineCode || carlineCode.charAt(0)!='P') {  // not unsure about Fieros
				if (modelYear<tempModelYearFloor)
					carline += "<BR>(not sure before " + tempModelYearFloor +")";
				if (modelYear>1995)
					carline += "<BR>(not sure after 1995)";
			}
			vinTable += '</TD><TD>' + carline + '</TD></TR>\n<TR><TD>';
			if (modelYear<=1986) {
				bodyTypeCode = vin.substring(5,7);
				for (i=0; i<bodyType1986Array.length; ++i) {
					if (bodyTypeCode==bodyType1986Array[i].code) {
						bodyType = bodyType1986Array[i].name;
						break;
					}
				}
				vinTable += '6<BR>7</TD><TD>Body type</TD><TD>' + vin.charAt(5) + '<BR>' + vin.charAt(6) + '</TD><TD>' + bodyType + '</TD></TR>\n';
			} else {  // 1987 or later
				bodyTypeCode = vin.charAt(5);
				bodyType = bodyTypeArray["12345678".indexOf(bodyTypeCode)];
				restraintCode = vin.charAt(6);
				restraint = restraintArray["123456".indexOf(restraintCode)];
				vinTable += '6</TD><TD>Body type</TD><TD>' + vin.charAt(5) + '</TD><TD>' + bodyType + '</TD></TR><TR><TD>\n';
				vinTable += '7</TD><TD>Restraints</TD><TD>' + vin.charAt(6) + '</TD><TD>' + restraint + '</TD></TR>\n';
			}
			engineCode = vin.charAt(7);

			// Fiero engines
			if (engineCode=='9' && makeIndex==1 && (modelYear>=1985 && modelYear<=1988))
				engine = "2.8-liter V6 MPFI, GM RPO L44";
			if (engineCode=='R' && (makeIndex>=0 && makeIndex<=3) && modelYear<=1992)
				engine = "2.5-liter L4 EFI, GM RPO LR8";
			if (makeIndex=='7') {  // Saturn engines
				if (engineCode=='7')
					engine = "1.9-liter L4 MFI DOHC 16V, GM RPO LL0";
				if (engineCode=='8')
					engine = "1.9-liter L4 MFI SOHC, GM RPO L24";
				if (engineCode=='9')
					engine = "1.9-liter L4 TBI, GM RPO LK0";
			}
	
if(modelYear>=1982 && modelYear<=1983) engine = "2.5L";
if(modelYear>=1982 && modelYear<=1983) engine = "3.0L";

if(modelYear>=1986 && modelYear<=1986 && engineCode=="J") engine = "1.8L Multi Port Fuel Injection";
if(modelYear>=1986 && modelYear<=1986 && engineCode=="0") engine = "1.8L Throttle Body Injection";
if(modelYear>=1986 && modelYear<=1986 && engineCode=="P") engine = "2.0L Throttle Body Injection";
if(modelYear>=1986 && modelYear<=1986 && engineCode=="2") engine = "2.5L Throttle Body Injection";
if(modelYear>=1986 && modelYear<=1986 && engineCode=="X") engine = "2.8L Carb";
if(modelYear>=1986 && modelYear<=1986 && engineCode=="B") engine = "3.8L Fuel Injection";
if(modelYear>=1986 && modelYear<=1987 && engineCode=="A") engine = "3.8L Carb";
if(modelYear>=1986 && modelYear<=1987 && engineCode=="8") engine = "4.1L Fuel Injection";
if(modelYear>=1986 && modelYear<=1987 && engineCode=="9") engine = "5.0L Carburetor";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="U") engine = "2.5L Throttle Body Injection";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="R") engine = "2.5L Throttle Body Injection";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="9") engine = "2.8L Multi Port Fuel Injection";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="L") engine = "3.0L Multi Port Fuel Injection";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="7") engine = "3.8L Fuel Injection";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="3") engine = "3.8L Fuel Injection";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="H") engine = "5.0L Carburetor";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="G") engine = "5.0L Carburetor";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="8") engine = "5.7L Fuel Injection";
if(modelYear>=1986 && modelYear<=1988 && engineCode=="6") engine = "5.7L Carburetor";
if(modelYear>=1986 && modelYear<=1989 && engineCode=="W") engine = "2.8L Multi Port Fuel Injection";
if(modelYear>=1986 && modelYear<=1989 && engineCode=="S") engine = "2.8L Multi Port Fuel Injection";
if(modelYear>=1986 && modelYear<=1989 && engineCode=="F") engine = "5.0L Fuel Injection";
if(modelYear>=1986 && modelYear<=1990 && engineCode=="Z") engine = "4.3L Throttle Body Injection";
if(modelYear>=1987 && modelYear<=1988 && engineCode=="1") engine = "2.0L Throttle Body Injection";
if(modelYear>=1987 && modelYear<=1987 && engineCode=="R") engine = "2.8L Throttle Body Injection";
if(modelYear>=1987 && modelYear<=1988 && engineCode=="7") engine = "4.1L Multi Port Fuel Injection";
if(modelYear>=1987 && modelYear<=1990 && engineCode=="M") engine = "2.0L Multi Port Fuel Injection";
if(modelYear>=1987 && modelYear<=1990 && engineCode=="Y") engine = "5.0L Carb";
if(modelYear>=1987 && modelYear<=1991 && engineCode=="K") engine = "2.0L Throttle Body Injection";
if(modelYear>=1988 && modelYear<=1989 && engineCode=="D") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1988 && modelYear<=1989 && engineCode=="T") engine = "3.1L Multi Port Fuel Injection";
if(modelYear>=1988 && modelYear<=1989 && engineCode=="5") engine = "4.5L";
if(modelYear>=1988 && modelYear<=1990 && engineCode=="C") engine = "3.8L";
if(modelYear>=1988 && modelYear<=1993 && engineCode=="E") engine = "5.0L Throttle Body Injection";
if(modelYear>=1989 && modelYear<=1989 && engineCode=="1") engine = "2.0L Throttle Body Injection";
if(modelYear>=1989 && modelYear<=1989 && engineCode=="A") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1989 && modelYear<=1989 && engineCode=="V") engine = "3.1L Multi Port Fuel Injection";
if(modelYear>=1989 && modelYear<=1989 && engineCode=="8") engine = "5.7L";
if(modelYear>=1989 && modelYear<=1990 && engineCode=="7") engine = "5.7L Throttle Body Injection";
if(modelYear>=1989 && modelYear<=1995 && engineCode=="K") engine = "5.7L";
if(modelYear>=1989 && modelYear<=1991 && engineCode=="R") engine = "2.5L Throttle Body Injection";
if(modelYear>=1989 && modelYear<=1991 && engineCode=="N") engine = "3.3L Multi Port Fuel Injection";
if(modelYear>=1990 && modelYear<=1990 && engineCode=="D") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1990 && modelYear<=1990 && engineCode=="A") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1990 && modelYear<=1990 && engineCode=="L") engine = "3.8L";
if(modelYear>=1990 && modelYear<=1990 && engineCode=="3") engine = "4.5L";
if(modelYear>=1990 && modelYear<=1990 && engineCode=="J") engine = "5.7L";
if(modelYear>=1990 && modelYear<=1991 && engineCode=="G") engine = "2.2L Throttle Body Injection";
if(modelYear>=1990 && modelYear<=1991 && engineCode=="V") engine = "3.1L Multi Port Fuel Injection";
if(modelYear>=1990 && modelYear<=1991 && engineCode=="F") engine = "5.0L";
if(modelYear>=1990 && modelYear<=1991 && engineCode=="8") engine = "5.7L";
if(modelYear>=1991 && modelYear<=1991 && engineCode=="D") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1991 && modelYear<=1991 && engineCode=="A") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1991 && modelYear<=1991 && engineCode=="C") engine = "3.8L";
if(modelYear>=1991 && modelYear<=1991 && engineCode=="L") engine = "3.8L";
if(modelYear>=1991 && modelYear<=1991 && engineCode=="B") engine = "4.9L";
if(modelYear>=1991 && modelYear<=1991 && engineCode=="7") engine = "5.7L Throttle Body Injection";
if(modelYear>=1991 && modelYear<=1991 && engineCode=="J") engine = "5.7L";
if(modelYear>=1991 && modelYear<=1992 && engineCode=="9") engine = "1.9L Throttle Body Injection";
if(modelYear>=1991 && modelYear<=1992 && engineCode=="7") engine = "1.9L Single Port Fuel Injection";
if(modelYear>=1991 && modelYear<=1992 && engineCode=="X") engine = "3.4L Multi Port Fuel Injection";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="H") engine = "2.0L Multi Port Fuel Injection";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="4") engine = "2.2L";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="D") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="A") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="3") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="R") engine = "2.5L Throttle Body Injection";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="F") engine = "5.0L";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="7") engine = "5.7L Throttle Body Injection";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="J") engine = "5.7L";
if(modelYear>=1992 && modelYear<=1992 && engineCode=="8") engine = "5.7L";
if(modelYear>=1992 && modelYear<=1993 && engineCode=="N") engine = "3.3L Multi Port Fuel Injection";
if(modelYear>=1992 && modelYear<=1993 && engineCode=="Z") engine = "4.3L Throttle Body Injection";
if(modelYear>=1992 && modelYear<=1993 && engineCode=="B") engine = "4.9L";
if(modelYear>=1992 && modelYear<=1993 && engineCode=="P") engine = "5.7L";
if(modelYear>=1992 && modelYear<=1995 && engineCode=="L") engine = "3.8L";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="H") engine = "2.0L Multi Port Fuel Injection";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="4") engine = "2.2L";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="D") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="A") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="3") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="A") engine = "2.5L";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="T") engine = "3.1L Fuel Injection";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="7") engine = "5.7L Throttle Body Injection";
if(modelYear>=1993 && modelYear<=1993 && engineCode=="J") engine = "5.7L";
if(modelYear>=1993 && modelYear<=1994 && engineCode=="9") engine = "1.9L Throttle Body Injection";
if(modelYear>=1993 && modelYear<=1995 && engineCode=="7") engine = "1.9L";
if(modelYear>=1993 && modelYear<=1995 && engineCode=="X") engine = "3.4L";
if(modelYear>=1993 && modelYear<=1995 && engineCode=="S") engine = "3.4L";
if(modelYear>=1993 && modelYear<=1995 && engineCode=="W") engine = "4.3L";
if(modelYear>=1993 && modelYear<=1995 && engineCode=="Y") engine = "4.6L";
if(modelYear>=1993 && modelYear<=1995 && engineCode=="9") engine = "4.6L";
if(modelYear>=1994 && modelYear<=1994 && engineCode=="H") engine = "2.0L Multi Port Fuel Injection";
if(modelYear>=1994 && modelYear<=1994 && engineCode=="4") engine = "2.2L";
if(modelYear>=1994 && modelYear<=1994 && engineCode=="D") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1994 && modelYear<=1994 && engineCode=="A") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1994 && modelYear<=1994 && engineCode=="3") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1994 && modelYear<=1994 && engineCode=="T") engine = "3.1L Multi Port Fuel Injection";
if(modelYear>=1994 && modelYear<=1994 && engineCode=="P") engine = "5.7L";
if(modelYear>=1994 && modelYear<=1995 && engineCode=="M") engine = "3.1L";
if(modelYear>=1994 && modelYear<=1995 && engineCode=="Z") engine = "4.3L";
if(modelYear>=1994 && modelYear<=1995 && engineCode=="B") engine = "4.9L";
if(modelYear>=1994 && modelYear<=1995 && engineCode=="J") engine = "5.7L";
if(modelYear>=1995 && modelYear<=1995 && engineCode=="8") engine = "1.9L Throttle Body Injection";
if(modelYear>=1995 && modelYear<=1995 && engineCode=="4") engine = "2.2L";
if(modelYear>=1995 && modelYear<=1995 && engineCode=="D") engine = "2.3L Multi Port Fuel Injection";
if(modelYear>=1995 && modelYear<=1995 && engineCode=="P") engine = "5.7L";
if(modelYear>=1996 && modelYear<=1996 && engineCode=="P") engine = "5.7L OBDII";
if(modelYear>=1996 && modelYear<=1996 && engineCode=="5") engine = "5.7L OBDII";  
  		

/*			
			//Chevrolet
			if(makeIndex==0 && modelYear>=1988 && modelYear<=1996)
			{
				if(modelYear>=1992 && modelYear<=1996 && engineCode=='4') engine = "2.2 L4 MFI 133CUI";
				if(modelYear==1996 && engineCode=='5') engine = "5.7 V8 MFI 350CUI";				
				if(modelYear>=1995 && modelYear<=1996 && engineCode=='K') engine = "3.8 V6 MFI 231CUI";
				if(modelYear>=1995 && modelYear<=1996 && engineCode=='M') engine = "3.1 V6 MFI 189CUI";				
				if(modelYear==1994 && engineCode=='M') engine = "3.1 V6 SFI 189CUI";
				if(modelYear>=1990 && modelYear<=1993 && engineCode=='P') engine = "5.7 V8 MFI 350CUI";				
				if(modelYear>=1995 && modelYear<=1996 && engineCode=='P') engine = "5.7 V8 MFI 350CUI";						
				if(modelYear>=1988 && modelYear<=1993  && engineCode=='E') engine = "5.0 V8 TBI 305CUI";							
				if(modelYear>=1995 && modelYear<=1996  && engineCode=='X') engine = "3.4 V6 MFI 207CUI";
				if(modelYear>=1991 && modelYear<=1994  && engineCode=='X') engine = "3.4 V6 SFI 207CUI";
				if(modelYear==1995 && engineCode=='J') engine = "5.7 V8 MFI 350CUI";
				if(modelYear==1994 && engineCode=='J') engine = "5.7 V8 SFI 350CUI";				
				if(modelYear>=1989 && modelYear<=1993  && engineCode=='7') engine = "5.7 V8 TBI 350CUI";
				if(modelYear>=1989 && modelYear<=1993  && engineCode=='8') engine = "5.7 V8 MFI 350CUI";
			}
		
			//Oldsmobile
			if(makeIndex==2 && modelYear>=1987 && modelYear<=1995)
			{
				if(modelYear>=1989 && modelYear<=1993 && engineCode=='T') engine = "3.1 V6 MFI 191CUI";
				if(modelYear==1994 && engineCode=='T') engine = "3.1 V6 SFI 191CUI";				
				if(modelYear>=1991 && modelYear<=1992 && engineCode=='E') engine = "5.0 V8 TBI 305CUI";				
			}				
			
			//Pontiac
			if(makeIndex==1 && modelYear>=1987 && modelYear<=1996)
			{					
				if(modelYear>=1988 && modelYear<=1993 && engineCode=='E') engine = "5.0 V8 TBI 305CUI";					
			
			}
			
			//Buick
			if(makeIndex==1 && modelYear>=1987 && modelYear<=1996)
			{					
				if(modelYear==1991 && engineCode=='E') engine = "5.0 V8 TBI 305CUI";					
			}		
*/      
      	
			
			
			vinTable += '<TR><TD>8</TD><TD>Engine</TD><TD>' + vin.charAt(7) + '</TD><TD>' + engine + '</TD></TR>\n';
			nationIndex = "123JK".indexOf(vin.charAt(0));
			if (vin.charAt(0)==4) nationIndex=0;  // 4=U.S. same as 1
			if (vin.charAt(2)==8) nationIndex=5;  // 8=Saturn
			for (i=0; i<plantArray[nationIndex].length; ++i) {
				if (plantCode==plantArray[nationIndex][i].code) {
					plant = plantArray[nationIndex][i].name;
					break;
				}
			}
		} else {
			vinTable += '4<BR>5<BR>6<BR>7<BR>8</TD><TD>?<BR>';
			if (modelYearIndex<0)
				vinTable += 'invalid<BR>model year<BR>code';
			else
				vinTable += 'not a GM<BR>passenger<BR>car';
			vinTable += '</TD><TD>' + vin.charAt(3) + '<BR>' + vin.charAt(4) + '<BR>' + vin.charAt(5) + '<BR>' + vin.charAt(6) + '<BR>' + vin.charAt(7) + '<BR>' + '</TD><TD>&nbsp;</TD></TR>\n';
		}

		vinTable += '<TR><TD>9</TD><TD>Check digit</TD><TD>' + vin.charAt(8) + '</TD><TD>' + checkDigitTableText + '</TD></TR>\n';
		vinTable += '<TR><TD>10</TD><TD>Model year</TD><TD>' + vin.charAt(9) + '</TD><TD>' + modelYear + '</TD></TR>\n';
		vinTable += '<TR><TD>11</TD><TD>Plant</TD><TD>' + vin.charAt(10) + '</TD><TD>' + plant + '</TD></TR>\n';
		sequenceNumber = vin.substring(11,17);
		vinTable += '<TR><TD>12<BR>13<BR>14<BR>15<BR>16<BR>17</TD><TD>Manufacturing<BR>plant<BR>production<BR>sequence<BR>number</TD><TD VALIGN="TOP">' + vin.charAt(11) + '<BR>' + vin.charAt(12) + '<BR>' + vin.charAt(13) + '<BR>' + vin.charAt(14) + '<BR>' + vin.charAt(15) + '<BR>' + vin.charAt(16) + '<BR>' + '</TD><TD>' + sequenceNumber + '&nbsp;</TD></TR>\n';
		vinTable += '</TABLE>';
		
		if(GetRandom(0,1)==1)
		{
			buch="haynes";
		}else{
			buch="chilton";
		}		
		
		if(make=="GM of Canada")
		{
			make="General Motors";
		}
		
		if(make=="less than 500 vehicles per year")
		{
			make="General Motors";
		}		
		
		vinTable += '<p><span class=\"imp\">Werbung:</span><br>';
		vinTable += '<iframe src="http://rcm-de.amazon.de/e/cm?t=ucf-21&o=3&p=48&l=st1&mode=books-de-intl-us&search='+make+'%20'+buch+'&fc1=000000&lt1=&lc1=3366FF&bg1=FFFFFF&f=ifr" marginwidth="0" marginheight="0" width="728" height="90" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';
		vinTable += '</p>'		

		if (carline.substring(0,5)=="Fiero") {
			FieroError = "";
			FieroCarline = carline;
			if (modelYear==1984 && carlineCode=="PF")
				FieroCarline = "Fiero SE or Indy";
			if (modelYear==1988 && carlineCode=="PE" && engineCode=="9")
				FieroCarline = "Fiero Formula";
			if (GMcarVin3!="1G2")
				FieroError += 'First 3 characters <B>' + GMcarVin3 + '</B> in VIN do not match expected characters <B>1G2</B>.<BR>\n';
			FieroBodyType = (modelYear>=1986 && carlineCode=="PG" ? "97" : "37");
			FieroBody = null;
			if (modelYear<=1986) {
				if (bodyTypeCode!=FieroBodyType.substring(0,2)) {
					FieroError += 'Body type <B>' + bodyTypeCode + '</B> in VIN does not match expected code <B>' + FieroBodyType + '</B>.<BR>\n';
					FieroBody = '?';
				}
			} else {
				if (bodyTypeCode!='1') {
					FieroError += 'Body style code <B>' + bodyTypeCode + '</B>) in VIN does not match expected code <B>1</B>.<BR>\n';
					FieroBody = '?';
				}
			}
			if ( !FieroBody )
				FieroBody = (FieroBodyType=="37" ? "notchback" : "fastback") + " (GM body type " + FieroBodyType + ")";
			FieroEngineCode = null;
			FieroEngine = '?';
			if (carlineCode=="PG") {
				if (engineCode!='9') FieroEngineCode = '9';
			} else if (modelYear==1984 || (modelYear<=1987 && carlineCode!="PF")) {
				if (engineCode!='R') FieroEngineCode = 'R';
			} else {
				if (engineCode!='9' && engineCode!='R') FieroEngineCode = 'R or 9';
			}
			if (FieroEngineCode) {
				FieroError += 'Engine code <B>' + engineCode + '</B> in VIN does not match expected code <B>' + FieroEngineCode + '</B>.<BR>\n';
			} else {
				FieroEngine = (engineCode=='R' ? "2.5-liter 4-cylinder" : "2.8-liter V6");
			}
			if (modelYear==1984 || modelYear>=1987) {
				FieroRestraintCode = (modelYear==1984 ? 'A' : '1');
				if (restraintCode!=FieroRestraintCode)
					FieroError += 'Restraint code <B>' + restraintCode + '</B> in VIN does not match expected code <B>' + FieroRestraintCode + '</B>.<BR>\n';
			}
			if (plantCode!='P')
				FieroError += 'Plant code <B>' + plantCode + '</B> in VIN does not match expected code <B>P</B>.<BR>\n';
			sequenceNumberError = false;
			for (i=0; i<sequenceNumber.length; ++i) {
				if ("0123456789".indexOf(sequenceNumber.charAt(i))<0) {
					FieroError += 'Manufacturing plant production sequence number <B>' + sequenceNumber + '</B> in VIN is not numeric.<BR>\n';
					sequenceNumberError = true;
				}
			}
			FieroSequenceMax = FieroSequenceMaxArray[modelYear-1984];
			if (sequenceNumber.length!=6)
				sequenceNumberError = true;
			if (!sequenceNumberError) {
				FieroSequenceNumber = eval(sequenceNumber);
				if (FieroSequenceNumber<200001) {
					FieroError += 'Sequence number <B>' + sequenceNumber + '</B> in VIN expected to be <B>200001</B> or greater.<BR>\n';
					sequenceNumberError = true;
				} else if (FieroSequenceNumber>FieroSequenceMax) {
					FieroError += 'Sequence number <B>' + sequenceNumber + '</B> in VIN expected to be <B>' + FieroSequenceMax + ' or less</B>.<BR>\n';
					sequenceNumberError = true;
				}
			}
			if (sequenceNumberError==true)
				FieroSequenceNumber = '?';
			else
				FieroSequenceNumber -= 200000;

					
			vinOutput += '<table cellspacing="0" class="forum_content"><tr><td class="top">'+modelYear + ' ' + make + ' ' + FieroCarline + '<BR><BR>\n';
			vinOutput += 'Engine: ' + FieroEngine + '<BR>\n';
			vinOutput += 'Body: ' + FieroBody + '<BR>\n';
			vinOutput += 'Number ' + FieroSequenceNumber + ' of ' + (modelYear==1988 ? '26401 or 2' : FieroSequenceMax-200000) + ' built in ' + modelYear + '</td></tr></table>';
			if (FieroError!="")
				vinOutput += '<span class="imp">Fiero VIN errors:<BR>\n' + FieroError + "</span><BR>\n";
		}

		vinOutput += vinTable;
	}
	return vinOutput;
}



function writeDecodedVin (vin,vinLabel) {
	vinText = "<div class=\"helpline\">"+decodeVin(vin,vinLabel)+"</div>";
	document.getElementById("decodeDiv").innerHTML = vinText;
	focusvin();
}



function randomFieroVin() {
	randomYear = Math.floor(Math.random()*5);
	randomModel = randomModelArray[randomYear][Math.floor(Math.random()*randomModelArray[randomYear].length)];
	randomEngine = 'R';
	if (randomModel=='X' || randomModel=='G' || (randomModel=='F' && randomYear>=1 && Math.random()<0.5))
		randomEngine = '9';
	if (randomModel=='X') randomModel = 'E';
	randomVin = "1G2" + (randomYear==0 ? 'A':'P') + randomModel + (randomYear<=2 ? (randomModel=='G' && randomYear==2 ? '97':'37'):'11') + randomEngine + '0' + "EFGHJ".charAt(randomYear) + 'P200001';
	randomVin = randomVin.substring(0,8) + checkDigitCalc(randomVin) + randomVin.substring(9,17);
	writeDecodedVin(randomVin,'Random example Fiero ');
}

function GetRandom( min, max ) {
        if( min > max ) {
                return( -1 );
        }
        if( min == max ) {
                return( min );
        }
 
        return( min + parseInt( Math.random() * ( max-min+1 ) ) );
} 
