jQuery().ready(function(){
		// Genzyme Filter Results by category
		var dataCopy = new dataObj();	
		// this function takes the 'dataCopy' var and removes all the objects which dont match the filter
		var filterData = function(){
			var filterCats = $("#sec10").attr("name");
			//filter stuff out of array depending on category
				var filteredProducts = new Array();
				for (l = 0; l < dataCopy.products.length; l++){
					var myProduct = dataCopy.products[l];
						if(myProduct.category == filterCats){
							filteredProducts.push(myProduct);
							
						}
					}
					
				//write out the HTML block at the bottom.
				var contentInsert = new Array();
				if(filteredProducts.length > 0){
						for (i= 0; i < filteredProducts.length; i++){
						myProduct = filteredProducts[i];	
						contentInsert.push("<a href=\"" + myProduct.url + "\">" + myProduct.name + "</a><br/>");
					}
				}
		
				$("#sec10").html("<br/>" + contentInsert.join(""));
			//filter out stuff for second category sec11

			var filterCats2 = $("#sec11").attr("name");
			//filter stuff out of array depending on category*/
				var filteredProducts2 = new Array();
				for (l = 0; l < dataCopy.products.length; l++){
					var myProduct2 = dataCopy.products[l];
						if(myProduct2.category == filterCats2){
							filteredProducts2.push(myProduct2);
							
						}
					}
					
				//write out the HTML block at the bottom.
				var contentInsert2 = new Array();
				if(filteredProducts2.length > 0){
						for (i= 0; i < filteredProducts2.length; i++){
						myProduct2 = filteredProducts2[i];	
						contentInsert2.push("<a href=\"" + myProduct2.url + "\">" + myProduct2.name + "</a><br/>");
					}
				}
		
				$("#sec11").html("<br/>" + contentInsert2.join(""));

			//filter out stuff for third category sec12

			var filterCats3 = $("#sec12").attr("name");
		//filter stuff out of array depending on category*/
				var filteredProducts3 = new Array();
				for (l = 0; l < dataCopy.products.length; l++){
					var myProduct3 = dataCopy.products[l];
						if(myProduct3.category == filterCats3){
							filteredProducts3.push(myProduct3);
							
						}
					}
					
				//write out the HTML block at the bottom.
				var contentInsert3 = new Array();
				if(filteredProducts3.length > 0){
						for (i= 0; i < filteredProducts3.length; i++){
						myProduct3 = filteredProducts3[i];	
						contentInsert3.push("<a href=\"" + myProduct3.url + "\">" + myProduct3.name + "</a><br/>");
					}
				}
		
				$("#sec12").html("<br/>" + contentInsert3.join(""));


				//filter out stuff for fourth category sec13

			var filterCats2 = $("#sec14").attr("name");
			//filter stuff out of array depending on category*/
				var filteredProducts2 = new Array();
				for (l = 0; l < dataCopy.products.length; l++){
					var myProduct2 = dataCopy.products[l];
						if(myProduct2.category == filterCats2){
							filteredProducts2.push(myProduct2);
							
						}
					}
					
				//write out the HTML block at the bottom.
				var contentInsert2 = new Array();
				if(filteredProducts2.length > 0){
						for (i= 0; i < filteredProducts2.length; i++){
						myProduct2 = filteredProducts2[i];	
						contentInsert2.push("<a href=\"" + myProduct2.url + "\">" + myProduct2.name + "</a><br/>");
					}
				}
		
				$("#sec14").html("<br/>" + contentInsert2.join(""));

			}
		
		// run on page load
		filterData();
});