// JavaScript Document
function sermonajax(slugname){
	//console.log(slugname);
	//ajaxFunction("/flashsermon.php?slug="+slugname, "sermonlist");
	$('#sermonlist').load('/flashsermon.php', {'slug':slugname}, 
		function(responseText){
			if(responseText.search("@@") != -1){
				var pieces = responseText.split("@@");
				var title = pieces[1];
				var slug = pieces[2];
				$(this).html(pieces[0]);
				getSermon(title + "&fromflash=true&slug=" + slug);
				$('#sermonplayer').html('');
			}
			$('.sermon').click( 
				function(){
					$('.sermon').css("background-color","");
					$(this).css("background-color","#EFEFEF");
					$('#sermonplayer').html('');
					var id = $(this).attr("id");
					var title = id.substring(0, id.length - 11);
					//console.log(title);
					getSermon(title);
				});
		});
}

function getSermon(title){
	ajaxFunction("/flashsermon.php?title="+title, "sermondetails");
}
