function InvodoPlayer(A){this.options=A||{};for(var C in this.defaultOptions){this.options[C]=this.options[C]||this.defaultOptions[C]}if(this.options.attachOnload){if(typeof window.onload!="function"){window.onload=this.bindAsEventListener(this,this.attachOnClickHandler)}else{var B=window.onload;window.onload=this.chainEventListener(this,this.attachOnClickHandler,B)}}}InvodoPlayer.prototype={defaultOptions:{linkClassName:"InvodoPL",targetName:"InvodoPlayer",attachOnload:false},IE:!!(window.attachEvent&&!window.opera),bindAsEventListener:function(B,A){return function(C){return A.call(B,C)}},chainEventListener:function(C,B,A){return function(D){try{B.call(C,D)}finally{if(A){A()}}}},attachOnClickHandler:function(){var A=this.findInvodoPlayerLinks();for(var B=0;B<A.length;B++){var C=A[B];if(C.addEventListener){C.addEventListener("click",this.bindAsEventListener(this,this.launch),true)}else{if(C.attachEvent){C.attachEvent("onclick",this.bindAsEventListener(this,this.launch))}}if(!C.target){C.target=this.options.targetName}}},findInvodoPlayerLinks:function(){var A=document.getElementsByTagName("a");var C=new Array();var D=new RegExp("(^|\\s)"+this.options.linkClassName+"($|\\s)");var E;for(var B=0;B<A.length;B++){E=A[B];if(D.test(E.className)){C.push(E)}}return(C)},launch:function(D){var H=null;if("string"==typeof D){H=D}else{var C=D||window.event;var I=C.currentTarget||((C.srcElement.tagName=="IMG")?C.srcElement.parentElement:C.srcElement);if(!I){alert("Our apologies.  The video cannot be played at this time.  Please check again later.");return this.cancelEvent(C)}if(C.stopped){return this.cancelEvent(C)}H=I.href}var J=this.options.affiliate||"None";var G=/^(http[s]?):\/\/([^\/]+)(\/[^\/?\s]*)*[?]?([^\#\s]*)[\#]?(\S*)$/i;var E=G.exec(H);if(E&&E[4]){var L=E[4];var A=L.split(/[&=]/);for(var F=0;F<(A.length+1);){var B=A[F++];var K=A[F++];if("a"==B&&K){J=K;break}}}window.open(H,this.options.targetName,"menubar=0,location=0,resizable=0,width=770,height=515");return this.cancelEvent(C)},cancelEvent:function(A){if(!A){return false}if(this.IE){this.returnValue=false;this.cancelBubble=true}else{A.preventDefault();A.stopPropagation()}A.stopped=true;return false},toString:function(){var A="InvodoPlayer:";for(var B in this.options){A+="\n\t"+B+": "+this.options[B]}return A}};var invodoPlayer=new InvodoPlayer({attachOnload:true});
