function js_form_builder (form_id){ this.form_id = form_id; this.frame = null; this.init = function(){ this.create_frame(); var XD=function(){var interval_id,last_hash,cache_bust=1,attached_callback,window=this;return{postMessage:function(message,target_url,target){if(!target_url){return}target=target||parent;if(window['postMessage']){target['postMessage'](message,target_url.replace(/([^:]+:\/\/[^\/]+).*/,'$1'))}else if(target_url){target.location=target_url.replace(/#.*$/,'')+'#'+(+new Date)+(cache_bust++)+'&'+message}},receiveMessage:function(callback,source_origin){if(window['postMessage']){if(callback){attached_callback=function(e){if((typeof source_origin==='string'&&e.origin!==source_origin)||(Object.prototype.toString.call(source_origin)==="[object Function]"&&source_origin(e.origin)===!1)){return!1}callback(e)}}if(window['addEventListener']){window[callback?'addEventListener':'removeEventListener']('message',attached_callback,!1)}else{window[callback?'attachEvent':'detachEvent']('onmessage',attached_callback)}}else{interval_id&&clearInterval(interval_id);interval_id=null;if(callback){interval_id=setInterval(function(){var hash=document.location.hash,re=/^#?\d+&/;if(hash!==last_hash&&re.test(hash)){last_hash=hash;callback({data:hash.replace(re,'')})}},100)}}}}}(); var self=this; XD.receiveMessage(function(message){ //window.alert("msg:["+message.data + "] received on "+window.location.host); if(message && message.data){ self.set_frame_height(message.data); } }); }; this.set_frame_height = function(height){ //alert('set:'+height); this.frame.style.height = height; }, this.scroll_to_page_top = function(){ if(window['scrollTo']){ window.scrollTo(0,0); }else{ window.location.href='#'; } }, this.create_frame = function(){ var htmlCode = ""; document.write(htmlCode); this.frame = document.getElementById(this.form_id); }; this.init(); } var js_form_builder_instance=new js_form_builder('iframe_o0M2553fd3n3tb4b8');