Ok, I made a different approach.
Since I'm naming my files 11.html, 12.html and so on, all I needed was:
Code:
var tr = window.location.pathname
//var tr = document.URL
len = tr.length
var filename = tr.substring(len-7,len-5);
I think that will do it for me..