function maxsize(str,max){ var trueleight = ''; if(str.length > max){ trueleight = str.substring(0,max) + '...'; }else{ trueleight = str; } return trueleight; }