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 'showall':
			document.getElementById('department').style.display = 'none';
			document.getElementById('alphabet').style.display = 'none';
			document.getElementById('location').style.display = 'none';
			showall();
			break;
		case 'department':
			document.getElementById('department').style.display = 'block';
			document.getElementById('alphabet').style.display = 'none';
			document.getElementById('location').style.display = 'none';
			department_change();
			break;
		case 'lastname':
			document.getElementById('department').style.display = 'none';
			document.getElementById('alphabet').style.display = 'block';
			document.getElementById('location').style.display = 'none';
			lastname_change();
			break;
		case 'firstname':
			document.getElementById('department').style.display = 'none';
			document.getElementById('alphabet').style.display = 'block';
			document.getElementById('location').style.display = 'none';
			firstname_change();
			break;
		case 'location':
			document.getElementById('department').style.display = 'none';
			document.getElementById('alphabet').style.display = 'none';
			document.getElementById('location').style.display = 'block';
			location_change();
			break;
	}
}


function showall()
{
	theform = document.getElementById('liststaff');
	
	theform.action = 'index.php?module=pagesetter&tid=4';
	theform.submit();
}


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


function lastname_change()
{
	theform = document.getElementById('liststaff');
	
	theform.action = 'index.php?module=pagesetter&tid=4&filter=last_name^ge^a,last_name^lt^b';
	theform.submit();
}


function firstname_change()
{
	theform = document.getElementById('liststaff');
	
	theform.action = 'index.php?module=pagesetter&tid=4&filter=first_name^ge^a,first_name^lt^b';
	theform.submit();
}


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


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

	switch (navtype.options[navtype.selectedIndex].value) {
		case 'month':
			document.getElementById('datemonth').style.display = 'block';
			document.getElementById('department').style.display = 'none';
			document.getElementById('alphabet').style.display = 'none';
			document.getElementById('location').style.display = 'none';
			birthdaymonth_change();
			break;
		case 'department':
			document.getElementById('datemonth').style.display = 'none';
			document.getElementById('department').style.display = 'block';
			document.getElementById('alphabet').style.display = 'none';
			document.getElementById('location').style.display = 'none';
			birthdaydepartment_change();
			break;
		case 'lastname':
			document.getElementById('datemonth').style.display = 'none';
			document.getElementById('department').style.display = 'none';
			document.getElementById('alphabet').style.display = 'block';
			document.getElementById('location').style.display = 'none';
			birthdaylastname_change();
			break;
		case 'firstname':
			document.getElementById('datemonth').style.display = 'none';
			document.getElementById('department').style.display = 'none';
			document.getElementById('alphabet').style.display = 'block';
			document.getElementById('location').style.display = 'none';
			birthdayfirstname_change();
			break;
		case 'location':
			document.getElementById('datemonth').style.display = 'none';
			document.getElementById('department').style.display = 'none';
			document.getElementById('alphabet').style.display = 'none';
			document.getElementById('location').style.display = 'block';
			birthdaylocation_change();
			break;
	}
}


function birthdaymonth_change()
{
	theform = document.getElementById('liststaff');

	theform.action = 'index.php?module=pagesetter&tid=4&tpl=birthdays&nav=navigate&navigationtype=month&filter=birthday^like^' + '01-' + '&orderby=birthday';
	theform.submit();
}


function birthdaydepartment_change()
{
	theform = document.getElementById('liststaff');
	thedepartment = document.getElementById('department');
	
	theform.action = 'index.php?module=pagesetter&tid=4&tpl=birthdays&nav=navigate&navigationtype=department&filter=department^sub^' + thedepartment.options[thedepartment.selectedIndex].value + '&orderby=birthday';
	theform.submit();
}


function birthdaylastname_change()
{
	theform = document.getElementById('liststaff');
	
	theform.action = 'index.php?module=pagesetter&tid=4&tpl=birthdays&nav=navigate&navigationtype=lastname&filter=last_name^ge^a,last_name^lt^b&orderby=last_name';
	theform.submit();
}


function birthdayfirstname_change()
{
	theform = document.getElementById('liststaff');
	
	theform.action = 'index.php?module=pagesetter&tid=4&tpl=birthdays&nav=navigate&navigationtype=firstname&filter=first_name^ge^a,first_name^lt^b&orderby=first_name';
	theform.submit();
}


function birthdaylocation_change()
{
	theform = document.getElementById('liststaff');
	thelocation = document.getElementById('location');
	
	theform.action = 'index.php?module=pagesetter&tid=4&tpl=birthdays&nav=navigate&navigationtype=location&filter=location^eq^' + thelocation.options[thelocation.selectedIndex].value + '&orderby=birthday';
	theform.submit();
}


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

	switch (navtype.options[navtype.selectedIndex].value) {
		case 'showall':
			document.getElementById('department').style.display = 'none';
			document.getElementById('location').style.display = 'none';
			unionmember_showall();
			break;
		case 'department':
			document.getElementById('department').style.display = 'block';
			document.getElementById('location').style.display = 'none';
			unionmember_department_change();
			break;
		case 'location':
			document.getElementById('department').style.display = 'none';
			document.getElementById('location').style.display = 'block';
			unionmember_location_change();
			break;
	}
}


function unionmember_showall()
{
	theform = document.getElementById('liststaff');

	theform.action = 'index.php?module=pagesetter&func=viewpub&tid=61&pid=6&tpl=members&nav=navigate&navigation=showall';
	theform.submit();
}


function unionmember_department_change()
{
	theform = document.getElementById('liststaff');
	thedepartment = document.getElementById('department');
	
	theform.action = 'index.php?module=pagesetter&func=viewpub&tid=61&pid=6&tpl=members&nav=navigate&navigation=department&department=' + thedepartment.options[thedepartment.selectedIndex].value;
	theform.submit();
}


function unionmember_location_change()
{
	theform = document.getElementById('liststaff');
	thelocation = document.getElementById('location');
	
	theform.action = 'index.php?module=pagesetter&func=viewpub&tid=61&pid=6&tpl=members&nav=navigate&navigation=location&location=' + thelocation.options[thelocation.selectedIndex].value;
	theform.submit();
}


function newperiod_change()
{
	theform = document.getElementById('liststaff');
	theperiod = document.getElementById('period');

	theform.action = 'index.php?module=pagesetter&tid=4&tpl=new&nav=navigate&navigationtype=period&period=' + theperiod.options[theperiod.selectedIndex].value + '&filter=appointmentdate^like^%' + theperiod.options[theperiod.selectedIndex].value + '-%';
	theform.submit();
}

