
/*****************************************************
*****************************************************/
function update_selectEntity(Son_Name,Parent_Value,Son_Value)
{
//alert("Son_Name-->"+Son_Name);
//alert("Parent_Value-->"+Parent_Value);
//alert("Son_Value-->"+Son_Value);
	var SonCombo = document.all[''+Son_Name];
	var i;					// index of the parent arrays.
	var WhoActive;
   	if (SonCombo)
	{
		//alert('Son_Name = ' + Son_Name + '----' + 'Parent_Value = ' + Parent_Value + '----' + 'Son_Value = ' + Son_Value) 
		
		// Remove all the current options
		while(SonCombo.length) SonCombo.options[0]=null;
		
		//  the son arrays
		var aRowsParentIDs =eval(Son_Name+"_ParentIDs");
		var aRowsText      =eval(Son_Name+"_Text"     );
		var aRowsIDs       =eval(Son_Name+"_IDs"      );
		var HiddenName     =eval("document.all.Temp"+Son_Name);
		//if AllowEmpty then add the empty line.
		//if ( SonCombo.AllowEmpty ) alert (Son_Name)
		if ( SonCombo.AllowEmpty ) 
		{
			SonCombo.options.add (new Option('Any',''));
		};
		for (i = 0;i<(aRowsParentIDs.length);i++)
		{
			if ( aRowsParentIDs[i]==Parent_Value && Parent_Value!='' )
			{
				SonCombo.options.add (new Option(unescape(aRowsText[i]),aRowsIDs[i]));
		    };
		};
		
		// in case there are no lines in the combo add empty line
		if ( SonCombo.length==0)
		{
			SonCombo.options.add (new Option('Any',''));
		    SonCombo.options[0].selected=true;
		};
		//handle back
		if (HiddenName)
			if (HiddenName.value != '') Son_Value = HiddenName.value;
		
		
		//select the correct line
		if ( !Son_Value || Son_Value=='') 
		{
		   SonCombo.options[0].selected=true;
		}
		else
		{
			
			SonCombo.selectedIndex = -1;
			
			SonCombo.value = Son_Value;
			
			if (SonCombo.value != Son_Value) 
			{
			  SonCombo.options[0].selected=true;
		    }
		};
		//handle back
		if (HiddenName) HiddenName.value = SonCombo.value;

		
		
		//Call the son for rebuild his values		
		try
		{
			SonCombo.onchange();
		}catch(e){}	
	}
}

function SetActiveField(Myfield)
{
Myfield.focus()
}