function isIE() {
	if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1) { return true; }
	else { return false; }
}

function toggle(id) {
	var e = document.getElementById(id);
	var d = "block";
	if (!isIE()) {
		if (e.insertRow) { d = "table"; }
		else if (e.insertCell) { d = "table-row"; }
	}
	if (e.style.display == "none" || e.style.display == "") { e.style.display = d; }
	else { e.style.display = "none"; }
	return;
}

//-->


/**
+	clearField()
+
+	@requires
+		none
+
+	@arguments
+		field - the DOM object whose value you wish to clear (will almost always be the self-reference of this)
+		text - the default text of the field
*/
function clearField(field, text) {
	if (field.value == text) { field.value = ""; }
	return;
}

/**
+	fillField()
+
+	@requires
+		isblank()
+
+	@arguments
+		field - the DOM object whose value you wish to fill (will almost always be the self-reference of this)
+		text - the default text of the field
*/
function fillField(field, text) {
	if (isblank(field.value)) { field.value = text; }
	return;
}

// finds if a string is blank (nothing but spaces)
function isblank(x) {
	var blank = true;
	for (i = 0; i < x.length; i++) {
		if (x.charAt(i) != ' ') { blank = false; }
	}
	return blank;
}

// finds if a form value is empty
function isempty(x) {
	if (x == "" || isblank(x)) { return true; }
	else { return false; }
}

// finds if a select box has not been changed
function unchanged(x) {
	if (x.selectedIndex == 0) { return true; }
	else { return false; }
}


/* Category Checker. Allows only 3 boxes to be checked */
var checkCount = 0 //initial checkCount of zero
var maxChecks = 3 //maximum number of allowed checked boxes

function categoryCheck(obj) {
	//increment/decrement checkCount
	//if(obj.checked) {
	//	checkCount = checkCount+1
	////} else {
//		checkCount = checkCount-1
//	}
	//if they checked a 4th box, uncheck the box, then decrement checkcount and pop alert
	//if (checkCount>maxChecks) {
	//	obj.checked = false
//	checkCount=checkCount-1
	//	alert('You may only choose up to '+maxChecks+' categories')
	//}
}
	
	