function show(argId)
{
	document.getElementById(argId).style.display = '';
	return true;
}


function hide(argId)
{
	document.getElementById(argId).style.display = 'none';
	return false;
}


/* show or hide a element */
function showHide(argId)
{
	el = document.getElementById(argId);
	if (el.style.display)
	{
		show(argId);
		return true;
	}
	else
	{
		hide(argId);
		return false;
	}
}


function enable(argId)
{
	document.getElementById(argId).disabled = false;
}


function disable(argId)
{
	document.getElementById(argId).disabled = true;
}


/* enable or disable a element */
function enableDisable(argId)
{
	if (document.getElementById(argId).disabled)
	{
		enable(argId);
		return false;
	}
	else
	{
		disable(argId);
		return true;
	}
}


/* function to select option rows */
function select(argSelectId,argOptionRow)
{
	if (document.getElementById(argSelectId).options[argOptionRow])
	{
		document.getElementById(argSelectId).options[argOptionRow].selected = 1;
		return true;
	}
}


function deselect(argSelectId,argOptionRow)
{
	if (document.getElementById(argSelectId).options[argOptionRow])
	{
		document.getElementById(argSelectId).options[argOptionRow].selected = 0;
		return true;
	}
}


/* function to (de)select option rows */
function selectDeselect(argSelectId,argOptionRow)
{
	el = document.getElementById(argSelectId);
	if (!el.options[argOptionRow])
	{
		return;
	}

	if (el.options[argOptionRow].selected)
	{
		deselect(argSelectId,argOptionRow);
		return false;
	}
	else
	{
		select(argSelectId,argOptionRow);
		return true;
	}
}


/* select all options */
function selectAll(argSelectId,argCheckboxPart)
{
	el = document.getElementById(argSelectId);
	if (!el.options.length)
	{
		return;
	}
	for (x=0;x<el.options.length;x++)
	{
		el.options[x].selected = 1;
		document.getElementById(argCheckboxPart+x).checked = 1;
	}
}


/* deselect all options */
function deselectAll(argSelectId,argCheckboxPart)
{
	el = document.getElementById(argSelectId);
	if (!el.options.length)
	{
		return;
	}
	for (x=0;x<el.options.length;x++)
	{
		el.options[x].selected = 0;
		document.getElementById(argCheckboxPart+x).checked = 0;
	}
}


/* href submit form and add action */
function hrefSubmit(argAction)
{
	document.forms[0].action += argAction;
	document.forms[0].submit();
}


/* return options checked in list(s) */
function listsChecked(argArrayIds)
{
	var x, y, z = 0, list;
	for (x=0;x<argArrayIds.length;x++)
	{
		list = document.getElementById(argArrayIds[x]);
		for (y=0;y<list.options.length;y++)
		{
			if (list.options[y].selected)
			{
				z++;
			}
		}
	}
	
	return z;
}

function changeImg(argId,argImgSrc)
{
	document.getElementById(argId).src = argImgSrc;
}
