var w1, selected_text1, w2, selected_text2;
var moduleNameArray = ["Hello World", "ACM-1", "ACM-2", "ACM-3", "ACM-4", "ACM-5", "ACM-6", "ACM-7", "ACM-B1", "ACM-B2", "ACM-B3", "ACM-B4", "ACM-B5", "ACM-B6", "ACM-B7", "ACM-B8", "ACM-B9", "ACM-BA", "ACM-BB", "ACM-BC", "ACM-BD", "ACM-BE", "ACM-BF", "ACM-BG", "ACM-BH", "ACM-C11", "ACM-C12", "ACM-C13", "ACM-C14", "ACM-C15", "ACM-C16", "ACM-C17", "ACM-C18", "ACM-C19", "ACM-C20", "ACM-C21", "ACM-C22", "ACM-C23", "ACM-C24", "ACM-C25", "ACM-C26", "ACM-C27", "ACM-C28", "ACM-C29", "K", "N", "P", "Q", "R", "T", "W", "X1", "X2", "X3", "X4", "X5", "X6", "X7", "X8", "Y11", "Y22", "Y33", "Y44", "Y55", "Y66"];

var moduleNumberArray = ["Hello World", "1", "2", "3", "4", "5", "6", "7", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH", "C11", "C12", "C13", "C14", "C15", "C16", "C17", "C18", "C19", "C20", "C21", "C22", "C23", "C24", "C25", "C26", "C27", "C28", "C29", "K", "N", "P", "Q", "R", "T", "W", "X1", "X2", "X3", "X4", "X5", "X6", "X7", "X8", "Y11", "Y22", "Y33", "Y44", "Y55", "Y66"];

var jpgHeightArray = ["Hello World", "200", "200", "200", "200", "200", "200", "200", "400", "400", "400", "400", "400", "400", "400", "400", "400", "400", "400", "400", "400", "400", "400", "400", "400", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "600", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];

var gifHeightArray = ["Hello World", "41", "41", "41", "41", "41", "41", "41", "82", "82", "82", "82", "82", "82", "82", "82", "82", "82", "82", "82", "82", "82", "82", "82", "82", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "124", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];

var moduleDescriptionArray = ["Hello World", '5" Blank', "Duplex (1) 15A (NEMA 5-15R)", "Singal recpt. (2) 15A (NEMA 5-15R)", "Duplex (1) 20A (NEMA 5-20R)", "Duplex (1) 20A Isolated Ground (NEMA 5-20R)", "Twistlock (1) 30A (NEMA L5-30R)", "Twistlock (1) 30A Isolated Ground (NEMA L5-30R)", '10" Blank', "Duplex (3) 15A (NEMA 5-15R)", "Singal recpt. (4) 15A (NEMA 5-15R)", "Duplex (2) 20A (NEMA 5-20R)", "Duplex (2) 20A Isolated Ground (NEMA 5-20R)", "Twistlock (1) 30A (NEMA L5-30R)", "Twistlock (1) 30A Isolated Ground (NEMA L5-30R)", "Duplex (1) 20A (NEMA 5-20R) with remote control", "Duplex (1) 20A Isolated Ground (NEMA 5-20R) with remote control", "Twistlock (1) 30A (NEMA L5-30R) with remote control", "Twistlock (1) 30A Isolated Ground (NEMA L5-30R) with remote control", "Duplex (1) 20A (NEMA 5-20R) with surge suppressor", "Duplex (1) 20A Isolated Ground (NEMA 5-20R) with surge suppressor", "Duplex (2) 20A (NEMA 5-20R) 2 circuits, 1 duplex each", "Duplex (2) 20A Isolated Ground (NEMA 5-20R) 2 circuits, 1 duplex each", "Twistlock (2) 30A (NEMA L5-30R) 2 circuits, 1 receptacle each", "Twistlock (2) 30A Isolated Ground (NEMA L5-30R) 2 circuits, 1 receptacle each", '15" Blank', "Duplex (4) 15A (NEMA 5-15R)", "Singal recpt. (6) 15A (NEMA 5-15R)", "Duplex (3) 20A (NEMA 5-20R)", "Duplex (3) 20A Isolated Ground (NEMA 5-20R)", "Twistlock (1) 30A (NEMA L5-30R)", "Twistlock (1) 30A Isolated Ground (NEMA L5-30R)", "Duplex (2) 20A (NEMA 5-20R) with remote control", "Duplex (2) 20A Isolated Ground (NEMA 5-20R) with remote control", "Twistlock (1) 30A (NEMA L5-30R) with remote control", "Twistlock (1) 30A Isolated Ground (NEMA L5-30R) with remote control", "Duplex (2) 20A (NEMA 5-20R) with surge suppressor", "Duplex (2) 20A Isolated Ground (NEMA 5-20R) with surge suppressor", "Duplex (1) 20A (NEMA 5-20R) with surge suppressor and remote control", "Duplex (1) 20A Isolated Ground (NEMA 5-20R) with surge suppressor and remote control", "Duplex (3) 20A (NEMA 5-20R) 3 circuits, 1 duplex each", "Duplex (3) 20A Isolated Ground (NEMA 5-20R) 3 circuits, 1 duplex each", "Twistlock (3) 30A (NEMA L5-30R) 3 circuits, 1 receptacle each", "Twistlock (3) 30A Isolated Ground (NEMA L5-30R) 3 circuits, 1 receptacle each", "Exterior JB1 plus 75-inch Chassis Combination", "Exterior JB2 plus 75-inch Chassis Combination", "Exterior JB3 plus 75-inch Chassis Combination", "Exterior JB4 plus 75-inch Chassis Combination", "Exterior JB5 plus 75-inch Chassis Combination", "Internal JB1 plus 75-inch Chassis Combination", "Internal JB2 plus 75-inch Chassis Combination", "Exterior JB1 plus 60-inch Chassis Combination", "Exterior JB2 plus 60-inch Chassis Combination", "Exterior JB3 plus 60-inch Chassis Combination", "Exterior JB4 plus 60-inch Chassis Combination", "Internal JB1 plus 60-inch Chassis Combination", "Internal JB2 plus 60-inch Chassis Combination", "Internal JB3 plus 60-inch Chassis Combination", "Internal JB4 plus 60-inch Chassis Combination", "Exterior JB1 plus 30-inch Chassis Combination", "Exterior JB2 plus 30-inch Chassis Combination", "Exterior JB3 plus 30-inch Chassis Combination", "Internal JB1 plus 30-inch Chassis Combination", "Internal JB2 plus 30-inch Chassis Combination", "Internal JB3 plus 30-inch Chassis Combination"];

var gifNameArray = ["Hello World", "img/Module-1.gif", "img/Module-2.gif", "img/Module-3.gif", "img/Module-4.gif", "img/Module-5.gif", "img/Module-6.gif", "img/Module-7.gif", "img/Module-B1.gif", "img/Module-B2.gif", "img/Module-B3.gif", "img/Module-B4.gif", "img/Module-B5.gif", "img/Module-B6.gif", "img/Module-B7.gif", "img/Module-B8.gif", "img/Module-B9.gif", "img/Module-BA.gif", "img/Module-BB.gif", "img/Module-BC.gif", "img/Module-BD.gif", "img/Module-BE.gif", "img/Module-BF.gif", "img/Module-BG.gif", "img/Module-BH.gif", "img/Module-C11.gif", "img/Module-C12.gif", "img/Module-C13.gif", "img/Module-C14.gif", "img/Module-C15.gif", "img/Module-C16.gif", "img/Module-C17.gif", "img/Module-C18.gif", "img/Module-C19.gif", "img/Module-C20.gif", "img/Module-C21.gif", "img/Module-C22.gif", "img/Module-C23.gif", "img/Module-C24.gif", "img/Module-C25.gif", "img/Module-C26.gif", "img/Module-C27.gif", "img/Module-C28.gif", "img/Module-C29.gif", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];

var jpgNameArray = ["Hello World", "img/ACM-1.jpg", "img/ACM-2.jpg", "img/ACM-3.jpg", "img/ACM-4.jpg", "img/ACM-5.jpg", "img/ACM-6.jpg", "img/ACM-7.jpg", "img/ACM-B1.jpg", "img/ACM-B2.jpg", "img/ACM-B3.jpg", "img/ACM-B4.jpg", "img/ACM-B5.jpg", "img/ACM-B6.jpg", "img/ACM-B7.jpg", "img/ACM-B8.jpg", "img/ACM-B9.jpg", "img/ACM-BA.jpg", "img/ACM-BB.jpg", "img/ACM-BC.jpg", "img/ACM-BD.jpg", "img/ACM-BE.jpg", "img/ACM-BF.jpg", "img/ACM-BG.jpg", "img/ACM-BH.jpg", "img/ACM-C11.jpg", "img/ACM-C12.jpg", "img/ACM-C13.jpg", "img/ACM-C14.jpg", "img/ACM-C15.jpg", "img/ACM-C16.jpg", "img/ACM-C17.jpg", "img/ACM-C18.jpg", "img/ACM-C19.jpg", "img/ACM-C20.jpg", "img/ACM-C21.jpg", "img/ACM-C22.jpg", "img/ACM-C23.jpg", "img/ACM-C24.jpg", "img/ACM-C25.jpg", "img/ACM-C26.jpg", "img/ACM-C27.jpg", "img/ACM-C28.jpg", "img/ACM-C29.jpg", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];

var numCircuitsArray = ["all",0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];

var moduleAMPsArray = ["all", "Blank","15 Amp","15 Amp","20 Amp","20 Amp","30 Amp","30 Amp","Blank", "15 Amp","15 Amp","20 Amp","20 Amp","30 Amp","30 Amp","20 Amp","20 Amp","30 Amp","30 Amp","20 Amp","20 Amp","20 Amp","20 Amp","30 Amp","30 Amp","Blank","15 Amp","15 Amp","20 Amp","20 Amp","30 Amp","30 Amp","20 Amp","20 Amp","30 Amp","30 Amp","20 Amp","20 Amp","20 Amp","20 Amp","20 Amp","20 Amp","30 Amp","30 Amp", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];

var moduleLengthArray = ["all", "5 inch", "5 inch","5 inch","5 inch","5 inch","5 inch","5 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "10 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "15 inch", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]

var lPriceArray = ["hello world", "$31.56", "$62.08", "$65.94", "$77.32", "$71.99", "$78.18", "$119.68", "$32.30", "$73.88", "$79.63", "$113.17", "$108.19", "$88.77", "$130.01", "$160.97", "$159.60", "$161.28", "$202.86", "$365.65", "$360.42", "$134.93", "$133.60", "$135.39", "$221.68", "$33.24", "$86.94", "$96.14", "$146.08", "$136.96", "$98.43", "$139.67", "$189.13", "$185.07", "$156.14", "$197.32", "$396.67", "$392.34", "$451.58", "$464.29", "$185.62", "$183.44", "$182.53", "$311.46", "$270.80", "$290.47", "$296.37", "$306.33", "$306.68", "$156.70", "$175.75", "$243.08", "$262.75", "$268.65", "$276.59", "$152.92", "$171.97", "$175.56", "$185.54", "$213.74", "$233.42", "$239.32", "$142.86", "$161.95", "$165.50"];

var toolTipList = [];
var selectedModName = [];
var selectedModNum = [];
var selectedModImgSrc = [];
var selectedModImgWidth = [];
var selectedModDesc = [];

var dataSet = {};
//var dataQuery = {}
var qs = 1;
var imgNumber = 1;
//var a = 1;

function DataSet(modelNums, modNam, description, thumbImg, gifHeight, image, imgWidth, circNum, modSize, modAMP, lPrice)
{
	this.modelNumber = modelNums;
	this.moduleNameArray = modNam;
	this.moduleDescription = description;
	this.thumbImgLoc = thumbImg;
	this.thumbImageWidth = gifHeight;
	this.jpgImg = image;
	this.jpgImgWidth = imgWidth;
	this.numberCircuits = circNum;
	this.moduleSize = modSize;
	this.moduleAMP = modAMP;
	this.listPrice = lPrice;
}

function QuerySet(modelNums, modNam, description, thumbImg, gifHeight, image, imgWidth, circNum, modSize, modAMP, lPrice)
{
	this.modelNumber = modelNums;
	this.moduleNameArray = modNam;
	this.moduleDescription = description;
	this.thumbImgLoc = thumbImg;
	this.thumbImageWidth = gifHeight;
	this.jpgImg = image;
	this.jpgImgWidth = imgWidth;
	this.numberCircuits = circNum;
	this.moduleSize = modSize;
	this.moduleAMP = modAMP;
	this.listPrice = lPrice;
}

var ds = 1;
while (ds < 44)
{
	dataSet[ds] = new DataSet(moduleNumberArray[ds], moduleNameArray[ds], moduleDescriptionArray[ds], gifNameArray[ds], gifHeightArray[ds], jpgNameArray[ds], jpgHeightArray[ds], numCircuitsArray[ds], moduleLengthArray[ds], moduleAMPsArray[ds], lPriceArray[ds]);
	ds = ds+1;
}

function loadQuerySet(q,r)
{
	
	selectedModName[q] = dataSet[r].moduleNameArray;
	selectedModNum[q] = dataSet[r].modelNumber;
	selectedModImgSrc[q] = dataSet[r].jpgImg;
	selectedModImgWidth[q] = dataSet[r].jpgImgWidth;
	selectedModDesc[q] = dataSet[r].moduleDescription;
}

function loadTrue(s,t)
{
	//alert(s + ", " + t)
	var imgNum = "image"+t;
	//alert(imgNum)
	toolTipList[t] = dataSet[s].moduleNameArray + ", " + dataSet[s].moduleDescription;
	//alert(toolTipList[t])
	loadQuerySet(t,s)
	document.getElementById(imgNum).src = dataSet[s].thumbImgLoc;
	document.getElementById(imgNum).width = 45;//20
	//document.getElementById(imgNum).height = dataSet[s].thumbImageWidth;
}

function loadFalse(u)
{
	//alert(u)
	var imgNum = "image"+u;				
	document.getElementById(imgNum).src = "images/Module-0.gif";
	document.getElementById(imgNum).width = 0;
	//document.getElementById(imgNum).height = 0;
}

function sortImages()
{
	w1 = document.List1.Module_Size.selectedIndex;
	selected_text1 = document.List1.Module_Size.options[w1].text;
	w2 = document.List2.Module_Amp.selectedIndex;
	selected_text2 = document.List2.Module_Amp.options[w2].text;
	w3 = document.Circuit1.Circuit_Num.selectedIndex;
	selected_text3 = document.Circuit1.Circuit_Num.options[w3].text;
	var qs = 1;

	if (selected_text1 != "All" & selected_text2 != "All" & selected_text3 != "All")//000
	{
		var qs = 1;
		var imgNumber = 1;
		var imgBlank = 43;
		while(qs < 44)
		{
			if (dataSet[qs].moduleSize == selected_text1 & dataSet[qs].moduleAMP == selected_text2 & dataSet[qs].numberCircuits == selected_text3)
			{
				loadTrue(qs,imgNumber)
				imgNumber = imgNumber + 1;
			}
			else{
				loadFalse(imgBlank)
				imgBlank = imgBlank - 1;
			}
			qs = qs +1;
		}		
	}
	
	if (selected_text1 == "All" & selected_text2 != "All" & selected_text3 != "All")//100
	{
		var qs = 1;
		var imgNumber = 1;
		var imgBlank = 43;
		while(qs < 44)
		{
			if (dataSet[qs].moduleAMP == selected_text2 & dataSet[qs].numberCircuits == selected_text3)
			{
				loadTrue(qs,imgNumber)
				imgNumber = imgNumber + 1;
			}
			else{
				loadFalse(imgBlank)
				imgBlank = imgBlank - 1;
			}
			qs = qs +1;
		}
	}
		
	if (selected_text1 == "All" & selected_text2 == "All" & selected_text3 != "All")//110
	{
		var qs = 1;
		var imgNumber = 1;
		var imgBlank = 43;
		while(qs < 44)
		{
			if (dataSet[qs].numberCircuits == selected_text3)
			{
				loadTrue(qs,imgNumber)
				imgNumber = imgNumber + 1;
			}
			else{
				loadFalse(imgBlank)
				imgBlank = imgBlank - 1;
			}
			qs = qs +1;
		}
	}
	
	if (selected_text1 != "All" & selected_text2 == "All" & selected_text3 == "All")//011
	{
		var qs = 1;
		var imgNumber = 1;
		var imgBlank = 43;
		while(qs < 44)
		{
			if (dataSet[qs].moduleSize == selected_text1)
			{
				loadTrue(qs,imgNumber)
				imgNumber = imgNumber + 1;
			}
			else{
				loadFalse(imgBlank)
				imgBlank = imgBlank - 1;
			}
			qs = qs +1;
		}		
	}
	
	if (selected_text1 != "All" & selected_text2 != "All" & selected_text3 == "All")//001
	{
		var qs = 1;
		var imgNumber = 1;
		var imgBlank = 43;
		while(qs < 44)
		{
			if (dataSet[qs].moduleSize == selected_text1 & dataSet[qs].moduleAMP == selected_text2)
			{
				loadTrue(qs,imgNumber)
				imgNumber = imgNumber + 1;
			}
			else{
				loadFalse(imgBlank)
				imgBlank = imgBlank - 1;
			}
			qs = qs +1;
		}		
	}
	
	if (selected_text1 == "All" & selected_text2 != "All" & selected_text3 == "All")//101
	{
		var qs = 1;
		var imgNumber = 1;
		var imgBlank = 43;
		while(qs < 44)
		{
			if (dataSet[qs].moduleAMP == selected_text2)
			{
				loadTrue(qs,imgNumber)
				imgNumber = imgNumber + 1;
			}
			else{
				loadFalse(imgBlank)
				imgBlank = imgBlank - 1;
			}
			qs = qs +1;
		}		
	}
	
	if (selected_text1 != "All" & selected_text2 == "All" & selected_text3 != "All")//010
	{
		var qs = 1;
		var imgNumber = 1;
		var imgBlank = 43;
		while(qs < 44)
		{
			if (dataSet[qs].moduleSize == selected_text1 & dataSet[qs].numberCircuits == selected_text3)
			{
				loadTrue(qs,imgNumber)
				imgNumber = imgNumber + 1;
			}
			else{
				loadFalse(imgBlank)
				imgBlank = imgBlank - 1;
			}
			qs = qs +1;
		}		
	}
	
	if (selected_text1 == "All" & selected_text2 == "All" & selected_text3 == "All")//111
	{
		//alert("all 3 are all")
		var qs = 1;
		var imgNumber = 1;
		var imgBlank = 43;
		while(qs < 44)
		{
			if (qs < 45)
			{
				loadTrue(qs,imgNumber)
				imgNumber = imgNumber + 1;
			}
			qs = qs +1;
		}		
	}
}

function disp_text()
   {
   w1 = document.List1.Module_Size.selectedIndex;
   selected_text1 = document.List1.Module_Size.options[w1].text;
   w2 = document.List2.Module_Amp.selectedIndex;
   selected_text2 = document.List2.Module_Amp.options[w2].text;
   get_text();
   }

function imgClick(y)
	{
		sortImages()
		//alert("y = " + y + ", Desc = " + selectedModImgSrc[y]);
		//document.getElementById("imageDesc").src = selectedModImgSrc[y];
		//document.getElementById("imageDesc").height = "180";
		document.getElementById("desigNum").innerHTML = selectedModNum[y];
		document.getElementById("model").innerHTML = selectedModName[y];
		document.getElementById("desc").innerHTML = selectedModDesc[y];
		addModule = "AddModule=" + selectedModNum[y]
	}