function submitForm(form, action) {
	form.action = action;
	form.submit();
}

function submitFormThin(form) {
	form.submit();
}

function fieldFocus(element) {
	document.getElementById(element).focus();
}

function isDefined(variable) {
	if(typeof(variable) !="undefined")
		return true;
	else
		return false;
}

function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 2;
	while(isDefined(theForm[z]) && theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
		if(theForm[z].type == 'checkbox') {
			theForm[z].checked = theElement.checked;
		}
		z++;
	}
}

function cancelForm(action) {
	window.location.href = action;
}

function toggleDiv(id) {
	element = document.getElementById(id);
	element.className = (element.className.toLowerCase() == 'show'?'hide':'show');
}

function showDiv(id) {
	element = document.getElementById(id);
	element.className = 'show';
}

function hideDiv(id) {
	element = document.getElementById(id);
	element.className = 'hide';
}

function copyInto(inputID, outputID, addText) {
	document.getElementById(outputID).innerHTML = document.getElementById(inputID).value + addText;
}

function subnavWide() {
	var options = document.getElementById('nav').getElementsByTagName("ul");
	
	if(document.all) {
		for(i = 0; i < options.length; i++) {
			options[i].style.width = document.body.scrollWidth - 20;
		}
	}
}

function addResizeEvent(func) {
	if(document.all) {
		var oldresize = window.onresize;
		
		if(typeof window.onresize != 'function') {
			window.onresize = func;
		} else {
			window.onresize = function() {
				oldresize();
				func();
			}
		}
	}
}

function searchWindow(url, title) {
window.open(url, title, 'left=50,top=50,height=500,width=750,scrollbars=yes,menubar=no,toolbar=no,location=no,status=yes,resizable=yes');
}
