/*! Help & Manual WebHelp 3 Script functions
Copyright (c) 2015-2019 by Tim Green. All rights reserved. Contact tg@it-authoring.com
*/
function xMsg(g){var b=g+": ",h=/^https??:\/\//im.test(document.location)?"?":"!";var f=document.domain;if(f!==""&&location.protocol!=="file:"){f=location.protocol+"//"+f+(location.port!==""?":"+location.port:"")}else{f="*"}function j(n,l,o){try{var k=typeof n!=="string"?n:n==="parent"?parent:n.indexOf("parent.")===0?parent.frames[n.substr(7)].contentWindow:document.getElementById(n).contentWindow;if(typeof l=="object"){k.postMessage(l,f)}else{if(typeof l=="string"){k.postMessage(l+(o?","+o:""),f)}}}catch(m){console.log(b+"SENDMESSAGE ERROR: "+n+" / "+l+" / "+o+" / "+m.message)}}function i(l){var k;l=l.replace(/^\*/,"");switch(l){case"true":return true;case"false":return false;case"null":return null;case"undefined":return undefined;default:k=parseFloat(l,10);if(!isNaN(k)){return k}else{return l}}}function e(p,m){var l=typeof arguments[2]=="object"?arguments[2]:[].slice.call(arguments,2);var o=p.split(".");var n=o.pop();for(var k=0;k<o.length;k++){m=m[o[k]]}return m[n].apply(m,l)}function c(p,o){var l=window,n=p.split("."),k=n.pop();for(var m=0;m<n.length;m++){l=l[n[m]]}if(typeof o!="undefined"){if(typeof o=="string"){l[k]=i(o)}else{l[k]=o}}else{return l[k]}}var a=function(m,p,k){var l=m.indexOf("?")<0?m:m.substr(0,m.indexOf("?"));var o=0;var n=setInterval(function(){o++;if(hmFlags.hmCurrentPage===l){clearInterval(n);o=0;e(p,window,k)}if(o>20){clearInterval(n);o=0}},3)};function d(m){m=m||window.event;var k=document.location.protocol,l,o;if(k.substr(0,4)==="http"&&m.origin!=f){return}if(typeof m.data=="object"){if(!m.data.action){return}switch(m.data.action){case"setnavlinks":hmWebHelp.tocNav(m.data);break;case"setmobnavlinks":hmWebHelp.mobNavLinks(m.data);break;case"breadcrumbs":hmWebHelp.tocNav({action:"bread",crumbs:m.data});break;case"loadtopic":hmWebHelp.tocNav({action:"set",href:m.data.href,bs:m.data.bs,ac:m.data.ac});if(typeof m.data.cbf=="string"){a(m.data.href,m.data.cbf,m.data.cba)}break;case"loadtopicnonav":hmWebHelp.tocNav({action:"load",href:m.data.href,bs:m.data.bs});if(typeof m.data.cbf=="string"){a(m.data.href,m.data.cbf,m.data.cba)}break;case"callfunction":e(m.data.fn,window,m.data.fa);break;case"href":var n=m.data.href.replace(/\?anchor\=/,"#");tocSource.findElement(n);break;case"bs":tocSource.findElement(m.data.bs);break;case"setvalue":c(m.data.vn,m.data.vv);break;case"getvalue":j(m.source,{action:"returnvalue",vn:m.data.vn.replace(/\./g,"_"),vv:c(m.data.vn),cbf:m.data.cbf});break;case"returnvalue":e(m.data.cbf,window,m.data.vv);break}}else{if(typeof m.data=="string"){console.log("ERROR: xMessage call with deprecated string argument "+m.data)}}}if(window.addEventListener){window.addEventListener("message",d,false)}else{(window.attachEvent("onmessage",d))}return{sendObject:j,sendMessage:j}};
