
function create_array() {

//manufacturers array
	mans = new Array("<a href=\"http://www.americh.com\" target=\"_blank\" class=\"navlink\">Americh</a>","<a href=\"http://www.aquaticwhirlpools.com\" target=\"_blank\" class=\"navlink\">Aquatic </a>","<a href=\"http://www.bainultra.com\" target=\"_blank\" class=\"navlink\">Bain Ultra (Ultra Bath)</a>","<a href=\"http://www.barclayproducts.com\" target=\"_blank\" class=\"navlink\">Barclay Products</a>","<a href=\"http://www.cheviotproducts.com\" target=\"_blank\" class=\"navlink\">Cheviot</a>","<a href=\"http://www.clearwatercollection.com\" target=\"_blank\" class=\"navlink\">Clearwater Collection</a>","<a href=\"http://www.duravit.us\" target=\"_blank\" class=\"navlink\">Duravit</a>","<a href=\"http://www.hansgrohe-usa.com\" target=\"_blank\" class=\"navlink\">Hansgrohe</a>","<a href=\"http://www.herbeau.com\" target=\"_blank\" class=\"navlink\">Herbeau</a>","<a href=\"http://www.hoesch.de\" target=\"_blank\" class=\"navlink\">Hoesh Bath Products</a>","<a href=\"http://www.hydrosystem.com\" target=\"_blank\" class=\"navlink\">Hydrosystem</a>","<a href=\"http://www.internationalbath.com\" target=\"_blank\" class=\"navlink\">International Bath</a>","<a href=\"http://www.jacuzzi.com\" target=\"_blank\" class=\"navlink\">Jacuzzi</a>","<a href=\"http://www.jasoninternational.com\" target=\"_blank\" class=\"navlink\">Jason International</a>","<a href=\"http://www.lefroybrooks.com\" target=\"_blank\" class=\"navlink\">Lefroy Brooks</a>","<a href=\"http://www.maax.com\" target=\"_blank\" class=\"navlink\">Maax</a>","<a href=\"http://www.nativetrails.net\" target=\"_blank\" class=\"navlink\">Native Trails</a>","<a href=\"http://www.neo-metro.com\" target=\"_blank\" class=\"navlink\">Neo Metro</a>","<a href=\"http://www.neptuneb.com\" target=\"_blank\" class=\"navlink\">Neptune</a>","<a href=\"http://www.ocbc.net\" target=\"_blank\" class=\"navlink\">Oregon Copper Bowl</a>","<a href=\"http://www.porcher-us.com\" target=\"_blank\" class=\"navlink\">Porcher</a>","<a href=\"http://www.stoneforest.com\" target=\"_blank\" class=\"navlink\">Stone Forest</a>","<a href=\"http://www.stromplumbing.com\" target=\"_blank\" class=\"navlink\">Strom Plumbing (Sign of the Crab)</a>","<a href=\"http://www.stthomascreations.com\" target=\"_blank\" class=\"navlink\">St. Thomas Creations</a>","<a href=\"http://www.thgusa.com\" target=\"_blank\" class=\"navlink\">THG USA Bath Products</a>","<a href=\"http://www.thompsontraders.com\" target=\"_blank\" class=\"navlink\">Thompson Traders</a>","<a href=\"http://www.totousa.com\" target=\"_blank\" class=\"navlink\">Toto</a>","<a href=\"http://www.ultrabaths.com\" target=\"_blank\" class=\"navlink\">Ultra Bath (Bain Ultra)</a>","<a href=\"http://www.beobridge.co.uk\" target=\"_blank\" class=\"navlink\">Victoria & Albert</a>","<a href=\"http://www.vitabathandspa.com\" target=\"_blank\" class=\"navlink\">Vita Bath and Vita Spa</a>","<a href=\"http://www.zumacollection.com\" target=\"_blank\" class=\"navlink\">Zuma</a>");

//array 1
	soaker = new Array("1","1","1","1","1","1","0","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","0","1","0");

//array 2
	air = new Array("1","1","1","0","0","1","0","0","0","0","1","1","1","1","0","1","0","0","1","0","1","0","0","0","0","0","1","1","0","1","1","0");

//array 3
	freestanding = new Array("1","1","1","1","1","1","1","1","1","1","1","0","0","1","1","0","1","1","1","0","1","0","1","1","1","1","0","1","1","0","1","0");

//array 4
	whirlpools = new Array("1","1","0","0","0","0","0","0","0","1","1","1","1","1","0","1","0","0","1","0","1","0","0","0","0","0","0","0","0","1","1","0");

//array 5
	acrylic = new Array("1","1","1","1","0","1","1","1","1","1","1","1","1","1","0","1","0","0","1","0","1","0","1","1","1","0","1","1","1","1","1","0");

//array 6
	stone = new Array("0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","0","0","0","0","0","0","0");

//array 7
	iron = new Array("0","0","0","1","1","0","0","0","1","0","0","0","0","0","1","0","0","0","0","0","1","0","1","0","0","0","1","0","0","0","0","0");

//array 8
	steel = new Array("0","1","0","0","0","0","0","0","1","0","0","0","0","0","0","0","1","1","0","1","0","0","0","0","0","1","0","0","0","0","0","0");

}

