function findTopOfControl(control)
{
	//returns the top of the control in pixels
	//
	//control:	the control to get the top of
	
	var boxTop = 0;
	
	if(control.offsetParent)
	{
		do
		{
			boxTop += control.offsetTop;
		} while(control = control.offsetParent);
	}
	
	return boxTop;
}

function findLeftOfControl(control)
{
	//returns the left of the control, in pixels
	//
	//control:	the control to get the left of
	
	var boxLeft = 0;
	
	if(control.offsetParent)
	{
		do
		{
			boxLeft += control.offsetLeft;
		} while(control = control.offsetParent);
	}

	return boxLeft;
}

function showMediaCoverage()
{
	var typeBox = document.getElementById('media_type');
	var yearBox = document.getElementById('media_year');
	
	if(typeBox==null || yearBox==null)
		return;
		
	window.location = "articles.php?page=6&type=" + typeBox.value + "&year=" + yearBox.value;
}

function showNewsArchives()
{
	var yearBox = document.getElementById('archive_year');
	var monthBox = document.getElementById('archive_month');
	
	if(yearBox==null || monthBox==null)
		return;
		
	window.location = "articles.php?page=archives&month=" + monthBox.value + "&year=" + yearBox.value;	
}

function showPublications()
{
	var yearBox = document.getElementById('archive_year');
	var monthBox = document.getElementById('archive_month');
	
	if(yearBox==null || monthBox==null)
		return;
		
	window.location = "articles.php?page=3&month=" + monthBox.value + "&year=" + yearBox.value;	
}

function showEventsArchives()
{
	var yearBox = document.getElementById('archive_year');
	var monthBox = document.getElementById('archive_month');
	
	if(yearBox==null || monthBox==null)
		return;
		
	window.location = "education.php?page=4&month=" + monthBox.value + "&year=" + yearBox.value;
}

function doSearch()
{
	var searchBox = document.getElementById('search_value');
	
	if(searchBox==null)
		return;
		
	window.location = "search.php?q=" + searchBox.value;
}

function tryDoSearch()
{
	var key = (window.event) ? event.keyCode : e.keyCode;
	
	if(key==13)
		doSearch();
}