var glossary = {"terms": [
{"term": "andesite", "plural": "andesite", "definition": "Andesite is a medium-colored dark gray volcanic rock containing 53-63 percent silica with a moderate viscosity when in a molten state."},
{"term": "aqueduct", "plural": "aqueducts", "definition": "An aqueduct is an artificial channel that is constructed to convey water from one location to another."},
{"term": "arch", "plural": "arches", "definition": "An arch is a structure capable of spanning a space while supporting significant weight (e.g. a doorway in a stone wall)."},
{"term": "beam", "plural": "beams", "definition": "A beam is a structural element that is capable of withstanding load primarily by resisting bending."},
{"term": "bearing", "plural": "bearing", "definition": "The bearing, of a structural member, is its ability to withstand a weight or strain "},
{"term": "brick", "plural": "bricks", "definition": "A brick is a rectangular block of clay baked by the sun or in a kiln, used as a building or paving material."},
{"term": "bridge", "plural": "bridges", "definition": "A bridge is a structure that allows people or vehicles to cross an obstacle such as a river or canal or railway etc."},
{"term": "buttress", "plural": "buttresses", "definition": "A buttress is an architectural structure built against (a counterfort) or projecting from a wall which serves to support or reinforce the wall."},
{"term": "cable", "plural": "cables", "definition": "The staying or suspending bridge element; in modern suspension bridges, the main supporting cable is hung from towers, and formed from steel wire."},
{"term": "canal", "plural": "canals", "definition": "A canal is a long and narrow strip of water made for boats or for irrigation."},
{"term": "cantilever", "plural": "cantilevered", "definition": "A cantilever is a beam supported on only one end. The beam carries the load to the support where it is resisted by moment and shear stress."},
{"term": "catchment", "plural": "catchment", "definition": "Catchment refers to a structure in which water is collected (especially a natural drainage area)."},
{"term": "cistern", "plural": "cisterns", "definition": "A cistern is an artificial reservoir for storing liquids, especially an underground tank for storing rainwater."},
{"term": "column", "plural": "columns", "definition": "A column is a vertical structural element that transmits, through compression, the weight of the structure above."},
{"term": "concrete", "plural": "concrete", "definition": "Concrete is a construction material composed of cement (commonly Portland cement) as well as other cementitious materials such as fly ash and slag."},
{"term": "girder", "plural": "girders", "definition": "A girder is a support beam used in construction."},
{"term": "hectare", "plural": "hectares", "definition": "A hectare (abbreviated as 'ha') is a unit of area equal to one square hectometre (0.1 kilometer, or 100 meters, squared), and commonly used for measuring land area."},
{"term": "jetty", "plural": "jetties", "definition": "A jetty is a wall built out into the water to restrain currents or protect a structure."},
{"term": "kiosk", "plural": "kiosks", "definition": "A kiosk is a small enclosed structure, often freestanding, open on one side or with a window."},
{"term": "lock", "plural": "locks", "definition": "A lock is a device for raising and lowering boats between stretches of water of different levels on river and canal waterways."},
{"term": "masonry", "plural": "masonry", "definition": "Masonry is the building of structures from individual units laid in and bound together by mortar, and the term 'masonry' can also refer to the units themselves."},
{"term": "pavilion", "plural": "pavilions", "definition": "A pavilion is a light roofed structure used as a shelter in a public place."},
{"term": "pier", "plural": "piers", "definition": "A pier is an upright support for a superstructure, such as an arch or bridge."},
{"term": "pile", "plural": "piles", "definition": "A pile is a column of wood or steel or concrete that is driven into the ground to provide support for a structure."},
{"term": "quay", "plural": "quays", "definition": "A quay is a stone or concrete structure on navigable water used for loading and unloading vessels"},
{"term": "reservoir", "plural": "reservoirs", "definition": "A reservoir is an artificial lake into which water flows and is stored for future use."},
{"term": "soffit", "plural": "soffits", "definition": "The underside of a part of a building (such as an arch or overhang or beam). "},
{"term": "span", "plural": "spans", "definition": "A span is a section between two intermediate supports, e.g. of a beam or a bridge."},
{"term": "truss", "plural": "trusses", "definition": "A truss is a structure comprising one or more triangular units constructed with straight slender members whose ends are connected at joints."},
{"term": "viaduct", "plural": "viaducts", "definition": "A bridge with several spans that carries road or rail traffic over a valley or other obstacles."}
]};

function lookUpTerm(term) {
	var i;
	for (i = 0; i < glossary.terms.length; i++) {
		var entry = glossary.terms[i];
		if (entry.term == term || entry.plural == term)
			return entry.definition;
		}

	return null;
}

function setGlossary(term) {
	var def = lookUpTerm(term);
	if (def == null)
		return;
	document.getElementById("glossary").innerHTML = "<dl><dt>" + term + "</dt><dd>" + def + "</dd></dl>";
}

function convertGlossaryText(s) {
	s = s.replace(/\b(arch|arches)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"arch\")'>$1</a>");
	s = s.replace(/\b(beam|beams)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"beam\")'>$1</a>");
	s = s.replace(/\b(bearing|bearings)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"bearing\")'>$1</a>");
	s = s.replace(/\b(bridge|bridges)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"bridge\")'>$1</a>");
	s = s.replace(/\b(buttress|buttresses)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"buttress\")'>$1</a>");
	s = s.replace(/\b(cable|cables)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"cable\")'>$1</a>");
	s = s.replace(/\b(cantilever|cantilevers)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"bridge\")'>$1</a>");
	s = s.replace(/\b(pile|piles)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"pile\")'>$1</a>");
	s = s.replace(/\b(span|spans)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"span\")'>$1</a>");
	s = s.replace(/\b(truss|trusses)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"truss\")'>$1</a>");
	s = s.replace(/\b(viaduct|viaducts)\b/, "<a class='Nglossary' href='javascript:setGlossary(\"viaduct\")'>$1</a>");
	return s;
}