function searching() {
	var puBox = document.getElementById("pubCriteria");
	
	if (puBox) {
		var searchMsg = document.getElementById("searchMsg");
		var shade = document.getElementById("searchShade");

		var h = puBox.offsetHeight;
		var w = puBox.offsetWidth;

		var boxHeight = searchMsg.clientHeight;
		var boxWidth = searchMsg.clientWidth;

		//alert(h + " / " + w);
		//alert(boxHeight + " / " + boxWidth);

		var boxTop = (h-boxHeight)/2;
		var boxLeft = (w-boxWidth)/2;

		shade.style.width = w + 'px';
		shade.style.height = (h-12) + 'px';
		shade.style.visibility = 'visible';

		searchMsg.style.top = boxTop + 'px';
		searchMsg.style.left = boxLeft + 'px';
		searchMsg.style.visibility = 'visible';
	}
		
}

function hideShade() {
	var searchMsg = document.getElementById("searchMsg");
	var shade = document.getElementById("searchShade");
	searchMsg.style.visibility = 'hidden';
	shade.style.visibility = 'hidden';
}

function checkSearchForm(thisForm)
{
	docType = thisForm.sePub.value;
	author = thisForm.author.value;
	thisDate = thisForm.date.value;
	title = thisForm.title.value;
	docNum = thisForm.docnum.value;
	keyword = thisForm.keyword.value;
	
	todayDate = new Date();
	thisYear = todayDate.getFullYear();
	
	if((docType=="AllPubs" || docType=="JRN") && author.length<2 && thisDate.length<2 && title.length<2 && docNum.length<2 && keyword.length<2)
	{
		alert("Please select some more robust search criteria. You must enter at least 2 characters into a field for a valid search.");
		return false;
	}
	
	if(thisDate!="")
	{
		dates = thisDate.split("/");
		if(dates.length>2)
		{
			alert("Please check your date format. Dates should be entered as year only (YYYY) or month and year (MM/YYYY).");
			return false;
		}
		else if(dates.length==1)
		{
			if(dates[0].length!=4)
			{
				alert("Please check your date format. Dates should be entered as year only (YYYY) or month and year (MM/YYYY).");
				return false;
			}
			else if(!Number(dates[0]))
			{
				alert("Please check your date format. Only numeric characters and slashes (\"/\") may be entered.");
				return false;			
			}
			else if(dates[0]<1998 || dates[0]>thisYear)
			{
				alert("Please check your date range. Publications are only available since 1998 and up to the present year.");
				return false;
			}
		}
		else
		{
			for (var i=0; i < dates.length; i++)
			{
				if(!Number(dates[i]))
				{
					alert("Please check your date format. Only numeric characters and slashes (\"/\") may be entered.");
					return false;
				}
				else if(dates[i].length>2 && (dates[i]>thisYear || dates[i]<1998))
				{
					alert("Please check your date range. Publications are only available since 1998 and up to the present year.");
					return false;
				}
			}
		}
	}	
	searching();
	return true;
}