(function($) {
    $.fn.ellipsis = function() {  
        return this.each(function() {            
            var el = $(this);  
            var Browsername;        
            if($.browser.safari)
              Browsername = "Safari";  
            var panelWidth = $('#advSearchForm').width();
               
			var ptext = el.html();
			var ptext1 = ptext;
			
			if($.browser.msie){
			    if(ptext.length > 30){
			        if(panelWidth == 295){			        	    			
			        ptext1 = ptext1.substr(0, 50);
			        if($.browser.version == "7.0"){ptext1 = ptext1.substr(0, 45);}			        
			        } else{				            			
			            ptext1 = ptext.substr(0, 60);
			            if($.browser.version == "7.0"){ptext1 = ptext.substr(0, 55);}			            
			        }        			
			        ptext1 = ptext1.replace(/\w+$/, '');
			        ptext1 = ptext1.replace(/\s+$/, '...');
			        el.html(ptext1);
			        }
			        else el.html(ptext);
			    }else{
			  if(ptext.length > 100){
			    if(panelWidth == 295){
			        ptext1 = ptext1.substr(0, 80); 			
			        if(Browsername == "Safari"){ptext1 = ptext1.substr(0, 90);}
			        } else{		
			            ptext1 = ptext.substr(0, 95);			   
			            if(Browsername == "Safari"){ptext1 = ptext.substr(0, 105);}
			        }
        			
			        ptext1 = ptext1.replace(/\w+$/, '');
			        ptext1 = ptext1.replace(/\s+$/, '...');
			        el.html(ptext1);
			        }
			        else el.html(ptext);
			  } 
        });
    };
})(jQuery);
