var html5_audiotypes=
{ mp3: "audio/mpeg",
ogg: "audio/ogg"
}
function createsoundbite(ix,sound)
{ var sb=document.createElement('audio');
if (sb.canPlayType)
{ var src=document.createElement('source');
if (sb.canPlayType('audio/ogg').length + sb.canPlayType('audio/mpeg').length >0)
{ if (sb.canPlayType('audio/ogg').length>0)
{ src.setAttribute('src','sounds/'+sound+'.ogg');
src.setAttribute('type', html5_audiotypes.ogg);
}
else if (sb.canPlayType('audio/mpeg').length>0)
{ src.setAttribute('src','sounds/'+sound+'.mp3');
src.setAttribute('type', html5_audiotypes.mp3);
}
sb.appendChild(src);
sb.load();
sb.playclip=function()
{ sb.pause();
sb.currentTime=0;
sb.play();
}
return sb;
}
}
else
{ var afn=new SWFObject("soundplayer.swf?imageFile=sounds/"+sound+".mp3",sound,1,1,7,"white");
afn.write("audio"+ix);
return {playclip:function()
{ var s=document.getElementById(sound);
if (s)
{ s.Rewind();
s.playSound();
}
else
{ if (want_sounds)
{ alert('Sound effects are OFF\nFlash Player is either not installed or too old!');
want_sounds=false;
}
}
}
}
}
}