/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

 function initBinding()
{
                $("#li3_2 a").click(function (event){
                    event.preventDefault();

                    var nom= this.id//$(this).attr('href');
                    para = $(this).parents().attr('id');


                    var splits = nom.substring(1).split('#');
                    var section = splits[0];
                    delete splits[0];
                    query = "section=" + nom;
               //     alert(para);
                    $('#loading').fadeIn();
                    $("#"+para).hide();
                  changeBackground(nom,para);
                 //  $('#'+para).css('background-image', 'url("./images/plato_menu_in.gif")')
                    $.ajax({
                        type: "POST",
                        url: "menus.php",
                        data: query,
                        cache: false,
                        success: function(data){
                            $("#"+para).html(data);
                            $('#loading').toggle();
                $("#"+para).show();
                initBinding();
                }

                    });
                    return false;
                    //
                    //                    $("#loading").show();
                    //                    $.get("menus.php",query, function(data){
                    //
                    //             $("#li3_3").html(data);
                    //             $("#loading").hide();
                    //                });
                    //            });
                });
}
function changeBackground(who,id){
    
    //alert(who);
var img = 'plato_menu_in.gif'
    switch (who) {
                    case 'showMenuIn':
            img = 'plato_menu_in.gif'
                        break;
                        case 'showMenu':
           img = 'plato_menu_dia.gif'
                        break;
                        case 'showMenuInfantil':
           img = 'menu_infantil.gif'
                        break;
                    default:
                        break;
                }
$('#'+id).css('background-image', 'url(./images/'+img+')')

}
            $(document).ready(function (){
                 initBinding();

            });




