// Checks text field value to see if it is empty or entirely spaces.
// If the value is empty or blank, the function returns true, else false.

function isBlank(value) {
	var string = value.toString();
	for (var x = 0; x < string.length; x++) {
		if (string.charAt(x) != " ") return false;
		}
	return true;
	}
	
// checks to see if email has a @ string. The '@institution' is automatically appended to the string
// so if there is an @ in this string, they entered it wrong.
function isEmail(value) 
{
	var string = value.toString();
	for (var x = 0; x < string.length; x++) 
	{
		if (string.charAt(x) == "@") return true;
	}
	return false;
}

// Use pattern matching to decide if a text field looks like a MAC address.
// Look for 12 hexadecimal digits mixed in with any sort of punctuation.

function isHardwareAddress(value) {
	if (isBlank(value)) return false;

	var string = value.toString().toUpperCase();

	var digits = string.match(/[A-F0-9]+/g);

	if (!digits) return false;

	var hardware = digits.join("");

	if (hardware.length != 12) return false;

	return true;
	}

// Extract any arguments that were included with the URL
// Returns an object lookup table containing arguments and values

function get_args(location) {
	var object = new Object();

	var query = location.search.substring(1);

	var pairs = query.split("&");
	for (var i = 0; i < pairs.length; i++) {
		var pair = pairs[i].split("=");
		object[pair[0]] = unescape(pair[1]);
		}

	return object;
	}