function sort_array() {
	
//Checks the value of the checkbox to see if it is checked.
	if (document.getElementById("Soaker").checked) {

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(soaker[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				soaker.splice(i-abcd, 1);
				air.splice(i-abcd, 1);
				freestanding.splice(i-abcd, 1);
				whirlpools.splice(i-abcd, 1);
				acrylic.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				iron.splice(i-abcd, 1);
				steel.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

//Checks the value of the checkbox to see if it is checked.
	if (document.getElementById("Air").checked) {

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(air[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				soaker.splice(i-abcd, 1);
				air.splice(i-abcd, 1);
				freestanding.splice(i-abcd, 1);
				whirlpools.splice(i-abcd, 1);
				acrylic.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				iron.splice(i-abcd, 1);
				steel.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

//Checks the value of the checkbox to see if it is checked.
	if (document.getElementById("Freestanding").checked) {

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(freestanding[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				soaker.splice(i-abcd, 1);
				air.splice(i-abcd, 1);
				freestanding.splice(i-abcd, 1);
				whirlpools.splice(i-abcd, 1);
				acrylic.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				iron.splice(i-abcd, 1);
				steel.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

//Checks the value of the checkbox to see if it is checked.
	if (document.getElementById("Whirlpools").checked) {

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(whirlpools[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				soaker.splice(i-abcd, 1);
				air.splice(i-abcd, 1);
				freestanding.splice(i-abcd, 1);
				whirlpools.splice(i-abcd, 1);
				acrylic.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				iron.splice(i-abcd, 1);
				steel.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

//Checks the value of the checkbox to see if it is checked.
	if (document.getElementById("Acrylic").checked) {

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(acrylic[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				soaker.splice(i-abcd, 1);
				air.splice(i-abcd, 1);
				freestanding.splice(i-abcd, 1);
				whirlpools.splice(i-abcd, 1);
				acrylic.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				iron.splice(i-abcd, 1);
				steel.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

//Checks the value of the checkbox to see if it is checked.
	if (document.getElementById("Stone").checked) {

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(stone[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				soaker.splice(i-abcd, 1);
				air.splice(i-abcd, 1);
				freestanding.splice(i-abcd, 1);
				whirlpools.splice(i-abcd, 1);
				acrylic.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				iron.splice(i-abcd, 1);
				steel.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

//Checks the value of the checkbox to see if it is checked.
	if (document.getElementById("Iron").checked) {

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(iron[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				soaker.splice(i-abcd, 1);
				air.splice(i-abcd, 1);
				freestanding.splice(i-abcd, 1);
				whirlpools.splice(i-abcd, 1);
				acrylic.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				iron.splice(i-abcd, 1);
				steel.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

//Checks the value of the checkbox to see if it is checked.
	if (document.getElementById("Steel").checked) {

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(steel[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				soaker.splice(i-abcd, 1);
				air.splice(i-abcd, 1);
				freestanding.splice(i-abcd, 1);
				whirlpools.splice(i-abcd, 1);
				acrylic.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				iron.splice(i-abcd, 1);
				steel.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

}


function display_array() {
//formats the sorted array for printing
	var output_mans = mans.join("<br />");
	
//Displays the formated array elements in the correct html elements
	document.getElementById("manufacturer_list").innerHTML = output_mans;
}

function run_sort() {
//Runs all of the sorting procedures and then displays the correct sorted list
	create_array();
	sort_array();
	display_array();
}

function check_uncheck(box) {
	if (document.getElementById(box).checked) {
		document.getElementById(box).checked = false;
	}
	else {
		document.getElementById(box).checked = true;
	}
}