﻿// START RAcdn
var version = "1.1";
var divName = "Brendan_RAcdn";
var altDivName = "Brendan_BrochureRequest_Alt_RAcdn";
var frameName = "Brendan_Brox_RQ";
var formName = "Brendan_Brox_Form";
var formAction = "https://www.revagency.net/ap5/vendors/Brendan/Brochure01_Form.cfm";
var defaultWidth = 755;
var defaultHeight = 950;
var ra_ref = "";
function flowframe(h) {
	document.getElementById(frameName).setAttribute("height", h);
}
var hrefsplit = window.location.href.split("?");
var sourceURL = hrefsplit[0];
if (hrefsplit.length == 2) {
	if (refmatch = hrefsplit[1].match(/\bra_ref=([^&]+)/gi)) {
		for (var i = 0; i < refmatch.length; i++) {
			var refsplit = refmatch[i].split("=");
			if (refsplit.length == 2) {
				if (refsplit[0].toLowerCase() == "ra_ref") {
					ra_ref = refsplit[1];
					break;
				}
			}
		}
	}
}
if (ra_ref === "") {
	var allCookies = document.cookie.split(";");
	for (var i = 0; i < allCookies.length; i ++) {
		var onePair = allCookies[i].split("=");
		if (onePair.length == 2) {
			if (onePair[0].replace(/\s/g, "") == "ra_ref") {
				ra_ref = onePair[1];
				break;
			}
		}
	}
}
if (ra_ref === "") {
	ra_ref = "-2";
}
var stashArgs = {};
stashArgs.print = function() {
	var output = "";
	for (var inputName in this) {
		if (typeof this[inputName] != "function") {
			output += ("<input type=\"hidden\" name=\""+inputName+"\" value=\""+this[inputName]+"\">");
		}
	}
	return output;
};
stashArgs.source = sourceURL;
stashArgs.ra_ref = ra_ref;
var frameTag = "<iframe scrolling=\"no\" width=\""+defaultWidth+"\" height=\""+defaultHeight+"\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" id=\""+frameName+"\" name=\""+frameName+"\" src=\"\"></iframe>";
var formTag = "<form name=\""+formName+"\" method=\"post\" action=\""+formAction+"?source="+sourceURL+"\" target=\""+frameName+"\">"+stashArgs.print()+"</form>";
document.getElementById(divName).innerHTML = (frameTag);
document.getElementById(altDivName).innerHTML = (formTag);
document.forms[formName].submit();
// END RAcdn