var control = 0;
$(document).on("ready", function () {
	$(document).on("click",'#btn_menu', function(){
		if(control == 0){
			$("#container").css({"transform" : "translate3D(80%, 0, 0)"});
			$("#menu").css({"z-index": "14", "transition": "all 600ms"});
			control++;
		}else{
			$("#menu").css({"z-index": "0", "transition": "all 0ms"});
			$("#container").css({"transform" :"none"});
			control--;
		}
	});
	$(".btn_search").on("click", function () {
		$("#search").css({"display":"block!important"});
        $("#search").slideDown();

    });
	$("#vOcultar").on("click", function () {
        $("#search").slideUp();
    });
// player

});
function sMusica() {
    var string = document.smusica.search.value;
    string = encodeURIComponent(string).replace(/%20/g, "+");
    string;
    string = "/search/" + string.toLowerCase() + "";
    location.href = string
}


$(function() { 
        // Setup the player to autoplay the next track
        var a = audiojs.createAll({
        	css: false,
          createPlayer: {
            markup: false,
            playPauseClass: 'play-pauseZ',
            scrubberClass: 'scrubberZ',
            progressClass: 'progressZ',
            loaderClass: 'loadedZ',
            timeClass: 'timeZ',
            durationClass: 'durationZ',
            playedClass: 'playedZ',
            errorMessageClass: 'error-messageZ',
            playingClass: 'playingZ',
            loadingClass: 'loadingZ',
            errorClass: 'errorZ'
          },
          trackEnded: function() {
            var next = $('#playlist li.playing').next();
            if (!next.length) next = $('#playlist li').first();
            next.addClass('playing').siblings().removeClass('playing');
            audio.load($('a', next).attr('data-src'));
            audio.play();
          }
        });
        
        // Load in the first track
        var audio = a[0];
            first = $('#playlist a').attr('data-src');
        $('#playlist li').first().addClass('playing');
        audio.load(first);

        // Load in a track on click
        $('#playlist li').click(function(e) {
          e.preventDefault();
          $(this).addClass('playing').siblings().removeClass('playing');
          audio.load($('a', this).attr('data-src'));
          audio.play();
        });
        $(document).on("click", ".nextZ", function() {
	        var next = $('li.playing').next();
            if (!next.length) next = $('#playlist li').first();
            next.click();
	    });
	    $(document).on("click", ".prevZ", function() {
	        var prev = $('li.playing').prev();
            if (!prev.length) prev = $('#playlist li').last();
            prev.click();
	    });
       
      });




