Ext.override(Array,{findBy:function(fn){var result=[];for(var i=0,len=this.length;i<len;i++){if(fn.call(this||scope,this[i])){result.push(this[i])}}if(result.length!==0){return result}}});Ext.override(String,{endsWith:function(s){return this.substring(this.length-s.length)==s}});Ext.ux.Sound=(function(){var hasFlash=(navigator.plugins&&Array.prototype.findBy.call(navigator.plugins,function(p){return p.name.indexOf('Flash')!==-1}));var FFWin=(Ext.isGecko&&Ext.isWindows),enabled=!FFWin||(navigator.plugins&&Array.prototype.findBy.call(navigator.plugins,function(p){return p.name.indexOf('QuickTime')!==-1}));if(!enabled){return{enable:Ext.emptyFn,disable:Ext.emptyFn,play:Ext.emptyFn}}var tracks={};return{enable:function(){enabled=true},disable:function(){enabled=false},stop:function(el){document.body.removeChild(document.getElementById(el))},play:function(url,options){if(!enabled){return}options=Ext.apply({track:'global',url:url,replace:false},options);var sound;if(Ext.isIE){sound=document.createElement('bgsound');sound.setAttribute('src',options.url);sound.setAttribute('loop','infinite');sound.setAttribute('autostart','1')}else if(FFWin&&!options.url.endsWith('.wav')){sound=document.createElement('object');sound.setAttribute('type',options.mime);sound.setAttribute('data',options.url);sound.setAttribute('loop','true');sound.setAttribute('autostart','true')}else{sound=document.createElement('embed');sound.setAttribute('src',options.url);sound.setAttribute('type',options.mime);sound.setAttribute('hidden','true');sound.setAttribute('loop','infinite');sound.setAttribute('autostart','1')}sound.className='x-hide-offsets';sound.setAttribute('id','sound_'+options.id);document.body.appendChild(sound)}}})();
