
//function doKeypress(maxLength,element,displayElement)
//{
//		if(!isNaN(maxLength))
//		{
//			//alert();
//			maxLength = parseInt(maxLength);
//			//var oTR = element.document.selection.createRange();
//			//var oTR = document.PropertySearch_Results.fc_Prop_Desc;
//			var oTR = element;
//			//alert(oTR);
//			// Allow user to type character if at least one character is selected
//			//alert(oTR.value.length);
//			//if(oTR.value.length >= 1)
//			//{
//			//alert("True");
//			//	event.returnValue = true;
//			//	}
//			
//			
//			if(oTR.value.length > maxLength-1)
//			{
//			//alert("True");
//				event.returnValue = false;
//			}
//			else
//			{
//				document.getElementById(displayElement).value = oTR.value.length;
//				alert(document.getElementById(displayElement).value);
//			}
//	}
//}
//// Cancel default behavior
//function doBeforePaste(maxLength)
//{
//	if(!isNaN(maxLength))
//		event.returnValue = false;
//}
//
//
//// Cancel default behavior and create a new paste routine
//function doPaste(maxLength,element)
//{
//	if(!isNaN(maxLength))
//	{
//		event.returnValue = false;
//		maxLength = parseInt(maxLength);
//		//var oTR = element.document.selection.createRange();
//		//var oTR = document.PropertySearch_Results.fc_Prop_Desc;
//		var oTR = element;
//		var iInsertLength = maxLength -  oTR.value.length;
//		var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
//		oTR.value = sData;
//	}
//}


function getObject(obj) 
{
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}


function Contar(entrada,salida,texto,caracteres)
{
  var entradaObj=getObject(entrada);
  var salidaObj=getObject(salida);
  var longitud=caracteres - entradaObj.value.length;
  if(longitud <= 0) {
    longitud=0;
    texto='<span class="disable"> '+texto+' </span>';
    entradaObj.value=entradaObj.value.substr(0,caracteres);
  }
  salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}


