function $(t)
{
	return document.getElementById(t);
}

function trim(t)
{
	return t.replace(/^\s+/, '').replace(/\s+$/, '');
}

function switchClass(objNode, strCurrClass, strNewClass)
{
	if (matchClass(objNode, strNewClass))
		 replaceClass(objNode, strCurrClass, strNewClass);
	else replaceClass(objNode, strNewClass, strCurrClass);
}

function removeClass(objNode, strCurrClass)
{
	replaceClass(objNode, '', strCurrClass);
}

function addClass(objNode, strNewClass)
{
	replaceClass(objNode, strNewClass, '');
}

function replaceClass(objNode, strNewClass, strCurrClass)
{
	var strOldClass = strNewClass;
	if (strCurrClass && strCurrClass.length)
	{
		strCurrClass = strCurrClass.replace('/\s+(\S)/g', '|$1');
		if (strOldClass.length) strOldClass += '|';
		strOldClass += strCurrClass;
	}
	objNode.className = objNode.className.replace(new RegExp('(^|\\s+)(' + strOldClass + ')($|\\s+)', 'g'), '$1');
	objNode.className += ((objNode.className.length)? ' ' : '') + strNewClass;
}

function matchClass(objNode, strCurrClass)
{
	return (objNode && objNode.className.length && objNode.className.match(new RegExp('(^|\\s+)(' + strCurrClass + ')($|\\s+)')));
}

function showId(id)
{
	$(id).style.display = 'block';
}

function hideId(id)
{
	$(id).style.display = 'none';
}


