var number	= "0123456789";
var alpha	= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var alphanum= alpha+number;
var accented= "ÀÁÈÉÌÍÒÓÙÚàáèéìíòóùú";
var phone	= number+"()+/ .-";
var flname	= alpha+accented+" .'";
var company = alphanum+accented+" .'";
var customer= alphanum+" -";
var city	= flname+accented+"-";
var address = city+number+accented+"()./,";

function res(t,v)
{
var w = "";
	for (i=0; i<t.value.length; i++) {
		x = t.value.charAt(i);
			if (v.indexOf(x,0) != -1) {
				w += x;
			}
	}
t.value = w;
}

function charsleft(fieldname,maxchar,countername)
{
	theInputBox = document.getElementById(''+fieldname+'');
	theCountBox = document.getElementById(''+countername+'');
	var currentChars = theInputBox.value.length;
	theCountBox.value = Math.max((maxchar - currentChars),0);

		if (currentChars > maxchar) {
			theInputBox.value = theInputBox.value.substring(0,maxchar);
		}

}
