function submitbutton(pressbutton){
  submitform(pressbutton);
}

function submitform(pressbutton){
  var form = document.jaForm;
  
	if (pressbutton) {
		document.jaForm.task.value=pressbutton;
		
		// compose form action
		var action = form.action + "?";
		if(form.controller.value != ''){
		  action += 'controller=' + form.controller.value;
		}
		if(form.task.value != ''){
		  action += '&task=' + form.task.value;
		}
		document.jaForm.action = action;
	}
	try {
		document.jaForm.onsubmit();
	}
	catch(e){}

	document.jaForm.submit();
}

function delSelectedFromList(id){
  var srcList = document.getElementById(id);
  
  for(i=0,n=srcList.length;i<n;i++){
    if(srcList.options[i].selected){
      srcList.options[i] = null;
    }
  }
}
function copyOptionsFromList(src_id, tgt_id){
  var srcList = document.getElementById(src_id);
  var tgtList = document.getElementById(tgt_id);
  
  for(i=0,n=srcList.length;i<n;i++){
    opt = new Option(srcList.options[i].text, srcList.options[i].value);
    tgtList.options.add(opt);
  }
}
function addSelectedToList(src_id, tgt_id){
  var srcList = document.getElementById(src_id);
  var tgtList = document.getElementById(tgt_id);
  
  for(i=0,n=srcList.length;i<n;i++){
    if(srcList.options[i].selected){
      opt = new Option(srcList.options[i].text, srcList.options[i].value);
      tgtList.options.add(opt);
    }
  }
}
function executeTask(id, task){
  var form = document.jaForm;
  cb = eval( 'form.' + id );
  if (cb) {
    //disable other select items
    for (i = 0; true; i++) {
      cbx = eval('form.cb'+i);
      if (!cbx) break;
      cbx.checked = false;
    } // for
    cb.checked = true;
    submitbutton(task);
  }
  return false;
}
function isChecked(isitchecked){
	if (isitchecked == true){
		document.jaForm.boxchecked.value++;
	}
	else {
		document.jaForm.boxchecked.value--;
	}
}

