var fixInputsFlag = false; hideArray = ["emailAddress", "OptIn", "currentLMS1", "onlineProgramInPlace1", "dietaryRequirements", "firstName", "lastName", "company", "country", "stateProv", "industry1", "jobTitleCategory1", "title", "primaryRole1", "busPhone", "numberOfUsersANZ1", "city" ]; if (typeof formSingleColumn === 'undefined') { formSingleColumn = ''; } if (formSingleColumn === 'true' || formSingleColumn === true) { formSingleColumn = true; } else { formSingleColumn = false; } function getResetNoteQuery() { var version = $("input[name='formVersion']").val(); if (version != "2" && version != "3") { return "#reset"; } window.translateFormLanguage = window.translateFormLanguage ? window.translateFormLanguage : "en"; var temp = (window.translateFormLanguage == "en-uk" || window.translateFormLanguage == "en-us" || window.translateFormLanguage == "en-anz") ? "en" : window.translateFormLanguage; return "." + temp + "-reset"; } function getPrivacyNoteQuery() { var version = $("input[name='formVersion']").val(); if (version != "2" && version != "3") { return "#privacy"; } window.translateFormLanguage = window.translateFormLanguage ? window.translateFormLanguage : "en"; var temp = (window.translateFormLanguage == "en-uk" || window.translateFormLanguage == "en-us" || window.translateFormLanguage == "en-anz") ? "en" : window.translateFormLanguage; return "." + temp + "-privacy"; } function numberFieldAllowdCharacters(evt) { var allowedCharaters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-", "(", ")"]; if (evt.key.toString().length == 1 && (!evt.ctrlKey || evt.key != "a") && !allowedCharaters.includes(evt.key)) { evt.preventDefault(); } } function fixInputs(selector) { if (fixInputsFlag) { return; } fixInputsFlag = true; var div = document.createElement('div'); div = $(div); div.addClass("row"); div.addClass("myContainerRow"); var target; if (selector == "") { selector = "form:not([name=translationPicklistForm]) input,form:not([name=translationPicklistForm]) select,form:not([name=translationPicklistForm]) textarea"; } $(selector).each(function (index) { $(this).closest('.layout-col').removeClass("col-sm-6"); var element = $(this).closest('.grid-layout-col'); var oldForm = false; if (element.length == 0) { element = $(this).closest('.individual '); oldForm = true; } if ($(this).prop('type') != "hidden") { var attrName = $(this).attr('name'); if (!formSingleColumn && attrName != 'OptIn' && $(this).prop('type') != "submit" && $(this).prop('type') != "textarea") { if(threeColumnFormDesign){ element.addClass("col-md-custom-4"); } else{ element.addClass("col-md-6"); } } else { element.addClass("col-md-12"); } element.css('padding-left', '0'); element.css('padding-right', '0'); element.css('min-height', '0'); element.find(".layout-col").css('min-height', '0'); var toDelete = element.parent(); target = element.parent().parent(); element.appendTo(div); toDelete.remove(); if (oldForm) { element.addClass("form-element-layout"); if (typeof attrName === 'undefined') { attrName = ''; } if (hideArray.includes(attrName)) { element.hide(); } } } }); target = $("form:not([name=translationPicklistForm]) > div").filter(":not(" + getResetNoteQuery() + ")").filter(":not(" + getPrivacyNoteQuery() + ")").first(); div.appendTo(target); if (iFrameDetection == true) { // $("form").prop("target", "_top"); } else { $("form.elq-form:not([name=translationPicklistForm])").append($(getPrivacyNoteQuery()).show()); $("form.elq-form:not([name=translationPicklistForm])").prepend($(getResetNoteQuery())); if(typeof emailAddress != "undefined" && emailAddress.toString().trim() !=""){ if (!disableProgressiveProfiling || (disableProgressiveProfiling && !disableProgressiveProfilingClearFields)) { $(getResetNoteQuery()).show(); } } } } var iFrameDetection = (window === window.parent) ? false : true; if (!Array.prototype.find) { Array.prototype.find = function (predicate) { 'use strict'; if (this == null) { throw new TypeError('Array.prototype.find called on null or undefined'); } if (typeof predicate !== 'function') { throw new TypeError('predicate must be a function'); } var list = Object(this); var length = list.length >>> 0; var thisArg = arguments[1]; var value; for (var i = 0; i < length; i++) { value = list[i]; if (predicate.call(thisArg, value, i, list)) { return value; } } return undefined; }; } if (typeof disableProgressiveProfiling === 'undefined') { disableProgressiveProfiling = ''; } if (disableProgressiveProfiling == 'true') { disableProgressiveProfiling = true; } else { disableProgressiveProfiling = false; } if (typeof disableProgressiveProfilingClearFields === 'undefined') { disableProgressiveProfilingClearFields = 'true'; } if (disableProgressiveProfilingClearFields == 'true') { disableProgressiveProfilingClearFields = true; } else { disableProgressiveProfilingClearFields = false; } if (typeof showAllProgressiveProfilingFields !== 'undefined' && showAllProgressiveProfilingFields == 'true') { showAllProgressiveProfilingFields = true; disableProgressiveProfiling = true; }else{ showAllProgressiveProfilingFields = false; } var statesUsa = '<option value="" class="forceTranslate">-- Please Select --</option><option value="AA">Armed Forces Americas</option><option value="AE">Armed Forces Europe</option><option value="AK">Alaska</option><option value="AL">Alabama</option><option value="AP">Armed Forces Pacific</option><option value="AR">Arkansas</option><option value="AS">American Samoa</option><option value="AZ">Arizona</option><option value="CA">California</option><option value="CO">Colorado</option><option value="CT">Connecticut</option><option value="DC">District of Columbia</option><option value="DE">Delaware</option><option value="FL">Florida</option><option value="GA">Georgia</option><option value="GU">Guam</option><option value="HI">Hawaii</option><option value="IA">Iowa</option><option value="ID">Idaho</option><option value="IL">Illinois</option><option value="IN">Indiana</option><option value="KS">Kansas</option><option value="KY">Kentucky</option><option value="LA">Louisiana</option><option value="MA">Massachusetts</option><option value="MD">Maryland</option><option value="ME">Maine</option><option value="MI">Michigan</option><option value="MN">Minnesota</option><option value="MO">Missouri</option><option value="MS">Mississippi</option><option value="MT">Montana</option><option value="NC">North Carolina</option><option value="ND">North Dakota</option><option value="NE">Nebraska</option><option value="NH">New Hampshire</option><option value="NJ">New Jersey</option><option value="NM">New Mexico</option><option value="NV">Nevada</option><option value="NY">New York</option><option value="OH">Ohio</option><option value="OK">Oklahoma</option><option value="OR">Oregon</option><option value="PA">Pennsylvania</option><option value="PR">Puerto Rico</option><option value="RI">Rhode Island</option><option value="SC">South Carolina</option><option value="SD">South Dakota</option><option value="TN">Tennessee</option><option value="TX">Texas</option><option value="UT">Utah</option><option value="VA">Virginia</option><option value="VI">Virgin Islands</option><option value="VT">Vermont</option><option value="WA">Washington</option><option value="WI">Wisconsin</option><option value="WV">West Virginia</option><option value="WY">Wyoming</option>'; var statesAustralia = '<option value="" class="forceTranslate">-- Please Select -- </option><option value="ACT">Austl. Cap. Terr.</option><option value="NSW">New South Wales</option><option value="NT">Northern Territory</option><option value="QLD">Queensland</option><option value="SA">South Australia</option><option value="TAS">Tasmania</option><option value="VIC">Victoria</option><option value="WA">Western Australia</option>'; var statesCanada = '<option value="" class="forceTranslate">-- Please Select -- </option><option value="AB">Alberta</option><option value="BC">British Columbia</option><option value="MB">Manitoba</option><option value="NB">New Brunswick</option><option value="NF">Newfoundland</option><option value="NL">Newfoundland and Labrador</option><option value="NS">Nova Scotia</option><option value="NT">Northwest Territories</option><option value="NU">Nunavut</option><option value="ON">Ontario</option><option value="PE">Prince Edward Island</option><option value="QC">Quebec</option><option value="SK">Saskatchewan</option><option value="YT">Yukon</option><option value="ZZ">Beyond the limits of any Prov.</option>'; var statesIndia = '<option value="" class="forceTranslate">-- Please Select -- </option><option value="AP">Andhra Pradesh</option><option value="AR">Arunachal Pradesh</option><option value="AS">Assam</option><option value="BR">Bihar</option><option value="CG">Chhattisgarh</option><option value="GA">Goa</option><option value="GJ">Gujarat</option><option value="HR">Haryana</option><option value="HP">Himachal Pradesh</option><option value="JK">Jammu and Kashmir</option><option value="JH">Jharkhand</option><option value="KA">Karnataka</option><option value="KL">Kerala</option><option value="MP">Madhya Pradesh</option><option value="MH">Maharashtra</option><option value="MN">Manipur</option><option value="ML">Meghalaya</option><option value="MZ">Mizoram</option><option value="NL">Nagaland</option><option value="OD">Odisha</option><option value="PB">Punjab</option><option value="RJ">Rajasthan</option><option value="SK">Sikkim</option><option value="TN">Tamil Nadu</option><option value="TR">Tripura</option><option value="UK">Uttarakhand</option><option value="UP">Uttar Pradesh</option><option value="WB">West Bengal</option><option value="AN">Andaman and Nicobar Islands</option><option value="CH">Chandigarh</option><option value="DD">Dadra and Nagar Haveli and Daman and Diu</option><option value="DL">Delhi</option><option value="LD">Lakshadweep</option><option value="PY">Puducherry</option><option value="LA">Ladakh</option>'; var progPro = (function () { var loopField = ""; var fieldsShown = 0; var progShown = 0; var country = "country"; var industry = "industry1"; var countryWithState = ["USA", "Canada", "Australia","US","CA","AU","India","IN"]; var explicitCountries = ["Canada", "Australia", "New Zealand", "Switzerland", "Austria", "Belgium", "Denmark", "Germany", "Italy", "Netherlands", "Spain"]; var optOutCountries = [ "Anguilla", "Antigua and Barbuda", "Argentina", "Aruba", "Barbados", "Belize", "Bermuda", "Bolivia", "Bonaire", "Brazil", "Cayman Islands", "Chile", "Christmas Island", "Colombia", "Costa Rica", "Jamaica", "Cuba", "Curacao", "Dominica", "Dominican Republic", "Ecuador", "El Salvador", "Faroe Islands", "Falkland Islands", "Falkland Islands (malvinas)", "Falkland Islands (Malvinas)", "French Guiana", "Grenada", "Guadeloupe", "Guatemala", "Guyana", "Haiti", "Honduras", "Martinique", "Mexico", "Nicaragua", "Panama", "Paraguay", "Peru", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin", "Saint Pierre and Miquelon", "St Vincent and the Grenadines", "The Bahamas", "Trinidad and Tobago", "Turks and Caicos Islands", "Uruguay", "Venezuela", "Virgin Islands (British)", "USA" ]; var whatProblem = "whatProblemAreYouTryingToSolve1"; var setRequired = function (requiredField) { if ($("label[for=" + requiredField + "] .required").length == 0) { var defaultValidationMessage = ($("[name=formValidMessage]").length > 0) ? $("[name=formValidMessage]").val() : "This field is required"; console.log(defaultValidationMessage + " / " + $("[name=formValidMessage]").val()); window[requiredField].add(Validate.Presence, { failureMessage: defaultValidationMessage }); if ($("label[for=fe128854] .elq-required").length == 0) { $("label[for=" + requiredField + "]").append('<span class="required">*</span>'); } console.log($(window[requiredField]).prop("name") + " is Required"); } }; var setField = function (progField, progStage) { try { loopField = progField; switch (eventType) { case "Webinar": var progType = progPro.contactFields.find(findProgType)[3]; break; case "Event": var progType = progPro.contactFields.find(findProgType)[4]; break; case "Download": var progType = progPro.contactFields.find(findProgType)[5]; break; default: var progType = progPro.contactFields.find(findProgType)[5]; break; } visibilityRules[progType](progField, progStage); } catch (err) { console.log(progStage + ": " + progField + " Not Found"); // location.reload(); } }; var setForm = function () { // if (progPro.formSet == true) { // return; // } if (disableProgressiveProfiling) { if (disableProgressiveProfilingClearFields) { $(getResetNoteQuery()).hide(); $.each(progPro.contactFields, function (index, item) { if ($("[name=" + item[0] + "]").attr("type") != "checkbox") { $("[name=" + item[0] + "]").val(""); } else { $("[name=" + item[0] + "]").prop("checked", false); progPro.optInAllowed = "true"; } }); } } $("[name=OptIn]").change(function () { if ($("[name=OptIn]").prop("checked")) { progPro.optInAllowed = ""; } else { progPro.optInAllowed = "true"; } }); $.each($("span.elq-required"), function (index, item) { item = $(item); itemParent = item.closest('.form-element-layout'); itemInput = itemParent.find("input"); if (itemInput.length == 0) { itemInput = itemParent.find("select"); } if (itemInput.length == 0) { itemInput = itemParent.find("textarea"); } if (itemInput.length == 0) { return; } var settings = { validMessage: "", onlyOnBlur: false, wait: 300 }; requiredField = itemInput.prop('id'); if (itemInput.length > 1) { this.getParentElement = function (list) { return list[list.length - 1].parentElement; }; settings.isGroup = true; settings.insertAfterWhatNode = this.getParentElement(itemInput); var domVal = itemInput; } else{ var domVal = document.querySelector('#' + requiredField); } domVal = new LiveValidation(domVal, settings); domVal.add(Validate.Presence, { failureMessage: "This field is required" }); console.log($(domVal).prop("name") + " is Required"); if (itemInput.prop('type') == "checkbox" && !settings.isGroup) { itemInput.prop("required", true); } itemInput.addClass("elqRequiredIs"); }); fixInputs(''); progPro.formSet = true; console.log("Set Form: " + eventType + " " + progPro.stage); setWhatProblem(); $.each(progPro.fixedFields, function (index, item) { progPro.setField(item, -1); }); if (progPro.stage > 5) { progPro.stage = 6; } if(showAllProgressiveProfilingFields){ $.each(progPro.contactFields, function (index, item) { showField(item[0], -1); }); visibilityRules.State("stateProv",-1); } else{ switch (progPro.stage) { case -1: break; case 0: console.log(progPro.firstVisit); $.each(progPro.firstVisit, function (index, item) { progPro.setField(item, progPro.stage); }); break; case 1: $.each(progPro.firstVisit, function (index, item) { progPro.setField(item, progPro.stage); }); break; case 2: var progPrePop = 0; $.each(progPro.secondVisit, function (index, item) { if (($("[name=" + item + "]").val() == "") || ($("[name=" + item + "]").val() == null)) { progPrePop++; } }); if (progPrePop > 0) { $.each(progPro.secondVisit, function (index, item) { progPro.setField(item, progPro.stage); }); break; } else { progPro.stage++; } case 3: var progPrePop = 0; $.each(progPro.thirdVisit, function (index, item) { if (($("[name=" + item + "]").val() == "") || ($("[name=" + item + "]").val() == null)) { progPrePop++; } }); if (progPrePop > 0) { $.each(progPro.thirdVisit, function (index, item) { progPro.setField(item, progPro.stage); }); break; } else { progPro.stage++; } case 4: var progPrePop = 0; $.each(progPro.fourthVisit, function (index, item) { if (($("[name=" + item + "]").val() == "") || ($("[name=" + item + "]").val() == null)) { progPrePop++; } }); if (progPrePop > 0) { $.each(progPro.fourthVisit, function (index, item) { progPro.setField(item, progPro.stage); }); break; } else { progPro.stage++; } case 5: var progPrePop = 0; $.each(progPro.fifthVisit, function (index, item) { if (($("[name=" + item + "]").val() == "") || ($("[name=" + item + "]").val() == null)) { progPrePop++; } }); if (progPrePop > 0) { $.each(progPro.fifthVisit, function (index, item) { progPro.setField(item, progPro.stage); }); break; } else { progPro.stage++; } case 6: break; default: $.each(progPro.firstVisit, function (index, item) { progPro.setField(item, progPro.stage); }); break; } } if ((eventType == "Download") && (submitButtonText == "")) { submitButtonText = $("[name=submitButtonText]").val(); } if (typeof _translateRegistrationForm == "function") { submitButtonText = _translateRegistrationForm(submitButtonText); } if (submitButtonText != "") { $(".submit-button").val(submitButtonText); $("[name=submitButtonText]").val(submitButtonText); $("[type=Submit]").val(submitButtonText); } $("input[type=submit]").parents('.form-element-layout').show(); $("input[type=submit]").parents('.form-element-layout').removeClass("forceHideField"); $("form:not([name=translationPicklistForm]), #wrapper").show(); if (iFrameDetection == true) { parent.postMessage('height|' + $(document).height(), "*"); } fixInputHeights(); if (typeof fullWebinarsUx === "function") { try { fullWebinarsUx(); } catch (error) { console.error(error); } } if (typeof formSetCallback === "function") { try { formSetCallback(); } catch (error) { console.error(error); } } $("form:not([name=translationPicklistForm]) .elq-label").each( function (i, e) { t = $(e).text().trim(); if (["address1","address2","address3"].includes(t)) { $(e).closest(".grid-layout-col").hide(); } } ) }; var setWhatProblem = function () { try { if (($("[name=p]").val() != "") && ($("[name=p]").val() != null)) { //$("[name='" + whatProblem + "']").val(""); //var myProblem = whatProblemList.find(findWhatProblem)[1]; $("[name='" + whatProblem + "']").val($("[name=p]").val()); } else { $("[name='p']").val(defaultWhatProblem); $("[name='" + whatProblem + "']").val(defaultWhatProblem); } } catch (err) { $("[name='p']").val(defaultWhatProblem); $("[name='" + whatProblem + "']").val(defaultWhatProblem); } }; var setHiddenFields = function () { var query = window.location.search.substring(1); var vars = query.split("&"); if (document.location.search.length) { for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (typeof pair[1] == "undefined") { continue; } if ($("[name='" + pair[0] + "']") && (pair[1] != "")) { var xVal = pair[1].replace(/\+/g, '%20'); xVal = xVal.replace("%A0", ''); $("[name='" + pair[0] + "']").val(decodeURIComponent(xVal)); } } } if ((typeof hotLead !== 'undefined') && ((hotLead == 'true') || (hotLead == 'TRUE') || (hotLead == true))) { $("[name='hotLead']").val("TRUE"); } if ((typeof scoreLead !== 'undefined') && ((scoreLead == 'true') || (scoreLead == 'TRUE') || (scoreLead == true))) { $("[name='scoreLead']").val("TRUE"); } $("[name='eid']").val($("[name='cid']").val()); setWhatProblem(); }; var mergeHiddenFields = function (uri) { var thisStage = parseInt($.cookie("progPro")) + 1; if (isNaN(thisStage)) { thisStage = 1; } var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); uri = updateQueryStringParameter(uri, pair[0], pair[1]); } return uri + "&stage=" + thisStage; }; var setStageCookie = function (e) { console.log("Received: " + e.data); if ((isNaN(e) == false) /*&& (eventType == "Download") */) { $.cookie('progPro', e, { expires: 180, domain: 'blackboard.com' }); $.cookie('progPro', e, { expires: 180, domain: '.anthology.com' }); } }; var updateQueryStringParameter = function (uri, key, value) { var re = new RegExp("([?|&])" + key + "=.*?(&|#|$)", "i"); if (uri.match(re)) { return uri.replace(re, '$1' + key + "=" + value + '$2'); } else { var hash = ''; if (uri.indexOf('#') !== -1) { hash = uri.replace(/.*#/, '#'); uri = uri.replace(/#.*/, ''); } var separator = uri.indexOf('?') !== -1 ? "&" : "?"; return uri + separator + key + "=" + value + hash; } }; var setGeolookup = function () { setField("stateProv", -1); setField("OptIn", -1); }; var findWhatProblem = function (problem) { return problem[0] == $("[name='p']").val(); }; var findProgType = function (progProObj) { return progProObj[0] == loopField; }; var hideField = function (currentField) { console.log("Tring to hide: " + currentField); $("[name=" + currentField + "]").parents('.form-element-layout').hide(); $("[name=" + currentField + "]").parents('.form-element-layout').addClass("forceHideField"); if (currentField == "stateProv") { $("[name=stateProv]").append("<option value=' '></option>"); $("[name=stateProv]").val(" "); } }; var showField = function (currentField, currentStage, Validation) { console.log(currentField + " " + progShown + " " + fieldsShown + " " + currentStage); if (currentStage == -1) { $("[name=" + currentField + "]").parents('.form-element-layout').show(); $("[name=" + currentField + "]").parents('.form-element-layout').removeClass("forceHideField"); fieldsShown++; if (Validation == "Required") { setRequired($("[name=" + currentField + "]").prop('id')); } } else if ((fieldsShown < progPro.maxFields) && (progShown < progPro.maxProgFields)) { $("[name=" + currentField + "]").parents('.form-element-layout').show(); $("[name=" + currentField + "]").parents('.form-element-layout').removeClass("forceHideField"); progShown++; fieldsShown++; if (Validation == "Required") { setRequired($("[name=" + currentField + "]").prop('id')); } } }; var resetForm = function () { $(getResetNoteQuery()).hide(); $("span.required").remove(); // if (eventType != "Download") { var missingFields = 0; if (($("[name=industry1]").is(':visible') == false)) { missingFields++; } if (($("[name=title]").is(':visible') == false)) { missingFields++; } progShown = progShown - missingFields; if (progShown < 0) { progShown = 0; } // } $.each(progPro.contactFields, function (index, item) { if (($("[name=" + item[0] + "]").is(':visible') == true)) { fieldsShown--; } if ($("[name=" + item[0] + "]").attr("type") != "checkbox") { $("[name=" + item[0] + "]").val(""); } else { $("[name=" + item[0] + "]").prop("checked", false); progPro.optInAllowed = "true"; } }); progPro.stage = 0; progPro.formSet = false; progPro.setForm(); if (iFrameDetection == true) { parent.postMessage('height|' + $(document).height(), "*"); } fixInputHeights(); if($("[name=OptIn]").closest(".layout-col").hasClass("d-none")){ $("[name=OptIn]").closest(".layout-col").removeClass("d-none"); $("[name=OptIn]").closest(".layout-col").parent().css("margin-top", ""); } }; var visibilityRules = { Required: function (currentField, currentStage) { showField(currentField, currentStage, "Required"); }, Optional: function (currentField, currentStage) { showField(currentField, currentStage); }, OptionalIfBlank: function (currentField, currentStage) { if (($("[name=" + currentField + "]").val() == "") || ($("[name=" + currentField + "]").val() == null)) { showField(currentField, currentStage); } }, RequiredIfBlank: function (currentField, currentStage) { if (($("[name=" + currentField + "]").val() == "") || ($("[name=" + currentField + "]").val() == null)) { showField(currentField, currentStage, "Required"); } }, Hide: function (currentField, currentStage) { hideField(currentField, currentStage); }, Country: function (currentField, currentStage) { if ($("[name=country]").val() == "") { $("[name=country]").val(countryLookup[$('[name=BbH_Country]').val()]); } showField(currentField, currentStage, "Required"); progPro.setField("stateProv", -1); progPro.setField("OptIn", -1); }, CountryIfBlank: function (currentField, currentStage) { if (($("[name=" + currentField + "]").val() == "") || ($("[name=" + currentField + "]").val() == null)) { if ($("[name=country]").val() == "") { console.log($('[name=BbH_Country]').val() + " " + countryLookup[$('[name=BbH_Country]').val()]); $("[name=country]").val(countryLookup[$('[name=BbH_Country]').val()]); } showField(currentField, currentStage, "Required"); progPro.setField("stateProv", -1); progPro.setField("OptIn", -1); } }, OptionalIfProspect: function (currentField, currentStage) { var useQuestion = false; if ((currentField == "currentLMS1") && (typeof useLMSQuestion !== 'undefined') && ((useLMSQuestion == 'TRUE') || (useLMSQuestion == 'true') || (useLMSQuestion == true))) { showField(currentField, -1); } if ((currentField == "onlineProgramInPlace1") && (typeof useOnlineProgramQuestion !== 'undefined') && ((useOnlineProgramQuestion == 'TRUE') || (useOnlineProgramQuestion == 'true') || (useOnlineProgramQuestion == true))) { showField(currentField, -1); } if ((useQuestion == true) && (progPro.clientType == "") && (($("[name=" + currentField + "]").val() == "") || ($("[name=" + currentField + "]").val() == null))) { showField(currentField, currentStage); } }, RequiredIfProspect: function (currentField, currentStage) { var useQuestion = false; if ((currentField == "currentLMS1") && (typeof useLMSQuestion !== 'undefined') && ((useLMSQuestion == 'TRUE') || (useLMSQuestion == 'true') || (useLMSQuestion == true))) { showField(currentField, -1, "Required"); } if ((currentField == "onlineProgramInPlace1") && (typeof useOnlineProgramQuestion !== 'undefined') && ((useOnlineProgramQuestion == 'TRUE') || (useOnlineProgramQuestion == 'true') || (useOnlineProgramQuestion == true))) { showField(currentField, -1, "Required"); } }, ReturnVisitIfBlank: function (currentField, currentStage) { if (($("[name=" + currentField + "]").val() == "") && (progPro.stage > 1)) { showField(currentField, currentStage); } }, OptIn: function (currentField, currentStage) { var myCountry = $("[name=" + country + "]").val(); if (typeof myCountry === 'undefined') { myCountry = ""; } myCountry = myCountry.trim(); //$(getPrivacyNoteQuery()).hide(); if (($("[name=" + currentField + "]").not(':checked')) && (progPro.optInAllowed == "true")) { //$(getPrivacyNoteQuery()).show(); showField(currentField, currentStage); if ($.inArray(myCountry, optOutCountries) > -1) { $("[name=" + currentField + "]").prop("checked", true); } else { $("[name=" + currentField + "]").prop("checked", false); if(typeof optInInitialChecked != "undefined" && optInInitialChecked){ $("[name=" + currentField + "]").prop("checked", true); } } $("[name=" + currentField + "]").trigger("change"); } else if (progPro.optInAllowed == "true") { hideField(currentField, currentStage); //$(getPrivacyNoteQuery()).hide(); } }, State: function (currentField, currentStage) { var myCountry = $("[name=" + country + "]").val(); myCountry = myCountry.trim(); if ($("select[name=" + currentField + "]")) { if (statesUsa == "") { statesUsa = $("[name=" + currentField + "]").html(); } if (myCountry == "Australia" || myCountry == "AU") { $("[name=" + currentField + "]").html(statesAustralia); } else if (myCountry == "Canada" || myCountry == "CA") { $("[name=" + currentField + "]").html(statesCanada); } else if (myCountry == "India" || myCountry == "IN") { $("[name=" + currentField + "]").html(statesIndia); } else { $("[name=" + currentField + "]").html(statesUsa); } if (typeof labelsAsPlaceholders != "undefined" && (labelsAsPlaceholders === true || labelsAsPlaceholders === "true")) { if(typeof labelShrink == "function"){ labelShrink(); } } } //Blank out if not Country with State if ($.inArray(myCountry, countryWithState) == -1) { $("[name=" + currentField + "]").val(""); hideField(currentField, currentStage); //If Country with State, show if field is not populated } else if (($("[name=" + currentField + "]").val() == "") || ($("[name=" + currentField + "]").val() == null)) { showField(currentField, currentStage, "Required"); if (($("[name=" + currentField + "]").val() == "") || ($("[name=" + currentField + "]").val() == null)) { $("[name=" + currentField + "]").val($('[name=BbH_Region]').val()); } //Otherwise Hide } else { hideField(currentField, currentStage); } } }; return { setField: setField, hideField: hideField, showField: showField, myList: statesUsa, visibilityRules: visibilityRules, setForm: setForm, setRequired: setRequired, setHiddenFields: setHiddenFields, mergeHiddenFields: mergeHiddenFields, setGeolookup: setGeolookup, resetForm: resetForm, setStageCookie: setStageCookie }; })(); progPro.optInAllowed = "true"; progPro.formSet = false; progPro.showSession = false; progPro.stage = 0; progPro.clientType = ""; var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == "eventType") { eventType = pair[1]; } if (pair[0] == "stage") { progPro.stage = parseInt(pair[1]); } if ((emailAddress == "") && (pair[0] == "em")) { emailAddress = pair[1]; } } // if (eventType == "Download") { if (progPro.stage == 0) { progPro.stage = parseInt($.cookie("progPro")) + 1; if (isNaN(progPro.stage) || disableProgressiveProfiling) { progPro.stage = 1; } } if(emailAddress == ""){ progPro.stage = 0; } console.log("Current stage: " + progPro.stage); progPro.maxFields = 50; progPro.maxProgFields = 50; progPro.fixedFields = ["emailAddress", "OptIn", "currentLMS1", "onlineProgramInPlace1", "dietaryRequirements"]; progPro.firstVisit = ["firstName", "lastName", "jobTitleCategory1", "title", "company", "country", "stateProv"]; progPro.secondVisit = ["industry1", "primaryRole1", "busPhone"]; progPro.thirdVisit = ["numberOfUsersANZ1", "busPhone"]; progPro.fourthVisit = ["city", "busPhone"]; progPro.fifthVisit = ["city"]; // // } // if (eventType == "Event") { // // progPro.stage = 0; // progPro.maxFields = 12; // progPro.maxProgFields = 2; // progPro.fixedFields = ["emailAddress", "firstName", "lastName", "company", "country", "stateProv", "busPhone", "OptIn", "Session", "dietaryRequirements"]; // progPro.firstVisit = ["title", "industry1", "jobTitleCategory1", "primaryRole1", "city", "numberOfUsersANZ1", "currentLMS1", "onlineProgramInPlace1"]; // // } // else { // // progPro.stage = 0; // progPro.maxFields = 12; // progPro.maxProgFields = 2; // progPro.fixedFields = ["emailAddress", "firstName", "lastName", "company", "country", "stateProv", "OptIn", "Session"]; // progPro.firstVisit = ["title", "industry1", "busPhone", "jobTitleCategory1", "primaryRole1", "city", "numberOfUsersANZ1", "currentLMS1", "onlineProgramInPlace1"]; // // } progPro.contactFields = [ [ "emailAddress", //Form Field 'C_EmailAddress', //Eloqua Contact Field '', //Default Value 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "firstName", 'C_FirstName', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "lastName", 'C_LastName', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "title", 'C_Title', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "company", 'C_Company', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "country", 'C_Country', '', 'Country', //Display Rule for Webinar Form 'Country', //Display Rule for Event Form 'Country' //Display Rule for Download Form ], [ "stateProv", 'C_State_Prov', '', 'State', //Display Rule for Webinar Form 'State', //Display Rule for Event Form 'State' //Display Rule for Download Form ], [ "industry1", 'C_Industry1', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "jobTitleCategory1", 'C_Job_Title_Category1', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "primaryRole1", 'C_Primary_Role1', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "busPhone", 'C_BusPhone', '', 'Optional', //Display Rule for Webinar Form 'Optional', //Display Rule for Event Form 'Optional' //Display Rule for Download Form ], [ "numberOfUsersANZ1", 'C_Number_of_Users__ANZ_1', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "currentLMS1", 'C_Current_LMS1', '', 'RequiredIfProspect', //Display Rule for Webinar Form 'RequiredIfProspect', //Display Rule for Event Form 'RequiredIfProspect' //Display Rule for Download Form ], [ "onlineProgramInPlace1", 'C_Online_Program_in_Place_1', '', 'RequiredIfProspect', //Display Rule for Webinar Form 'RequiredIfProspect', //Display Rule for Event Form 'RequiredIfProspect' //Display Rule for Download Form ], [ "city", 'C_City', '', 'OptionalIfBlank', //Display Rule for Webinar Form 'OptionalIfBlank', //Display Rule for Event Form 'OptionalIfBlank' //Display Rule for Download Form ], [ "whatProblemAreYouTryingToSolve1", 'C_What_problem_are_you_trying_to_solve_1', '', 'Hide', //Display Rule for Webinar Form 'Hide', //Display Rule for Event Form 'Hide' //Display Rule for Download Form ], [ "OptIn", 'C_OptIn', '', 'OptIn', //Display Rule for Webinar Form 'OptIn', //Display Rule for Event Form 'OptIn' //Display Rule for Download Form ], [ "Session", '', '', 'Required', //Display Rule for Webinar Form 'Required', //Display Rule for Event Form 'Required' //Display Rule for Download Form ], [ "dietaryRequirements", '', '', 'Hide', //Display Rule for Webinar Form 'Optional', //Display Rule for Event Form 'Hide' //Display Rule for Download Form ] ]; window.onload = function () { if (progPro.formSet == false) { $(getResetNoteQuery()).hide(); progPro.setForm(); } } $(document).ready(function () { if ($(".elq-form:not([name=translationPicklistForm])").length > 0) { $("form:not([name=translationPicklistForm])").trigger("reset"); $("form:not([name=translationPicklistForm])").hide(); /* $.getJSON("https://telize-v1.p.mashape.com/geoip?mashape-key=OxXupQANrAmshM2jwGNUNIx4vKeMp1iKx16jsn7daa8rE4ONZf", function(json) { $('[name=BbH_IP]').val(json.ip); $('[name=BbH_Continent]').val(json.continent_code); $('[name=BbH_Country]').val(json.country_code); $('[name=BbH_Region]').val(json.region_code); $('[name=BbH_PostalCode]').val(json.postal_code); $('[name=BbH_City]').val(json.city); if ($("[name=country]").is(":visible")) { console.log($('[name=BbH_Country]').val() + " " + countryLookup[$('[name=BbH_Country]').val()]); $("[name=country]").val(countryLookup[$('[name=BbH_Country]').val()]); progPro.setGeolookup(); } } ); */ $("[name='notificationEmailSubject']").val(notificationEmailSubject); $("[name='notificationEmailRecipient']").val(notificationEmailRecipient); $("[name='sharedListID']").val(sharedListID); $("[name='e']").val(ConfirmationEmail); $("[name='c']").val(ThankYouPage); $("[name='src']").val(defaultLeadSource); $("[name='cid']").val(sfdcCampaignId); progPro.setHiddenFields(); setTimeout(function () { $("[name=country]").change(function () { progPro.setField("stateProv", -1); progPro.setField("OptIn", -1); fixInputHeights(); }); }, 1500); } if (iFrameDetection == true) { // $("form:not([name=translationPicklistForm])").prop("target", "_top"); } else { $("form.elq-form:not([name=translationPicklistForm])").append($(getPrivacyNoteQuery()).attr("id", "privacy")); $("form.elq-form:not([name=translationPicklistForm])").prepend($(getResetNoteQuery()).attr("id", "reset")); } if ($(".elq-form:not([name=translationPicklistForm])").length == 0) { if (emailAddress == "") { _elqQ.push(['elqDataLookup', encodeURIComponent(VisitorLookupId), '']); } } else if (emailAddress == "") { console.log('Running Unknown'); _elqQ.push(['elqDataLookup', encodeURIComponent(VisitorLookupId), '']); } else { console.log('Running: ' + emailAddress); FirstLookup = false; _elqQ.push(['elqDataLookup', encodeURIComponent(ContactLookupId), '<' + ContactUniqueField + '>' + emailAddress + '</' + ContactUniqueField + '>']); } $.each(progPro.contactFields, function (index, item) { $("[name='" + this[0] + "']").parents('.form-element-layout').hide(); $("[name='" + this[0] + "']").parents('.form-element-layout').addClass("forceHideField"); }); $("#resetForm").click(function (e) { e.preventDefault(); progPro.resetForm(); }); $("form:not([name=translationPicklistForm])").submit(function (event) { $.each($(".elqRequiredIs"), function (index, item) { item = $(item); if (item.val() == "") { item.addClass("LV_invalid_field"); } else { item.removeClass("LV_invalid_field"); } }); if (($('.LV_valid_field').length > 0) && ($('.LV_invalid_field:visible').length == 0) /* && (eventType == "Download") */) { if (iFrameDetection == true) { parent.postMessage('stage|' + progPro.stage, "*"); } else { $.cookie('progPro', progPro.stage, { expires: 180, domain: 'blackboard.com' }); $.cookie('progPro', progPro.stage, { expires: 180, domain: '.anthology.com' }); } } else if (eventType == "Download") { return false; } }); progPro.setForm(); if (typeof LeadRouting === 'undefined') { LeadRouting = ""; } LeadRouting = LeadRouting.toLowerCase(); $('input[name="leadRouting"]').val(LeadRouting); $("[name=busPhone]").keyup(numberFieldAllowdCharacters); $("[name=busPhone]").keydown(numberFieldAllowdCharacters); }); var VisitorLookupId = "753ba1c369b54b4a90656f34e15a439c"; // LOOKUP A: The ID of your Visitor Web Data Lookup var ContactLookupId = "f52c5b076d114ec39c1dabaa33526787"; // LOOKUP B: The ID of your Contact/Datacard Web Data Lookup var VisitorUniqueField = "V_ElqEmailAddress"; // Unique field's HTML Name from LOOKUP A (usually V_Email_Address) var ContactUniqueField = "C_EmailAddress"; // Unique field's HTML Name from LOOKUP B (usually C_EmailAddress) var FirstLookup = true; // var _elqQ = _elqQ || []; // _elqQ.push(['elqSetSiteId', '2376']); // _elqQ.push(['elqTrackPageView']); // // (function() { // function async_load() { // var s = document.createElement('script'); // s.type = 'text/javascript'; // s.async = true; // s.src = '//img.en25.com/i/elqCfg.min.js'; // var x = document.getElementsByTagName('script')[0]; // x.parentNode.insertBefore(s, x); // } // if (window.addEventListener) window.addEventListener('DOMContentLoaded', async_load, false); // else if (window.attachEvent) window.attachEvent('onload', async_load); // })(); function SetElqContent() { if (typeof extraSetElqContent == 'function') { if (extraSetElqContent()) { return; } } if (typeof webinarNameSetElqContent == 'function') { if (webinarNameSetElqContent()) { return; } } console.log("SetElqContent"); if (this.GetElqContentPersonalizationValue) { if (FirstLookup && this.GetElqContentPersonalizationValue.toString().includes("M_Client_Type1")) { emailAddress = GetElqContentPersonalizationValue(VisitorUniqueField); if (progPro.formSet == false) { _elqQ.push(['elqDataLookup', encodeURIComponent(ContactLookupId), '<' + ContactUniqueField + '>' + emailAddress + '</' + ContactUniqueField + '>']); FirstLookup = false; } else { if (typeof fullWebinarsUx === "function") { try { fullWebinarsUx(); } catch (error) { console.error(error); } } if (typeof formLoadedCallback === "function") { try { formLoadedCallback(); } catch (error) { console.error(error); } } } } else if (this.GetElqContentPersonalizationValue.toString().includes("M_Client_Type1")) { $.each(progPro.contactFields, function (index, item) { item[2] = GetElqContentPersonalizationValue(item[1]); console.log(item[2] + " " + item[1]); if ($("[name=" + item[0] + "]").attr("type") != "checkbox") { $("[name=" + item[0] + "]").val(item[2]); } else if ((item[2] != "") && (item[2] != 0)) { $("[name=" + item[0] + "]").prop("checked", true); progPro.optInAllowed = "false"; } }); progPro.clientType = GetElqContentPersonalizationValue('M_Client_Type1'); progPro.setForm(); if (typeof fullWebinarsUx === "function") { try { fullWebinarsUx(); } catch (error) { console.error(error); } } if (typeof formLoadedCallback === "function") { try { formLoadedCallback(); } catch (error) { console.error(error); } } } } else { return null; } } var CollabWebinar_EventSeriesCounter = 0; var CollabWebinar_EventSeriesCounterReceived = 0; var CollabWebinar_EventSeriesWebinarNames = {}; var CollabWebinar_EventSeriesWebinarNames_report = false; function webinarNameSetElqContent() { if (this.GetElqContentPersonalizationValue) { if (typeof GetElqContentPersonalizationValue("Event_Name1") != "undefined" && GetElqContentPersonalizationValue("Event_Name1").toString().trim() != "") { CollabWebinar_EventSeriesCounterReceived = CollabWebinar_EventSeriesCounterReceived + 1; var wId = GetElqContentPersonalizationValue("Event_ID1"); var temp = { wId: wId, eventName: GetElqContentPersonalizationValue("Event_Name1"), maxRegistered: GetElqContentPersonalizationValue("Max_Registered1"), registeredCounter: GetElqContentPersonalizationValue("Registered_Counter1"), seriesName: GetElqContentPersonalizationValue("Series_Name1"), WebinarDate: GetElqContentPersonalizationValue("Webinar_Date___Time1"), WebinarEndDate: GetElqContentPersonalizationValue("Webinar_End_Date___Time1"), WebinarTimezone: GetElqContentPersonalizationValue("Webinar_Timezone1"), Recurrence: GetElqContentPersonalizationValue("Recurrence1"), Recurring_Start_Date: GetElqContentPersonalizationValue("Recurring_Start_Date1"), Recurring_Duration: GetElqContentPersonalizationValue("Recurring_Duration1"), Recurring_End_Date: GetElqContentPersonalizationValue("Recurring_End_Date1") }; if (temp.maxRegistered == "") { temp.maxRegistered = 0; } if (temp.registeredCounter == "") { temp.registeredCounter = 0; } temp.maxRegistered = parseInt(temp.maxRegistered); temp.registeredCounter = parseInt(temp.registeredCounter); if (typeof maxRegistrantsWebinarCallback == 'function') { try { maxRegistrantsWebinarCallback(temp); } catch (error) { console.error(error); } } CollabWebinar_EventSeriesWebinarNames[wId] = temp; if (CollabWebinar_EventSeriesCounterReceived == CollabWebinar_EventSeriesCounter && !CollabWebinar_EventSeriesWebinarNames_report) { CollabWebinar_EventSeriesWebinarNames_report = true; CollabWebinar_EventSeriesWebinarNames["endTime"] = new moment(); var secondsToFetchData = CollabWebinar_EventSeriesWebinarNames.endTime.diff(CollabWebinar_EventSeriesWebinarNames.startTime, "seconds", true); var actionUrl = "https://go.blackboard.com/e/f2"; var data = { url: location.href.split("?")[0], UniqueId: new Date() / 1 + "-" + location.href.split("?")[0], timeInSeconds: secondsToFetchData, webinarNumber: CollabWebinar_EventSeriesCounter, elqFormName: "Webinarinfobenchmark", elqSiteID: "2376", }; $.post(actionUrl, data).done(function (data) { }); } return true; } } return false; } var collabProgProVariablesMapping = ["CollabWebinar_EventSeries"]; for(var collabProgProVariable in collabProgProVariablesMapping){ collabProgProVariable = collabProgProVariablesMapping[collabProgProVariable]; var collabProgProVariableNoPrefix = collabProgProVariable.replace("CollabWebinar_","Webinar_"); if(typeof window[collabProgProVariableNoPrefix] !== "undefined"){ window[collabProgProVariable] = window[collabProgProVariableNoPrefix]; } } if (typeof EventSeries !== "undefined") { CollabWebinar_EventSeries = EventSeries; } if (typeof CollabWebinar_EventSeries === "undefined") { CollabWebinar_EventSeries = []; } if (typeof threeColumnFormDesign === "undefined") { threeColumnFormDesign = false; } if (threeColumnFormDesign === "true") { threeColumnFormDesign = true; if(typeof progPro != "undefined" && typeof progPro.stage != "undefined" && progPro.stage == 3){ threeColumnFormDesign = false; } } else { threeColumnFormDesign = false; } if (typeof moment == "function") { CollabWebinar_EventSeriesWebinarNames["startTime"] = new moment(); for (var i in CollabWebinar_EventSeries) { for (var j in CollabWebinar_EventSeries[i]) { CollabWebinar_EventSeriesCounter = CollabWebinar_EventSeriesCounter + 1; _elqQ.push(["elqDataLookup", encodeURIComponent("ed37f4057405418bb7d4bc192b9352af"), "<Event_ID1>" + CollabWebinar_EventSeries[i][j] + "</Event_ID1>"]); } } } function webinarNameFormSuccess() { if (typeof CollabWebinar_EventSeriesWebinarNames.endTime == "undefinde") { return true; } if ($("[name='c']").val().split("?").length < 2) { return true; } if ($("[name='c']").val().split("?")[1].split("se=").length < 2) { return true; } if ($(".LV_invalid_field:visible").length > 0) { return true; } var eventsSelected = $("[name='c']").val().split("?")[1].split("se=")[1].split("X"); var email = $("input[name=emailAddress]").val().toString().trim(); if (email == "") { return true; } for (var i in eventsSelected) { var id = eventsSelected[i].toString().trim(); var info = CollabWebinar_EventSeriesWebinarNames[id]; if (typeof info == "undefined") { continue; } var actionUrl = "https://go.blackboard.com/e/f2"; if (info.Recurrence == "weekly" || info.Recurrence == "biweekly") { var webinarTime = moment.tz(info.Recurring_End_Date, info.WebinarTimezone); } else { var webinarTime = moment.tz(info.WebinarEndDate, info.WebinarTimezone); } var pastWebinar = "yes"; if (webinarTime > moment()) { pastWebinar = "no"; } var data = { eventId: id, regId: email + "-" + id, eventName: info.eventName, pastWebinar: pastWebinar, seriesName: info.seriesName, email: email, elqFormName: "webinarInfoBlindForm", elqSiteID: "2376", }; console.log(eventsSelected[i]); console.log(CollabWebinar_EventSeriesWebinarNames[eventsSelected[i]]); console.log(data); $.post(actionUrl, data).done(function (data) { }); } return true; } function fixInputHeights() { if (formSingleColumn) { return; } var heights = []; var hMax = 0; var visibleElements = []; $("form:not([name=translationPicklistForm]) select:visible, form:not([name=translationPicklistForm]) input:visible").each(function (i, e) { if (typeof $(e).attr("name") !== 'undefined' && $(e).attr("name") != "OptIn") { $(e).closest(".form-element-layout").find("label").not(".elq-item-label").first().css("height", ""); } }); if ($(window).width() < 992) { return; } var visibleElements = []; var visibleElementsLabels = []; $("form:not([name=translationPicklistForm]) select:visible, form:not([name=translationPicklistForm]) input:visible").each(function (i, e) { if (typeof $(e).attr("name") !== 'undefined' && $(e).attr("name") != "OptIn") { var tempLabel = $(e).closest(".form-element-layout").find("label").not(".elq-item-label").first(); if (!visibleElementsLabels.includes(tempLabel.text())) { var tempLabel = tempLabel; var tH = tempLabel.outerHeight(); // var tH = tempLabel.height(); if (tH > hMax) { hMax = tH; } tH = Math.ceil(tH); tempLabel.css("height", tH); heights.push(tH); visibleElements.push(tempLabel); visibleElementsLabels.push(tempLabel.text()); } } }); var step = 2; if (threeColumnFormDesign) { step = 3; } for (var i = 0; i + (step - 1) < visibleElements.length; i = i + step) { var maxH = 0; for (var j = i; j < i + step; j++) { maxH = Math.max(maxH, heights[j]); } for (var j = i; j < i + step; j++) { if (heights[j] != maxH) { } visibleElements[j].css("height", maxH); } } }