function Trim(s) {
var maxchars = 255; // Change number to maximum characters.
if (s.value.length > maxchars)
s.value = s.value.substring(0,maxchars);
}
var textcontrol;
function TrimPaste(s)
{
textcontrol = s
setTimeout(function()
{
var maxchars = 255; // Change number to maximum characters.
if (textcontrol.value.length > maxchars)
textcontrol.value = textcontrol.value.substring(0,maxchars);
}, 50); // 1ms should be enough
}

function CheckPersonalizedText(form)
{
if (form.CustomText.value != "")
{
if(form.CustomText.value.substr(0,1) >= "a" && form.CustomText.value.substr(0,1) <= "z")
{
return confirm("The 'Personalized Text' entered for this chart starts with a lower case letter. If this is correct click 'OK' else click 'Cancel' to make changes.");
}
else
{
return true;
}
}
}
