// JavaScript Document
/* This script is property of Tanner Naeher, coyote6.com.  It may only be used as a template for others.  Any use of its images or content is strictly forbidden without written consent.*/
/* The purpose of this script is to display and hide text fields. */
/* The selecting of the class portion of this script was loosely based off a script from Visual Quickstart Guide to JavaScript & Ajax 6th Edition. */

// Displays Hidden Elements By ID - Block.
function display (element_name) {
	var TextDisplay = document.getElementById(element_name);
	if (TextDisplay) {
		TextDisplay.style.display = "block";
	}
}

// Displays Hidden Elements By ID - Inline.
function display_inline (element_name) {
	var TextDisplay = document.getElementById(element_name);
	if (TextDisplay) {
		TextDisplay.style.display = "inline";
	}
}

// Hides Displayed Elements By ID.
function hide (element_name) {
	var TextDisplay = document.getElementById(element_name);
	if (TextDisplay) {
		TextDisplay.style.display = "none";
	}
}

// Displays Hidden Elements By Class - Block.
function display_class (element_name) {
	var all_tags = document.getElementsByTagName("*");
	for (i = 0; i<all_tags.length; i++){
		// If there are more than one class than separate it into an array.
		var class_array = all_tags[i].className.split(" ");
		// Check to see if there are multiple classes in the element.
		if (class_array.length > 0) {
			// Loop through each individual class and check for a match.
			for (counter = 0; counter<class_array.length; counter++) {
				if (class_array[counter]==element_name) {
					all_tags[i].style.display = "block";
				}
			}
		}
	}
}

// Displays Hidden Elements By Class - Inline.
function display_class_inline (element_name) {
	var all_tags = document.getElementsByTagName("*");
	for (i = 0; i<all_tags.length; i++){
		// If there are more than one class than separate it into an array.
		var class_array = all_tags[i].className.split(" ");
		// Check to see if there are multiple classes in the element.
		if (class_array.length > 0) {
			// Loop through each individual class and check for a match.
			for (counter = 0; counter<class_array.length; counter++) {
				if (class_array[counter]==element_name) {
					all_tags[i].style.display = "inline";
				}
			}
		}
	}
}

// Hides Displayed Elements By Class.
function hide_class (element_name) {
	var all_tags = document.getElementsByTagName("*");
	for (i = 0; i<all_tags.length; i++){
		// If there are more than one class than separate it into an array.
		var class_array = all_tags[i].className.split(" ");
		// Check to see if there are multiple classes in the element.
		if (class_array.length > 0) {
			// Loop through each individual class and check for a match.
			for (counter = 0; counter<class_array.length; counter++) {
				if (class_array[counter]==element_name) {
					all_tags[i].style.display = "none";
				}
			}
		}
	}
}