if(typeof jeroenwijering=="undefined"){var jeroenwijering=new Object();jeroenwijering.utils=new Object()}jeroenwijering.Player=function(B,C,A){this.configuration={backgroundcolor:"ffffff",file:"video.wmv",height:"260",image:"",backcolor:"FFFFFF",frontcolor:"000000",lightcolor:"000000",screencolor:"000000",width:"320",logo:"",overstretch:"false",showicons:"true",shownavigation:"true",showstop:"false",showdigits:"true",usefullscreen:"true",usemute:"false",autostart:"false",bufferlength:"3",duration:"0",repeat:"false",sender:"",volume:"90",link:"",linkfromdisplay:"false",linktarget:"_self"};for(itm in this.configuration){if(A[itm]!=undefined){if(itm.indexOf("color")>0){this.configuration[itm]=A[itm].substr(-6)}else{this.configuration[itm]=A[itm]}}}Silverlight.createObjectEx({source:C,parentElement:B,properties:{width:this.configuration.width,height:this.configuration.height,version:"1.0",inplaceInstallPrompt:true,isWindowless:"false",background:"#"+this.configuration.backgroundcolor},events:{onLoad:this.onLoadHandler},context:this})};jeroenwijering.Player.prototype={onLoadHandler:function(A,F,E){F.configuration.sender=E;var C=new jeroenwijering.Controller(F.configuration);var D=new jeroenwijering.View(F.configuration,C);var B=new jeroenwijering.Model(F.configuration,C,D);C.startMVC(D,B)}};jeroenwijering.Controller=function(A){this.configuration=A};jeroenwijering.Controller.prototype={startMVC:function(B,A){this.view=B;this.model=A;if(this.configuration.usemute=="true"){this.view.onVolume(0);this.view.onMute(true);this.model.goVolume(0)}else{this.view.onVolume(this.configuration.volume);this.model.goVolume(this.configuration.volume)}if(this.configuration.autostart=="true"){this.model.goStart()}else{this.model.goPause()}},setState:function(A,B){this.state=B},setLink:function(){if(this.configuration.linktarget.indexOf("javascript:")==0){return Function(this.configuration.linktarget).apply()}else{if(this.configuration.linktarget=="_blank"){window.open(this.configuration.link)}else{if(this.configuration.linktarget!=""){window.location=this.configuration.link}}}},setMute:function(){if(this.configuration.usemute=="true"){this.configuration.usemute="false";this.model.goVolume(this.configuration.volume);this.view.onMute(false)}else{this.configuration.usemute="true";this.model.goVolume(0);this.view.onMute(true)}},setPlay:function(){if(this.state=="Buffering"||this.state=="Playing"){this.model.goPause()}else{this.model.goStart()}},setScrub:function(A){if(A<2){A=0}else{if(A>this.configuration.duration-4){A=this.configuration.duration-4}}if(this.state=="Buffering"||this.state=="Playing"){this.model.goStart(A)}else{this.model.goPause(A)}},setStop:function(){this.model.goStop()},setVolume:function(A){if(A<0){A=0}else{if(A>100){A=100}}this.configuration.volume=Math.round(A);this.model.goVolume(A);this.view.onVolume(A);if(this.configuration.usemute=="true"){this.configuration.usemute="false";this.view.onMute(false)}},setFullscreen:function(){var A=!this.configuration.sender.getHost().content.FullScreen;this.configuration.sender.getHost().content.FullScreen=A;jeroenwijering.utils.delegate(this.view,this.view.onFullscreen)}};jeroenwijering.View=function(A,B){this.configuration=A;this.controller=B;this.fstimeout;this.fslistener;this.display=this.configuration.sender.findName("PlayerDisplay");this.controlbar=this.configuration.sender.findName("PlayerControls");this.configuration.sender.getHost().content.onResize=jeroenwijering.utils.delegate(this,this.resizePlayer);this.configuration.sender.getHost().content.onFullScreenChange=jeroenwijering.utils.delegate(this,this.onFullscreen);this.assignColorsClicks();this.resizePlayer()};jeroenwijering.View.prototype={onBuffer:function(B){var A=this.configuration.sender;if(B==0){A.findName("BufferText").Text=null}else{B<10?B="0"+B:B=""+B;A.findName("BufferText").Text=B}},onFullscreen:function(C){var A=this.configuration.sender;var B=A.getHost().content.FullScreen;if(B){this.fstimeout=setTimeout(jeroenwijering.utils.delegate(this,this.hideFSControls),2000);this.fslistener=this.display.addEventListener("MouseMove",jeroenwijering.utils.delegate(this,this.showFSControls));A.findName("FullscreenSymbol").Visibility="Collapsed";A.findName("FullscreenOffSymbol").Visibility="Visible"}else{clearTimeout(this.fstimeout);this.display.removeEventListener("MouseMove",this.fslistener);this.controlbar.Visibility="Visible";this.display.Cursor="Hand";A.findName("FullscreenSymbol").Visibility="Visible";A.findName("FullscreenOffSymbol").Visibility="Collapsed"}this.resizePlayer()},showFSControls:function(D,A){var B=D.findName("PlayerControls");var C=A.GetPosition(B).Y;clearTimeout(this.fstimeout);this.controlbar.Visibility="Visible";this.display.Cursor="Hand";if(C<0){this.fstimeout=setTimeout(jeroenwijering.utils.delegate(this,this.hideFSControls),2000)}},hideFSControls:function(){this.controlbar.Visibility="Collapsed";this.display.Cursor="None"},onLoad:function(C){var B=this.configuration.sender;var A=B.findName("TimeSlider").Width;B.findName("DownloadProgress").Width=Math.round(A*C/100)},onMute:function(B){var A=this.configuration.sender;this.configuration.usemute=""+B;if(B){A.findName("VolumeHighlight").Visibility="Collapsed";A.findName("MuteSymbol").Visibility="Visible";A.findName("MuteOffSymbol").Visibility="Collapsed";if(this.state=="Playing"){A.findName("MuteIcon").Visibility="Visible"}}else{A.findName("VolumeHighlight").Visibility="Visible";A.findName("MuteSymbol").Visibility="Collapsed";A.findName("MuteOffSymbol").Visibility="Visible";A.findName("MuteIcon").Visibility="Collapsed"}},onState:function(B,C){var A=this.configuration.sender;this.state=C;if(C=="Buffering"||C=="Playing"||C=="Opening"){A.findName("PlayIcon").Visibility="Collapsed";A.findName("PlaySymbol").Visibility="Collapsed";A.findName("PlayOffSymbol").Visibility="Visible";if(C=="Playing"||this.configuration.showicons=="false"){A.findName("BufferIcon").Visibility="Collapsed";A.findName("BufferText").Visibility="Collapsed";if(this.configuration.usemute=="true"){A.findName("MuteIcon").Visibility="Visible"}}else{if(this.configuration.showicons=="true"){A.findName("BufferIcon").Visibility="Visible";A.findName("BufferText").Visibility="Visible"}else{A.findName("BufferIcon").Visibility="Collapsed";A.findName("BufferText").Visibility="Collapsed"}}}else{A.findName("MuteIcon").Visibility="Collapsed";A.findName("BufferIcon").Visibility="Collapsed";A.findName("BufferText").Visibility="Collapsed";A.findName("PlaySymbol").Visibility="Visible";A.findName("PlayOffSymbol").Visibility="Collapsed";if(this.configuration.showicons=="true"){A.findName("PlayIcon").Visibility="Visible"}else{A.findName("PlayIcon").Visibility="Collapsed"}}},onTime:function(D,C){var B=this.configuration.sender;var B=this.configuration.sender;var A=B.findName("TimeSlider").Width;var E=Math.round(A*D/C);if(isNaN(E)){E=0}this.configuration.duration=C;B.findName("ElapsedText").Text=jeroenwijering.utils.timestring(D);B.findName("RemainingText").Text=jeroenwijering.utils.timestring(C-D);B.findName("TimeSymbol")["Canvas.Left"]=E+4;B.findName("TimeHighlight").Width=E-2},onVolume:function(B){var A=this.configuration.sender;A.findName("VolumeHighlight").Width=Math.round(B/5)},assignColorsClicks:function(){this.display.Cursor="Hand";this.display.Background="#FF"+this.configuration.screencolor;if(this.configuration.linkfromdisplay=="false"){this.display.addEventListener("MouseLeftButtonUp",jeroenwijering.utils.delegate(this.controller,this.controller.setPlay))}else{this.display.addEventListener("MouseLeftButtonUp",jeroenwijering.utils.delegate(this.controller,this.controller.setLink))}if(this.configuration.logo!=""){this.display.findName("OverlayCanvas").Visibility="Visible";this.display.findName("OverlayLogo").ImageSource=this.configuration.logo}this.controlbar.findName("ControlbarBack").Fill="#FF"+this.configuration.backcolor;this.assignButton("Play",this.controller.setPlay);this.assignButton("Stop",this.controller.setStop);this.configuration.sender.findName("ElapsedText").Foreground="#FF"+this.configuration.frontcolor;this.assignSlider("Time",this.changeTime);this.configuration.sender.findName("DownloadProgress").Fill="#FF"+this.configuration.frontcolor;this.configuration.sender.findName("RemainingText").Foreground="#FF"+this.configuration.frontcolor;this.assignButton("Link",this.controller.setLink);this.assignButton("Fullscreen",this.controller.setFullscreen);this.assignButton("Mute",this.controller.setMute);this.assignSlider("Volume",this.changeVolume)},assignButton:function(C,A){var B=this.configuration.sender.findName(C+"Button");B.Cursor="Hand";B.addEventListener("MouseLeftButtonUp",jeroenwijering.utils.delegate(this.controller,A));B.addEventListener("MouseEnter",jeroenwijering.utils.delegate(this,this.rollOver));B.addEventListener("MouseLeave",jeroenwijering.utils.delegate(this,this.rollOut));this.configuration.sender.findName(C+"Symbol").Fill="#FF"+this.configuration.frontcolor;try{this.configuration.sender.findName(C+"OffSymbol").Fill="#FF"+this.configuration.frontcolor}catch(D){}},assignSlider:function(C,A){var B=this.configuration.sender.findName(C+"Button");B.Cursor="Hand";B.addEventListener("MouseLeftButtonUp",jeroenwijering.utils.delegate(this,A));B.addEventListener("MouseEnter",jeroenwijering.utils.delegate(this,this.rollOver));B.addEventListener("MouseLeave",jeroenwijering.utils.delegate(this,this.rollOut));this.configuration.sender.findName(C+"Slider").Fill="#FF"+this.configuration.frontcolor;this.configuration.sender.findName(C+"Highlight").Fill="#FF"+this.configuration.frontcolor;this.configuration.sender.findName(C+"Symbol").Fill="#FF"+this.configuration.frontcolor},rollOver:function(C){var B=C.Name.substr(0,C.Name.length-6);this.configuration.sender.findName(B+"Symbol").Fill="#FF"+this.configuration.lightcolor;try{this.configuration.sender.findName(B+"OffSymbol").Fill="#FF"+this.configuration.lightcolor}catch(A){}},rollOut:function(C){var B=C.Name.substr(0,C.Name.length-6);this.configuration.sender.findName(B+"Symbol").Fill="#FF"+this.configuration.frontcolor;try{this.configuration.sender.findName(B+"OffSymbol").Fill="#FF"+this.configuration.frontcolor}catch(A){}},changeTime:function(E,B){var A=E.findName("TimeSlider");var C=B.GetPosition(A).X;var D=Math.floor(C/A.Width*this.configuration.duration);this.controller.setScrub(D)},changeVolume:function(D,A){var C=D.findName("VolumeButton");var B=A.GetPosition(C).X;this.controller.setVolume(B*5)},resizePlayer:function(){var B=this.configuration.sender.getHost().content.actualWidth;var C=this.configuration.sender.getHost().content.actualHeight;var A=this.configuration.sender.getHost().content.FullScreen;if(this.configuration.shownavigation=="true"){if(A==true){this.resizeDisplay(B,C);this.controlbar["Canvas.Left"]=Math.round(B/2-250);this.resizeControlbar(500,C-this.controlbar.Height-16);this.controlbar.findName("ControlbarBack")["Opacity"]=0.5}else{this.resizeDisplay(B,C-20);this.controlbar["Canvas.Left"]=0;this.resizeControlbar(B,C-this.controlbar.Height);this.controlbar.findName("ControlbarBack")["Opacity"]=1}}else{this.resizeDisplay(B,C)}},resizeDisplay:function(A,B){this.stretchElement("PlayerDisplay",A,B);this.stretchElement("VideoWindow",A,B);this.stretchElement("PlaceholderImage",A,B);this.centerElement("PlayIcon",A,B);this.centerElement("MuteIcon",A,B);this.centerElement("BufferIcon",A,B);this.centerElement("BufferText",A,B);this.display.findName("OverlayCanvas")["Canvas.Left"]=A-110;this.display.Visibility="Visible"},resizeControlbar:function(D,F,A){this.controlbar["Canvas.Top"]=F;this.stretchElement("PlayerControls",D);this.stretchElement("ControlbarBack",D);this.placeElement("PlayButton",0);var C=17;this.placeElement("VolumeButton",D-24);this.placeElement("MuteButton",D-37);var B=37;if(this.configuration.showstop=="true"){this.placeElement("StopButton",C);C+=17}else{this.controlbar.findName("StopButton").Visibility="Collapsed"}if(this.configuration.usefullscreen=="true"){B+=18;this.placeElement("FullscreenButton",D-B)}else{this.controlbar.findName("FullscreenButton").Visibility="Collapsed"}if(this.configuration.link!=""){B+=18;this.placeElement("LinkButton",D-B)}else{this.controlbar.findName("LinkButton").Visibility="Collapsed"}if(this.configuration.showdigits=="true"&&D-B-C>160){B+=35;this.controlbar.findName("RemainingButton").Visibility="Visible";this.controlbar.findName("ElapsedButton").Visibility="Visible";this.placeElement("RemainingButton",D-B);this.placeElement("ElapsedButton",C);C+=35}else{this.controlbar.findName("RemainingButton").Visibility="Collapsed";this.controlbar.findName("ElapsedButton").Visibility="Collapsed"}this.placeElement("TimeButton",C);this.stretchElement("TimeButton",D-C-B);this.stretchElement("TimeShadow",D-C-B);this.stretchElement("TimeStroke",D-C-B);this.stretchElement("TimeFill",D-C-B);this.stretchElement("TimeSlider",D-C-B-10);this.stretchElement("DownloadProgress",D-C-B-10);var E=this.configuration.sender.findName("TimeSymbol");this.stretchElement("TimeHighlight",E["Canvas.Left"]-5);this.controlbar.Visibility="Visible"},centerElement:function(B,A,D){var C=this.configuration.sender.findName(B);C["Canvas.Left"]=Math.round(A/2-C.Width/2);C["Canvas.Top"]=Math.round(D/2-C.Height/2)},stretchElement:function(B,A,D){var C=this.configuration.sender.findName(B);C.Width=A;if(D!=undefined){C.Height=D}},placeElement:function(B,A,C){var D=this.configuration.sender.findName(B);D["Canvas.Left"]=A;if(C){D["Canvas.Top"]=C}}};jeroenwijering.Model=function(A,B,D){this.configuration=A;this.controller=B;this.view=D;this.video=this.configuration.sender.findName("VideoWindow");this.preview=this.configuration.sender.findName("PlaceholderImage");var C={"true":"UniformToFill","false":"Uniform",fit:"Fill",none:"None"};this.state=this.video.CurrentState;this.timeint;this.video.Stretch=C[this.configuration.overstretch];this.preview.Stretch=C[this.configuration.overstretch];this.video.BufferingTime=jeroenwijering.utils.spanstring(this.configuration.bufferlength);this.video.AutoPlay=true;this.video.AddEventListener("CurrentStateChanged",jeroenwijering.utils.delegate(this,this.stateChanged));this.video.AddEventListener("MediaEnded",jeroenwijering.utils.delegate(this,this.mediaEnded));this.video.AddEventListener("BufferingProgressChanged",jeroenwijering.utils.delegate(this,this.bufferChanged));this.video.AddEventListener("DownloadProgressChanged",jeroenwijering.utils.delegate(this,this.downloadChanged));if(this.configuration.image!=""){this.preview.Source=this.configuration.image}};jeroenwijering.Model.prototype={goPause:function(A){this.video.pause();if(!isNaN(A)){this.video.Position=jeroenwijering.utils.spanstring(A)}this.timeChanged()},goStart:function(A){this.video.Visibility="Visible";this.preview.Visibility="Collapsed";if(this.state=="Closed"){this.video.Source=this.configuration.file}else{this.video.play()}if(!isNaN(A)){this.video.Position=jeroenwijering.utils.spanstring(A)}},goStop:function(){this.video.Visibility="Collapsed";this.preview.Visibility="Visible";this.goPause(0);this.video.Source="null"},goVolume:function(A){this.video.Volume=A/100},stateChanged:function(){var A=this.video.CurrentState;if(A!=this.state){this.controller.setState(this.state,A);this.view.onState(this.state,A);this.state=A;this.configuration.duration=Math.round(this.video.NaturalDuration.Seconds*10)/10;if(A!="Playing"&&A!="Buffering"&&A!="Opening"){clearInterval(this.timeint)}else{this.timeint=setInterval(jeroenwijering.utils.delegate(this,this.timeChanged),100)}}},mediaEnded:function(){if(this.configuration.repeat=="true"){this.goStart(0)}else{this.video.Visibility="Collapsed";this.preview.Visibility="Visible";this.goPause(0)}},bufferChanged:function(){var A=Math.round(this.video.BufferingProgress*100);this.view.onBuffer(A)},downloadChanged:function(){var A=Math.round(this.video.DownloadProgress*100);this.view.onLoad(A)},timeChanged:function(){var A=Math.round(this.video.Position.Seconds*10)/10;this.view.onTime(A,this.configuration.duration)}};jeroenwijering.utils.delegate=function(A,B){return function(){return B.apply(A,arguments)}};jeroenwijering.utils.timestring=function(A){var C=Math.floor(A/3600);var B=Math.floor(A%3600/60);var D=Math.round(A%60);var E="";D>9?E+=D:E+="0"+D;B>9?E=B+":"+E:E="0"+B+":"+E;C>0?E=C+":"+E:null;return E};jeroenwijering.utils.spanstring=function(A){var C=Math.floor(A/3600);var B=Math.floor(A%3600/60);var D=Math.round(A%60*10)/10;var E=C+":"+B+":"+D;return E};