<div id="jquery_jplayer_cont" class="wall_events_jplayer_cont">
	<div class="icons wall_events_jplayer_close" onclick="closeAudioPlayer();"></div>
	<div id="jquery_jplayer"></div>
	<div class="jp-single-player">
		<div class="jp-interface">
		<div id="song_title"></div>
			<ul class="jp-controls">
				<li><a href="#" id="jplayer_play" class="jp-play" tabindex="1"></a></li>
				<li><a href="#" id="jplayer_pause" class="jp-pause" tabindex="1"></a></li>
				<li><a href="#" id="jplayer_stop" class="jp-stop" tabindex="1"></a></li>
				<li><a href="#" id="jplayer_volume_min" class="jp-volume-min" tabindex="1">{$lang.profile.sound_off}</a></li>
			</ul>
			<div class="jp-progress">
				<div id="jplayer_load_bar" class="jp-load-bar">
					<div id="jplayer_play_bar" class="jp-play-bar"></div>
				</div>
			</div>
			<div id="jplayer_volume_bar" class="jp-volume-bar">
				<div id="jplayer_volume_bar_value" class="jp-volume-bar-value"></div>
			</div>
			<div id="jplayer_play_time" class="jp-play-time"></div>
			<div id="jplayer_total_time" class="jp-total-time"></div>
			<div id="jplayer_time_delimiter">/</div>
		</div>
	</div>
</div>

{literal}
<script type="text/javascript">
	function playAudio(url, name, obj){
		obj = obj || null;
		if(!$('#jquery_jplayer_cont').is(':visible')){
			$('#jquery_jplayer_cont').css({display: 'block', bottom: '-102px'}).animate({'bottom': '+=102'});
		}
		var next_btn = null;
		if(obj){
			next_btn = $(obj).parents('.audio_item').next().find('.play_audio_btn');
			if(!$(next_btn).size()){
				next_btn = $(obj).parents('.audio_item').parent().find('.play_audio_btn:first');
				if(!$(next_btn).size()){
					next_btn = obj;
				}
			}
		}
		// Local copy of jQuery selectors, for performance.
		var jpPlayTime = $("#jplayer_play_time");
		var jpTotalTime = $("#jplayer_total_time");
		$("#jquery_jplayer").jPlayer({
			ready: function () {
				this.element.jPlayer("setFile", url).jPlayer("play");
			},
			volume: 80,
			swfPath: "{/literal}{$site_root}{$index_theme_path}/js{literal}"
		})
		.jPlayer("onProgressChange", function(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime) {
			jpPlayTime.text($.jPlayer.convertTime(playedTime));
			jpTotalTime.text($.jPlayer.convertTime(totalTime));
		})
		.jPlayer("onSoundComplete", function() {
			if(next_btn){
				$(next_btn).click();
			}else{
				this.element.jPlayer("play");
			}
		});
		$('#song_title').html(name);
		$("#jquery_jplayer").jPlayer("setFile", url).jPlayer("play");
	}
	
	function closeAudioPlayer(){
		$("#jquery_jplayer").jPlayer('stop');
		$('#jquery_jplayer_cont').animate({'bottom': '-=102'}, 100, function(){$(this).hide();});
	}
</script>
{/literal}