function openPlayer(n,t,i,r,u,f,e,o){var c=$(n),h,s;if(c!==null&&(h="FFCC00",f&&f.length>0)){if($(n).width(i).height(r),s=new WebmovieMapper(f,h,i,r,o),s.isValide())sdbb.isiDevice||sdbb.isIEMobile||sdbb.isAndroid?$(n).html(s.write()):$(n).html(s.write());else throw new Error("invalide webmovie url: "+f);return}}function WebmovieMapperURL(n){var t=n.split("?"),i;t.length>1&&(i=t[1].split("#"),this.query=i.shift(),n=t[0],i.length>1&&(n+="#".arrQuery.join("#")));n.match(/^((http|https|ftp):\/\/)?(w*\.?)?([^#?\/]+)([^#]*)([^#]*)$/)?(this.url=RegExp["$&"],this.protocol=RegExp.$2,this.host=RegExp.$4,this.path=RegExp.$5,this.hash=RegExp.$6,this.isValide=function(){return!0}):this.isValide=function(){return!1};this.getParamValue=function(n){n=escape(unescape(n));var r=new RegExp("[&]?"+n+"(?:=([^&]*))?","i"),i=r.exec(this.query),t=null;if(i!=null)t=i[1];else return null;return t.length==0?null:t};this.getPathValue=function(n){var t=this.path.split("/"),i;if($.isNumeric(n)){if(t.length>n&&n>=0)return t[n]}else for(i=0;i<t.length;i++)if(t[i]==n&&i<t.length-1)return t[i+1];return null}}function WebmovieMapper(n,t,i,r,u){this.strurl=n;this.color=t;this.blnisvalide=!1;this.url=null;this.width=i;this.height=r;this.autoplay=u.toString();this.autoplayNumeric=u?1:0;this.validateURL()}WebmovieMapper.prototype={validateURL:function(){if(this.url=new WebmovieMapperURL(this.strurl),!this.url.isValide())return this;var n=this.url.host.split(".");return this.type="",n.length>1&&(this.type=n[n.length-2]),this.type=this.type.toLowerCase(),this.validateType()},validateType:function(){return this.each("sf,srf,youtube,vimeo,rsi,rts,unige".split(","),function(n){this.type==n&&(this.blnisvalide=!0)})},each:function(n,t){for(var i=0;i<n.length;i++)t.apply(this,[n[i],i,n]);return this},isValide:function(){return this.blnisvalide},ucFirst:function(n){var t=n.charAt(0).toUpperCase();return t+n.substr(1)},write:function(){return this["write"+this.ucFirst(this.type)].apply(this)},writeSf:function(){var n=this.url.getParamValue("id");return n==null&&(n=this.url.getPathValue("embed")),'<iframe src="//tp.srgssr.ch/p/srf/embed?urn=urn:srf:ais:video:'+n+'&autoplay=true" width="100%" height="100%" frameborder="0"><\/iframe>'},writeSrf:function(){var n=this.url.getParamValue("id");return n==null&&(n=this.url.getPathValue("embed")),'<iframe src="//tp.srgssr.ch/p/srf/embed?urn=urn:srf:ais:video:'+n+'&autoplay=true" width="100%" height="100%" frameborder="0"><\/iframe>'},writeVimeo:function(){var n=this.url.getPathValue(1);return'<iframe src="https://player.vimeo.com/video/'+n+"?title=0&amp;byline=0&amp;portrait=0&amp;color="+this.color+"&autoplay="+this.autoplayNumeric+'" width="'+this.width+'" height="'+this.height+'" frameborder="0" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"><\/iframe>'},writeYoutube:function(){var n=this.url.getParamValue("v");return n==null&&(n=this.url.getPathValue(1),n=="v")?(n=this.url.getPathValue(2),'<object width="'+this.width+'" height="'+this.height+'"><param name="movie" value="https://www.youtube.com/v/'+n+'"?autoplay='+this.autoplayNumeric+'><\/param><param name="allowscriptaccess" value="always"><\/param><embed src="https://www.youtube.com/v/'+n+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="340" height="207"><\/embed><\/object>'):'<iframe width="'+this.width+'" height="'+this.height+'" src="https://www.youtube.com/embed/'+n+"?rel=0&autoplay="+this.autoplayNumeric+'" frameborder="0" allowfullscreen><\/iframe>'},writeRsi:function(){var n=this.url.getParamValue("id");return n==null&&(n=this.url.getPathValue("embed")),'<iframe src="//tp.srgssr.ch/p/rsi/embed?urn=urn:rsi:video:'+n+'&autoplay=true" width="100%" height="100%" frameborder="0"><\/iframe>'},writeRts:function(){var n=this.url.getParamValue("id");return n==null&&(n=this.url.getPathValue("embed")),'<iframe src="//tp.srgssr.ch/p/rts/embed?urn=urn:rts:video:'+n+'&autoplay=true" width="100%" height="100%" frameborder="0"><\/iframe>'},writeUnige:function(){var n=Math.round(this.width),t=Math.round(this.height),i=this.url.getPathValue(2),r=this.url.getPathValue(3);if(r==null)throw new Error("sdbbMovieMapper: invalide url for mediaserver.unige: "+this.strurl);return'<iframe src="https://elearn-services.unige.ch/medias/share/video?url=https://mediaserver.unige.ch/proxy/'+i+"/"+r+"&width="+n+"&height="+t+"&id="+i+'&start=0" width="'+n+'" height="'+t+'" frameborder="0" allowfullscreen="1"><\/iframe>'}}