String.prototype.trunc =
    function( text, length, ellipsis )
	{
	   // length ( default = 20 )
	   if (typeof length == 'undefined') var length =  20;
	
	   // ellipsis display ( default = "..." )
	   if (typeof ellipsis == 'undefined') var ellipsis = '...';
	
	   // if text length does not exceed limit then return text as is 
	   if (text.length < length) return text; 
	
	   // convert text string
	   for (var i = length-1; text.charAt(i) != ' '; i--) {
	     length--;
	   }
	
	   return text.substr(0, length) + ellipsis;
	};



function TruncateLeadClass() 
{
    TruncateLeadClass.trunacteLeadId = '.shorten_docs_lead_js';

    this.truncateAllLead = function()
    {
    	$( TruncateLeadClass.trunacteLeadId ).each(function () {
			var sText = $( this ).html();
			sText = sText.trunc( sText, 200 );
			$( this ).html( sText );
			$( this ).show( 'slow' );
		});
    }
}

