
var maxL=1000;
var bName = navigator.appName;
function taLimit(taObj) {
	if (taObj.value.length==maxL) return false;
	return true;
}

function taCount(taObj,Cnt) { 
	objCnt=createObject(Cnt);
	objVal=taObj.value;
	
	//when maxL is reached, do not add any more characters
	if (objVal.length>maxL) taObj.value=taObj.value.substring(0,maxL);
	
	//change text color to red when 5% remaining
	if (objVal.length>(maxL-(maxL*.05))) {
		document.getElementById('formCounter').style.color = '#ff0000';
		} 
		//change text color to orange when 10% remaining
		else if (objVal.length>(maxL-(maxL*.10))) {
			document.getElementById('formCounter').style.color = '#ff9900';
			} 
			//chante text color back to default color
			else {
				document.getElementById('formCounter').style.color = '#555555';
				}
			
	if (objCnt) {
		//correct Firefox counter
		if(bName == "Netscape"){	
			objCnt.textContent=maxL-objVal.length;}
		else{objCnt.innerText=maxL-objVal.length;}
	}
	return true;
}

function createObject(objId) {
	if (document.getElementById) return document.getElementById(objId);
	else if (document.layers) return eval("document." + objId);
	else if (document.all) return eval("document.all." + objId);
	else return eval("document." + objId);
}

