function focusFirstInput(skip) {
	var found = [];
	var j = 0;

	// for each form
	for (f=0; f < document.forms.length; f++) {

		// for each element in each form
		for(i=0; i < document.forms[f].length; i++) {

			// if it's not a hidden element and it's not disabled
			if (document.forms[f][i].type != "hidden" && document.forms[f][i].disabled != true) {
				found[j] = document.forms[f][i];
				j++;
			}

			//  this element, stop looking
			if (found.length > skip) {
				break;
			}
		}

		// if found in this form, stop looking
		if (found.length > skip) {
			break;
		}
	}
	
	if (found.length > skip) {
		// focus on last
		last = found.pop();
		last.focus();
	} else if (found.length){
		// focus on first
		found[0].focus();
	}
}

function blur_submit(thefield) {
	if (thefield.defaultValue != thefield.value) {
		thefield.form.submit();
	}
}

function clearText(thefield){

	// Clear default form value script
	if (thefield.defaultValue == thefield.value) {
		thefield.value = '';
	}
}
