/* Author: 

*/

var menu_state = "foo";

$(document).ready(function(){
   $("#main_menu").jPlayer({
     ready: function() {
       $(this).jPlayer("setMedia", {
         mp3: "media/DaveBathMainMenu.mp3", 
         });
     },
     
     ended: function() {
       $(this).jPlayer("play");
     },
     swfPath: "/js/libs"
   });
   
   $("#sub_menu").jPlayer({
      ready: function() {
        $(this).jPlayer("setMedia", {
          mp3: "media/DaveBathSubMenu.mp3",
        });
       },
      ended: function() {
        $(this).jPlayer("play");
      },
      swfPath: "/js/libs"
    });

    $("#busy").jPlayer({
       ready: function() {
         $(this).jPlayer("setMedia", {
           mp3: "media/DaveBathIsBusyRightNow.mp3",
         });
        },
       ended: function() {
         $(this).jPlayer("play");
       },
       swfPath: "/js/libs"
     });
     
     $("#select_bath").buttonset();
     $("#ring_button").button();
     

     $("#ring_button").click(function() {
         menu_state = "main";
         $("#ring_dave").fadeOut(200, function () { $("#keypad").fadeIn(200);});
         $("#main_menu").jPlayer("play");
     });

     $("#1").click(function() {
        if (menu_state == 'main'){
            $("#main_menu").jPlayer("stop");
            $("#busy").jPlayer("play");
            menu_state = "queue";
        }else if (menu_state == 'sub'){
            $("#sub_menu").jPlayer("stop");
            $("#busy").jPlayer("play");
            menu_state = "queue";
        }else if (menu_state == 'queue'){

         };
         
     });

     $("#2").click(function() {
        if (menu_state == 'main'){
            $("#main_menu").jPlayer("stop");
            $("#busy").jPlayer("play");
            menu_state = "queue";
        }else if (menu_state == 'sub'){
            $("#sub_menu").jPlayer("stop");
            $("#busy").jPlayer("play");
            menu_state = "queue";
        }else if (menu_state == 'queue'){

         };
         
     });
     
     $("#3").click(function() {
        if (menu_state == 'main'){
            $("#main_menu").jPlayer("stop");
            $("#busy").jPlayer("play");
            menu_state = "queue";
        }else if (menu_state == 'sub'){
            $("#sub_menu").jPlayer("stop");
            $("#busy").jPlayer("play");
            menu_state = "queue";
        }else if (menu_state == 'queue'){

         };
         
     });

     $("#4").click(function() {
        if (menu_state == 'main'){
            $("#main_menu").jPlayer("stop");
            $("#sub_menu").jPlayer("play");
            menu_state = "sub";
        }else if (menu_state == 'sub'){
            $("#sub_menu").jPlayer("stop");
            $("#busy").jPlayer("play");
            menu_state = "queue";
        }else if (menu_state == 'queue'){

         };
         
     });

     $("#5").click(function() {
        if (menu_state == 'main'){
            $("#main_menu").jPlayer("stop");
            $("#busy").jPlayer("play");
            menu_state = "queue";
        }else if (menu_state == 'sub'){

        }else if (menu_state == 'queue'){

         };
         
     });

     $("#hash").click(function() {
        if (menu_state == 'main'){
            $("#main_menu").jPlayer("stop");
            $("#main_menu").jPlayer("play");
            menu_state = "main";
        }else if (menu_state == 'sub'){
            $("#sub_menu").jPlayer("stop");
            $("#main_menu").jPlayer("play");
            menu_state = "main";
        }else if (menu_state == 'queue'){
             $("#busy").jPlayer("stop");
             $("#busy").jPlayer("play");
             menu_state = "queue";
         };
         
     });
     
     
     $("#classic").click( function() {
        $('#img_classic').show();
        $('#img_disco').hide();
        $('#img_ice').hide();
        $('#img_hawaiian').hide();
     });
     $("#ice").click(function(){
         $('#img_classic').hide();
         $('#img_disco').hide();
         $('#img_ice').show();
         $('#img_hawaiian').hide();
     });
     $("#hawaiian").click( function() {
         $('#img_classic').hide();
         $('#img_disco').hide();
         $('#img_ice').hide();
         $('#img_hawaiian').show();
     });
     $("#disco").click(function(){
         $('#img_classic').hide();
         $('#img_disco').show();
         $('#img_ice').hide();
         $('#img_hawaiian').hide();
     });

});


















