
function ShowViewState()
{
	var buf = document.forms[0]['__VIEWSTATE'].value;
	alert('View state is ' + buf.length + ' bytes');
}

function SetFocusToControl(id)
{
	var o = findControl('input', id);
    if( o != null )
	{
		o.focus();
		return true;
	}
	else
		return false;
}

function Hidediv( divid )
{
	var divlayer = document.getElementById( divid );

	if( divlayer.style.display == "none" )
	{
		divlayer.style.display = "";
	}
	else
	{
		divlayer.style.display = "none";
	}
}

function findControl( tagName, controlId )
{
	var aControls = document.getElementsByTagName(tagName);
	if( aControls == null )
		return null;

	for (var i = 0; i < aControls.length; i++)
	{
		var j = aControls[i].id.lastIndexOf(controlId);
		if ((j != -1) && (j == (aControls[i].id.length - controlId.length)))
			return aControls[i];
	}

	return null;
}
