// Show hide ingredient description

//Handle hiding or showing the current id
function ShowOrHideTable(sTheID) {

	if ( document.getElementById(sTheID).style.display == "" )  {
		document.getElementById(sTheID).style.display = "none";
	}
	else {
		HideAll("ingredient_");
		document.getElementById(sTheID).style.display = "";
	}
}

function HideAll(sPrefix) {

	var oTags = document.getElementsByTagName("*");
	var iPrefixLength = sPrefix.length;

	//Loop through the entire document looking at each tag
	for (var i = 0; i < oTags.length; i++) {
		//If the current tag supports having an ID, continue
		if ( oTags[i].id ) {
			//If the current tag has an ID, continue
			if ( oTags[i].id.length > iPrefixLength ) {
				//Check to see if the current ID is prefixed with what we are trying to hide
				if ( oTags[i].id.substring(0,iPrefixLength) == sPrefix ) {
					document.getElementById(oTags[i].id).style.display = "none";
				}
			}
		}
	}
}
