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('department').style.display = 'none';
			document.getElementById('datemonth').style.display = 'block';
			dateyear_change();
			break;
		case 'department':
			document.getElementById('dateyear').style.display = 'none';
			document.getElementById('department').style.display = 'block';
			document.getElementById('datemonth').style.display = 'none';
			newdepartment_change();
			break;
		case 'category':
			document.getElementById('dateyear').style.display = 'none';
			document.getElementById('department').style.display = 'none';
			document.getElementById('datemonth').style.display = 'none';
			category_change();
			break;
	}
}


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

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


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


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


function category_change()
{
	theform = document.getElementById('listnews');
	thecategory = document.getElementById('category');
	
	theform.action = 'index.php?module=pagesetter&tid=3&filter=category^sub^' + thecategory.options[thecategory.selectedIndex].value;
	theform.submit();
}

