
/*
////////////////////////////
	Lumon
	Written by: Stefan Hospes
	Start: 3 - 9 - 2006
	File: Engine.js
////////////////////////////
*/

function addsmiley(value)
{
	document.getElementById('itemfield').value += ' ' + value + ' ';
    document.getElementById('itemfield').focus();
}

function countchar(str,chr)
{
	var count = 0;
	
	for(var x = 0; x < str.length; x++)
	{
		if(str.charAt(x) == chr)
		{
			count++;
		}
	}
	
	return count;
}

function textCounter(field, countfield, maxlimit) 
{
	if (field.value.length > maxlimit)
	{
		field.value = field.value.substring(0, maxlimit);
	}
	else
	{
		countfield.value = maxlimit - field.value.length;
	}
}
