function selectSelect(control, value)
{
  var options = control.options;

  for (var i = 0; i < options.length; i++) {
    if (options[i].value == value) {
      options[i].selected = true;
      break;
    }
  }
}


function navigationtype_change()
{
	navtype = document.getElementById('navigationtype');

	switch (navtype.options[navtype.selectedIndex].value) {
		case 'date':
			document.getElementById('dateyear').style.display = 'block';
			document.getElementById('datemonth').style.display = 'block';
			document.getElementById('category').style.display = 'none';
			document.getElementById('host').style.display = 'none';
			document.getElementById('location').style.display = 'none';
			document.getElementById('department').style.display = 'none';
			dateyear_change();
			break;
		case 'category':
			document.getElementById('dateyear').style.display = 'none';
			document.getElementById('datemonth').style.display = 'none';
			document.getElementById('category').style.display = 'block';
			document.getElementById('host').style.display = 'none';
			document.getElementById('location').style.display = 'none';
			document.getElementById('department').style.display = 'none';
			category_change();
			break;
		case 'host':
			document.getElementById('dateyear').style.display = 'none';
			document.getElementById('datemonth').style.display = 'none';
			document.getElementById('category').style.display = 'none';
			document.getElementById('host').style.display = 'block';
			document.getElementById('location').style.display = 'none';
			document.getElementById('department').style.display = 'none';
			host_change();
			break;
		case 'location':
			document.getElementById('dateyear').style.display = 'none';
			document.getElementById('datemonth').style.display = 'none';
			document.getElementById('category').style.display = 'none';
			document.getElementById('host').style.display = 'none';
			document.getElementById('location').style.display = 'block';
			document.getElementById('department').style.display = 'none';
			location_change();
			break;
		case 'department':
			document.getElementById('dateyear').style.display = 'none';
			document.getElementById('datemonth').style.display = 'none';
			document.getElementById('category').style.display = 'none';
			document.getElementById('host').style.display = 'none';
			document.getElementById('location').style.display = 'none';
			document.getElementById('department').style.display = 'block';
			newdepartment_change();
			break;
	}
}


function dateyear_change()
{
	theform = document.getElementById('listevents');
	thedateyear = document.getElementById('dateyear');

	theform.action = 'index.php?module=pagesetter&tid=48&filter=startdate^like^' + thedateyear.options[thedateyear.selectedIndex].value;
	theform.submit();
}


function category_change()
{
	theform = document.getElementById('listevents');
	thecategory = document.getElementById('category');

	theform.action = 'index.php?module=pagesetter&tid=48&filter=category^sub^' + thecategory.options[thecategory.selectedIndex].value;
	theform.submit();
}


function host_change()
{
	theform = document.getElementById('listevents');
	thehost = document.getElementById('host');
	
	theform.action = 'index.php?module=pagesetter&tid=48&filter=host^like^' + thehost.options[thehost.selectedIndex].value;
	theform.submit();
}


function host_change()
{
	theform = document.getElementById('listevents');
	thehost = document.getElementById('host');
	
	theform.action = 'index.php?module=pagesetter&tid=48&filter=host^like^' + thehost.options[thehost.selectedIndex].value;
	theform.submit();
}


function location_change()
{
	theform = document.getElementById('listevents');
	thelocation = document.getElementById('location');
	
	theform.action = 'index.php?module=pagesetter&tid=48&filter=location^like^' + thelocation.options[thelocation.selectedIndex].value;
	theform.submit();
}


function department_change()
{
	theform = document.getElementById('listevents');
	thedepartment = document.getElementById('department');
	
	theform.action = 'index.php?module=pagesetter&tid=48&filter=department^sub^' + thedepartment.options[thedepartment.selectedIndex].value;
	theform.submit();
}


function newdepartment_change()
{
	theform = document.getElementById('listevents');
	thedepartment = document.getElementById('department');
	
	theform.action = 'index.php?module=pagesetter&tid=48&filter=newdepartment^sub^' + thedepartment.options[thedepartment.selectedIndex].value;
	theform.submit();
}

