
/*
*   function to decet where browser able to play audio from html5 audio
*/
function html5_audio(){
	var a = document.createElement('audio');
	return !!(a.canPlayType);
}

/*
*   creating audio object and fallback object
*/
function createAudio(source)
{  var audioelement;	 
  if(html5_audio())
   {
   	audioelement = new Audio(source);
	audioelement.load();
   }else{
		audioelement=document.createElement("embed"); 
		audioelement.setAttribute('type', 'audio/mpeg');
		audioelement.setAttribute('src', source);
		audioelement.setAttribute('loop', false);
		audioelement.setAttribute('hidden', true);
		audioelement.setAttribute('autostart', false);
		audioelement.setAttribute("enablejavascript", true);
		 $('body').append(audioelement);
  }
    return audioelement;
}
/*
*   playing audio for ie8
*/
function PlayIESound(url) {
  document.all.sound.src = url;
 }
 /*
*  branching ipad, ie8 and other browsers 
*/
function playAnimationaudios(audiodom)
{              
	
	if(html5_audio())
                 {
			   if(navigator.userAgent.match(/ipad/i)!= null)
		          { 
		          	
		          	
				  document.getElementById("correctanimation").src=audiodom;
					document.getElementById("correctanimation").load();
					 
                    document.getElementById("correctanimation").play();	
              			
		          }else
				  {
				  document.getElementById("correctanimation").src=audiodom;
		           document.getElementById("correctanimation").play();
                 }				   
			}else
			{
				PlayIESound(audiodom);
			}
}
