function show (id)
{
	el = document.getElementById(id);

	if (el != null && el.className == "hid")
	{
		el.className = "vis";
	}
}
function hide (id)
{
	el = document.getElementById(id);

	if (el != null && el.className == "vis")
	{
		el.className = "hid";
	}
}
function showhide (id)
{
	el = document.getElementById(id);

	if (el != null && el.className == "vis")
	{
		el.className = "hid";
	}
	else if (el != null && el.className == "hid")
	{
		el.className = "vis";
	}
}
function selshow (obj, prefix)
{
	for (var i = 0; i < obj.length; i++)
	{
		hide(prefix + i);
	}

	show(prefix + obj.selectedIndex);
}

var nodeMsg  = 'Do you really want to delete this node (and sub-nodes)';

/**
 * Displays an confirmation box beforme to submit a "DROP/DELETE/ALTER" query.
 * This function is called while clicking links
 *
 * @param   object   the link
 * @param   object   the sql query to submit
 *
 * @return  boolean  whether to run the query or not
 */
function confirmLink(theLink, theSqlQuery)
{
	// Confirmation is not required in the configuration file
	// or browser is Opera (crappy js implementation)
	if (nodeMsg == '' || typeof(window.opera) != 'undefined')
	{
		return true;
	}

	var is_confirmed = confirm(nodeMsg + ':\n' + theSqlQuery);
	if (is_confirmed)
	{
		theLink.href += '&is_js_confirmed=1';
	}

	return is_confirmed;
}

var userMsg  = 'Do you really want to delete this user';

/**
 * Displays an confirmation box beforme to submit a "DROP/DELETE/ALTER" query.
 * This function is called while clicking links
 *
 * @param   object   the link
 * @param   object   the sql query to submit
 *
 * @return  boolean  whether to run the query or not
 */
function confirmUserLink(theLink, theSqlQuery)
{
	// Confirmation is not required in the configuration file
	// or browser is Opera (crappy js implementation)
	if (userMsg == '' || typeof(window.opera) != 'undefined')
	{
		return true;
	}

	var is_confirmed = confirm(userMsg + ':\n' + theSqlQuery);
	if (is_confirmed)
	{
		theLink.href += '&is_js_confirmed=1';
	}

	return is_confirmed;
}

var resetMsg  = 'Do you really want to reset the questionnaire for this user';

/**
 * Displays an confirmation box beforme to submit a "DROP/DELETE/ALTER" query.
 * This function is called while clicking links
 *
 * @param   object   the link
 * @param   object   the sql query to submit
 *
 * @return  boolean  whether to run the query or not
 */
function confirmResetLink(theLink, theSqlQuery)
{
	// Confirmation is not required in the configuration file
	// or browser is Opera (crappy js implementation)
	if (resetMsg == '' || typeof(window.opera) != 'undefined')
	{
		return true;
	}

	var is_confirmed = confirm(resetMsg + ':\n' + theSqlQuery);
	if (is_confirmed)
	{
		theLink.href += '&is_js_confirmed=1';
	}

	return is_confirmed;
}