function CheckTA()
{
var max= 750, textinhalt;
textinhalt=document.getElementById("tx_comments_pi1_content").value;
if (textinhalt.length >= max)
{
document.getElementById("tx_comments_pi1_content").value=textinhalt.substring(0,max);
document.getElementById("tx_comments_pi1_content").scrollTop = document.getElementById("tx_comments_pi1_content").scrollHeight;
/*document.getElementById("tx_comments_pi1_content").blur();*/
textinhalt=document.getElementById("tx_comments_pi1_content").value;
}
if (textinhalt.length > 0)
{
document.getElementById("counter").firstChild.data = textinhalt.length +"/"+ max;
} 
if (textinhalt.length == 0){
document.getElementById("counter").firstChild.data = "max. "+max+" Zeichen"
}

if (textinhalt.length >= max)
{
document.getElementById("counter").style.color = "#ff0000";
document.getElementById("counter").style.background = "#F5F500";
document.getElementById("counter").style.border = "1px solid black";
document.getElementById("counter").firstChild.data = textinhalt.length + "/" + max;
}
 else {
document.getElementById("counter").style.color = "#000000";
document.getElementById("counter").style.background = "#ffffff";
document.getElementById("counter").style.border = "0px solid black";
}
}
