carea_val = new Array();
function zit(fe,we,ueb)
{
if(document.getElementById){
var orig_height=document.getElementById(fe).style.height;
orig_height=parseInt(orig_height.slice(0,-2));
var height_rest=orig_height - we;
if (ueb == '+'){we=orig_height + we;document.getElementById(fe).style.height=we+"px";document.coma_xinha_height=we+"px";carea_val[fe]=null;}
else if (ueb == '-' && height_rest > 0) {we=orig_height - we;document.getElementById(fe).style.height=we+"px";document.coma_xinha_height=we+"px";carea_val[fe]=null;}
else if (ueb == 'small'){
if (carea_val[fe] == null){carea_val[fe]=orig_height;document.getElementById(fe).style.height=we+"px";document.coma_xinha_height=we+"px";}
else {document.getElementById(fe).style.height=carea_val[fe]+"px";document.coma_xinha_height=we+"px";carea_val[fe]=null;}
}
else if (ueb == 'orig') {document.getElementById(fe).style.height=we+"px";document.coma_xinha_height=we+"px";carea_val[fe]=null;}
}
}

check_one_all_merker = new Array();
function check_one_all(oobject,mode,sobject){
if (mode == 1){
if (document.getElementById(oobject).checked != true && document.getElementById(sobject).checked == true){document.getElementById(oobject).checked = true;}
}
else if (mode == 2){
if (document.getElementById(sobject).checked == true && oobject != sobject){document.getElementById(oobject).checked = false;}
check_one_all_merker[document.getElementById(oobject).name] = 0;
if (oobject != sobject){check_one_all_merker[document.getElementById(sobject).name] = 0;}
}
else if (mode == 3){
  for (var i=0;i<document.getElementsByName(oobject).length;i++) {
    if (check_one_all_merker[oobject] != 1){
    document.getElementsByName(oobject)[i].checked = true;
    if (oobject != sobject){document.getElementsByName(sobject)[i].checked = false;check_one_all_merker[sobject] = 0;}
    }
    else {document.getElementsByName(oobject)[i].checked = false;}
  }
  if (check_one_all_merker[oobject] != 1){check_one_all_merker[oobject] = 1;}
  else {check_one_all_merker[oobject] = 0;}
}
}

var coma_multiselect_entries = new Object();

function multiselectMove(source, destination, entries_key, direction, oneorall) {
//by guido k. for comasystem
//moves selected options from one select to another.
//leaves sorting of the options as it was set in the object coma_multiselect_entries[name_of_select],
//so you can sort inside your perl or php script, which gives you better sort algorithm. 
	
//source= source select
//destination= destination select
//entries_key= the key inside the entries-object under which the values are stored
//direction= move from source to destination (1) or from destination to source (0)
//oneorall= move all options of a select (1) or just the selected (0)	

//from source to destination
if (direction == 1){
for(var dcount=0; dcount<source.length; dcount++) {
	if(source[dcount].selected == true || oneorall == 1){coma_multiselect_entries[entries_key][source[dcount].value]['sel']=1;}
	}
}
//from destination to source
else{
for(var dcount=0; dcount<destination.length; dcount++) {
	if(destination[dcount].selected == true || oneorall == 1){coma_multiselect_entries[entries_key][destination[dcount].value]['sel']=0;}
	}
}

//delete all options in the two select-fields
source.length=0;
destination.length=0;

//create options in the two select-fields
for (var element in coma_multiselect_entries[entries_key]){
var element2=unescape(coma_multiselect_entries[entries_key][element]['val']);	
if (coma_multiselect_entries[entries_key][element]['sel']==1){destination[destination.length]=new Option(element2, element);}
else{source[source.length]=new Option(element2, element);}
}	
}


function multiselectMove2(source, destination, entries_key, direction, oneorall) {
//by guido k. for comasystem
//moves selected options from one select to another.
//leaves sorting of the options as it was set in the object coma_multiselect_entries[name_of_select],
//so you can sort inside your perl or php script, which gives you better sort algorithm. 
		
//source= source select
//destination= destination select
//entries_key= the key inside the entries-object under which the values are stored
//direction= move from source to destination (1) or from destination to source (0)
//oneorall= move all options of a select (1) or just the selected (0)	

//from source to destination
var dest_final_array = new Array();
var source_final_array = new Array();

for(var dcount=0; dcount<destination.length; ++dcount) {dest_final_array[destination.options[dcount].value]=destination.options[dcount].text;}
for(var scount=0; scount<source.length; ++scount) {source_final_array[source.options[scount].value]=source.options[scount].text;}

//from source to destination
if (direction == 1){
	
for(var scount=0; scount<source.length; ++scount) {
	if(source[scount].selected == true || oneorall == 1){
		dest_final_array[source.options[scount].value]=source.options[scount].text;
		delete(source_final_array[source.options[scount].value]);
		}
	}
}
//from destination to source
else{
for(var dcount=0; dcount<destination.length; dcount++) {
	if(destination[dcount].selected == true || oneorall == 1){
		delete(dest_final_array[destination.options[dcount].value]);
		source_final_array[destination.options[dcount].value]=destination.options[dcount].text;
		}
	}
}

//delete all options in the two select-fields
source.length=0;
destination.length=0;

//create options in the two select-fields
for (var element in dest_final_array){
var destlen = destination.length;
destination.options[destlen]= new Option(dest_final_array[element],element,false,false);
}

for (var element in source_final_array){
var sourcelen = source.length;
source.options[sourcelen]= new Option(source_final_array[element],element,false,false);
}	
}
