function expandcontract() {
	current = document.listform.tcontract.value;
	if (current=='expanded') {
		document.listform.contract.value = 'Contract List';
	} else {
		document.listform.contract.value = 'Expand List';
	}
	document.listform.submit()
}

function getTrainingLogs() {
	document.listform.logusername.value = '*';
	document.listform.submit();
}

function sortOn(field) {
	document.listform.logusername.value = '*';
	document.listform.logorder.value = field;
	document.listform.submit();
}

function gotoPosting() {
	location.href="#post";
	document.submitform.postTitle.focus();
}

function handleSiteSearch() {
	// open a new window to display the results of a site search from the forum

	// look at their current window size to decide what size the new window will be
	// and where it will be positioned
	if (document.all) {
		w	= document.body.clientWidth;
		h	= document.body.clientHeight;
	} else {
		w	= window.innerWidth;
		h	= window.innerHeight;
	}

	// position the new window in the center is the screen near the top
	w		= (w>860) ? 850 : w;
	sw		= screen.width;
	posX	= (sw - w)/2;
	posY	= 10;

	// setup the new window, open it, and submit the search form.
	var myBars = 'directories=yes,location=yes,menubar=yes,status=yes';
	myBars += ',titlebar=yes,toolbar=yes';
	var myOptions	= 'scrollbars=yes,width='+w+',height='+h+',resizable=yes';
	myOptions += (document.all) ? ',left='+posX+',top='+posY : ',screenX='+posX+',screenY='+posY;
	var myFeatures = myBars + ',' + myOptions;
	var refWindow = open('about:blank', 'searchresults', myFeatures);
	document.siteform.submit();
	refWindow.focus();
}

var submitclicked;
function validateSearch(formobj) {
	// make sure the search fields have something in them
	// if this search is a site search redirect appropriately
	switch (submitclicked.name) {
		case 'submitsearch':
			targetfield	= document.listform.formsearchtext;
			break;
		case 'logusersearch':
			targetfield	= document.listform.logusername;
			break;
		case 'sitesearch':
			targetfield	= document.siteform.sterm;
			break;
	}

	stringsize	= targetfield.value.length

	if (stringsize>2) {
		if (submitclicked.name=='sitesearch') { handleSiteSearch() };
		return true;
	}
	targetfield.focus();
	return false;
}