answer to my comment(this code is for my tms scheme and you can adapt it to your need):
var originShift = 2 * Math.PI * 6378137 / 2.0;
var initialResolution = 2 * Math.PI * 6378137 / 256; //tilesize
var lon = 10;
var lat = 20;
var mx = lon * originShift / 180.0;
var my = Math.log(Math.tan((90 + lat) * Math.PI / 360.0)) / (Math.PI / 180.0);
my = my * originShift / 180.0;
//MetersToPixel(mx, my, zooma)
var res = initialResolution / (Math.pow(2, zooma));
var px = (mx + originShift) / res;
var py = (my + originShift) / res;
//PixelsToTile(px, py)
var tx = Math.ceil(px / parseFloat(256)) - 1;
var ty = Math.ceil(py / parseFloat(256)) - 1;
tx and ty will give you to tms result as lanlot. if you want to know equivalent to google map, you can calculate the Y file name (Math.pow(2, zoom) - 1) - ty
Google Tile Mechanism: x/y/z.jpg
TMS Tile Mechanism: z/y/x.jpg
i hope it helps you...