/* Viocorp Enhanced Media Player
 * Created by: Sugendran Ganess
 */
var Vio=(function(){var m="undefined",h=window,d=document;function q(v){return v.constructor==String?d.getElementById(v):v}function r(z,y,w){var v=d.createElement(z);if(typeof(y)!=m){if(y!=null&&y!=""){v.className=y}if(typeof(w)!=m){for(var x in w){if(typeof(v.style[x])!=m){v.style[x]=w[x]}}}}return v}function p(v){return d.createTextNode(v)}function s(v){while(v.hasChildNodes()){v.removeChild(v.firstChild)}}function f(w){var v=w.getElementsByTagName("object");if(v.length>0){return v[0]}return null}function j(v){if(typeof(window.console)!=m&&typeof(window.console.log)!=m){console.log(v)}}var u=(function(){var v=navigator.userAgent.toLowerCase();return{usesAttachEvent:(typeof(d.attachEvent)!=m),usesEventListener:(typeof(d.addEventListener)!=m),webkit:(/webkit/.test(v)),msie:(ie=!+"\v1")}})();function a(){var v=document.getElementsByTagName("script");return v[v.length-1]}function o(){}var l=false,e=new Array();function g(){if(typeof(Vio)==m){setTimeout(arguments.callee,10)}else{if(!l){l=true;o();for(var v=0;v<e.length;v++){try{e[v]()}catch(w){j(w)}}Vio.Event.Trigger("Render")}}}function k(v){if(l){try{v()}catch(w){j(w)}}else{e.push(v)}}function b(v){if(h.addEventListener){h.addEventListener("load",v,false)}else{if(h.attachEvent){h.attachEvent("onload",v)}else{if(typeof h.onload=="function"){var w=h.onload;h.onload=function(){w();v()}}else{h.onload=v}}}}(function(){if(typeof(d.readyState)!=m&&d.readyState=="complete"){g()}else{if(!l){if(d.addEventListener){d.addEventListener("DOMContentLoaded",function(){d.removeEventListener("DOMContentLoaded",arguments.callee,false);g()},false)}else{if(document.attachEvent){d.attachEvent("onreadystatechange",function(){if(d.readyState==="complete"){d.detachEvent("onreadystatechange",arguments.callee);g()}});if(document.documentElement.doScroll&&h==top){(function(){if(!l){try{d.documentElement.doScroll("left")}catch(v){return setTimeout(arguments.callee,20)}g()}})()}}}b(g)}}})();function n(){this.length=0}(function(){var v=["push","pop","shift","unshift","slice","splice","join","sort"];for(var w=0;w<v.length;w++){(function(x){n.prototype[x]=function(){return Array.prototype[x].apply(this,arguments)}})(v[w])}})();return{$ge:q,$go:f,$ce:r,$ct:p,$ee:s,ObjArray:n,Extend:function c(v,y,x){if(typeof(y)==m){y=v;v=Vio}if(typeof(x)==m){x=false}for(var w in y){if(x===true&&typeof(v[w])!=m&&v[w].constructor==Object){c(v[w],y[w],true)}else{v[w]=y[w]}}return v},OnReady:k,Log:j,Rand:function(){return Math.floor(Math.random()*10000)+Math.floor(Math.random()*100)},Browser:u,GetScriptTag:a,Config:{}}})();Vio.OnReady(function(){VioLoader.Run()});Vio.Extend(Vio,{Event:(function(){var UNDEF="undefined",eventStack=new Array();function EvtCallback(target,fn,data){this.target=target;this.callback=fn;this.data=data}function Evt(evtName){this.Name=evtName;this.callbacks=new Array()}function findEvent(evtName){for(var i=0;i<eventStack.length;i++){if(eventStack[i].Name==evtName){return eventStack[i]}}}function removeCallbacks(evt,target,fn){var i=0;while(i<evt.callbacks.length){if(evt.callbacks[i].target==target&&((fn==true)||(evt.callbacks[i].callback==fn))){evt.callbacks.splice(i,1)}else{i++}}}return{Bind:function(target,evtName,callback,data){var evt=findEvent(evtName);if(evt==null){evt=new Evt(evtName);eventStack.push(evt)}evt.callbacks.push(new EvtCallback(target,callback,data||{}))},Unbind:function(target,evtName,callback){var evt=findEvent(evtName);if(evt!=null){removeCallbacks(evt,target,typeof(callback)==UNDEF?true:callback)}},Trigger:function(evtName,val){var evt=findEvent(evtName);if(evt!=null){for(var i=0;i<evt.callbacks.length;i++){with(evt.callbacks[i]){try{var r=callback.call(target,{value:val||"",data:data});if(typeof(r)!=UNDEF&&r==false){break}}catch(ex){Vio.Log(ex)}}}}}}})()});Vio.Extend((function(){function h(f){return f<10?"0"+f:f}function a(f){if(f.constructor==Date){return isFinite(f.valueOf())?f.getUTCFullYear()+"-"+h(f.getUTCMonth()+1)+"-"+h(f.getUTCDate())+"T"+h(f.getUTCHours())+":"+h(f.getUTCMinutes())+":"+h(f.getUTCSeconds())+"Z":null}else{return f.valueOf()}}var g=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,b=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function d(f){b.lastIndex=0;return b.test(f)?'"'+f.replace(b,function(j){var k=e[j];return typeof k==="string"?k:"\\u"+("0000"+j.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+f+'"'}function c(l,n){var f,j,p,o,q,m=n[l];if(m&&typeof m==="object"){m=a(m)}switch(typeof m){case"string":return d(m);case"number":return isFinite(m)?String(m):"null";case"boolean":case"null":return String(m);case"object":if(!m){return"null"}q=[];if(Object.prototype.toString.apply(m)==="[object Array]"){for(f=0;f<m.length;f++){q[f]=c(f,m)||"null"}p=q.length===0?"[]":"["+q.join(",")+"]";return p}for(j in m){if(Object.hasOwnProperty.call(m,j)){p=c(j,m);if(p){q.push(d(j)+":"+p)}}}p=q.length===0?"{}":"{"+q.join(",")+"}";return p}}return{toJSON:function(f){return c("",{"":f})}}})());Vio.Extend((function(){function a(b,k){var c=["January","February","March","April","May","June","July","August","September","October","November","December"],d=b.getMonth()+1,l=b.getFullYear(),j=b.getHours();function g(f){return f<10?"0"+f:f}function h(f,m){k=k.replace(f,m)}function e(f){return f.toString()}h(/y{4}/,l);h(/yy/,e(l).substr(2,2));h(/dd/,g(b.getDate()));if(k.indexOf("HH")>-1){h(/HH/,g(j))}if(k.indexOf("hh")>-1){h(/hh/,g(j>12?j-12:j==0?12:j))}h(/mm/,g(b.getMinutes()));h(/ss/,g(b.getSeconds()));if(k.indexOf("t")>-1){h(/t/,(j>11)?"pm":"am")}h(/M{4}/,c[d-1]);h(/MMM/,c[d-1].substr(0,3));h(/MM/,g(d));return k}return{FormatDate:a}})());Vio.Extend((function(){var UNDEF="undefined",log=Vio.Log;function getReq(url,data,fn,err){var xhr=(window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest());var params="";for(var a in data){if(params.length>0){params+="&"}params+=(a+"="+Vio.toJSON(data[a]))}xhr.open("GET",url+(url.match(/\?/)?"&":"?")+params,true);xhr.onreadystatechange=function(evt){if(xhr.readyState==4){if(xhr.status==200){try{var resp=eval("("+xhr.responseText+")");if(resp&&resp.d){if(resp.d.Error.length>0){err(resp.d.Error[0].Message)}else{fn(resp.d.Item,resp.d.ItemInfo)}}else{err("An invalid response was recieved")}}catch(e){log(e);err("An error occured parsing the result")}}else{err("Error loading URL")}}};xhr.setRequestHeader("Content-Type","application/json; charset=utf-8");xhr.send(null)}return{Ajax:function(url,data,callback,err){getReq(url,data||{},callback||log,err||log)}}})());Vio.Extend((function(){var UNDEF="undefined";function setParams(target,params){for(var a in params){if(typeof(target[a])!=UNDEF&&(target[a]==null||target[a].constructor!=Array)){target[a]=params[a]}}}function Thumbnail(o){if(typeof(o)!=UNDEF){setParams(this,o)}}Vio.Extend(Thumbnail.prototype,{Width:0,Height:0,Path:""});function MediaUrl(o){if(typeof(o)!=UNDEF){setParams(this,o);var extRegex=(/^.*\.(\w{3}).*$/gi);var match=extRegex.exec(this.Url)||extRegex(this.Url);this.Extension=match[1].toLowerCase();this.Quality=this.Quality.toLowerCase()}}Vio.Extend(MediaUrl.prototype,{Url:null,Quality:null,Duration:0,MediaType:null,Extension:null});function MediaBase(o){if(typeof(o)!=UNDEF){setParams(this,o);this.Thumbnails=new Array();this.Keywords=new Array();this.Urls=new Array();var dateRegex=new RegExp("/","g");if(dateRegex.test(this.DisplayTime)){this.DisplayTime=eval("(new "+this.DisplayTime.replace(dateRegex,"")+")")}this.LoadUrls(o.MediaUrls);for(var i=0;i<o.KeyWords.length;i++){this.Keywords.push(o.KeyWords[i])}for(var i=0;i<o.Thumbnails.length;i++){this.Thumbnails.push(new Thumbnail(o.Thumbnails[i]))}}}Vio.Extend(MediaBase.prototype,{MediaId:null,DisplayTime:"",MediaTitle:"",MediaDescription:"",MediaType:"",AuthorName:"",Urls:[],Thumbnails:[],Keywords:[],IsMatch:function(regEx){if(regEx.constructor==String){regEx=new RegExp(regEx,"igm")}if((regEx.test(this.MediaTitle))||(regEx.test(this.MediaDescription))){return true}else{for(var i=0;i<this.Keywords.length;i++){if(regEx.test(this.Keywords[i])){return true}}}return false},LoadUrls:function(mediaUrls){if(mediaUrls.length>0){for(var i=0;i<mediaUrls.length;i++){this.Urls.push(new MediaUrl(mediaUrls[i]))}}},HasUrl:function(extension){for(var i=0;i<this.Urls.length;i++){if(this.Urls[i].Extension==extension){return true}}return false},FindUrl:function(extension,quality){extension=extension.toLowerCase();quality=quality.toLowerCase();var j=-1;for(var i=0;i<this.Urls.length;i++){if(this.Urls[i].Extension==extension){if(this.Urls[i].Quality==quality){return this.Urls[i]}else{j=Math.max(j,i)}}}if(j>-1){return this.Urls[j]}return null},FindThumbnail:function(width){if(this.Thumbnails.length==0){return null}var tlist=[];for(var i=0;i<this.Thumbnails.length;i++){if(this.Thumbnails[i].Width==width){return this.Thumbnails[i]}if(this.Thumbnails[i].Width>width){tlist.push(this.Thumbnails[i])}}if(tlist.length==0){tlist=this.Thumbnails}var mi=0;var minx=tlist[0].Width;for(var i=0;i<tlist.length;i++){if(tlist[0].Width<minx){minx=tlist[0].Width;mi=i}}return tlist[mi]}});function Media(){}Media.prototype=new Vio.ObjArray();Vio.Extend(Media.prototype,{Find:function(mediaId){for(var i=0;i<this.length;i++){if(this[i].MediaId==mediaId){return this[i]}}return null},Add:function(mediaBaseObject){var mb=this.Find(mediaBaseObject.MediaId);if(mb==null){mb=new MediaBase(mediaBaseObject);this.push(mb)}else{mb.LoadUrls(mediaBaseObject.MediaUrls)}return mb},AddRange:function(mediaBaseObjects){for(var i=0;i<mediaBaseObjects.length;i++){this.Add(mediaBaseObjects[i])}},Load:function(mediaId,callback){Vio.Ajax(Vio.BaseURL+"content.asmx/MediaInfoByMethod",{mediaId:mediaId,streamingMethod:"AkamaiProgressiveStream"},function(respItem,respItemInfo){Vio.Media.Add(respItem[0]);if(typeof(callback)=="function"){callback()}})},LoadP:function(mediaId,callback){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",Vio.BaseURL+"JSONP.axd?a=media&id="+mediaId);head.appendChild(script);if(typeof(callback)=="function"){var timedout=false,timeout=setTimeout(function(){timedout=true},30000);(function(){var mb=Vio.Media.Find(mediaId);if(mb!=null&&mb.Urls.length>0){clearTimeout(timeout);timedout=true;callback()}else{if(!timedout){setTimeout(arguments.callee,10)}}})()}}});return{Media:new Media()}})());Vio.Extend((function(){var b="undefined";function c(g,e){for(var f in e){if(typeof(g[f])!=b&&(g[f]==null||g[f].constructor!=Array)){g[f]=e[f]}}}function a(e){if(typeof(e)!=b){c(this,e);this.SubGroups=new Array();this.MediaBases=new Array();if(e.MediaBases&&e.MediaBases.length>0){for(var f=0;f<e.MediaBases.length;f++){this.MediaBases.push(Vio.Media.Add(e.MediaBases[f]))}}if(e.SubGroups&&e.SubGroups.length>0){for(var f=0;f<e.SubGroups.length;f++){var g=new a(e.SubGroups[f]);this.SubGroups.push(g);Vio.Groups.push(g)}}}}Vio.Extend(a.prototype,{Id:"",Name:"",Description:"",SortName:"",SortDirection:"",SubGroups:new Array(),MediaBases:new Array(),Filter:function(f){if(f.constructor==String){f=new RegExp(f,"igm")}if(f.source==""){return this.MediaBases}else{var g=[];for(var e=0;e<this.MediaBases.length;e++){if(this.MediaBases[e].IsMatch(f)){g.push(this.MediaBases[e])}}return g}},Sort:function(j,f){if(this.SortName!=j||this.SortDirection!=f){var g=(j=="date"?"DisplayTime":"MediaTitle");var h=(f=="asc"?1:-1);function e(k,l){return(k[g]<l[g])?(-1*h):((k[g]>l[g])?(1*h):0)}this.MediaBases.sort(e);this.SortName=j;this.SortDirection=f}}});function d(){}d.prototype=new Vio.ObjArray();Vio.Extend(d.prototype,{Find:function(e){for(var f=0;f<this.length;f++){if(this[f].Id==e){return this[f]}}return null},Load:function(e,f){Vio.Ajax(Vio.BaseURL+"content.asmx/MediaByGroup",{groupId:e},function(g,h){Vio.Groups.Add(g);if(typeof(f)=="function"){f()}})},LoadP:function(g,k){this.Remove(g);var e=document.getElementsByTagName("head")[0];var h=document.createElement("script");h.setAttribute("type","text/javascript");h.setAttribute("src",Vio.BaseURL+"JSONP.axd?a=group&id="+g);e.appendChild(h);if(typeof(k)=="function"){var j=false,f=setTimeout(function(){j=true},30000);(function(){if(Vio.Groups.Find(g)==null){if(!j){setTimeout(arguments.callee,10)}}else{clearTimeout(f);j=true;k()}})()}},Remove:function(e){for(var f=0;f<this.length;f++){if(this[f].Id==e){this.splice(f,1);return}}},Add:function(e){this.Remove(e.Id);this.push(new a(e))}});return{Groups:new d()}})());Vio.Extend({Player:(function(){var e="undefined",l="px",f={},b=Vio.$ge,d=Vio.$ce,h=Vio.$ct,j=Vio.$ee,c=[];function k(q,o,p){return(typeof(q[o])==e)?p:q[o]}var a=function(o){if(o.constructor==String){o=b(o)}else{if(o.id==""){o.id="VioTarget_"+Math.floor((Math.random()*100))+"_"+((new Date()).valueOf())}}this.Id=o.id;this.Element=o;this.Options={embedPlayer:{showSplash:false,splashImage:"",showChooser:false,showChooserWhenPlaying:false,playerFormat:"",playerQuality:"",playerWidth:400,playerHeight:224},playlist:{playlistHeight:224,playlistWidth:200,sort_order:"name",sort_direction:"asc"},mediainfo:{},bookmarks:[]}};Vio.Extend(a.prototype,{Id:null,Element:null,PlayerElement:null,PlayerOptions:null,MediaInfo:null,PlaylistElement:null,PlaylistControl:null,Options:{}});function g(H){var O=H.value;var Q=O.Options.embedPlayer;var u=Vio.Media.Find(Q.mediaId);if(u){setTimeout(function(){Vio.Event.Trigger("RenderMediaInfo",O)},10);setTimeout(function(){Vio.Event.Trigger("RenderPlayerOptions",O)},10);if(Q.showSplash){j(O.PlayerElement);var y=Q.splashImage;if(y==""){var p=u.FindThumbnail(Q.playerWidth);if(p!=null){y=p.Path}}var B=d("img",null,{width:Q.playerWidth+l,height:Q.playerHeight+l});B.src=y;var G=d("a");G.href="javascript:void(0);";G.onclick=function(){Vio.Player.Render(O.Id);return false};G.appendChild(B);O.PlayerElement.appendChild(G);O.Options.embedPlayer.showSplash=false}else{if(Q.showChooser||((Q.playerFormat||"")=="")||((Q.playerQuality||"")=="")){j(O.PlayerElement);O.PlayerElement.style.width=Q.playerWidth+l;O.PlayerElement.style.height=Q.playerHeight+l;var p=u.FindThumbnail(Q.playerWidth);if(Q.splashImage!=""||p!=null){var A=(Q.splashImage!="")?Q.splashImage:p.Path;O.PlayerElement.style.backgroundImage="url("+A+")";O.PlayerElement.style.backgroundPosition="50% 50%";O.PlayerElement.style.backgroundRepeat="no-repeat"}else{O.PlayerElement.style.backgroundImage="none"}if(u.Urls.length==0){for(var D=0;D<Vio.Media.length;D++){if(Vio.Media[D].Urls.length>0){u=Vio.Media[D];break}}}var N=d("select");N.id=O.Id+"_mediaPlayer";var C=d("select");C.id=O.Id+"_mediaQuality";function E(q,T){try{q.add(T,null)}catch(o){q.add(T)}}for(var G in f){for(var D=0;D<u.Urls.length;D++){var I=u.Urls[D].Extension;if(f[G].CanPlay(u.Urls[D].Extension)){var P=new Option(f[G].Name,G);E(N,P);break}}}var S=[];function K(o){for(var q=0;q<S.length;q++){if(S[q]==o){return true}}return false}for(var D=0;D<u.Urls.length;D++){var w=u.Urls[D].Quality;if(w=="undefined"){continue}if(!K(w)){S.push(w)}}var z={hd:4,high:3,medium:2,low:1};S.sort(function(o,q){return(z[o]||0)>(z[q]||0)});for(var D=0;D<S.length;D++){var P=new Option((S[D]=="hd")?"HD":(S[D].substr(0,1).toUpperCase()+S[D].substr(1)),S[D]);P.selected=(S.length-1)==D;E(C,P)}var F=d("div","player-chooser");var L=d("div","player-chooser-spacer");F.appendChild(L);var x=d("div","player-chooser-box");L.appendChild(x);var v=d("div","title");v.appendChild(h("Media Player Options"));x.appendChild(v);var s=d("div","choices vio-clearfix");x.appendChild(s);var M=d("div","format");M.appendChild(h("Format"));M.appendChild(N);s.appendChild(M);var R=d("div","quality");R.appendChild(h("Quality"));R.appendChild(C);s.appendChild(R);var r=d("div","save-button");var J=d("input");J.onclick=function(){Vio.Player.Choose(O.Id);return false};J.type="button";J.setAttribute("value","Save");r.appendChild(J);x.appendChild(r);O.PlayerElement.appendChild(F)}else{if(Q.playerFormat=="auto"){O.Options.embedPlayer.playerFormat=(function(){var o=Vio.Media[0];for(var T in f){for(var q=0;q<o.Urls.length;q++){if(f[T].CanPlay(o.Urls[q].Extension)){return T}}}return null})();g({value:O})}else{f[Q.playerFormat].Render(O)}}}}}function n(r){var y=r.value,x=k(y.Options,"embedPlayer",{}),z=k(y.Options,"bookmarks",[]);if(y.PlayerOptions&&(x.showChooserWhenPlaying||z.length>0)){j(y.PlayerOptions);if(z.length>0){var p=d("ul","bookmarks");for(var v=0;v<z.length;v++){var s=d("li");var q=d("a");var u=d("img");q.href=z[v].Url.replace(/\{0\}/i,location.toString()).replace(/\{1\}/i,document.title);q.title=u.tooltip=z[v].Name;u.src=z[v].IconUrl;q.appendChild(u);s.appendChild(q);p.appendChild(s)}y.PlayerOptions.appendChild(p)}if(x.showChooserWhenPlaying){var w=d("a","player-option");w.appendChild(h("Player options"));w.href="javascript:void(0);";w.onclick=function(){Vio.Player.ShowOptions(y.Id)};y.PlayerOptions.appendChild(w)}}}function m(u){var C=u.value,w=k(C.Options,"playlist",{}),D=k(C.Options,"mediainfo",{}),B=k(C.Options,"embedPlayer",{}),y=k(C.Options,"player",{}),r=k(D,"show_title",true),s=k(D,"show_desc",true),q=k(D,"show_date",false),z=k(D,"date_fmt","dd MM yy"),p=Vio.Media.Find(B.mediaId);if(C.MediaInfo&&p){j(C.MediaInfo);if(r){var v=d("div","media-title");v.appendChild(h(p.MediaTitle));C.MediaInfo.appendChild(v)}if(s){var x=d("div","media-description");x.innerHTML=p.MediaDescription;C.MediaInfo.appendChild(x)}if(q){var A=d("div","media-date");A.appendChild(h(Vio.FormatDate(p.DisplayTime,z)));C.MediaInfo.appendChild(A)}}}Vio.Event.Bind(window,"RenderPlayer",g);Vio.Event.Bind(window,"RenderPlayerOptions",n);Vio.Event.Bind(window,"RenderMediaInfo",m);return{Layouts:{},AddTarget:function(p,q,o){if(typeof(Vio.Player.Layouts[p])!="undefined"){var r=new a(q);Vio.Extend(r.Options,o,true);Vio.Player.Layouts[p].AddTarget(r)}},NewTarget:function(p){var o=new a(p);c.push(o);return o},FindTarget:function(r){for(var q=0;q<c.length;q++){if(c[q].Id==r){return c[q]}}for(var o in Vio.Player.Layouts){var p=Vio.Player.Layouts[o].FindTarget(r);if(p!=null){return p}}return null},Render:function(p){var o=Vio.Player.FindTarget(p);if(o!=null){setTimeout(function(){g({value:o})},10)}},Choose:function(r){var p=Vio.Player.FindTarget(r);if(p!=null){var o=b(p.Id+"_mediaPlayer");var q=b(p.Id+"_mediaQuality");p.Options.embedPlayer.playerFormat=o.options[o.selectedIndex].value;p.Options.embedPlayer.playerQuality=q.options[q.selectedIndex].value;p.Options.embedPlayer.showChooser=false;setTimeout(function(){Vio.Event.Trigger("Render",p)},10)}},ShowOptions:function(p){var o=Vio.Player.FindTarget(p);if(o!=null){o.Options.embedPlayer.playerFormat="";o.Options.embedPlayer.playerQuality="";o.Options.embedPlayer.showChooser=false;setTimeout(function(){Vio.Event.Trigger("Render",o)},10)}},MediaPlayers:f}})()});Vio.Extend({Playlist:(function(){var d="undefined",j="px",a=Vio.$ge,c=Vio.$ce,f=Vio.$ct,g=Vio.$ee;function b(n,l,m){return(typeof(n[l])==d)?m:n[l]}function e(x){var K=x.value,u=K.Options.playlist,n=K.Options.embedPlayer,z=K.Options.player,H=Vio.Groups.Find(n.groupId||null),N=b(n,"mediaId",""),E=b(u,"show_title",true),F=b(u,"show_desc",true),v=b(u,"show_thumbnail",true),s=b(u,"show_date",false),p=b(u,"thumbnail_width",96),l=b(u,"thumbnail_height",54),L=b(u,"item_height",60),B=b(u,"item_width",300),D=b(u,"desc_cutoff",-1),M=b(u,"date_fmt","dd MM yy"),C=b(u,"filter","");if(C.constructor==String){C=new RegExp(C,"igm")}function I(o){return o=="Video"?z.default_video_thumb:o=="Audio"?z.default_audio_thumb:z.default_image_thumb}function m(O,P){if(P<0||O.length<P){return O}else{var o=O.substr(0,P);return o.substr(0,o.lastIndexOf(" "))+" ..."}return(D<0)?O:O.substr(0,D)}g(K.PlaylistElement);var q=1;function G(){this.className=this.className+" hover"}function r(){this.className=this.className.replace(/\shover/,"")}function J(S,V){var X=c("div");V="media-card vio-clearfix "+(V.length>0?V+" ":"")+S.MediaType.toLowerCase()+((++q%2)==0?"":" alt")+(S.MediaId==N?" now-playing":"");X.className=V;X.setAttribute("rel",S.MediaId);X.onmouseover=G;X.onmouseout=r;var o=c("a");var R=c("a");X.onclick=o.onclick=R.onclick=function(Y){if(typeof(Y)==d){Y=window.event}Vio.Playlist.PlayMedia(K.Id,S.MediaId);if(typeof(Y.cancelBubble)!=d){Y.cancelBubble=true}else{Y.stopPropagation()}return false};o.href=R.href="javascript:void(0);";if(v){o.style.width=p+j;o.style.height=l+j;o.className="thumbnail";var O=c("img");var P=S.FindThumbnail(p);if(P==null){O.src=I(S.MediaType);O.style.height=l+j;O.style.width=((l/54)*96)+j;if(l!=54||p!=96){O.style.marginLeft=(((p-((l/54)*96))/2))+j}}else{O.src=P.Path;O.style.height=l+j;O.style.width=((l/P.Height)*P.Width)+j;if(l!=P.Height||p!=P.Width){O.style.marginLeft=(((p-((l/P.Height)*P.Width))/2))+j}}o.appendChild(O);X.appendChild(o)}if(E||F||s){var W=c("dl");if(E){var Q=c("dt");R.appendChild(f(S.MediaTitle));Q.appendChild(R);W.appendChild(Q)}if(F){var U=c("dd");U.innerHTML=(m(S.MediaDescription,D));W.appendChild(U)}if(s){var T=c("dd");T.appendChild(f(Vio.FormatDate(S.DisplayTime,M)));W.appendChild(T)}X.appendChild(W)}K.PlaylistElement.appendChild(X)}if(H){var w=H.Filter(C);for(var A=0;A<w.length;A++){J(w[A],A==0?"first":A==(w.length-1)?"last":"")}}else{var y=Vio.Media.Find(N);if(y!=null){J(y,"first")}}}function k(n){var u=n.value,q=u.Options.playlist,v=Vio.Groups.Find(u.Options.embedPlayer.groupId||"");g(u.PlaylistControl);if(v!=null){var s=c("ul","vio-clearfix");var m=c("li");m.appendChild(f("Sort by:"));s.appendChild(m);var w=c("li");if(v.SortName=="name"){w.className=v.SortDirection}var l=c("a","sort");l.href="javascript:void(0);";l.onclick=function(){Vio.Playlist.SortMedia(u.Id,"name")};l.appendChild(f("Name"));w.appendChild(l);s.appendChild(w);var p=c("li");if(v.SortName=="date"){p.className=v.SortDirection}var r=c("a","sort");r.href="javascript:void(0);";r.onclick=function(){Vio.Playlist.SortMedia(u.Id,"date")};r.appendChild(f("Date"));p.appendChild(r);s.appendChild(p);u.PlaylistControl.appendChild(s)}}function h(m){var p=m.value,s=b(p.Options,"embedPlayer",{}),l=b(s,"mediaId","");if(p.PlaylistElement&&l!=""){var n=p.PlaylistElement.childNodes;var q=(/\snow-playing/);for(var r=0;r<n.length;r++){if(n[r]&&n[r].nodeType==1){if(q.test(n[r].className)){n[r].className=n[r].className.replace(q,"")}if(n[r].getAttribute("rel")==l){n[r].className=n[r].className+" now-playing"}}}}}Vio.Event.Bind(window,"RenderPlaylist",e);Vio.Event.Bind(window,"RenderPlaylistControl",k);Vio.Event.Bind(window,"RenderMediaInfo",h);return{PlayMedia:function(m,l){var n=Vio.Player.FindTarget(m);if(n!=null){n.Options.embedPlayer.mediaId=l;setTimeout(function(){Vio.Event.Trigger("RenderPlayer",n)},10)}return true},FilterMedia:function(l,m){var n=Vio.Player.FindTarget(l);if(n!=null){n.Options.playlist.filter=m;setTimeout(function(){Vio.Event.Trigger("RenderPlaylist",n)},10)}},SortMedia:function(l,o){var n=Vio.Player.FindTarget(l);if(n!=null){var m=Vio.Groups.Find(n.Options.embedPlayer.groupId||"");if(m!=null){m.Sort(o,(o==m.SortName)?(m.SortDirection=="asc"?"desc":"asc"):(o=="date"?"desc":"asc"));setTimeout(function(){Vio.Event.Trigger("RenderPlaylist",n)},10);setTimeout(function(){Vio.Event.Trigger("RenderPlaylistControl",n)},10)}}}}})()});if(typeof(VioLoader)=="undefined"){var VioLoader=(function(){var UNDEF="undefined",isRun=false,LoadStack=new Array();function log(o){if(typeof(window.console)!=UNDEF&&typeof(window.console.log)=="function"){console.log(o)}}function checkScriptOptions(opts){var s=document.getElementsByTagName("script"),t=s[s.length-1],o=eval(t.innerHTML)||{};if(typeof(opts.embedPlayer)==UNDEF){opts.embedPlayer={}}if(typeof(opts.playlist)==UNDEF){opts.playlist={}}var embedMap={PlayerWidth:"playerWidth",PlayerHeight:"playerHeight",ShowSplash:"showSplash",SplashImage:"splashImage",ShowChooser:"showChooser",ShowChooserWhenPlaying:"showChooserWhenPlaying",PlayerFormat:"playerFormat",DefaultExtension:"playerExtension",DefaultQuality:"playerQuality",AutoStart:"autoStart",AutoRewind:"autoRewind"},playlistMap={PlaylistWidth:"playlistWidth",PlaylistHeight:"playlistHeight"};for(var a in o){if(typeof(o[a])!="function"){if(typeof(embedMap[a])!=UNDEF){opts.embedPlayer[embedMap[a]]=o[a]}else{if(typeof(playlistMap[a])!=UNDEF){opts.playlist[playlistMap[a]]=o[a]}}}}return t}return{Fn:function(fn){if(!isRun){LoadStack.push(fn)}else{fn.call(null)}},Add:function(playerName,options){t=checkScriptOptions(options);var playerId=/playerid=([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})/.exec(t.src)[1];var css=Vio.BaseURL+"StyleSheet.axd?playerId="+playerId;LoadStack.push(function(){if(typeof(document.createStyleSheet)=="function"){document.createStyleSheet(css)}else{var head=document.getElementsByTagName("head")[0];var style=document.createElement("link");style.setAttribute("rel","stylesheet");style.setAttribute("type","text/css");style.setAttribute("href",css);head.appendChild(style)}});var d=document.createElement("div");d.className="vio-container vio-clearfix";t.parentNode.replaceChild(d,t);LoadStack.push((function(){Vio.Player.AddTarget(playerName,d,options)}))},Run:function(){if(!isRun){isRun=true;for(var i=0;i<LoadStack.length;i++){try{LoadStack[i].call(null)}catch(ex){log(ex)}}}}}})()}Vio.Extend(Vio.Player.MediaPlayers,{Flash:(function(){var e="undefined",h="object",m=window,k=document,l=navigator,d=Vio.$ce,g=Vio.$ge,b="application/x-shockwave-flash",c=Vio.Browser,f="3.2.5r6";var j=function(){var y="Shockwave Flash",B="ShockwaveFlash.ShockwaveFlash",C="Flash/expressInstall.swf",s=false,r=[],o=false;function n(E){return E.toLowerCase()}function q(E){return parseInt(E,10)}var x=(function(){var H=[0,0,0],F=null;if(typeof l.plugins!=e&&typeof l.plugins[y]==h){F=l.plugins[y].description;if(F&&!(typeof l.mimeTypes!=e&&l.mimeTypes[b]&&!l.mimeTypes[b].enabledPlugin)){s=true;F=F.replace(/^.*\s+(\S+\s+\S+$)/,"$1");H[0]=q(F.replace(/^(.*)\..*$/,"$1"));H[1]=q(F.replace(/^.*\.(.*)\s.*$/,"$1"));H[2]=/[a-zA-Z]/.test(F)?q(F.replace(/^.*[a-zA-Z]+(.*)$/,"$1")):0}}else{if(typeof m.ActiveXObject!=e){try{var E=new ActiveXObject(B);if(E){F=E.GetVariable("$version");if(F){F=F.split(" ")[1].split(",");H=[q(F[0]),q(F[1]),q(F[2])]}}}catch(G){}}}return H})();function w(){return v("6.0.65")&&!o}function D(G,J,F){o=true;var E=g(F);if(E){G.id="SWF$Object$Expr$Inst";G.width=Math.max(G.width||310,310);G.height=Math.max(G.height||137,137);var I=s?"PlugIn":"ActiveX",H="MMredirectURL="+m.location.toString().replace(/&/g,"%26")+"&MMplayerType="+I+"&MMdoctitle="+k.title;if(typeof J.flashvars!=e){J.flashvars+="&"+H}else{J.flashvars=H}p(G,J,F)}}function p(P,J,F){var N,K=g(F);if(K){if(typeof P.id==e){P.id=F+"_obj"}if(c.msie){var M=d("span");var G="";for(var E in P){if(P[E]!=Object.prototype[E]){if(n(E)=="data"){J.movie=P[E]}else{if(n(E)=="styleclass"){G+=' class="'+P[E]+'"'}else{if(n(E)!="classid"){G+=" "+E+'="'+P[E]+'"'}}}}}var L="";for(var O in J){if(J[O]!=Object.prototype[O]){L+='<param name="'+O+'" value="'+J[O]+'" />'}}K.style.visibility="hidden";K.appendChild(M);M.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+G+">"+L+"</object>";K.style.visibility="visible";r[r.length]=P.id;N=g(P.id)}else{var I=d(h);I.setAttribute("type",b);for(var H in P){if(P[H]!=Object.prototype[H]){if(n(H)=="styleclass"){I.setAttribute("class",P[H])}else{if(n(H)!="classid"){I.setAttribute(H,P[H])}}}}for(var Q in J){if(J[Q]!=Object.prototype[Q]&&n(Q)!="movie"){A(I,Q,J[Q])}}K.appendChild(I);N=I}}return N}function A(E,G,F){var H=d("param");H.setAttribute("name",G);H.setAttribute("value",F);E.appendChild(H)}function u(E){var F=g(E);if(F&&F.nodeName=="OBJECT"){if(c.msie){F.style.display="none";(function(){if(F.readyState==4){for(var G in F){if(typeof F[G]=="function"){F[G]=null}}F.parentNode.removeChild(F)}else{setTimeout(arguments.callee,10)}})()}else{F.parentNode.removeChild(F)}}}function v(G){var F=x,E=G.split(".");E[0]=q(E[0]);E[1]=q(E[1])||0;E[2]=q(E[2])||0;return(F[0]>E[0]||(F[0]==E[0]&&F[1]>E[1])||(F[0]==E[0]&&F[1]==E[1]&&F[2]>=E[2]))?true:false}var z=function(){if(c.usesAttachEvent){window.attachEvent("onunload",function(){for(var E=0;E<r.length;E++){u(r[E])}})}}();return{embed:function(I,J,L,E,H,K,F,G){Vio.OnReady(function(){L+="";E+="";var N={};if(G&&typeof G===h){for(var O in G){N[O]=G[O]}}N.data=I;N.width=L;N.height=E;var R={};if(F&&typeof F===h){for(var P in F){R[P]=F[P]}}if(K&&typeof K===h){for(var Q in K){if(typeof R.flashvars!=e){R.flashvars+="&"+Q+"="+K[Q]}else{R.flashvars=Q+"="+K[Q]}}}if(v(H)){p(N,R,J)}else{if(w()){N.data=Vio.BaseURL+C;D(N,R,J)}else{var M=g(J);M.innerHTML='<p style="padding:1em;">The minimum supported version of flash is '+H+'. Please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Adobe</a> to get the latest version of the Flash plugin.</p>'}}})},getVersion:function(){return{major:x[0],minor:x[1],release:x[2]}},hasVersion:v,remove:function(E){u(E)}}}();function a(n){if(c.msie){return n.getAttribute("classid")=="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"}else{return n.type==b}return false}return{Name:"Flash",Render:function(p){var r=Vio.$go(p.PlayerElement),n=p.Options.embedPlayer;if(r&&a(r)){r.loadViostream({id:n.mediaId})}else{Vio.$ee(p.PlayerElement);var o=d("div");o.id="VioPlayer"+Vio.Rand();var q={configURL:(Vio.BaseURL+"ConfigXml.axd?playerId="+n.playerId),defaultMediaId:n.mediaId};j.embed(Vio.BaseURL+"Flash/VioPlayer.swf?v="+f,o,n.playerWidth,n.playerHeight,"9.0.115",q,{allowFullScreen:true,allowScriptAccess:"always",wmode:"transparent"},{id:o.id+"_obj"});p.PlayerElement.appendChild(o)}},CanPlay:function(n){return(/flv|mp3|mp4|gif|png|jpg/i).test(n)}}})()});Vio.Extend(Vio.Player.MediaPlayers,{Quicktime:(function(){var c="undefined",b="video/quicktime",d="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B",h=Vio.Browser;var a=(function(){if(navigator.plugins!=null&&navigator.plugins.length>0){for(i=0;i<navigator.plugins.length;i++){var j=navigator.plugins[i];if(j.name.indexOf("QuickTime")>-1){return true}}}else{if(Vio.Browser.msie){var l=null;try{l=new ActiveXObject("QuickTime.QuickTime");if(l!=null){return true}}catch(k){}}}return false})();function g(q,n,k,p,m){var l={};l.width=k+"";l.height=p+"";var j="<object ";if(Vio.Browser.msie){l.classid=d;l.codebase="http://www.apple.com/qtactivex/qtplugin.cab";m.src=n}else{l.type=b;l.pluginspage="http://www.apple.com/quicktime/download/";l.data=n}m.qtsrc=n;for(var o in l){j+=(o+'="'+l[o]+'" ')}j+=">";for(var o in m){j+='<param name="'+o+'" value="'+m[o]+'" />'}j+="</object>";q.innerHTML=j}function f(j){if(h.msie){return j.getAttribute("classid")==d}else{return j.type==b}}return{Name:"Quicktime",Render:function e(r){var q=r.Options.embedPlayer;var p=r.Options.player;var o=Vio.Media.Find(q.mediaId);if(o&&o.Urls.length>0){var l=["mov","mp4","mp3"];var j=0;while(typeof(q.playerExtension)==c&&j<l.length){if(o.HasUrl(l[j])){q.playerExtension=l[j]}j++}var n=o.FindUrl(q.playerExtension,q.playerQuality);if(n){var k=Vio.$go(r.PlayerElement);if(k&&f(k)){k.SetURL(n.Url)}else{Vio.$ee(r.PlayerElement);var m={controller:true,enablejavascript:true,scale:(p.scaling=="fit"?"aspect":"tofit"),autoplay:(p.autoplay=="always"?true:false),volume:(Math.round(100*parseFloat(p.volume_default||"0.8")))};var s=document.createElement("div");r.PlayerElement.appendChild(s);g(s,n.Url,q.playerWidth,q.playerHeight,m)}}else{Vio.Log("media item not available")}}else{Vio.Media.LoadP(q.mediaId,function(){var u=Vio.Media.Find(q.mediaId);if(u&&u.Urls.length>0){e(r)}})}},CanPlay:function(j){switch(j){case"mov":case"mp4":case"mp3":return true;break}return false}}})()});Vio.Extend(Vio.Player.MediaPlayers,{WindowsMedia:(function(){var b="undefined",c="application/x-ms-wmp",a="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6";browser=Vio.Browser;function d(o,l,h,n,k){var j={};o.id="VioPlayer"+Vio.Rand();j.width=h+"";j.height=n+"";var g="<object ";if(Vio.Browser.msie){j.classid=a;k.src=l}else{j.type=c;j.data=l}k.URL=l;k.FileName=l;for(var m in j){g+=(m+'="'+j[m]+'" ')}g+=">";for(var m in k){g+='<param name="'+m+'" value="'+k[m]+'" />'}g+="</object>";o.innerHTML=g}function f(g){if(browser.msie){return g.getAttribute("classid")==a}else{return g.type==c}return false}return{Name:"Windows Media",Render:function e(p){var o=p.Options.embedPlayer;var n=p.Options.player;var m=Vio.Media.Find(o.mediaId);if(m&&m.Urls.length>0){var j=["wmv","wma","mp3"];var g=0;while(typeof(o.playerExtension)==b&&g<j.length){if(m.HasUrl(j[g])){o.playerExtension=j[g]}g++}var l=m.FindUrl(o.playerExtension,o.playerQuality);if(l){var h=Vio.$go(p.PlayerElement);if(h&&f(h)&&typeof(h.newMedia)=="function"){h.currentMedia=h.newMedia(l.Url)}else{Vio.$ee(p.PlayerElement);var k={AutoStart:(n.autoplay=="always"?1:0),AllowScan:1,EnablePositionControls:false,EnableFullScreenControls:true,ShowPositionControls:false,ShowTracker:1,StretchToFit:(n.scaling=="fit"?1:0),DisplaySize:4,AutoSize:0,uiMode:"mini",AllowChangeDisplaySize:1,Volume:(Math.round(100*parseFloat(n.volume_default||"0.8")))};var q=document.createElement("div");p.PlayerElement.appendChild(q);d(q,l.Url,o.playerWidth,o.playerHeight,k)}}else{Vio.Log("no media")}}else{Vio.Media.LoadP(o.mediaId,function(){var r=Vio.Media.Find(o.mediaId);if(r&&r.Urls.length>0){e(p)}})}},CanPlay:function(g){switch(g){case"wmv":case"wma":case"mp3":return true;break}return false}}})()});Vio.Extend({BaseURL:"http://player.cdn.vioapi.com/v6/"});