$(document).ready(function() {
    var filename = parseUri(window.location).file;
    filename = filename.replace(".html", "");
    var section = filename.replace('menu-', "");

    var xml_block = '';

    $.ajax({
        url: 'menu.xml',
        dataType: 'xml',
        success: function(data) {
            $(data).find('section').each(function() {
                if ($(this).attr('name') == section) {
                    xml_block += '<section><items>';
                    $(this).find('items item').each(function() {
                        //alert($(this).find('title').text());
                        var title = $(this).find('title').text();
                        var price = $(this).find('price').text();
                        var desc = $(this).find('description').text();
                        xml_block += '<item><title>' + title + '</title><price>' + price + '</price><description>' + desc + '</description></item>';
                    });
                    xml_block += '</items></section>'

                    $('#menu-content').xslt({ xml: xml_block, xslUrl: 'menu.xsl', dataTypeXml: true });
                }
            });
        }
    });

});
