/**
  * Checks/unchecks all options of a <select> element
  *
  * @param   string   the form name
  * @param   string   the element name
  * @param   boolean  whether to check or to uncheck the element
  *
  * @return  boolean  always true
  */
function setSelectOptions(the_form, the_select, do_check)
{
    var selectObject = document.forms[the_form].elements[the_select];
    var selectCount  = selectObject.length;

    for (var i = 0; i < selectCount; i++) {
        selectObject.options[i].selected = do_check;
    } // end for

    return true;
} // end of the 'setSelectOptions()' function

function MoveOption(nama_1,nama_2)
{
var x=document.getElementById(nama_1)
var p = document.getElementById(nama_2)
var new_option;

new_option              = document.createElement('option');
new_option.value        = x.options[x.selectedIndex].value;
new_option.text         = x.options[x.selectedIndex].text;
new_option.selected     = true;

if (p.options.length != 0)
{
	exist = "no";	
	for (var i=0; i<=p.options.length-1; i++){
		//alert(p.options[i].value + " / " + x.options[x.selectedIndex].value);		
		if (p.options[i].value == x.options[x.selectedIndex].value)
		{
			exist = "yes";			
		}		
	}
	
	if (exist == "no")
	{
		p.options.add(new_option);		
	}
}else{
	p.options.add(new_option);	
}


//x.remove(x.selectedIndex)
}

function clearlistbox(lb){
  for (var i=lb.options.length-1; i>=0; i--){
    lb.options[i] = null;
  }
  lb.selectedIndex = -1;
}

function MoveOptionALL(nama_1,nama_2)
{
var x=document.getElementById(nama_1)
var p = document.getElementById(nama_2)

try {
	p.selectedIndex = -1;
	p.options.length = 0;
}catch(e)
{
	clearlistbox(p);
}

for (var i=0; i<=x.options.length-1; i++){
	var new_option;

	new_option              = document.createElement('option');
	new_option.value        = x.options[i].value;
	new_option.text         = x.options[i].text;
	new_option.selected     = true;
	
	p.options.add(new_option);
}
/*var new_option;

new_option              = document.createElement('option');
new_option.value        = x.options[x.selectedIndex].value;
new_option.text         = x.options[x.selectedIndex].text;
new_option.selected     = true;

p.options.add(new_option);
*/
//x.remove(x.selectedIndex)
}

function RemoveOption(nama)
{
var x=document.getElementById(nama)

x.remove(x.selectedIndex)
}

