$(document).ready(function(){


  if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))
    {

    $('script').each(function()
    {
      if ($(this).html().indexOf("AudioPlayer.embed") != -1)
        {

        var players = $(this).html().split('AudioPlayer.embed');


        for (var i in players)
          {

          var rawmp3 = players[i].split('soundFile:"')[1];

          if (rawmp3 != null)
            {
            var end = rawmp3.indexOf('"');
            var newLen = rawmp3.length - (rawmp3.length - end);
            var mp3 = decodeURIComponent(rawmp3.substring(0, newLen));
            
            $('#audioplayer_'+i).parent().html('<audio style="width: 100%" autoplay="autoplay" controls="true"><source src="' + mp3 + '" /></audio>');         
            
          }
        }

      }     

    });        





  }


});
