﻿function setText(element, text)
{
	if (typeof element.innerText != 'undefined')
	{
		element.innerText = text;
	}
	else if (typeof element.textContent != 'undefined')
	{
		element.textContent = text;
	}
}
function swapNextDisplay(el1)
{
	if (el1 && el1.nextSibling) {
		var el2 = el1.nextSibling;
		while(el2.nodeType != 1) {
			el2 = el2.nextSibling;
		}
		if (el2) {
			var display = el1.style.display;
			el1.style.display = el2.style.display;
			el2.style.display = display;
		}
	}
}
function swapDisplay(el1Id, el2Id)
{
	var el1 = $get(el1Id);
	var el2 = $get(el2Id);
	var display = el1.style.display;
	el1.style.display = el2.style.display;
	el2.style.display = display;
}
function switchDisplay(el1Id)
{
	var el1 = $get(el1Id);
	if (el1.style.display == 'none') {
		el1.style.display = '';
	} else {
		el1.style.display = 'none';
	}
}
function doShow(el1Id)
{
	var el1 = $get(el1Id);
	el1.style.display = '';
}
function doHide(el1Id)
{
	var el1 = $get(el1Id);
	el1.style.display = 'none';
}
function encodeString(str) {
	return str.replace(/'/gi,"\\\'");
}