function contaCaracteres(boxcontado, contarcorpo, valormax) {    
	var field = document.getElementById(boxcontado);
	if (field && field.value.length >= valormax) {
		field.value = field.value.substring(0, valormax);
	}
	var txtField = document.getElementById(contarcorpo);
	if (txtField) {  
		txtField.innerHTML = field.value.length;
	}
}

function contaCaracteresNew(boxcontado, contarcorpo, total) {
	if((document.getElementById('MP').checked == true)){
		var valormax = 170;
	}
	if((document.getElementById('D1').checked == true) || (document.getElementById('D2').checked == true)){
		var valormax = 100;
	}
	var field = document.getElementById(boxcontado);
	if (field && field.value.length >= valormax){
		field.value = field.value.substring(0, valormax);
	}
	var txtField = document.getElementById(contarcorpo);
	var t = document.getElementById(total).innerHTML = valormax;
	if(t){
		t;
	} else {
		document.getElementById(total).innerHTML = "Escolha um Tipo Manchete!";
	}
	if (txtField){
		txtField.innerHTML = field.value.length;
	}
}

