function onChangeChoice(id)
{
	var f = document.forms["poll"];
	if(f.responseid.value != "")
	{
		document.images["imgchoice"+f.responseid.value].className = "imgRadio";
	}
	f.responseid.value = id;
	document.images["imgchoice"+id].className = "imgRadioSelected";
}




/********************************/
var divContainer = null;
var stepTime = 10;
var handleTick = null;
var stepHeight = 5;
var hideLimit = 500;
var lastID = null;
/********************************/
function clearTick(handle)
{
	if(handle != null)
	{
		clearInterval(handle);
		handle = null;
	}
	return null;
}

function showSubMenu(id)
{
	handleTick = clearTick(handleTick);
	hideHandler = clearTick(hideHandler);
	var div = document.getElementById('sub'+id);
	if(div == null) return;
	div.style.display = "block";
	if( typeof(div.normalHeight) == "undefined" )
		div.normalHeight = div.scrollHeight;

	divContainer = div;
	handleTick = setInterval("FxScroll(true)", stepTime); 
	if(lastID != null && lastID != id)
		DirectHide(lastID);
	lastID = id;
}

function DirectHide(id)
{
	var div = document.getElementById('sub'+id);
	if(div == null) return;
	div.style.display = "none";
	div.style.height = '0px';
}

function Debug(v)
{
	document.forms["frmSearch"].q.value = v;
}

function FxScroll(isShow)
{
	currentHeight = divContainer.style.height.substr(0, divContainer.style.height.length-2)*1;
	currentHeight += isShow ? stepHeight : -stepHeight;
	if(isShow && currentHeight > divContainer.normalHeight)
	{
		currentHeight = divContainer.normalHeight;
		handleTick = clearTick(handleTick);
	}
	if(!isShow && currentHeight <= 0)
	{
		currentHeight = 0;
		handleTick = clearTick(handleTick);
		divContainer.style.display = "none";
	}
	
	divContainer.style.height = currentHeight+'px';
}

var hideHandler = null;
function hideSubMenu(id)
{
	hideHandler = clearTick(hideHandler);
	hideHandler = setInterval('tryHideSubMenu('+id+')', hideLimit);
}

function tryHideSubMenu(id)
{
	hideHandler = clearTick(hideHandler);
	handleTick = clearTick(handleTick);
	div = document.getElementById('sub'+id);
	if(div == null) return;
	divContainer = div;
	
	handleTick = setInterval("FxScroll(false)", stepTime);
}

function HideLastSubMenu()
{
	tryHideSubMenu(lastID);
}