actiefback = new Image();
actiefback.src = "/images/icons/back-on.gif";
inactiefback = new Image();
inactiefback.src = "/images/icons/back-off.gif";
actiefnext = new Image();
actiefnext.src = "/images/icons/next-on.gif";
inactiefnext = new Image();
inactiefnext.src = "/images/icons/next-off.gif";

actiefup = new Image();
actiefup.src = "/images/icons/up-on.gif";
inactiefup = new Image();
inactiefup.src = "/images/icons/up-off.gif";
actiefdown = new Image();
actiefdown.src = "/images/icons/down-on.gif";
inactiefdown = new Image();
inactiefdown.src = "/images/icons/down-off.gif";

actiefdelall = new Image();
actiefdelall.src = "/images/icons/delitem-on.gif";
inactiefdelall = new Image();
inactiefdelall.src = "/images/icons/delitem-off.gif";
actiefaddall = new Image();
actiefaddall.src = "/images/icons/additem-on.gif";
inactiefaddall = new Image();
inactiefaddall.src = "/images/icons/additem-off.gif";

actiefsort = new Image();
actiefsort.src = "/images/icons/sort-on.gif";
inactiefsort = new Image();
inactiefsort.src = "/images/icons/sort-off.gif";

function additem(key,field)
	{ /*eval('var thisfield = document.data.' + field + '.value;');*/
	  var thisfield=document.getElementById(field).value;
	  
	  thisfield = thisfield + "@" + key + "@";
	  
	  document.getElementById(field).value=thisfield;
	  /*eval('document.data.' + field + '.value = thisfield;');*/ }

function delitem(key,field)
	{ /*eval('var thisfield = document.data.' + field + '.value;');*/
	  var thisfield=document.getElementById(field).value;
	  
	  var re = new RegExp("@" + key + "@","g")
	  
	  thisfield = thisfield.replace(re,"");
	  
	  document.getElementById(field).value=thisfield;
	  /*eval('document.data.' + field + '.value = thisfield;');*/ }

function addthis(selboxkey,field)
	{ eval('var al = document.data.alist' + selboxkey + ';');
	  eval('var il = document.data.ilist' + selboxkey + ';');
	 
	 /*al=document.getElementsById('alist'+selboxkey);
	 il=document.getElementsById('ilist'+selboxkey);*/
	 
	  if (il.selectedIndex > -1)
	  	{ var so = il.options[il.selectedIndex];
	  
		  var no = new Option(so.text, so.value, 0, 1);
		  al.options[al.options.length] = no;
		  additem(so.value,field);

		  il.options[il.selectedIndex] = null; } }

function addall(selboxkey,field)
	{ eval('var al = document.data.alist' + selboxkey + ';');
	  eval('var il = document.data.ilist' + selboxkey + ';');
	  
	  var total = il.options.length;
	  for (x = 0; x < total; x++)
	  	{ var so = il.options[0];
	  
		  var no = new Option(so.text, so.value, 0, 0);
		  al.options[al.options.length] = no;

		  additem(so.value,field);

		  il.options[0] = null; } }

function delthis(selboxkey,field)
	{ eval('var al = document.data.ilist' + selboxkey + ';');
	  eval('var il = document.data.alist' + selboxkey + ';');

	  if (il.selectedIndex > -1)
	  	{ var so = il.options[il.selectedIndex];
	  
		  var no = new Option(so.text, so.value, 0, 1);
		  al.options[al.options.length] = no;

		  delitem(so.value,field);

		  il.options[il.selectedIndex] = null; } }

function delall(selboxkey,field)
	{ eval('var al = document.data.ilist' + selboxkey + ';');
	  eval('var il = document.data.alist' + selboxkey + ';');
	  
	  var total = il.options.length;
	  for (x = 0; x < total; x++)
	  	{ var so = il.options[0];
	  
		  var no = new Option(so.text, so.value, 0, 0);
		  al.options[al.options.length] = no;

		  delitem(so.value,field);

		  il.options[0] = null; } }
	  
function sopts(key,selboxkey)
	{ eval('var il = document.data.ilist' + selboxkey + ';');
	  
	  y = 0;
	  skey = -1;
	  while (y < il.options.length && skey < 0)
	  	{ if (il.options[y].value == key) skey = y;
		  y++; }
	  return skey; }

function addtolist(key,selboxkey)
	{ if (key > -1)
		{ eval('var al = document.data.alist' + selboxkey + ';');
		  eval('var il = document.data.ilist' + selboxkey + ';');
	  
		  var so = il.options[key];

		  var no = new Option(so.text, so.value, 0, 1);
		  al.options[al.options.length] = no;
		  
		  il.options[key] = null; } }

function SortList(box)
	{ var temptxt = "";
	  var tempval = "";
	  for (var x = 0; x < box.options.length-1; x++)
		{ for (var y = (x+1); y < box.options.length; y++)
			{ if (box.options[x].text > box.options[y].text)
				{ temptxt = box.options[x].text; 
                  tempval = box.options[x].value; 

                  box.options[x].text = box.options[y].text; 
                  box.options[x].value = box.options[y].value; 

                  box.options[y].text = temptxt;
                  box.options[y].value = tempval; } } } }

function moveup(selboxkey,field)
	{ eval('var al = document.data.alist' + selboxkey + ';');
	  
	  var sel = al.selectedIndex;
	  
	  if (sel > 0)
	  	{ var holdtext = al.options[sel].text;
		  var holdvalue = al.options[sel].value;
		  
		  delitem(al.options[sel].value);
		  eval('var contacts = document.data.' + field + '.value;');
		  var re = new RegExp("@" + (al.options[sel-1].value) + "@","g")
		  items = items.replace(re,"@" + al.options[sel].value + "@@" + al.options[sel-1].value + "@");
		  eval('document.data.' + field + '.value = contacts;');
		  
		  al.options[sel].text = al.options[sel-1].text;
		  al.options[sel].value = al.options[sel-1].value;

		  al.options[sel-1].text = holdtext;
		  al.options[sel-1].value = holdvalue;
		  
		  al.options[sel-1].selected = true; } }

function movedown(selboxkey,field)
	{ eval('var al = document.data.alist' + selboxkey + ';');
	  
	  var sel = al.selectedIndex;
	  
	  if (sel < al.options.length-1)
	  	{ var holdtext = al.options[sel].text;
		  var holdvalue = al.options[sel].value;
		  
		  delitem(al.options[sel].value);
		  eval('var contacts = document.data.' + field + '.value;');
		  var re = new RegExp("@" + (al.options[sel+1].value) + "@","g")
		  items = items.replace(re,"@" + al.options[sel+1].value + "@@" + al.options[sel].value + "@");
		  eval('document.data.' + field + '.value = contacts;');
		  
		  al.options[sel].text = al.options[sel+1].text;
		  al.options[sel].value = al.options[sel+1].value;

		  al.options[sel+1].text = holdtext;
		  al.options[sel+1].value = holdvalue;
		  
		  al.options[sel+1].selected = true; } }