var lastBoundControl;

function ShowCal(a, defD, minD, maxD, fD, dC, lng)
{
	var d;
	if ((a.value == "") || (a.value == fD))
	{
		var o = document.getElementById(dC);
		if ((o == null) || (o.value == "") || (o.value == fD))
			d = defD;
		else
			d = o.value;
	}
	else
		d = a.value;
		
	ShowCalendar(a.id, 'Calendar', minD, maxD, d, fD, lng);
	lastBoundControl = a.id;
}

function HideCal()
{
	var c = document.getElementById("Calendar");
	if (c != null) c.style.visibility = "hidden";
}

function PosCalOnResize()
{
	if (document.getElementById("Calendar").style.visibility == "visible" && lastBoundControl != null)
		SetCalendarPos(lastBoundControl, 'Calendar');
}

function AS()
{
	var s;
	if(divAdvancedSearch.style.display=='block') 
	{
		divAdvancedSearch.style.display='none'; 
		s = ">>";
	}
	else 
	{
		divAdvancedSearch.style.display='block';
		s = "<<";
	}
	
	SetInnerText("aAS", s);
}

function UpdOcc(o, s)
{
	if (aOcc != null)
		SetInnerText(o, aOcc[s.selectedIndex]);
}

function SetInnerText(o, s)
{
	var d = document.getElementById(o);
	d.textContent = s;
	
	if (d != null)
		if (document.all)	// IE 
			d.innerText = s;
		else				// MOZILLA
			d.textContent = s;
}

function ShowChildrenNote(dv)
{
	if (cba && idxa)
	{
		var d="none";
		for(var i=0;i<cba.length;i++)
		{
			var cb = document.getElementById(cba[i]);
			var si = cb.options[cb.selectedIndex].value;
			for(var n=0;n<idxa.length;n++)
			if (idxa[n]==si)
			{
				d="block";
				break;
			}
			if(d=="block")
				break;
		}
		document.getElementById(dv).style.display=d;
	}
}
	
