function initForm(config) {
	var route = config.route;
	var formId = config.formId;

	var activeBlock = document.getElementById(formId);
	initSignupBlock(activeBlock);

	document.addEventListener("DOMContentLoaded", function() {
		sendHeightPostMessage();
	});

	window.addEventListener("resize", function() {
		sendHeightPostMessage();
	});

	var sendHeightPostMessage = function() {
		var body = document.body;
		var html = document.documentElement;
		var height = Math.max(body.offsetHeight, html.scrollHeight, html.offsetHeight);
		var heightMessage = JSON.stringify({
			action: "iframeHeight",
			height: height
		});

		window.parent.postMessage(heightMessage, "*");
	};

	function getParameterByName(name, url) {
		if (!url) {
			url = window.location.href;
		}

		name = name.replace(/[\[\]]/g, "\\$&");
		var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
		var results = regex.exec(url);

		if (!results) {
			return null;
		}

		if (!results[2]) {
			return "";
		}

		return decodeURIComponent(results[2].replace(/\+/g, " "));
	}



	function initSignupBlock(signupBlock) {

		//var route  = "/wp-content/themes/edm-blog-v2/subscriber.php";
		var email  = signupBlock.getElementsByClassName("newsletterEmail")[0];
		var resBox = signupBlock.getElementsByClassName("subscribe-box-result")[0];

		signupBlock.getElementsByClassName("subscribe-submit")[0].addEventListener("click", validate);

		function validate() {
			// signup is EOLfor EDM newsletters, we just redirect the user to chamaileon
			window.top.location.href = "https://users.chamaileon.io/register?utm_source=edm-blog&utm_medium=redirect&utm_campaign=link-in-edm-blog-form";
		}
	}
}