/* krpanoJS 1.0.8.14 prerelease soundinterface plugin (build 2010-12-08) */
var krpanoplugin=function(){function n(){}function o(){var a=arguments;if(a.length>1){var b=String(a[0]).toLowerCase(),f=a[1],p=a.length>2?parseInt(a[2]):1,j=a.length>3?a[3]:null;a=e.isphone||e.ispad;if(b=="auto"||b=="null"||b=="")b="autoid_"+e.timertick+"_"+Math.ceil(e.random*1E3);f=e.parsepath(f);var c=null;if(a&&k)if(d[b]!==undefined){c=d[b];c.currentTime=0;c.pause();d[b]=null;delete d[b];c=null}if(c!=null||d[b]!==undefined){if(c==null)c=d[b];else d[b]=c;c.currentTime=0;c.pause()}else{c=document.createElement("audio");
if(!c){e.trace(2,l);return}c.addEventListener("error",function(){e.trace(3,"soundinterface - loading of "+f+" failed!")},true);c.addEventListener("ended",function(){if(c.loopcount>0){c.loopcount--;if(c.loopcount==0)j&&e.call(j);else c.currentTime=0}else c.currentTime=0},true);d[b]=c}try{c.loopcount=p;c.src=f;c.play();if(a)if(c.paused){var h=document.body,i=function(){h.removeEventListener("touchstart",i,true);g&&g.paused&&!g.ended&&g.play()};h.removeEventListener("touchstart",i,true);g=c;h.addEventListener("touchstart",
i,true)}}catch(v){e.trace(2,l)}}}function q(a){(a=d[a])&&a.pause()}function r(a){(a=d[a])&&a.paused&&a.play()}function s(a){if(a=d[a])a.paused?a.play():a.pause()}function t(a){if(a=d[a]){a.currentTime=0;a.pause()}}function u(){var a,b;for(a in d)if((b=d[a])&&b.paused!==undefined){b.pause();d[a]=null;delete b}d=[];g=null}function m(a){var b,f;for(b in d)if((f=d[b])&&f.paused!==undefined)if(a==false){if(f.paused==false){f.pause();f.needresume=true}}else f.needresume&&f.play()}var e=null,d=[],g=null,
k=false,l="soundinterface - HTML5 audio is not supported by this browser!";this.registerplugin=function(a){e=a;e.preloadsound=n;e.playsound=o;e.pausesound=q;e.resumesound=r;e.pausesoundtoggle=s;e.stopsound=t;e.stopallsounds=u;a=navigator.userAgent;var b=a.indexOf("OS ");if(b>0){b+=3;if(a.slice(b,a.indexOf(" ",b)).split("_").join(".")<"4.2")k=true}window.addEventListener("pagehide",function(){m(false)},true);window.addEventListener("pageshow",function(){m(true)},true)}};
