function changeSelectedItem(TargetListBox,SourceCode,SelectedValue)
{
    TargetListBox.length = 0;
    if(SelectedValue==0)
        return false;
    var aryCode = SourceCode.split("|");

    for(var i=0;i<aryCode.length;i++)
	{
		var aryItem = aryCode[i].split(",");
		if(aryItem[0].substr(0, SelectedValue.length)==SelectedValue && aryItem[1]!="")
		    TargetListBox.options.add(new Option(aryItem[1],aryItem[0]));
	}
	
}
function addListBoxItem(SourceListBox,TargetListBox)
{
    var intMaxCount=3

	if(SourceListBox.selectedIndex>=0)
	{
		if (TargetListBox.options.length >= intMaxCount)
		{
			alert('不能超过' + intMaxCount + '个!');
			return false;
		}
		for (var i=0;i<TargetListBox.options.length;i++)
		{
			if (TargetListBox.options[i].value == SourceListBox.options[SourceListBox.selectedIndex].value)
			{
				alert('您不能重复加入!');
				return false;
			}
		}

	   TargetListBox.options.add(new Option(SourceListBox.options[SourceListBox.selectedIndex].text,SourceListBox.options[SourceListBox.selectedIndex].value));
	   selectAllListBoxItem(TargetListBox);
	}
}
function removeListBoxItem(TargetListBox)
{
	for (var i = TargetListBox.length - 1; i>=0; i--)
	{
		if (TargetListBox.options[i].selected)
		{
		  TargetListBox.remove(i);
		}
	}
	selectAllListBoxItem(TargetListBox);
}

function selectAllListBoxItem(TargetListBox)
{
    for (var i=0;i<TargetListBox.length;i++)
    {
        TargetListBox.options[i].selected=true;
    }
}