
	function div_img_switch(divid, imageid)
	{	// Toggle a div (visible / invisible) with a collapse / expand image
		document.getElementById(divid).style.display = document.getElementById(divid).style.display == 'none' ? '' : 'none';

		if (right(document.getElementById(imageid).src, 10) == "expand.gif")
		{	document.getElementById(imageid).src = document.getElementById(imageid).src.substring(0, document.getElementById(imageid).src.length - 10) + "collapse.gif";
		}
		else
		{	document.getElementById(imageid).src = document.getElementById(imageid).src.substring(0, document.getElementById(imageid).src.length - 12) + "expand.gif";
		}
	}

	function toggle_field(field)
	{	if(right(document.getElementById('img_' + field).src, 10) == "expand.jpg")
		{	document.getElementById('img_' + field).src = "" + field + "_collapse.jpg";
			document.getElementById('div_' + field + '_expand').style.display = 'none';
			document.getElementById('div_' + field + '_collapse').style.display = '';
		}
		else
		{	document.getElementById('img_' + field).src = "" + field + "_expand.jpg";
			document.getElementById('div_' + field + '_expand').style.display = '';
			document.getElementById('div_' + field + '_collapse').style.display = 'none';
		}
	}

	function font_increase(div_id)
	{	font_size = document.getElementById(div_id).style.fontSize.replace('px', '');
		line_height = document.getElementById(div_id).style.lineHeight.replace('px', '');

		if (font_size == "")
		{	font_size = 11;
		}
		if (line_height == "")
		{	line_height = 14;
		}

		document.getElementById(div_id).style.fontSize = (font_size * 1 + 2) + 'px';
		document.getElementById(div_id).style.lineHeight = (line_height * 1 + 2) + 'px';
	}

	function font_decrease(div_id)
	{	font_size = document.getElementById(div_id).style.fontSize.replace('px', '');
		line_height = document.getElementById(div_id).style.lineHeight.replace('px', '');

		if (font_size == "")
		{	font_size = 11;
		}
		if (font_size <= 3)
		{	font_size = 3
		}
		if (line_height == "")
		{	line_height = 14;
		}
		if (line_height <= 6)
		{	line_height = 6
		}

		document.getElementById(div_id).style.fontSize = (font_size * 1 - 2) + 'px';
		document.getElementById(div_id).style.lineHeight = (line_height * 1 - 2) + 'px';
	}

	function right(str, n)
	{	if (n <= 0)
		{	// Interrupt proces since n is invalid
			return "";
		}
		else if (n > String(str).length)
		{	// Interrupt proces since n is invalid (return full string)
			return str;
		}
		else
		{	var iLen = String(str).length;
			return String(str).substring(iLen, iLen - n);
		}
	}
	
	function left(str, n)
	{	if (n <= 0)
		{	return "";
		}
		else if (n > String(str).length)
		{	return str;
		}
		else
		{	return String(str).substring(0,n);
		}
	}
