function KeyPressFunc(myfield, e, functionToCall, functionParameters)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13)
	{
		if(functionParameters!="")
			functionToCall(functionParameters);
		else
			functionToCall();
		return false;
	}
	else
		return true;
}

function doSearch(destination)
{
	if (document.getElementById("txtKeyword"))
	{
			var newLoc = destination;
			var Keyword = getValue("txtKeyword");
			var FName = getValue("txtFirstName");
			var LName = getValue("txtLastName");
			var Practice = getDropdownValue("cboPractices");
			var School = getDropdownValue("cboSchools");
			var Office = getDropdownValue("cboOffices");
			var BarAdmis = getDropdownValue("cboBarAdmissions");
			var Level = getDropdownValue("cboLevels");

			LName = (LName=="LAST NAME")?"":LName;
			FName = (FName=="FIRST NAME")?"":FName;
			Keyword = (Keyword=="KEYWORD")?"":Keyword;
			
			newLoc = (LName=="")? newLoc : newLoc+"&LastName="+LName;
			newLoc = (FName=="")? newLoc : newLoc+"&FirstName="+FName;
			newLoc = (Keyword=="")? newLoc : newLoc+"&KeywordPhrase="+Keyword;
			newLoc = (Practice=="")? newLoc : newLoc+"&AdvancedServices="+Practice;
			newLoc = (Level=="")? newLoc : newLoc+"&Level="+Level;
			newLoc = (School=="")? newLoc : newLoc+"&Schools="+School;
			newLoc = (BarAdmis=="")? newLoc : newLoc+"&BarAdmissions="+BarAdmis;
			newLoc = (Office=="")? newLoc : newLoc+"&Office="+Office;

			location.href=newLoc;
	}
}

function getDropdownValue(strInput)
{
	var theInput = document.getElementById(strInput);
	if (theInput)
		return theInput.options[theInput.selectedIndex].value;
	else
		return "";
}

function getValue(strInput)
{
	if(document.getElementById(strInput))
		return document.getElementById(strInput).value;
	else
		return "";
}