function auto_size_iframe(url){

	this.visit_id="u8eDJ7XM7o6fr71";
	this.frame_id = "auto_size_iframe_"+this.visit_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){var match=target_url.match(new RegExp(/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi));if(!match){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 && typeof message.data === 'string'){
				var parts=message.data.split(',');
				var operation=parts[0];
				if(operation=='resize'){
					var height=parts[1];
					var visit_id=parts.length>=3 ? parts[2] : null;
					self.set_frame_height(height, visit_id);
				}else if(operation=='scroll_to'){
					var y=parseInt(parts[1]);
					var visit_id=parts.length>=3 ? parts[2] : null;
					self.scroll_to(y, visit_id);
				} else if (operation === 'redirect') {
                    location.assign(parts[1]);
                }
			}
		});
	};

	this.set_frame_height = function(height, visit_id){
		if(!visit_id || this.visit_id==visit_id){
			this.frame.style.height = height;
		}
	},

	this.scroll_to = function (y, visit_id){
		if(!visit_id || this.visit_id==visit_id){
			var destination=y + jQuery("#"+this.frame_id).offset().top;
			jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100);
		}
	},

	this.scroll_to_page_top = function(){
		if(window['scrollTo']){
			window.scrollTo(0,0);
		}else{
			window.location.href='#';
		}
	},
	this.create_frame = function(){
				var htmlCode = "<html><body><iframe src=\""+url+"#"+encodeURIComponent(document.location.href)+"\""
			+" allowtransparency=\"true\" frameborder=\"0\" name=\""+this.frame_id+"\" id=\""+this.frame_id+"\" style=\"height:100px;width:100%;border:none;\" scrolling=\"no\" onload=\"auto_size_iframe_instance.scroll_to_page_top();\" allow='camera'></iframe></body></html>";
		document.write(htmlCode);
		this.frame = document.getElementById(this.frame_id);
	};

	this.init();
}

    var getScriptURL = (function() {
        var formId = 'u8eDJ7XM7o6fr71';
        var scripts = document.getElementsByTagName('script');
        var len =  scripts.length;
        var regex = new RegExp(".*" + formId + ".*", "g");
        for(var i = 0; i < len; i++){
           if (scripts[i].src.length > 0) {
                if(regex.test(scripts[i].src)) {
                    return function() { return scripts[i].src.split("?")[1]; };
                }
           }
        }
    })();
    var dataUrl = getScriptURL() ?  getScriptURL() : '';

    var auto_size_iframe_instance=new auto_size_iframe('https://www.emailmeform.com/builder/embed/u8eDJ7XM7o6fr71'+'?'+dataUrl);
if (typeof jQuery == 'undefined'){
	document.write(unescape("%3Cscript src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
}
