function RLDataItem(value, text)
{
	this.value = value;
	this.text = text;
	return this;
}

function renderRLChild(parentItemId)
{
	if (childList.options != null)
		childList.options.length = 0;
	
	for (var i=0; i<RLData[parentItemId].length; i++)
	{
		var option = document.createElement("OPTION");
		option.text  = RLData[parentItemId][i].text;
		option.value = RLData[parentItemId][i].value;
		
		childList.options[childList.length] = option;
	}
	
	selectRLChild("");
	if(selectedList)
		parentList.selectedIndex = -1;
}

function selectRLChild(childItemId)
{
	childList.value = childItemId;
	if(childValueField)
		childValueField.value = childItemId;
}

function selectValue()
{
	if (childList.selectedIndex > -1)
	{
		//getting value
		var selOption = childList.options[childList.selectedIndex];
			
		if(selOption.value!=''){
		    if (!checkSelected(selOption.value))
		    {
			    addValueInList(selOption);
		    }
		}
		else{
	        for(var i=1;i<childList.length;i++)
            {
                var selOption = childList.options[i];
                if (!checkSelected(selOption.value))
		        {
			        addValueInList(selOption);
		        }
            }
		}
		

		
		childList.selectedIndex = - 1;
	}
}

function addValueInList(selOption)
{
    //adding value
	var option = document.createElement("OPTION");
	option.text  = selOption.text;
	option.value = selOption.value;
	option.selected = true;
	selectedList.options[selectedList.length] = option;
}

function removeValue()
{
	if (selectedList.selectedIndex -1)
		selectedList.options[selectedList.selectedIndex] = null;
}

function checkSelected(value)
{
	for(j=0; j<selectedList.length; j++)
		if (selectedList.options[j].value == value)
			return true;
	return false;
}