jQuery(document).ready(function(){

var today,dd,mm,yy;

today = new Date();
dd = parseInt(today.getDate(), 10)
mm = parseInt(today.getMonth(), 10) + 1;
yy = parseInt(today.getFullYear().toString().substr(2,2), 10);
if (dd < 10) dd = "0"+dd;
if (mm < 10) mm = "0"+mm;
if (yy < 10) yy = "0"+yy;

mp3file = dd + mm + yy + ".mp3";
//console.log(mp3file);
$.post("/include/ajax/file_exists.php",{filename: mp3file},function(data){
  console.log(data);
  if(data.filename!="not exists"){
/*
        AudioPlayer.embed("listentothegospel", {
		      soundFile: data.filename,
		      width: 160,
		      titles: "Vangelo del "+dd+"/"+mm+"/"+yy,  
          artists: "Parola del Signore"
		    });
*/
  	$('#listentothegospel').append('<audio src="'+data.filename+'" controls style="width:100%;"></audio>');
  }
  else{ $("#listentothegospel").css({"font-style":"italic","color":"Red"}).html("Oggi non è disponibile il file audio..."); }
},"json");

////////////////////////////////////////////////////////////////////
//                                                                //
// Load liturgy block                                             //
////////////////////////////////////////////////////////////////////

$.get("/include/ajax/mydailyliturgy.php", function(thisdata){$("span#dailyliturgy").html(thisdata); });

$.get("/include/ajax/mydailyliturgy.php", {please:"comment"}, function(shtmldata){
//  alert(shtmldata);
  $('div#commento-liturgico').html("<div style='border:groove 4px Orange;background-color: LightYellow;color:Blue;padding:15px;text-align:justify;line-height:1.5;'>"+shtmldata+"</div>");
});
col3w = $('#col3wrapper').width();
$('#commento-liturgico').dialog({
			width: col3w,
			modal: true,
			autoOpen: false,
			show: 'blind',
			hide: 'explode'
});
$('#comment-helper').click(function() {
			$('#commento-liturgico').dialog('open');
			return false;
});
////////////////////////////////////////////////////////////////////
// END OF LOAD LITURGY BLOCK                                      //
//****************************************************************//
////////////////////////////////////////////////////////////////////    

 });
