// Enables/Disables a Select based on inputs
function toggleSelect(from,to,enable,disable) { 
  // Respect strict on/off setting
  if (enable==1) {to.disabled=1;return;}
  if (disable==1) {to.disabled=0;return;}

  // Get input element and type
  var fromType=from.tagName;

  // Get value of input element
  var value;
  switch (fromType)
  {
	  case 'SELECT':
		  value=from.options[from.selectedIndex].value;
		  break;
  }

  // Change year from Inaug when not looking at draft history
  if ((value!='draft_history.php')&&(to.options[to.selectedIndex].value=='inaug'))
  {
	  to.selectedIndex=to.selectedIndex-1;
  }

  // Check enable array for value
  var enableArray=enable.split("|");
  for (var i=0;i<enableArray.length;i++)
  {
	  if (enableArray[i]==value)
	  {
		  to.disabled=0;
		  return;
	  }
  }
  // Check disable array for value
  var disableArray=disable.split("|");
  for (var i=0;i<disableArray.length;i++)
  {
	  if (disableArray[i]==value)
	  {
		  to.disabled=1;
		  return;
	  }
  }  

  // Toggle
  if (to.disabled==1) {to.disabled=0;}
  else {to.disabled=1;}

  return;
}

