/*! Help & Manual WebHelp 3 Script functions
Copyright (c) 2015-2019 by Tim Green. All rights reserved. Contact tg@it-authoring.com
*/
function videoBoxConstructor(){var c=function(f,e){if(f<e){return f}return e};var a=function(f,e){if(f>e){return f}return e};var b=function(u,e,D,z,j,f,o,G,y,F){var h=$(window);var E=$(document);var A=$("body");var k=null;$(A).prepend('<div id="hmlightboxbackground" style="z-index:99997;border:none;padding:0;margin:0;position:absolute;left:0;top:0;background-color:#7F7F7F"></div>');var g=$("#hmlightboxbackground");g.css("opacity","0.5");$(A).prepend('<div id="hmlightboxscrolllayer" style="z-index:99998;border:none;padding:0;margin:0;position:absolute;left:0;top:0;background:none;overflow:auto"></div>');k=parent.$("#hmlightboxscrolllayer");A=k;$(A).prepend('<div id="hmlightbox" style="z-index:99999;position:absolute;display:none"></div>');var i=$("#hmlightbox");var t=$(u).appendTo(i);t.children("object").first().attr("id","hmVideoBox");var q=null;if(G!==null){$(i).append('<p id="hmlightboxcaption">'+G+"</p>");q=$("#hmlightboxcaption")}var C=300;var l,v;var B=f;var m=o;if(hmLightboxConstrained){if(f>($(h).width()-40)){f=$(h).width()-40;if(f<(B/2)){f=B/2}o=m*f/B}}t.css({width:f+"px",height:o+"px"});if(q!==null){q.css("width",f+"px")}if(hmAnimate&&y){v=s();if(q!==null){q.css("display","none")}t.css({width:z+"px",height:j+"px"});l=s();p();l[0]=e;l[1]=D;i.css({left:l[0]+"px",top:l[1]+"px"});i.show();i.animate({left:v[0]-t.position().left,top:v[1]-t.position().top},C,function(){if(q!==null){q.css("display","block")}});t.animate({width:f,height:o},C)}else{v=s();p();i.show()}$(h).bind("resize.hmlightbox",p);$(h).bind("scroll.hmlightbox",w);$(A).bind("click.hmlightbox",x);$(A).bind("keydown.hmlightbox",n);$(i).focus();function w(){g.css("width",(($(E).scrollLeft()>0)?$(E).width():$(h).width())+"px");g.css("height",(($(E).scrollTop()>0)?$(E).height():$(h).height())+"px")}function p(){if(hmLightboxConstrained){var H=f;f=$(h).width()-40;if(f>B){f=B}else{if(f<(B/2)){f=B/2}}if(H!=f){o=m*f/B;t.css({width:f+"px",height:o+"px"});if(q!==null){q.css("width",f+"px")}}}var I=s();i.css({left:I[0]+"px",top:I[1]+"px"});if(k!==null){k.css({width:$(h).width()+"px",height:$(h).height()+"px"})}w()}function s(){var K=i.width();var N=i.height();if(F){K=f;N=o}var M=a(K+40,E.width());var I=a(N+40,E.height());var L=a(20,parseInt(($(h).width()-K)/2)+(E.scrollLeft()));var H=a(20,parseInt(($(h).height()-N)/2)+(E.scrollTop()));var J=new Array(L,H,K,N);return J}function n(H){if(H.keyCode==27){r()}}function x(I){var H=(!F)||(I.pageX<i.position().left)||(I.pageY<i.position().top)||(I.pageX>i.position().left+i.width())||(I.pageY>i.position().top+i.height());if(H){r()}}function r(){if(hmAnimate&&y){if(q!==null){q.css("display","none")}t.animate({width:0,height:0},C);i.animate({left:e+z/2,top:D+j/2},C,function(){$("object#hmVideoBox").remove();i.remove();if(k!==null){k.remove()}g.remove()})}else{t.css({width:0,height:0});i.remove();if(k!==null){k.remove()}g.remove()}$(h).unbind(".hmlightbox");$(A).unbind(".hmlightbox")}};var d=function(h){var l=h.data,g=h.$obj.offset().left,j=h.$obj.offset().top,f=h.$obj.outerWidth(),k=h.$obj.outerHeight(),i=h.vWidth,e=h.vHeight;b(l,g,j,f,k,i,e,"",true,true)};return d}hmWebHelp.funcs.hmVideoBox=videoBoxConstructor();
