function limit( field, maxlimit, limit_id )
{
	//alert(field + ' - ' + limit_id);
	var limitreached = false;
	var strlen = field.value ? field.value.length : 0;
	if ( strlen > maxlimit )
	{
		limitreached = true;
		field.value = field.value.substr( 0, maxlimit );
		strlen = field.value ? field.value.length : 0;
	}
	if ( counter = document.getElementById( 'limitcounter' + limit_id ) )
		counter.innerHTML = strlen;
/*
	if ( legend = document.getElementById( 'limit' + limit_id ) )
		legend.style.color = limitreached ? 'red' : 'black';
*/
}

function posint( targ_input )
{
	if ( !targ_input.value ) return;
	
	output = targ_input.value.replace( /(^0*)|[^0-9]*/gi, '' );
	targ_input.value = output;
}

function clean_ss( targ_input )
{
	if ( !targ_input.value ) return;
	
	output = targ_input.value.replace( /[^0-9\-]*/gi, '' );
	targ_input.value = output;
}

function clean_phone( targ_input )
{
	if ( !targ_input.value ) return;
	
	output = targ_input.value;
	output = output.replace( /[^0-9\-.]*/gi, '' );
	output = output.replace( /\./gi, '-' );
	targ_input.value = output;
}

function clean_date( targ_input )
{
	if ( !targ_input.value ) return;
	
	output = targ_input.value;
	output = output.replace( /[^0-9\-\/]*/gi, '' );
	output = output.replace( /\-/gi, '/' );
	targ_input.value = output;
}
	
