
function fillloads(){ 
 // this function is used to fill the loads list on load first is value, second is text 
addOption(document.drop_list_powload.loads, "Floor", "Floor Racks", "");
addOption(document.drop_list_powload.loads, "Seismic-certified", "Seismic-Certified RacksTM", "");
addOption(document.drop_list_powload.loads, "Vari-Rack", "Vari-Rack", "");
addOption(document.drop_list_powload.loads, "Portable", "Portable Racks", "");
addOption(document.drop_list_powload.loads, "Wall-Mount", "Wall-Mount Racks & Shelves", "");
addOption(document.drop_list_powload.loads, "Pull", "Pull & Turn Racks", "");
addOption(document.drop_list_powload.loads, "Credenza", "Credenza Racks", "");
addOption(document.drop_list_powload.loads, "Laminated", "Laminated Racks", "");
}

function SelectSubCat_powload(){
// ON selection of loads this function will work

removeAllOptions(document.drop_list_powload.SubCat_powload);
removeAllOptions(document.drop_list_powload.Tier3_powload);
addOption(document.drop_list_powload.SubCat_powload, "", "Make a Selection", "");

if(document.drop_list_powload.loads.value == 'singlephase'){
addOption(document.drop_list_powload.SubCat_powload,"phase100", "100A");
addOption(document.drop_list_powload.SubCat_powload,"phase200", "200A");
}
if(document.drop_list_powload.loads.value == 'threephase'){
addOption(document.drop_list_powload.SubCat_powload,"phase125", "125A");
addOption(document.drop_list_powload.SubCat_powload,"phase225", "225A");
}
if(document.drop_list_powload.loads.value == 'controlunit'){
addOption(document.drop_list_powload.SubCat_powload,"", "No further options");
}
if(document.drop_list_powload.loads.value == 'stabmount'){
addOption(document.drop_list_powload.SubCat_powload,"cbstandard", "Standard");
addOption(document.drop_list_powload.SubCat_powload,"cbcontrol", "Controlled");
}
}
////////////////// 
function SelectTier3_powload(){
removeAllOptions(document.drop_list_powload.Tier3_powload);
addOption(document.drop_list_powload.Tier3_powload, "", "Make a Selection", "");

if(document.drop_list_powload.SubCat_powload.value == 'phase100'){
addOption(document.drop_list_powload.Tier3_powload,"", "No further options");
}
if(document.drop_list_powload.SubCat_powload.value == 'phase200'){
addOption(document.drop_list_powload.Tier3_powload,"", "No further options");
}
if(document.drop_list_powload.SubCat_powload.value == 'phase125'){
addOption(document.drop_list_powload.Tier3_powload,"", "No further options");
}
if(document.drop_list_powload.SubCat_powload.value == 'phase225'){
addOption(document.drop_list_powload.Tier3_powload,"", "No further options");
}
if(document.drop_list_powload.SubCat_powload.value == 'cbstandard'){
addOption(document.drop_list_powload.Tier3_powload,"Twentya21", "20A");
}
if(document.drop_list_powload.SubCat_powload.value == 'cbcontrol'){
addOption(document.drop_list_powload.Tier3_powload,"Twentya22", "20A");
addOption(document.drop_list_powload.Tier3_powload,"Twentyapole22", "20A 2-pole");
addOption(document.drop_list_powload.Tier3_powload,"Thirtya22", "30A");
addOption(document.drop_list_powload.Tier3_powload,"Thirtyapole22", "30A 2-pole");
}
}
/////////////////


/////////////////
function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}


function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;

	selectbox.options.add(optn);
}
