function displayElement(elementId, displayStyle)
{
	var element = document.getElementById(elementId);
	if (element != null)
		element.style.display = displayStyle;
}

function showElement(elementId, display)
{
	var element = document.getElementById(elementId);
	if (element != null)
		element.visibility = (display)?"visible":"hidden";
}

function getRepeaterControlId(causingElementId, causingElementName, elementId)
{
	var elementPos = causingElementId.indexOf(causingElementName);
	var rptName = causingElementId.substr(0, elementPos);
	
	var rptElementId = rptName + elementId;

	return rptElementId;
}

function enableRepeaterControl(causingElementId, causingElementName, elementId, bEnable)
{
	var rptElement = document.getElementById(getRepeaterControlId(causingElementId, causingElementName, elementId));
	if (rptElement != null)
		rptElement.disabled = bEnable;
}

function toggleEnableRepeaterControl(causingElementId, causingElementName, elementId)
{
	var rptElement = document.getElementById(getRepeaterControlId(causingElementId, causingElementName, elementId));
	if (rptElement != null)
		rptElement.disabled = !rptElement.disabled;
}

function addStyle(element, property, value)
{
	if (element != null)
	{
		element.style['prevStyle'] = element.style[property];
		element.style[property] = value;
	}
}

function removeStyle(element, property)
{
	if (element != null)
		element.style[property] = "";
}

function restoreStyle(element, property)
{
	if (element != null)
		element.style[property] = element.style['prevStyle'];
}

function addRepeaterControlStyle(causingElementId, causingElementName, elementId, property, value)
{
//	alert(causingElementId+", "+causingElementName+", "+elementId);
	var rptElement = document.getElementById(getRepeaterControlId(causingElementId, causingElementName, elementId));
//	alert(rptElement);
	if (rptElement != null)
		addStyle(rptElement, property, value);
}

function removeRepeaterControlStyle(causingElementId, causingElementName, elementId, property, value)
{
	var rptElement = document.getElementById(getRepeaterControlId(causingElementId, causingElementName, elementId));
	if (rptElement != null)
		restoreStyle(rptElement, property);
}

function displayRepeaterControl(causingElementId, causingElementName, elementId, displayStyle)
{
	var rptElement = document.getElementById(getRepeaterControlId(causingElementId, causingElementName, elementId));

	if (rptElement != null)
		displayElement(rptElement.id, displayStyle);
}

function doRepeaterControlClick(causingElementId, causingElementName, elementId)
{
	var rptElement = document.getElementById(getRepeaterControlId(causingElementId, causingElementName, elementId));

	if (rptElement != null)
		rptElement.click();
}
