// JavaScript Document
//***********************************************************
//*	Criado Por:		Jaime Peixe								*
//*	Criado Em:		21/11/2007								*
//*	Modificado Por:	Jaime Peixe								*
//*	Modificado Em:	20/05/2008								*
//*	Funcionalidade:	Conta os Dígitos do Campo				*
//***********************************************************
function countCharacters(type,obj,length,count){
	try{
		if(obj.value.length >= length){
			obj.value = obj.value.toString().substr(0,length);
		}
		
		switch(type){
			case 1:
				document.getElementById(count).value = obj.value.length;
			break;
			case 2:
			break;			
			default:
				document.getElementById(count).value = length - obj.value.length;
			break;
		}
		
		return true;
	} catch(e) {
		return false;	
	}
}
