var cut = 0; if (filen.length > 15 && cut == 0){ filen = file.substr(0, 15); filen += "..."; cut = 1; }