/* krpanoJS 1.0.8.15 soundinterface plugin (build 2012-10-05) */
var krpanoplugin=function(){function v(b){var a=b.split("|");if(a.length>1){if(h==null){h="";var c=document.createElement("audio");if(!(c===null||c===undefined)){h+="wav";if(c.canPlayType!==undefined){var d=c.canPlayType("audio/ogg");if(d.match(/maybe|probably/i))h+="ogg";d=c.canPlayType("audio/mpeg");if(d.match(/maybe|probably/i))h+="mp3";d=c.canPlayType("audio/mp4");if(d.match(/maybe|probably/i))h+="mp4"}else h+="mp3"}}c=a.length;if(h.indexOf("mp3")>=0)for(d=0;d<c;d++){var i=String(a[d]).toLowerCase();
if(i.indexOf(".mp3")>0){b=a[d];break}}else if(h.indexOf("mp4")>=0)for(d=0;d<c;d++){i=String(a[d]).toLowerCase();if(i.indexOf(".mp4")>0){b=a[d];break}}else if(h.indexOf("ogg")>=0)for(d=0;d<c;d++){i=String(a[d]).toLowerCase();if(i.indexOf(".ogg")>0||i.indexOf(".oga")>0){b=a[d];break}}else if(h.indexOf("wav")>=0)for(d=0;d<c;d++){i=String(a[d]).toLowerCase();if(i.indexOf(".wav")>0){b=a[d];break}}else b=a[0]}a=q.rootpath;if(a!=null&&a.length>0&&String(a).toLowerCase()!="null"){if(a.charAt(a.length-1)!=
"/")a+="/"}else a="";a+=b;return a=unescape(g.parsePath(a))}function w(){}function x(){var b=arguments;if(b.length>1){var a=String(b[0]).toLowerCase(),c=b[1],d=b.length>2?parseInt(b[2]):1,i=b.length>3?b[3]:null;if(a=="auto"||a=="null"||a=="")a="autoid_"+g.timertick+"_"+Math.ceil(g.random*1E3);c=v(c);var e=null;if(k&&r)if(f[a]!==undefined){e=f[a];e.currentTime=0;e.pause();f[a]=null;delete f[a];e=null}if(e!=null||f[a]!==undefined){if(e==null)e=f[a];else f[a]=e;e.currentTime=0;e.pause()}else{e=document.createElement("audio");
if(!e){g.trace(2,s);return}e.addEventListener("error",function(){g.trace(3,"soundinterface - loading of "+c+" failed!")},true);e.addEventListener("ended",function(){if(e.loopcount>0){e.loopcount--;if(e.loopcount==0)i&&g.call(i);else{e.currentTime=0;e.play()}}else{e.currentTime=0;e.play()}},true);f[a]=e}try{e.loopcount=d;e.src=c;e.volume=m;e.play();if(k)if(e.paused){var n=document.body,o=function(){n.removeEventListener("touchstart",o,true);j&&j.paused&&!j.ended&&j.play()};n.removeEventListener("touchstart",
o,true);j=e;n.addEventListener("touchstart",o,true)}}catch(D){g.trace(2,s)}}}function y(b){(b=f[String(b).toLowerCase()])&&b.pause()}function z(b){(b=f[String(b).toLowerCase()])&&b.paused&&b.play()}function A(b){if(b=f[String(b).toLowerCase()])b.paused?b.play():b.pause()}function B(b){if(b=f[String(b).toLowerCase()]){b.currentTime=0;b.pause()}}function C(){var b,a;for(b in f)if((a=f[b])&&a.paused!==undefined){a.pause();f[b]=null;delete a}f=[];j=null}function t(b){var a,c;for(a in f)if((c=f[a])&&c.paused!==
undefined)if(b==false){if(c.paused==false){c.pause();c.needresume=true}}else c.needresume&&c.play()}function u(){m=l?0:p;var b,a;for(b in f)if(a=f[b]){a.volume=m;if(k)if(l){if(a.paused==false){a._krp_muted=true;a.pause()}}else if(a._krp_muted==true){a._krp_muted=false;a.play()}}}var q=null,g=null,f=[],j=null,k=false,r=false,s="soundinterface - HTML5 audio is not supported by this browser!",p=1,l=false,m=1;this.registerplugin=function(b,a,c){g=b;q=c;c.keep=true;c.registerattribute("rootpath","");c.registerattribute("volume",
1,function(d){p=d;u()},function(){return p});c.registerattribute("mute",false,function(d){l=String("yesontrue1").indexOf(String(d).toLowerCase())>=0;u()},function(){return l});g.soundinterface=c;g.preloadsound=w;g.playsound=x;g.pausesound=y;g.resumesound=z;g.pausesoundtoggle=A;g.stopsound=B;g.stopallsounds=C;b=navigator.userAgent;a=b.indexOf("OS ");if(a>0){a+=3;if(b.slice(a,b.indexOf(" ",a)).split("_").join(".")<"4.2")r=true}k=g.isphone||g.ispad;if(window){window.addEventListener("pagehide",function(){t(false)},
true);window.addEventListener("pageshow",function(){t(true)},true)}};var h=null};
