!function(){function e(){var o=!1,e=$$(".getParentURL"),t=$$(".jotform-form")[0];function n(n){e.each(function(e){var t=function(){if(!o){try{o=parent.document.URL||document.URL}catch(e){console.log("Iframe embed detected - cant access parent, waiting for postmessage"),o=document.referrer}setTimeout(function(){console.log("Parent URL:",o)},4e3)}return o}();e.value!==t&&(e.value=t,e.triggerEvent("keyup")),n&&e.up(".form-line").hide()})}function r(e){if(e&&e.data)try{var t;e.data&&function(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return!0}catch(e){}return!1}(e.data)&&("urls"==(t=JSON.parse(e.data)).type&&t.value.docurl&&(o=decodeURIComponent(t.value.docurl),n()))}catch(e){console.error(e.message)}}this.init=function(){r(),t.observe("submit",function(){n()}),n(!0)},window.addEventListener?window.addEventListener("message",r,!1):window.attachEvent("onmessage",r)}document.observe("dom:loaded",function(){$("stage")||(Element.prototype.triggerEvent=function(e){if(document.createEvent){var t=document.createEvent("HTMLEvents");return t.initEvent(e,!0,!0),this.dispatchEvent(t)}if(this.fireEvent)return this.fireEvent("on"+e)},(new e).init())})}();