Why is it adding %20 to the spaces in my javascript variables
<pre><code>function openFile(file, object) {
    var extension = file.substr( (file.lastIndexOf('.') +1) );

    var fileName = file.substr((file.lastIndexOf('/') +1), (file.length - (file.lastIndexOf('/') +1))-4);


    object.append('&lt;img class="theimage" src="" alt="icon"/&gt;');
    object.append('&lt;span class="thefile"&gt;&lt;/span&gt;');


    switch(extension) {

        case 'ppt':
            object.find('img').attr('src', 'PowerPoint-icon.png');
        break;
        case 'pdf':
            object.find('img').attr('src', 'pdficon_large.gif'); 
        break;
        case 'txt':
            object.find('img').attr('src', 'txt_icon.png'); 
        break;
        default:
            alert('error');
    }

    object.find('span.thefile').text(fileName);

};
</code></pre>

<p>This function runs properly on it's own but when I add it to my school's cms template it add %20 to all the spaces in fileName.</p>

<p>Do you think they have their own function that is doing this? What would be the purpose? For security? </p>
