
function create_array() {

//manufacturers array
	mans = new Array("<a href=\"http://www.adagiosinks.com\" target=\"_blank\" class=\"navlink\">Adagio</a>","<a href=\"http://www.alchemyglass.com\" target=\"_blank\" class=\"navlink\">Alchemy Glass</a>","<a href=\"http://www.allante.net\" target=\"_blank\" class=\"navlink\">Allante International</a>","<a href=\"http://www.aquabrass.com\" target=\"_blank\" class=\"navlink\">Aqua Brass</a>","<a href=\"http://www.aquadis.com\" target=\"_blank\" class=\"navlink\">Aquadis</a>","<a href=\"http://www.aquawareamerica.com\" target=\"_blank\" class=\"navlink\">Aquaware</a>","<a href=\"http://www.barclayproducts.com\" target=\"_blank\" class=\"navlink\">Barclay Products</a>","<a href=\"http://www.batesandbates.com/home.html\" target=\"_blank\" class=\"navlink\">Bates & Bates</a>","<a href=\"http://www.castellimarble.com\" target=\"_blank\" class=\"navlink\">Castelli Marble</a>","<a href=\"http://www.cheviotproducts.com\" target=\"_blank\" class=\"navlink\">Cheviot</a>","<a href=\"http://www.coyoteglass.com\" target=\"_blank\" class=\"navlink\">Coyote Glass</a>","<a href=\"http://www.curvetusa.com\" target=\"_blank\" class=\"navlink\">Curvet</a>","<a href=\"http://www.delafrontera.com\" target=\"_blank\" class=\"navlink\">de la Frontera</a>","<a href=\"http://www.decolav.com\" target=\"_blank\" class=\"navlink\">DecoLav</a>","<a href=\"http://www.derosedesigns.com\" target=\"_blank\" class=\"navlink\">DeRose Design</a>","<a href=\"http://www.duravit.us\" target=\"_blank\" class=\"navlink\">Duravit</a>","<a href=\"http://www.elkayusa.com\" target=\"_blank\" class=\"navlink\">Elkay</a>","<a href=\"http://www.gravityglas.com\" target=\"_blank\" class=\"navlink\">Gravity Glas</a>","<a href=\"http://www.hastingstilebath.com\" target=\"_blank\" class=\"navlink\">Hastings Tile & Bath</a>","<a href=\"http://www.herbeau.com\" target=\"_blank\" class=\"navlink\">Herbeau</a>","<a href=\"http://www.jaaroncaststone.com\" target=\"_blank\" class=\"navlink\">J Aaron Cast Stone</a>","<a href=\"http://www.julien.ca\" target=\"_blank\" class=\"navlink\">Julien</a>","<a href=\"http://www.fhpkindred.com\" target=\"_blank\" class=\"navlink\">Kindred</a>","<a href=\"http://www.kwcamerica.com\" target=\"_blank\" class=\"navlink\">KWC Faucets</a>","<a href=\"http://www.lebijoucollection.net\" target=\"_blank\" class=\"navlink\">LeBijou</a>","<a href=\"http://www.linkasink.com\" target=\"_blank\" class=\"navlink\">Link-A-Sink</a>","<a href=\"http://www.miro.com\" target=\"_blank\" class=\"navlink\">Miro</a>","<a href=\"http://www.mondobrass.com/\" target=\"_blank\" class=\"navlink\">Mondo Brass (Italbrass)</a>","<a href=\"http://www.nativetrails.net\" target=\"_blank\" class=\"navlink\">Native Trails</a>","<a href=\"http://www.neptuneb.com\" target=\"_blank\" class=\"navlink\">Neptune</a>","<a href=\"http://www.oceanaglassdesigns.com\" target=\"_blank\" class=\"navlink\">Oceana Glass</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.quiescenceisd.com\" target=\"_blank\" class=\"navlink\">Quiescence (In Stone Gallery)</a>","<a href=\"http://www.rockymountainhardware.com\" target=\"_blank\" class=\"navlink\">Rocky Mountain Hardware</a>","<a href=\"http://www.rohlhome.com\" target=\"_blank\" class=\"navlink\">Rohl</a>","<a href=\"http://www.signofthecrab.com\" target=\"_blank\" class=\"navlink\">Sign of the Crab (Strom Plumbing)</a>","<a href=\"http://www.sonia-sa.com\" target=\"_blank\" class=\"navlink\">Sonia</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.suncraftind.com\" target=\"_blank\" class=\"navlink\">Suncraft</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.villeroy-boch.com\" target=\"_blank\" class=\"navlink\">Villeroy & Boch</a>","<a href=\"http://www.glasssink.com\" target=\"_blank\" class=\"navlink\">Vitraform</a>","<a href=\"http://www.whitehauscollection.com\" target=\"_blank\" class=\"navlink\">Whitehaus Collection</a>"
);

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

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

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

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

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

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

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

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

}

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

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(drop[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				drop.splice(i-abcd, 1);
				under.splice(i-abcd, 1);
				vessel.splice(i-abcd, 1);
				wall.splice(i-abcd, 1);
				china.splice(i-abcd, 1);
				glass.splice(i-abcd, 1);
				metal.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

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

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(under[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				drop.splice(i-abcd, 1);
				under.splice(i-abcd, 1);
				vessel.splice(i-abcd, 1);
				wall.splice(i-abcd, 1);
				china.splice(i-abcd, 1);
				glass.splice(i-abcd, 1);
				metal.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

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

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(vessel[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				drop.splice(i-abcd, 1);
				under.splice(i-abcd, 1);
				vessel.splice(i-abcd, 1);
				wall.splice(i-abcd, 1);
				china.splice(i-abcd, 1);
				glass.splice(i-abcd, 1);
				metal.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

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

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(wall[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				drop.splice(i-abcd, 1);
				under.splice(i-abcd, 1);
				vessel.splice(i-abcd, 1);
				wall.splice(i-abcd, 1);
				china.splice(i-abcd, 1);
				glass.splice(i-abcd, 1);
				metal.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

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

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(china[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				drop.splice(i-abcd, 1);
				under.splice(i-abcd, 1);
				vessel.splice(i-abcd, 1);
				wall.splice(i-abcd, 1);
				china.splice(i-abcd, 1);
				glass.splice(i-abcd, 1);
				metal.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

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

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(glass[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				drop.splice(i-abcd, 1);
				under.splice(i-abcd, 1);
				vessel.splice(i-abcd, 1);
				wall.splice(i-abcd, 1);
				china.splice(i-abcd, 1);
				glass.splice(i-abcd, 1);
				metal.splice(i-abcd, 1);
				stone.splice(i-abcd, 1);
				abcd = abcd + 1;
			}
		}
	}

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

	//Begins sorting the array elements by checkbox values
		var abcd = 0;
		var counter = mans.length;
		for (i = 0; i < counter; ++i) {
			if(metal[i-abcd] != "1") {
				mans.splice(i-abcd, 1);
				drop.splice(i-abcd, 1);
				under.splice(i-abcd, 1);
				vessel.splice(i-abcd, 1);
				wall.splice(i-abcd, 1);
				china.splice(i-abcd, 1);
				glass.splice(i-abcd, 1);
				metal.splice(i-abcd, 1);
				stone.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);
				drop.splice(i-abcd, 1);
				under.splice(i-abcd, 1);
				vessel.splice(i-abcd, 1);
				wall.splice(i-abcd, 1);
				china.splice(i-abcd, 1);
				glass.splice(i-abcd, 1);
				metal.splice(i-abcd, 1);
				stone.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;
	}
}
