function change_dependencies( listname, new_value ) 
{
// classname используется для хранения старого значения выбранного элемента списка
var oldCategory = document.getElementById("category").className;
var oldProductType = document.getElementById("product_type_"+oldCategory).className;
if ( listname == "category" )
{
	document.getElementById("product_type_"+oldCategory).style.display = "none";
	document.getElementById("product_type_"+new_value).style.display = "block";

	document.getElementById("manufacture_"+oldCategory).style.display = "none";
	document.getElementById("manufacture_"+new_value).style.display = "block";
}
var tmpElement;
if ( oldProductType > 0 ) 
{
	var i = 1;
	while ( i < 6 )
	{
      tmpElement = document.getElementById("option"+oldProductType+"_"+i+"_tr");
	if ( tmpElement)
		tmpElement.style.display = "none";
      tmpElement = document.getElementById("option"+oldProductType+"_"+i+"_label");
	if ( tmpElement)
		tmpElement.style.display = "none";
      tmpElement = document.getElementById("option"+oldProductType+"_"+i+"");
	if ( tmpElement)
		tmpElement.style.display = "none";
      tmpElement = document.getElementById("option"+oldProductType+"_"+i+"_label_from");
	if ( tmpElement)
		tmpElement.style.display = "none";
      tmpElement = document.getElementById("option"+oldProductType+"_"+i+"_from");
	if ( tmpElement)
		tmpElement.style.display = "none";
      tmpElement = document.getElementById("option"+oldProductType+"_"+i+"_label_to");
	if ( tmpElement)
		tmpElement.style.display = "none";
      tmpElement = document.getElementById("option"+oldProductType+"_"+i+"_to");
	if ( tmpElement)
		tmpElement.style.display = "none";
	i = i+1;
	}
}

var optionID;
if ( listname != "category" )
	optionID = "option"+new_value;
else
	optionID = "option"+document.getElementById("product_type_"+new_value).className;

	var i = 1;
	while ( i < 6 )
	{
      tmpElement = document.getElementById(optionID+"_"+i+"_tr");
	if ( tmpElement)
		tmpElement.style.display = "table-row";
      tmpElement = document.getElementById(optionID+"_"+i+"_label");
	if ( tmpElement)
		tmpElement.style.display = "inline";
      tmpElement = document.getElementById(optionID+"_"+i+"");
	if ( tmpElement)
		tmpElement.style.display = "inline";
      tmpElement = document.getElementById(optionID+"_"+i+"_label_from");
	if ( tmpElement)
		tmpElement.style.display = "inline";
      tmpElement = document.getElementById(optionID+"_"+i+"_from");
	if ( tmpElement)
		tmpElement.style.display = "inline";
      tmpElement = document.getElementById(optionID+"_"+i+"_label_to");
	if ( tmpElement)
		tmpElement.style.display = "inline";
      tmpElement = document.getElementById(optionID+"_"+i+"_to");
	if ( tmpElement)
		tmpElement.style.display = "inline";
	i = i+1;
	}

//document.getElementById("product_type_"+oldCategory).className = 0;
if ( listname == "category" )
	document.getElementById("category").className = String(new_value);
else
	document.getElementById("product_type_"+oldCategory).className = String(new_value);
}


