/*! Help & Manual WebHelp 3 Script functions
Copyright (c) 2015-2019 by Tim Green. All rights reserved. Contact tg@it-authoring.com
*/
function hmDropDownToggles(){var a=this;a.clicked=false;this.HMToggle=function(t,m,r,n){var p=(typeof m==="undefined")?"toggle":m,q=(typeof r==="undefined")?150:r,s=t.attr("data-icon"),f=t.attr("data-type"),k=s?t.attr("data-src0"):null,j=s?t.attr("data-src1"):null,h=t.attr("data-state"),d=$("div#"+t.attr("id").replace(/_LINK/,"")),c=s?$("img#"+s):null,o=typeof n!=="undefined",i=true;function l(w){var A=t.position().top,u=d.position().top,D=(u-A)+d.height(),C=hmpage.$scrollContainer.height(),z=(A+D)-C,v=hmpage.$scrollBox[0].scrollTop,B=v+z,y=0,x=false;if(B<v){x=true}else{if(D>C||B<0){B=t;y=-10}}if(!x){hmpage.$scrollBox.scrollTo(B,300,{axis:"y",offset:{top:y},onAfter:function(){if(t.attr("class")=="dropdown-toggle"&&!a.clicked){hmWebHelp.flashTarget(t,3,200)}}})}else{if(t.attr("class")=="dropdown-toggle"&&!a.clicked){hmWebHelp.flashTarget(t,3,200)}}}function g(){d.slideDown(q,function(){if(!o&&typeof hmxtoggle=="undefined"){l(d)}});t.attr("data-state","1");if(s){c.attr("src",j)}if(!o){$("svg#showhide_toggles_icon").find("use").attr("xlink:href","#eye-off");$("li#showhide_toggles span").first().html("Спрятать дополнительный текст")}}function e(){d.slideUp(q);t.attr("data-state","0");if(s){c.attr("src",k)}if(!o){if($("a.dropdown-toggle[data-state='1']").length<1){$("svg#showhide_toggles_icon").find("use").attr("xlink:href","#eye");$("li#showhide_toggles span").first().html("Показать дополнительный текст")}}}switch(p){case"toggle":if(h==="0"||d.is(":hidden")){g()}else{e()}break;case"expand":g();break;case"collapse":e();break}};this.hmToggleToggles=function(){var g,k={},l,c,f,j,h,e,i;if(arguments.length>0&&typeof arguments[0]==="object"){i=arguments[0];k=typeof i.toggles==="undefined"?$("a.dropdown-toggle"):i.toggles;l=k.length;c=typeof i.speed==="undefined"&&l<21?150:l>20?0:i.speed;f=typeof i.mode==="undefined"?"toggle":i.mode;j=f!=="collapse"?"1":"0";h=typeof i.scrolltarget==="undefined"?null:i.scrolltarget;e=i.dotoggle;g=f==="collapse"?l-1:0}else{k=$("a.dropdown-toggle");l=k.length;c=l<21?150:0;g=0;f="toggle";j="1";h=null}if(f==="toggle"){k.each(function(){if($(this).attr("data-state")==="1"){f="collapse";j="0";g=l-1;return false}});if(f==="toggle"){f="expand";j="1";g=0}}function d(){var n=c,m=c>0?c+20:0,o=$(k[g]);if(o.attr("class")==="dropdown-toggle-body"){o=$("a.dropdown-toggle[id^="+o.get(0).id+"]")}if(o.attr("data-state")===j){n=m=0}if(f==="collapse"){a.HMToggle(o,f,c,"multi");g--;if(g>-1){setTimeout(function(){d()},m)}else{if(h&&h.is(":visible")){setTimeout(function(){hmpage.$scrollBox.scrollTo(h,300,{offset:{top:-10},onAfter:function(){if(e){a.HMToggle(e)}}})},m+50)}}$("svg#showhide_toggles_icon").find("use").attr("xlink:href","#eye");$("li#showhide_toggles span").first().html("Показать дополнительный текст")}else{if(f==="expand"){a.HMToggle(o,f,c,"multi");g++;if(g<l){setTimeout(function(){d()},m)}else{if(h){setTimeout(function(){hmpage.$scrollBox.scrollTo(h,300,{offset:{top:-10},onAfter:function(){if(e){a.HMToggle(e)}else{if(a.doflash){hmWebHelp.flashTarget(h.parent(),3,200)}}}})},m+50)}}$("svg#showhide_toggles_icon").find("use").attr("xlink:href","#eye-off");$("li#showhide_toggles span").first().html("Спрятать дополнительный текст")}}}d()};function b(d){var h,g,f,e;if(d&&typeof d==="object"){h=d.method;a.clicked=typeof d.clicked!="undefined"&&d.clicked;g=d.obj;a.doflash=typeof d.doFlash=="undefined"?true:d.doFlash;switch(h){case"HMToggle":if(typeof g.target!=="undefined"){a.HMToggle(g.target,g.mode,g.speed)}else{a.HMToggle(g)}break;case"HMToggleIcon":var c=g.attr("id");c=c.replace(/_ICON$/,"_LINK");g=$("a#"+c);a.HMToggle(g);break;case"hmToggleToggles":if(typeof g==="object"&&g!==null){a.hmToggleToggles(g)}else{a.hmToggleToggles()}break}}}return b}hmWebHelp.funcs.hmDoToggle=new hmDropDownToggles();
