function dS_addSelection( act, nameFF, ret, thisForm, eLVD, sort, onChng )
	{

		if ( act.indexOf('sel') != -1 ) var frFF = eval('thisForm.avl'+nameFF), toFF = eval('thisForm.sel'+nameFF);
		else var frFF = eval('thisForm.sel'+nameFF), toFF = eval('thisForm.avl'+nameFF);

		if ( act.indexOf('All') == -1 )
		{
			if ( frFF.selectedIndex == -1 ) return;
			var frFFval = new Array(), frFFtxt = new Array();
			for ( s=0;frFF.selectedIndex >= 0;++s )
			{
				frFFval[s] = frFF.options[frFF.selectedIndex].value; frFFtxt[s] = frFF.options[frFF.selectedIndex].text;
				frFF.options[frFF.selectedIndex] = null;
			}
		}
		else
		{
			if ( frFF.options.length == 0 ) return;
			var frFFval = new Array(), frFFtxt = new Array(), frFFl = frFF.length;
			for ( s=0;s<frFFl;++s )
			{
				frFFval[s] = frFF.options[0].value;
				frFFtxt[s] = frFF.options[0].text;
				frFF.options[0] = null;
			}
		}

		if (sort == true)
		{
			if (toFF.length == 0) toFFst = 0;
			else for ( toFFst=toFF.length-1;dS_sortAbeforeB(frFFtxt[0],toFF.options[toFFst].text);--toFFst ) if ( toFFst == 0 ) break;
			var toFFval = new Array(), toFFtxt = new Array();
			for ( s=toFFst;s<toFF.length;++s )
			{
				toFFval[s-toFFst] = toFF.options[s].value; toFFtxt[s-toFFst] = toFF.options[s].text;
			}
			newLength = toFF.length + frFFval.length;
			toFFi = 0; frFFi = 0;
			for ( s=0;s<newLength-toFFst;++s )
			{
				if ( toFFi == toFFval.length )
				{
					toFF.options[s+toFFst] = new Option( frFFtxt[frFFi], frFFval[frFFi] ); ++frFFi;
				}
				else if ( frFFi == frFFval.length )
				{
					toFF.options[s+toFFst] = new Option( toFFtxt[toFFi], toFFval[toFFi] ); ++toFFi;
				}
				else
				{
					if ( dS_sortAbeforeB(toFFtxt[toFFi],frFFtxt[frFFi]) )
					{
						toFF.options[s+toFFst] = new Option( toFFtxt[toFFi], toFFval[toFFi] ); ++toFFi;
					}
					else
					{
						toFF.options[s+toFFst] = new Option( frFFtxt[frFFi], frFFval[frFFi] ); ++frFFi;
					}
				}
			}

			for ( ;toFFi<toFFval.length;++toFFi )
			{
				toFF.options[s] = new Option( toFFtxt[toFFi], toFFval[toFFi] ); ++s;
			}
			for ( ;frFFi<frFFval.length;++frFFi )
			{
				toFF.options[s] = new Option( frFFtxt[frFFi], frFFval[frFFi] ); ++s;
			}
		}
		else
		{
			for ( s=0;s<frFFval.length;++s )
			{
				toFF.options[toFF.length] = new Option( frFFtxt[s], frFFval[s] );
			}
		}

		if ( act.indexOf('des') == -1 )
		{
			if ( ret == 'selected' || ret == 'all' ) dS_setSelectedList( toFF, thisForm, eval('thisForm.selected'+nameFF), eLVD );
			if ( ret == 'changes' || ret == 'all' ) dS_setChangedLists( frFFval, thisForm, eval('thisForm.add'+nameFF), eval('thisForm.remove'+nameFF), eLVD );
		}
		else
		{
			if ( ret == 'selected' || ret == 'all' ) dS_setSelectedList( frFF, thisForm, eval('thisForm.selected'+nameFF), eLVD );
			if ( ret == 'changes' || ret == 'all' ) dS_setChangedLists( frFFval, thisForm, eval('thisForm.remove'+nameFF), eval('thisForm.add'+nameFF), eLVD );
		}
		if ( frFFval.length != 0) eval(unescape(onChng));
	}

function dS_sortAbeforeB( vA, vB )
{
	vA = vA.toLowerCase(); vB = vB.toLowerCase();
	if ( vB >= vA ) return true;
	else return false;
}


function dS_setSelectedList( FF, thisForm, selFF, eLVD )
{
	var LVD = unescape(eLVD), selList = new Array();
	if (FF.length == 0)
	{
		selFF.value = '';
	}
	else
	{
		for ( s=0;s<FF.length;++s )
		{
			selList[s] = FF.options[s].value;
			selFF.value = selList.join(LVD);
		}
	}
}


function dS_setChangedLists( chAr, thisForm, aFF, dFF, eLVD )
{
	var LVD = unescape(eLVD);
	for ( s=0;s<chAr.length;++s )
	{
		var v = chAr[s], vL = v.length, dFFL = dFF.value.length, vI;
		if ( dFF.value == v ) dFF.value = '';
		else if ( dFF.value.substring(0,vL+1) == (v + LVD) ) dFF.value = dFF.value.substring(vL+1,dFFL);
		else if ( dFF.value.indexOf( LVD + v + LVD ) != -1 )
		{
			vI = dFF.value.indexOf( LVD + v + LVD );
			dFF.value = dFF.value.substring(0,vI) + dFF.value.substring(vI+vL+1,dFFL) ;
		}
		else if ( dFF.value.substring(dFFL-vL-1,dFFL) == (LVD + v) ) 	dFF.value = dFF.value.substring(0,dFFL-vL-1);
		else
		{
			if ( aFF.value.length == 0 ) aFF.value = v;
			else aFF.value = aFF.value + LVD + v;
		}
	}
}