function updatelist(){
	var updatelist = document.getElementById("updatelist");
	var vectors = document.getElementById("vectors");
	var biologics = document.getElementById("biologics");
	
	var productlist = new Array();
	var biologiclist = new Array();
	var vectorlist = new Array();
	
	for(var x = 0; x < vectors.options.length; x++){
		if(vectors.options[x].selected == true){
			vectorlist.push(vectors.options[x].value);
		}
	}
	for(var y = 0; y < biologics.options.length; y++){
		if(biologics.options[y].selected == true){
			biologiclist.push(biologics.options[y].value);
		}
	}
	productlist = productlist.concat(vectorlist, biologiclist);
	
	var html = "";
	var query = "'" + productlist.join("','") + "'";
	$.getJSON("facilities/search/" + query, function(json) {
		for(var i in json)
		{
			var facility = json[i];
			var classifications = new Array();

			for(var i in facility.Classification)
			{
				var classification = facility.Classification[i];
				classifications.push(classification);
			}

			html += "<div class=\"aProduct\"><h3><a href=\"facilities/profile/" + facility.id + "\">" + facility.name + "</a></h3>";
			html += "<div class=\"aProductInfo\">" + facility.address1 + " " + facility.address2 + " | " + facility.city + ", " + facility.state + " | " + facility.zip + "</div>";
			
			var classes = new Array();
			classes['vector'] = new Array();
			classes['biologic'] = new Array();
			
			
			for(var i in classifications)
			{
				var classification = classifications[i];
				var thisClass = classifications[i].classification;
				var product = classifications[i].product;
				for(var p in productlist){
					if(productlist[p] == product){
						product = "<span class=\"searched\">" + product + "</span>";
					}
				}

				classes[thisClass].push(product);
			}
			
			if(classes['biologic'].length > 0){
				html += "<div class=\"products\"><b>Biologic:</b> " + classes['biologic'].join(", ") + "</div>";
			}
			if(classes['vector'].length > 0){
				html += "<div class=\"products\"><b>Vectors:</b> " + classes['vector'].join(", ") + "</div>";
			}
			html += "</div>";
		}
		if(html == "")
		{
				html = "<div class=\"empty\">Choose one or more biologics or vector manufacturer(s). Results will be displayed here, in alphabetical order.</div>";
		}
		$("#updatelist").html(html);
	});
}

function showAddFacility(value){
	var facilityInfo = document.getElementById('addFacility');
	if(value != "NEW" || value == "SELECT")
	{
		facilityInfo.style.display = 'none';
	}
	else
	{
		facilityInfo.style.display = 'block';
	}
}

