﻿// START RAcdn
var version = "1.2";
var divName = "Uniworld_BrochureRequest_RAcdn";
var altDivName = "Uniworld_BrochureRequest_Alt_RAcdn";
var frameName = "Uniworld_BrochureRequest_Frame";
var formName = "Uniworld_BrochureRequest_Form";
var formAction = "https://www.revagency.net/ap5/vendors/Uniworld/Brochure01_Form.cfm";
var defaultWidth = 875;
var defaultHeight = 1000;
var ra_ref = "";
function flowframe(h) {
    document.getElementById(frameName).setAttribute("height", h);
}
var hrefsplit = window.location.href.split("?");
var source_URL = 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_URL = source_URL;
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_URL=" + source_URL + "\" target=\"" + frameName + "\">" + stashArgs.print() + "</form>";
document.getElementById(divName).innerHTML = (frameTag);
document.getElementById(altDivName).innerHTML = (formTag);
document.forms[formName].submit();
// END RAcdn
