/*
 HTML5 Video Player
 Version: 1.0.2
 (c) 2011 DMXzone.com
 @build 06-09-2011 14:39:21
*/
(function(j){var n={plugins:["Display","Startbutton","Controlbar","Bufferingicon"],width:570,height:320,controls:!0};j.fn.dmxHTML5VideoPlayer=function(e){function g(c,a){var d=a.getItemConfig("title",a.getItemIdx());d||(d="");return c.replace(/##index##/g,a.getItemIdx()).replace(/##nr##/g,a.getItemIdx()+1).replace(/##title##/g,d.replace(/'/g,"\\'").replace(/"/g,'\\"'.replace(/([\n\r\t])/g,"\\$1"))).replace(/##time##/g,k(a.getPosition())).replace(/##remaining##/g,k(a.getDuration()-a.getPosition())).replace(/##duration##/g,
k(a.getDuration())).replace(/##position##/g,o(a.getPosition(),a.getDuration())).replace(/##volume##/g,a.getVolume())}function o(c,a){return Math.round(100*c/a)||0}function k(c){var a={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""},d=new Date(c),b=d.getUTCHours(),c=d.getUTCMinutes(),d=d.getUTCSeconds(),b=a.padHour&&b<10?"0"+b:b,c=a.padMin&&c<10?"0"+c:c,d=a.padSec&&d<10?"0"+d:d;return(a.showHour?b+a.sepHour:"")+(a.showMin?c+a.sepMin:"")+(a.showSec?
d+a.sepSec:"")}function m(c){c=jQuery('<a href="'+String(c)+'" />');return String(String(c[0].href))}var h=/chrome/.test(navigator.userAgent.toLowerCase()),i=function(){var c=jQuery('script[src*="ScriptLibrary/dmxHTML5VideoPlayer.js"]');if(c.length>0){var c=c.eq(0).attr("src"),a=c.indexOf("dmxHTML5VideoPlayer.js");if(a!=-1)return c.substring(0,a)}return""}(),b=i+"jarisplayer.swf",e=j.extend(n,e,{useYTIframeAPI:!function(){var c=!1,a=navigator,b=a.plugins,e,f=window.ActiveXObject;if(b&&b.length)(a=
a.mimeTypes)&&a["application/x-shockwave-flash"]&&a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(c=!0);else if(typeof f!=="undefined"){try{e=new f("ShockwaveFlash.ShockwaveFlash")}catch(g){}c=!!e}return c}(),playerFlashMP4:b,playerFlashMP3:b,defaultPoster:i+"html5_video_player_poster_nobutton.jpg"});m(i);for(var l=0;l<e.playlist.length;l++){for(var b=e.playlist[l],f=0;f<3;f++)if(b[f]&&b[f].src)b[f].src=m(b[f].src);if(b[0]&&b[0].src&&
b[0].src.search(/\/vid\.ly\//)!=-1&&(f=b[0].src.replace(/\/$/,"").match(/\/vid\.ly\/(\w+)/))&&f.length>0)f=f[1],b[0]={src:"http://vidly.s3.amazonaws.com/"+f+"/mp4.mp4",type:"video/mp4"},b[1]={src:"http://vidly.s3.amazonaws.com/"+f+"/webm.webm",type:"video/webm"},b[2]={src:"http://vidly.s3.amazonaws.com/"+f+"/ogv.ogv",type:"video/ogg"};h&&b[0]&&b[1]&&(f=b[1],b[1]=b[0],b[0]=f)}e.volume&&e.volume>0&&(e.volume/=100);if(!e.poster)e.poster=i+"html5_video_player_poster_nobutton.jpg";e.currentItemPlaying=
-1;h=projekktor(this.selector,e);j(this.selector).attr("id");h.addListener("state",function(c,a){if(a&&a.config){var b=document.getElementById(a._id);switch(c){case "PLAYING":a.config.currentItemPlaying==-1&&a._bubbleEvent("item",a.getItemIdx());a.config.currentItemPlaying=a.getItemIdx();a.config.onPlay&&(typeof a.config.onPlay=="string"?(new Function(g(a.config.onPlay,a))).call(b):a.config.onPlay.call(a));break;case "PAUSED":a.config.onPause&&(typeof a.config.onPause=="string"?(new Function(g(a.config.onPause,
a))).call(b):a.config.onPause.call(a));break;case "IDLE":a.config.onStop&&(typeof a.config.onStop=="string"?(new Function(g(a.config.onStop,a))).call(b):a.config.onStop.call(a))}}});e.onUpdate&&h.addListener("time",function(b,a){if(a&&a.config){var d=document.getElementById(a._id);a.config.onUpdate&&(typeof a.config.onUpdate=="string"?(new Function(g(a.config.onUpdate,a))).call(d):a.config.onUpdate.call(a))}});(e.onChange||e.onNext||e.onPrevious)&&h.addListener("item",function(b,a){if(a&&a.config){var d=
document.getElementById(a._id);a.config.onChange&&(typeof a.config.onChange=="string"?(new Function(g(a.config.onChange,a))).call(d):a.config.onChange.call(a));a.config.onNext&&a.config.currentItemPlaying!=null&&b>a.config.currentItemPlaying&&(typeof a.config.onNext=="string"?(new Function(g(a.config.onNext,a))).call(d):a.config.onNext.call(a));a.config.onPrevious&&a.config.currentItemPlaying!=null&&b<a.config.currentItemPlaying&&(typeof a.config.onPrevious=="string"?(new Function(g(a.config.onPrevious,
a))).call(d):a.config.onPrevious.call(a))}});return this}})(jQuery);

