/*cmb Extention*/
function ShowCmbWnd(list_name)
{
	var b=document.getElementById("cmbWindow_"+list_name);
	if(b)
		b.style.display="block";
	
	ShowSearchElementsEx(false);
	
}

function CloseCmbWnd(list_name)
{
	var b=document.getElementById("cmbWindow_"+list_name);
	if(b)
		b.style.display="none";
	
	ShowSearchElementsEx(true);	
}

function ShowSearchElementsEx(show)
{
	var form=document.getElementById("searchform");
	if(!form)
		return;
	var view="none";
	if(show)
		view="inline";
	for(var i=0;i<form.length;i++)
	{
		if(form.elements[i].type=="select-one")
			form.elements[i].style.display=view;
	}
}

function SelectCmbValues(list_name, list_parent,list_result_title)
{
	var sel=0;
	var cklist=document.getElementById("cmbList"+list_name);
	if(!cklist)
		return false;
	var ck=cklist.getElementsByTagName("input");
	for(i=0;i<ck.length;i++)
	{
		if(ck[i].checked)
			sel++;
	}
	
	var parent_cmb=document.getElementById(list_parent);
	
	if(!parent_cmb)
		return false;
	if(sel)
	{
		
		parent_cmb.value=-100;
		parent_cmb.options[parent_cmb.selectedIndex].text=list_result_title+": "+sel;
	}	
	else
	{
		parent_cmb.value=0;
	}
	
	document.getElementById("cmbWindow_"+list_name).style.display = 'none';
		
	ShowSearchElementsEx(true);
	
	return false;	
}

function ResetCmbValues(list_name, list_parent)
{
	var sel=0;
	var cklist=document.getElementById("cmbList"+list_name);
	if(!cklist)
		return;
		
	var ck=cklist.getElementsByTagName("input");
	for(i=0;i<ck.length;i++)
	{
		ck[i].checked=false;
	}
	var parent_cmb=document.getElementById(list_parent);
	if(parent_cmb)
		parent_cmb.value=0;
}

function cmbSelectAll(list_name, list_parent)
{
	ResetCmbValues(list_name,list_parent);
	document.getElementById("cmbWindow_"+list_name).style.display = 'none';
		
	ShowSearchElementsEx(true);	
}
/* end cmb Extention*/
