$(function(){
    var app = {
    
        init: function(){
        
            $("body").delegate('#menu img', 'mouseover', function(){
                $(this).attr('src', $(this).attr('src').replace(/bt_/, 'over_bt_'));
            });
            
            $("body").delegate('#menu img', 'mouseout', function(){
                $(this).attr('src', $(this).attr('src').replace(/over_bt_/, 'bt_'));
            });
            
            
            $("body").delegate('#page_index img', 'mouseover', function(){
                $(this).attr('src', $(this).attr('src').replace(/bt_/, 'over_bt_'));
            });
            
            $("body").delegate('#page_index img', 'mouseout', function(){
                $(this).attr('src', $(this).attr('src').replace(/over_bt_/, 'bt_'));
            });
            
            $("body").delegate('#page_index img', 'click', function(){
            
                var btnId = $(this).attr('id');
                
                $("#progHome_" + btnId).show().siblings().hide()
                
            });
            
            $.address.change(function(e){
            
                if (e.value == '/') {
                    e.value = '/index';
                }
                
                $("#content").load(e.value);
                
            });
            
            this.initPlayer();
            
        },
        
        
        initPlayer: function(){
        
            //            var audioList = ["04 Love Is Gone (Eddie Thoneick's Liberte Remix).mp3", "05 Delirious (ft Tara Mc Donald).mp3"];
            var currentTrack = 0;
            
            var objPlayer = $("#jquery_jplayer_1").jPlayer({
                ready: function(){
                    $(this).jPlayer("setMedia", {
                        mp3: "/audio/Calvin_Harris_-_Feel_So_Close.mp3"
                    });
                    
                    objPlayer.jPlayer("play");
                    
                    //                    $('.jp-next').bind('click', function(){
                    //                    
                    //                        if ((currentTrack + 1) <= audioList.length - 1) {
                    //							
                    //							currentTrack++;
                    //							
                    //                            objPlayer.jPlayer("setMedia", {
                    //                                mp3: $.address.baseURL() + "/audio/" + audioList[currentTrack]
                    //                            });
                    //							
                    //							objPlayer.jPlayer("play");
                    //                        }
                    //                        
                    //                    })
                
                    //                    $('.jp-previous').bind('click', function(){
                    //                    
                    //                        if ((currentTrack - 1) >= 0) {
                    //							
                    //							currentTrack--;
                    //							
                    //                            objPlayer.jPlayer("setMedia", {
                    //                                mp3: $.address.baseURL() + "/audio/" + audioList[currentTrack]
                    //                            });
                    //							
                    //							objPlayer.jPlayer("play");
                    //                        }
                    //                        
                    //                    })
                },
                swfPath: "/js/jplayer",
                supplied: "mp3"
            });
            
        }
    }
    
    app.init();
});

