var selectedString=null,rsExp={settings:{usePost:!1,useCloudService:!1,protocol:document.location.protocol||"http:",region:null,rsent:"rsent",appserverhost:"app.readspeaker.com",flash:{allowScriptAccess:"always",height:"30",params:"&autoplay=1&rlang=sv&rskin=bump&time_format=ms&rcontrol=mini&c1=0x4a8aca&c2=0xFFFFFF&c3=0x3069A1&c4=0x003366&c5=0xbfe4f5&c6=0xffffff&c7=0xbfe4f5&c9=0x003366&c15=0xcccccc&c16=0x000000",width:"365"}},imageSrc:{cloud:{closeSrc:"/graphic/default/images/rs_player_close_13px.png",
flashSrc:"/flash/readspeaker.swf",iconSrc:"/graphic/default/images/rs_player_icon_16px.gif",playSrc:"/graphic/default/images/rs_player_play_13px.png",playInactiveSrc:"/graphic/default/images/rs_player_play_inactive_13px.png",pauseSrc:"/graphic/default/images/rs_player_pause_13px.png",pauseInactiveSrc:"/graphic/default/images/rs_player_pause_inactive_13px.png",stopSrc:"/graphic/default/images/rs_player_stop_13px.png",stopInactiveSrc:"/graphic/default/images/rs_player_stop_inactive_13px.png"},media:{closeSrc:"/images/enterprise/default/close.png",
flashSrc:"/flash/readspeaker20.swf",playSrc:"/images/enterprise/default/play.png",playInactiveSrc:"/images/enterprise/default/play2.png",pauseSrc:"/images/enterprise/default/pause.png",pauseInactiveSrc:"/images/enterprise/default/pause2.png",stopSrc:"/images/enterprise/default/stop.png",stopInactiveSrc:"/images/enterprise/default/stop2.png",iconSrc:"/images/buttons/listen_icons/icon_16px.gif"}},data:{params:null,images:null,phrases:{closeplayer:decodeURIComponent("St%C3%A4ng%20spelare"),gotowebsite:"Go to the ReadSpeaker website",
nosound:"Inget ljud?",pause:"Paus",play:"Play",speechenabled:"Talsatt av <a href='http://www.readspeaker.com/sv/?ref="+encodeURIComponent(document.location.href)+"' target='_blank'>ReadSpeaker</a>",stop:"Stopp",volume:"Volym"},setParams:function(a){for(var c={},b="",d="",b="",a=a.split("?")[1].split(/[;&]/),e=0;e<a.length;e++)if((b=a[e].split("="))&&2==b.length)d=unescape(b[0]),b=unescape(b[1]),b=b.replace(/\+/g," "),c[d]=b;return c},setImages:function(){var a={},c="",b=rsExp.settings.region||"eu",
d=rsExp.settings.useCloudService&&"https"!=rsExp.settings.protocol?"cloud":"media",e=rsExp.imageSrc[d],f;for(f in e)e.hasOwnProperty(f)&&(c=-1!=e[f].indexOf("://")?"":"cloud"==d?"http://f1."+b+".readspeaker.com":rsExp.settings.protocol+"//media.readspeaker.com",a[f]=c+e[f]);return a},getImage:function(a){return this.images&&this.images[a]&&void 0!==this.images[a]?this.images[a]:""},getParam:function(a){return this.params&&this.params[a]&&void 0!==this.params[a]?this.params[a]:null},getPhrase:function(a){return this.phrases&&
this.phrases[a]&&void 0!==this.phrases[a]?this.phrases[a]:""},getUserAgent:function(){return document.selection?"IE":(-1<navigator.userAgent.toLowerCase().indexOf("iphone")||-1<navigator.userAgent.toLowerCase().indexOf("ipad")||-1<navigator.userAgent.toLowerCase().indexOf("ipod"))&&-1<navigator.vendor.toLowerCase().indexOf("apple")?"IOS":"OTHER"}},vars:{selectedString:"",STATE_NOT_READY:0,STATE_READY:1,STATE_PLAYING:2,currentState:0},initialize:function(a){rsExp.vars.currentState==rsExp.vars.STATE_NOT_READY&&
(rsExp.data.params=rsExp.data.setParams(a),rsExp.data.images=rsExp.data.setImages(),rsExp.createStylesheet(),rsExp.vars.currentState=rsExp.vars.STATE_READY)},readspeaker:function(a,c){rsExp.initialize(a);rsExp.player(a,c)},player:function(a,c){var b=a.replace(/&selectedhtml=null/i,"");if(0<rsExp.vars.selectedString.length)b=rsExp.issuePOST(b,rsExp.vars.selectedString);else if(rsExp.settings.usePost&&rsExp.data.getParam("readid")){var d=document.getElementById(rsExp.data.getParam("readid")).innerHTML;
d&&(b=rsExp.issuePOST(b,"<div id='"+rsExp.data.getParam("readid")+"'>"+d+"</div>"))}var d="<div id='rsPlayerArea'><div id='rsTopRow'><span style='position: absolute; top: 0px; left: 0px;'>",d=d+rsExp.createPlayer(b),d=d+"</span>",d=d+"<span style='position: absolute; top: 4px; right: 4px;'>",d=d+("<a style='border-style: none;' href='JavaScript:void(0);' onclick='rsExp.closepage(\""+c+"\");return false'><img style='border-style: none !important; margin: 0px !important;' id='closebr' src='"+rsExp.data.getImage("closeSrc")+
"' alt='"+rsExp.data.getPhrase("closeplayer")+"' title='"+rsExp.data.getPhrase("closeplayer")+"'></a>"),d=d+"</span>",d=d+"</div>",d=d+"<div id='rsBottomRow'>",d=d+(rsExp.data.getPhrase("speechenabled")+"<br/>"),d=d+("<a href='"+b+"'>"+rsExp.data.getPhrase("nosound")+"</a>"),d=d+"</div>",d=d+"</div>",e=document.getElementById(c);e&&(e.innerHTML=d,e.style.display="block");rsExp.html5.start(b+"&audioformat=mp3");rsExp.vars.currentState=rsExp.vars.STATE_PLAYING},createPlayer:function(a){var c="";"IOS"==
rsExp.data.getUserAgent()?(c+='<div style="position: absolute; top: 4px; left: 4px;"><a id="rs_playbtn" href="JavaScript:void(0);"><img id="rs_playimg" style="border-style: none !important; margin: 0px !important; padding:0px !important;" src="'+rsExp.data.getImage("playInactiveSrc")+'" title="'+rsExp.data.getPhrase("play")+'" alt="'+rsExp.data.getPhrase("play")+'"></a></div>',c+='<div style="position: absolute; top: 4px; left: 21px;"><a id="rs_pausebtn" href="JavaScript:void(0);"><img id="rs_pauseimg" style="border-style: none !important; margin: 0px !important; padding:0px !important;" src="'+
rsExp.data.getImage("pauseSrc")+'" title="'+rsExp.data.getPhrase("pause")+'" alt="'+rsExp.data.getPhrase("pause")+'"></a></div>',c+='<div style="position: absolute; top: 4px; left: 38px;"><a id="rs_stopbtn" href="JavaScript:void(0);"><img id="rs_stopimg" style="border-style: none !important; margin: 0px !important; padding:0px !important;" src="'+rsExp.data.getImage("stopSrc")+'" title="'+rsExp.data.getPhrase("stop")+'" alt="'+rsExp.data.getPhrase("stop")+'"></a></div>',c=c+'<div id="timeline"><div id="duration"></div><span id="durationtxt"></span></div>'+
('<div style="position: absolute; top: 2px; left: 231px;"><a href="http://www.readspeaker.com/?ref='+encodeURIComponent(document.location.href)+'"><img style="border-style: none !important; margin: 0px !important; padding:0px !important;" src="'+rsExp.data.getImage("iconSrc")+'" title="'+rsExp.data.getPhrase("gotowebsite")+'" alt="'+rsExp.data.getPhrase("gotowebsite")+'" /></a></div>')):(c=document.selection?c+('<object id="rsPlayer" style="height:'+rsExp.settings.flash.height+"px; width:"+rsExp.settings.flash.width+
'px;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'):c+('<object id="rsPlayer" style="height:'+rsExp.settings.flash.height+"px; width:"+rsExp.settings.flash.width+'px;" data="'+rsExp.data.getImage("flashSrc")+"?mp3="+encodeURIComponent(a)+rsExp.settings.flash.params+"&text_play="+rsExp.data.getPhrase("play")+"&text_pause="+rsExp.data.getPhrase("pause")+"&text_stop="+rsExp.data.getPhrase("stop")+"&text_vol="+rsExp.data.getPhrase("volume")+'" type="application/x-shockwave-flash">'),c+='<param name="movie" value="'+
rsExp.data.getImage("flashSrc")+"?mp3="+encodeURIComponent(a)+rsExp.settings.flash.params+"&text_play="+rsExp.data.getPhrase("play")+"&text_pause="+rsExp.data.getPhrase("pause")+"&text_stop="+rsExp.data.getPhrase("stop")+"&text_vol="+rsExp.data.getPhrase("volume")+'" />',c+='<param name="autostart" value="true"><param name="quality" value="high"><param name="allowScriptAccess" value="'+rsExp.settings.flash.allowScriptAccess+'"></object>');return c},closepage:function(a){rsExp.html5.stop();if(a=document.getElementById(a))a.innerHTML=
"",a.style.display="none";rsExp.vars.currentState=rsExp.vars.STATE_READY},copySelected:function(){setTimeout("rsExp.getSelectedHTML()",50);return!0},issuePOST:function(a,c){if(!document.getElementById("postiframe1")){var b=null;if(document.selection)try{b=document.createElement('<iframe name="postiframe1">')}catch(d){b=document.createElement("iframe")}else b=document.createElement("iframe");b.name="postiframe1";b.setAttribute("id","postiframe1");b.setAttribute("style","display: none; position: absolute;");
b.style.display="none";var e=document.getElementsByTagName("body"),f=null;0<e.length&&(f=e.item(0));if(f)f.appendChild(b);else return}a+="&output=audiolink";b=document.createElement("form");b.target="postiframe1";b.method="post";f=a.split("?");e=Math.random();b.action=rsExp.settings.protocol+"//"+rsExp.settings.appserverhost+"/enterprise/iframeproxy.php?rsent="+rsExp.settings.rsent+"&randid="+e;var f=f[1].split("&"),h;for(h=0;h<f.length;h++){var g=f[h].split("="),j=document.createElement("input");
j.setAttribute("name",unescape(g[0]));-1!=unescape(g[0]).indexOf("url")&&3>unescape(g[1]).length?j.setAttribute("value",document.location.href):j.setAttribute("value",unescape(g[1]));b.appendChild(j)}j=document.createElement("input");1>rsExp.vars.selectedString.length&&rsExp.settings.usePost?j.setAttribute("name","html_base64"):j.setAttribute("name","selectedhtml_base64");j.setAttribute("value",rsExp.base64.encode(c));b.appendChild(j);document.body.appendChild(b);b.submit();document.body.removeChild(b);
return rsExp.settings.protocol+"//"+rsExp.settings.appserverhost+"/enterprise/iframeproxy.php?rsent="+rsExp.settings.rsent+"&listen=1&randid="+e},getSelectedHTML:function(){rsExp.vars.selectedString="";var a=void 0;window.getSelection?(selobj=window.getSelection(),selobj.isCollapsed||(selobj.getRangeAt?a=selobj.getRangeAt(0):(a=document.createRange(),a.setStart(selobj.anchorNode,selobj.anchorOffset),a.setEnd(selobj.focusNode,selobj.focusOffset)),a?(DOM=a.cloneContents(),object=document.createElement("div"),
object.appendChild(DOM.cloneNode(!0)),rsExp.vars.selectedString=object.innerHTML):rsExp.vars.selectedString=selobj)):document.selection?(selobj=document.selection,a=selobj.createRange(),rsExp.vars.selectedString=a&&a.htmlText&&a.text&&0<a.text.length?a.htmlText:a&&a.text?a.text:""):document.getSelection&&(rsExp.vars.selectedString=document.getSelection())},createStylesheet:function(){if(!document.styleSheets.rsstylesheet&&!document.getElementById("rsstylesheet")){var a=document.createElement("style");
a.name="rsstylesheet";a.type="text/css";a.setAttribute("id","rsstylesheet");a.style.display="none";var c=document.getElementsByTagName("head"),b=null;0<c.length&&(b=c.item(0));b&&(b.appendChild(a),a=parseInt(rsExp.settings.flash.height)+31,c=parseInt(rsExp.settings.flash.width)+24,rsExp.changeCSSRule("#rsPlayerArea","position: relative !important; border:1px solid #aeaeae !important; background:#ffffff !important; width: "+c+"px !important; height: "+a+"px !important; line-height: normal !important;"),
rsExp.changeCSSRule("#rsPlayerArea object","max-width: none !important;"),rsExp.changeCSSRule("#rsTopRow","margin-bottom: 2px !important; width: 100% !important; height: 20px !important;"),rsExp.changeCSSRule("#closebr","border-style: none !important; margin: 0px !important; padding: 0px !important; width: 20px;"),rsExp.changeCSSRule("#rsBottomRow","font-style: normal !important; font-family: Arial !important; color: #333 !important; font-size: 11px !important; padding-left: 2px !important; margin-top: 11px;"),
rsExp.changeCSSRule("#rsBottomRow a","color: #000 !important; border-style: none !important; text-decoration: underline !important; font-weight: normal !important; font-size: 11px !important; font-family: Arial !important;"),rsExp.changeCSSRule("#rsBottomRow a:hover","text-decoration: underline !important; font-weight: bold !important;"),rsExp.changeCSSRule("#timeline","position: absolute !important; top: 4px !important; left: 55px !important; height: 11px !important; background-color: #F4F4F4 !important; width: 170px !important; border: 1px solid #3380CC !important;"),
rsExp.changeCSSRule("#duration","position: relative !important; height: 11px !important; background-color: #92C0EF !important; width: 0px;"),rsExp.changeCSSRule("#durationtxt","position: absolute !important; top: 1px !important; left: 0px !important; text-align: center !important; font-size: 10px !important; font-weight: bold !important; font-family: Helvetica !important; color: #003399 !important; line-height: 80% !important; width: 100% !important;"))}},changeCSSRule:function(a,c){document.styleSheets.rsstylesheet?
css=document.styleSheets.rsstylesheet:document.getElementById("rsstylesheet")&&(css=document.getElementById("rsstylesheet"));css.addRule?css.addRule(a,c):css.sheet.insertRule&&css.sheet.insertRule(a+" {"+c+"}",css.sheet.cssRules.length)},html5:{STATE_BEGIN:0,STATE_USER_START_NOT_READY:1,STATE_USER_START_PLAYING:2,state:0,audioelement:null,url:null,start:function(a){"IOS"==rsExp.data.getUserAgent()&&(rsExp.html5.url=a,rsExp.html5.stop(),rsExp.html5.audioelement=new Audio(rsExp.html5.url),rsExp.html5.audioelement.setAttribute("controls",
"controls"),rsExp.html5.audioelement.loop=!1,rsExp.html5.audioelement.play(),rsExp.html5.audioelement.addEventListener("ended",rsExp.html5.controls.stop,!1),rsExp.html5.audioelement.addEventListener("timeupdate",rsExp.html5.controls.timer,!1),document.getElementById("rs_playbtn").addEventListener("click",rsExp.html5.controls.play,!1),document.getElementById("rs_pausebtn").addEventListener("click",rsExp.html5.controls.pause,!1),document.getElementById("rs_stopbtn").addEventListener("click",rsExp.html5.controls.stop,
!1),rsExp.html5.state=rsExp.html5.STATE_USER_START_PLAYING)},controls:{play:function(){rsExp.html5.audioelement?rsExp.html5.audioelement.play():rsExp.html5.start(rsExp.html5.url);document.getElementById("rs_playimg")&&document.getElementById("rs_playimg").setAttribute("src",rsExp.data.getImage("playInactiveSrc"));document.getElementById("rs_pauseimg")&&document.getElementById("rs_pauseimg").setAttribute("src",rsExp.data.getImage("pauseSrc"));document.getElementById("rs_stopimg")&&document.getElementById("rs_stopimg").setAttribute("src",
rsExp.data.getImage("stopSrc"))},pause:function(){setTimeout("rsExp.html5.audioelement.pause()",200);document.getElementById("rs_pauseimg")&&document.getElementById("rs_pauseimg").setAttribute("src",rsExp.data.getImage("pauseInactiveSrc"));document.getElementById("rs_playimg")&&document.getElementById("rs_playimg").setAttribute("src",rsExp.data.getImage("playSrc"))},stop:function(){rsExp.html5.audioelement&&rsExp.html5.audioelement.removeEventListener("timeupdate",rsExp.html5.controls.timer,!1);rsExp.html5.stop();
document.getElementById("rs_stopimg")&&document.getElementById("rs_stopimg").setAttribute("src",rsExp.data.getImage("stopInactiveSrc"));document.getElementById("rs_playimg")&&document.getElementById("rs_playimg").setAttribute("src",rsExp.data.getImage("playSrc"));document.getElementById("rs_pauseimg")&&document.getElementById("rs_pauseimg").setAttribute("src",rsExp.data.getImage("pauseInactiveSrc"));document.getElementById("duration").style.width="0%";document.getElementById("durationtxt").innerHTML=
"00:00 | 00:00"},timer:function(){if(rsExp.html5.audioelement){var a=document.getElementById("duration"),c=document.getElementById("durationtxt"),b=rsExp.html5.audioelement.duration;a.style.width=100*(rsExp.html5.audioelement.currentTime/b)+"%";if(b)a=parseInt(b%60)+"",d=parseInt(b/60%60)+"",e=parseInt(b/60/60%60)+"";else var d=a="00",e="";var f=parseInt(rsExp.html5.audioelement.currentTime%60)+"",h=parseInt(rsExp.html5.audioelement.currentTime/60%60)+"",g=parseInt(rsExp.html5.audioelement.currentTime/
60/60%60)+"";0!=e?(2>e.length&&(e=0+e+":"),2>g.length&&(g=0+g+":")):g=e="";2>d.length&&(d=0+d);2>a.length&&(a=0+a);2>h.length&&(h=0+h);2>f.length&&(f=0+f);c.innerHTML=b?g+h+":"+f+" | "+e+d+":"+a:"00:00 | 00:00"}}},stop:function(){rsExp.html5.state!=rsExp.html5.STATE_BEGIN&&(rsExp.html5.audioelement&&rsExp.html5.audioelement.pause(),rsExp.html5.audioelement=null);rsExp.html5.state=rsExp.html5.STATE_BEGIN}},base64:{encode:function(a){newdata=encodeURIComponent(a);for(var c=0,b=0,a=[];c<newdata.length;c++)37!=
newdata.charCodeAt(c)?a[b]=newdata.charCodeAt(c):(a[b]=parseInt("0x"+newdata.charAt(c+1)+""+newdata.charAt(c+2)),c+=2),b++;c=a.length;parseInt((c+2)/3);for(var b=new String,d=parseInt(c/3),e,f=c-3*d,c=0;c<3*d;c+=3)e=rsExp.base64.chars(a[c]>>2),b+=e,e=rsExp.base64.chars((a[c]&3)<<4|a[c+1]>>4),b+=e,e=rsExp.base64.chars((a[c+1]&15)<<2|a[c+2]>>6),b+=e,e=rsExp.base64.chars(a[c+2]&63),b+=e;1==f&&(b+=rsExp.base64.chars(a[c]>>2),b+=rsExp.base64.chars((a[c]&3)<<4),b+="==");2==f&&(b+=rsExp.base64.chars(a[c]>>
2),b+=rsExp.base64.chars((a[c]&3)<<4|a[c+1]>>4),b+=rsExp.base64.chars((a[c+1]&15)<<2),b+="=");return b},decode:function(a){for(var c="",b="",d=0,e=0,f="",h=a.length;d<h;)if(-1!=rsExp.base64.value(a[d])){f=a.substring(d,d+4);for(i=e=0;4>i;i++)"="==f[i]&&e++;for(i=0;i<3-e;i++){0==i?b=rsExp.base64.value(f[0])<<2|(rsExp.base64.value(f[1])&48)>>4:1==i?b=(rsExp.base64.value(f[1])&15)<<4|(rsExp.base64.value(f[2])&60)>>2:2==i&&(b=(rsExp.base64.value(f[2])&3)<<6|rsExp.base64.value(f[3]));var g=b.toString(16);
1==g.length&&(g="0"+g);c+="%"+g}d+=4}else d++;return decodeURIComponent(c)},value:function(a){a=a.charCodeAt(0);return 65<=a&&90>=a?a-65:97<=a&&122>=a?a-97+26:48<=a&&57>=a?a-48+52:43==a?62:47==a?63:-1},chars:function(a){return 26>a?String.fromCharCode(a+65):52>a?String.fromCharCode(a+97-26):62>a?String.fromCharCode(a+48-52):62==a?"+":63==a?"/":String.fromCharCode(0)}}};function readspeaker(a,c){rsExp.readspeaker(a,c)}
document.addEventListener?(document.addEventListener("mouseup",rsExp.copySelected,!1),document.addEventListener("keyup",rsExp.copySelected,!1)):document.attachEvent?(document.attachEvent("onmouseup",rsExp.copySelected),document.attachEvent("onkeyup",rsExp.copySelected)):(document.onmouseup=rsExp.copySelected,document.onkeyup=rsExp.copySelected);
