

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  Jeff Harding (jbh@site-ations.com ) -->
<!-- Web Site:  http://site-ations.com -->
<!-- Begin
oldvalue1=0;
oldvalue2=0;
oldvalue3=0;


function textCounterMulti(toplimit,field) {
var gtposition = new Array()
var ltposition = new Array()
var tagtext = new Array()
tagtext[0]=0;

var total_length=(field.value.length);
var actual_length=(field.value.length);
var totalstring=(field.value);

// find how many less than signs we have

lt='1';
opencount = 0;
opos = totalstring.indexOf("<");
while ( opos != -1 ) {
   opencount++;
   ltposition[lt]=totalstring.indexOf("<",opos);
   opos = totalstring.indexOf("<",opos+1);
   total_length=ltposition[lt];
lt++
}

gt='1'
closecount = 0;
cpos = totalstring.indexOf(">");
while ( cpos != -1 ) {
   closecount++;
   gtposition[gt]=totalstring.indexOf(">",cpos);
   cpos = totalstring.indexOf(">",cpos+1);
gt++
}

for(tt=1;tt<=opencount;tt++){
//alert(gtposition[tt]+" is the position of closer # "+tt);
if (closecount == opencount){
//alert(tt);
tagtext[tt]=((gtposition[tt]+1)-(ltposition[tt]))
//alert(tagtext[tt])
if(tt>1){
tagtext[tt]=(tagtext[tt-1]+tagtext[tt])
//alert(tagtext[tt])
document.headermaker.textintags.value=tagtext[tt];
}
}
}
total_length=(actual_length-tagtext[opencount]);
if((closecount=='0')&(opencount!='0')){
total_length=actual_length-(actual_length-ltposition[opencount]);
}
if((closecount<opencount)&(closecount!='0')){
insideopencount=opencount-1;
//alert(tagtext[closecount]+"\n"+tagtext[opencount])
total_length=1//actual_length-tagtext[insideopencount]((actual_length-ltposition[opencount]));
}
if((closecount=='0')&(opencount=='0')){

total_length=actual_length;
}
//alert(actual_length-(actual_length-ltposition[opencount]))((field2.value.length)+(field3.value.length))+((field.value.length)+(field3.value.length))+((field.value.length)+(field2.value.length))+
var maxvalue1 = ((toplimit)-(tagtext[opencount]));
var maxvalue2 = ((toplimit)-(tagtext[opencount]));
var maxvalue3 = ((toplimit)-(tagtext[opencount]));
//alert(field3.value.length+", "+toplimit)


if ((field.value.length > maxvalue1)&(toplimit!='0')&(oldvalue1 != field.value.length)){
//alert(field.value.length+" is the length, the last gt sign is at "+field.value.lastIndexOf(">")+" and the character at the end is "+field.value.charAt(field.value.length-1))
if(field.value.charAt(field.value.length-1)!=">"){
field.value = field.value.substring(0, maxvalue1);
//alert("you have exceeded the limit of "+toplimit+" characters for this item!\nYour text has been trimmed to fit, make changes and verify all paragraphs!")
}else if(field.value.charAt(field.value.length-1)==">"){
lasttaggroup=field.value.substring(field.value.lastIndexOf("<"), (field.value.lastIndexOf(">")+1))
//alert(lasttaggroup)
field.value = (field.value.substring(0,ltposition[opencount]-1)+lasttaggroup);
//alert("you have exceeded the limit of "+toplimit+" characters for this item!\nYour text has been trimmed to fit, make changes and verify all paragraphs!")
}
oldvalue1=field.value.length;


}
}
//  End -->

