0 && jQuery("input[name='systemFormsLCID']").val() != ''){
lcid = jQuery("input[name='systemFormsLCID']").val();
return lcid;
}
else if(jQuery("input[name='systemFormsLanguageLocaleProduct']").val().indexOf("-") !== 1){
lcid = jQuery("input[name='systemFormsLanguageLocaleProduct']").val();
if(lcid.trim().substr(0,1) != '-'){
lcid = typeof lcid !== "undefined" ? lcid.trim().substr(0,5) : null;
}else{
lcid = "EN-US";
}
return lcid;
}else{
lcid = "EN-US";
return lcid;
}
}
/**
* Returns the index of a particular occurance of a string
* @function getIndexOf
* @memberOf Parameters
* @example // returns 3 from 'Hello World'
* Parameters.getIndexOf('Hello World', 'l', 2 );
* @param {string} variableString What to look in?
* @param {string} identifier What to look for?
* @param {number} index Which occurance?
*/
function getIndexOf(variableString, identifier, index) {
return variableString.split(identifier, index).join(identifier).length;
}
/**
* Outputs either the Newsletter code, or null
* @function getNewsLetter
* @memberOf Parameters
*/
function getNewsLetter() {
var newsletterBrand = jQuery("input[name='systemFormsLanguageLocaleProduct']").val();
// if it's not undefined and it's long enough to actually have a newsletter indicator in it
if (typeof newsletterBrand !== "undefined" && newsletterBrand.split('-').length === 4) {
// start at the 3rd occurance of "-" and continue to the end of the string
newsletterBrand = newsletterBrand.trim().substr(getIndexOf(newsletterBrand, '-', 3) + 1, newsletterBrand.length);
return newsletterBrand;
}
else {
return null;
}
}
// single commercial topic
function getSingleTopicNewsLetter(){
var lcid = Parameters.getLCID();
// account for improperly capitalized URL and input params
if (lcid !== null) {
lcid = lcid.toUpperCase();
}
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
if(topicId !== ''){
if((lcid == "EN-US" || lcid == "EN-CA" || lcid == "FR-CA")){
newsletterBrand = brandingText.default['singleComTopic']['newsletter'][topicId];
}else{
if(lcid in brandingText && brandingText[lcid].hasOwnProperty('singleComTopic') && brandingText[lcid]['singleComTopic'].hasOwnProperty('newsletter') && topicId in brandingText[lcid]['singleComTopic']['newsletter']){
newsletterBrand = brandingText[lcid]['singleComTopic']['newsletter'][topicId];
}else{
newsletterBrand = brandingText.default['singleComTopic']['newsletter'][topicId];
}
}
return newsletterBrand;
}else{
return null;
}
}
/**
* Gets the brand from the LCID value, example: LCID=EN-US-MSFT - brandSelector would return MSFT
* @function brandSelector
* @memberOf Parameters
*/
function brandSelector() {
masterSetting = jQuery("input[name='systemFormsLanguageLocaleProduct']").val();
if (isNewsLetter === true) {
var brandStart = getIndexOf(masterSetting, '-', 2) + 1;
var brandEnd = getIndexOf(masterSetting, '-', 3) - (getIndexOf(masterSetting, '-', 2) + 1);
return masterSetting.trim().substr(brandStart, brandEnd);
}else if(masterSetting.trim().indexOf("-") == 0){
return masterSetting.trim().replace('-', '').toUpperCase();
}else{
return masterSetting.trim().replace(lcid + '-', '').toUpperCase();
}
}
/**
* get value of the URL param for wt.mc_id or wt.ot_id, regardless of which one exists
* @function Parameters#getMCID
* @protected
*/
// get the mcid of the URL
function getMCID() {
var mcid;
if (window.location.href.match(/Wt\.mc_id=([^&]*)/i) ) {
mcid = window.location.href.match(/Wt\.mc_id=([^&]*)/i);
return mcid === null ? null : mcid[0].toLowerCase().replace('wt.mc_id=', '');
}
else if (window.location.href.match(/Wt\.ot_id=([^&]*)/i)) {
mcid = window.location.href.match(/Wt\.ot_id=([^&]*)/i);
return mcid === null ? null : mcid[0].toLowerCase().replace('wt.ot_id=', '');
}
}
/**
* Set the systemFormsLanguageLocaleProduct hidden input with the correct language, if language was defined
* by URL parameter or string
* @function setSystemFormsVal
* @memberOf Parameters
*/
function setSystemFormsVal() {
var systemLocaleProduct= jQuery('input[name="systemFormsLanguageLocaleProduct"]');
if ( brand !== null &&
systemLocaleProduct.length > 0 &&
systemLocaleProduct.val().length > 5 &&
typeof brand !== "undefined" && brand.indexOf('-') === -1 && (jQuery('input[name=systemFormsTopicGUID]').length === -1 || jQuery('input[name=systemFormsTopicGUID]').val() === '')) {
systemLocaleProduct.val(lcid + '-' + brand);
}
if(jQuery("input[name='systemFormsLCID']").length > 0){
jQuery("input[name='systemFormsLCID']").val(lcid);
jQuery('input[name="systemFormsLanguageLocaleProduct"]').val(lcid + '-' + brand);
}
}
/**
* Sets the 'wTmcid' hidden input value based on what is captured by getMCID()
* @function setMCID
* @memberof Parameters
*/
function setMCID() {
if (jQuery('input[name="wTmcid"]').length > 0 && getMCID() !== null) {
jQuery('input[name="wTmcid"]').val(getMCID());
}
}
/**
* create URL params to add to followup URL after form fill
* for Now Take Flight pages
* @function Parameters.nowTakeFlight
*/
function nowTakeFlight() {
var flightParams = "?firstName=" + jQuery('#FirstName').val() + "&lastName=" + jQuery('#LastName').val() + "&companyName=" + jQuery('#Company').val() + "&email=" + jQuery('#Email').val();
return flightParams;
}
/** Parse out the postmessage created by Now Take Flight pages
* @function Parameters.captureFlightData
*/
function captureFlightData(data) {
var flightURL = data;
return flightURL;
}
return {
getLCID : getLCID,
setMCID : setMCID,
setSystemFormsVal : setSystemFormsVal,
nowTakeFlight: nowTakeFlight,
captureFlightData : captureFlightData,
getIndexOf : getIndexOf,
getNewsLetter : getNewsLetter,
getSingleTopicNewsLetter : getSingleTopicNewsLetter,
brandSelector : brandSelector
};
})();
//Add hiden CPM fields for all forms
const validLCID = ["AR", "AR-SA", "CS-CZ", "DA", "DE", "DE-AT", "DE-CH", "DE-DE", "EL-GR", "EN", "EN-AU", "EN-CA", "EN-DE", "EN-GB", "EN-IE", "EN-IL", "EN-IN", "EN-US", "EN-ZA", "ES", "ES-ES", "FI", "FR", "FR-BE", "FR-CA", "FR-CH", "HE", "HU-HU", "ID", "IT", "JA", "KO-KR", "NL", "NL-BE", "NO", "PL", "PT", "PT-BR", "RU", "SV", "TH-TH", "TR", "UK-UA", "ZH-CN", "ZH-HK", "ZH-SG", "ZH-TW"];
let isValidLCID = validLCID.filter(x => x == Parameters.getLCID().toUpperCase());
let cultureName = 'EN';
if(isValidLCID.length > 0){
cultureName = Parameters.getLCID().toUpperCase()
}
form.addHiddenFields({
cPMOriginalSource : "OneGDC-" + jQuery('input[name="lpId"]').val()
,
cPMCultureName : cultureName
});
// we need to remove the newsletter identifier if USA isn't selected and add it back if it is.
var isNewsLetter = false;
if(jQuery('input[name=systemFormsTopicGUID]').length > 0 && jQuery('input[name=systemFormsTopicGUID]').val() != ''){
var newsletterTitle = Parameters.getSingleTopicNewsLetter();
}else{
var newsletterTitle = Parameters.getNewsLetter();
}
if (newsletterTitle != null) {
isNewsLetter = true;
}
/**
* Namespace for checkbox functions
* @namespace Checkboxes
*/
var Checkboxes = (function() {
// empty variable for storage
var inputDataField = [];
/**
* Add the new checkbox values to the hidden input on form submit
* @function Checkboxes.checkboxSubmission
*/
function checkboxSubmission(){
var hiddenInput = jQuery('input[name="cDLProgramAssociation"]');
var inputArrayString = inputDataField.toString();
if(jQuery('input[name="cDLProgramAssociation"]').length !== 0) {
hiddenInput.val(inputArrayString);
}
}
/**
* If the checkboxes haven't been removed by autohide, then they should have their values and
* text populated by the hidden tokens
* @function Checkboxes.checkForBoxes
*/
function checkForBoxes() {
if (jQuery('#dynamicCheckboxes').length !== 0) {
var checkboxValue;
var checkBoxes = jQuery('#dynamicCheckboxes input[type=checkbox]');
// Add hidden field
form.addHiddenFields({
"cDLProgramAssociation":""
});
// iterates over all the checkboxes to add values
checkBoxes.each(function () {
// looks only for checked boxes
if(jQuery(this).prop('checked')) {
checkboxValue = jQuery(this).val();
inputDataField.push(checkboxValue);
}
});
// looks for changes in checkbox checked/unchecked
checkBoxes.on('change', function(){
// if box is newly checked add new value
if(jQuery(this).prop('checked')) {
checkboxValue = jQuery(this).val();
inputDataField.push(checkboxValue);
return checkboxValue;
} else {
// if box is unchecked remove
var checkboxValue = jQuery(this).val();
// checks if value exists in array
if((inputDataField).indexOf(checkboxValue) !== -1) {
var inputIndex = inputDataField.indexOf(checkboxValue);
if (inputIndex >= 0) {
inputDataField.splice(inputIndex, 1);
}
}
}
});
}
}
// Add array to hidden input
form.onSubmit(checkboxSubmission);
return {
checkboxSubmission:checkboxSubmission,
checkForBoxes:checkForBoxes
};
})();
/**
* Redefine form submission action if it isn't set on the landing page, but is set on the form.
* For use later with the "form action".
*
* @function changeFormURL
*/
function changeFormURL() {
var pageAction = (jQuery('#formAction div').length > 0) ? jQuery('#formAction div') : jQuery('#formAction');
var formAction = (jQuery('#formRedirect div').length > 0) ? jQuery('#formRedirect div') : jQuery('#formRedirect');
pageAction = (typeof pageAction.html() === "undefined") ? null : (pageAction.text().indexOf('[REPLACE]') > -1 || pageAction.text().indexOf('%7B%7Bmy.Form-Action%7D%7D') > -1 || pageAction.text().indexOf('{{my.Form-Action}}') > -1) ? null : (pageAction.text() === "") ? null : pageAction.text().replace(/\s|()|(<\/p>)/g, '');
formAction = (typeof formAction.html() === "undefined") ? null : (formAction.text().indexOf('[REPLACE]') > -1 || formAction.text().indexOf('%7B%7Bmy.Form-Action%7D%7D') > -1 || formAction.text().indexOf('{{my.Form-Action}}') > -1) ? null : (formAction.text() === "") ? null : formAction.text().replace(/\s|(
)|(<\/p>)/g, '');
var redirectURL = (pageAction !== null) ? pageAction : (formAction !== null) ? formAction : null;
return redirectURL;
}
/**
* All functions pertaining to select input manipulation. Includes transations for text, updating option values, etc.
*
* @namespace Select
*/
var Select = (function() {
/**
* Determine if labels or placeholders are being used and update the first selection option text accordingly
*
* @function Select.updateFirstOption
*/
function updateFirstOption() {
if (jQuery('label[for=FirstName]').css('display') == 'none' || jQuery('label[for]').css('display') !== "none" && typeof formLocalizationStrings[lcid].form.companySize != "undefined") { // there are no visible labels
if (brand === 'EDU' || brand === 'Microsoft Education' || (jQuery('#mktoForm_14970').length > 0)) {
formLocalizationStrings[lcid].form.studentNumberSelect = formLocalizationStrings[lcid].form.studentNumber + "... *"; // Update school size placeholder to be the label name
} else {
formLocalizationStrings[lcid].form.companySizeSelect = formLocalizationStrings[lcid].form.companySize; // Update company size placeholder to be the label name
}
}
else if ( typeof formLocalizationStrings[lcid].formSelectCountry != "undefined") { // labels are being used instead of placeholders
formLocalizationStrings[lcid].formSelectCountry["Country... *"] = formLocalizationStrings[lcid].formSelectCountry["Select..."]; // Update country and job role placeholders to be "Select"
//formLocalizationStrings[lcid].formSelectJobRole["Job role... *"] = formLocalizationStrings[lcid].formSelectJobRole["Select..."];
}
}
// unifying country options across all 300ish forms. Used to prevent editing all the forms which would take forever
/**
* Replaces all of the HTML for a given select input, updating the option values and text. Takes form design into account and responds accordingly.
* @function Select~buildOptions
* @access protected
* @param {string} location pass the LCID value into the function
*
* @example // rebuilds the #Country select options with values from the French object
* jQuery('#Country').html(buildOptions('FR-FR'));
*/
function buildOptions(location) {
var countryReplacements = [];
if (language !== "EN") {
if (noLabels === true) {
countryReplacements += '' + formLocalizationStrings[location].formSelectCountry['Country... *'] + ' ';
}
else {
countryReplacements += '' + formLocalizationStrings[location].formSelectCountry['Select...'] + ' ';
}
}
else {
if (noLabels === true) {
countryReplacements += 'Country/Region... * ';
}
else {
if(jQuery('#mktoForm_16408').length > 0){
countryReplacements += 'Customer country...* ';
}else{
countryReplacements += 'Select... ';
}
}
}
//Adding Default option for form #mktoForm_15585 for task 31515[New form for Trial in a Box - UK]- 30th Aug 2018
if(jQuery('#mktoForm_15585, #mktoForm_15584').length > 0){
countryReplacements += '' + formLocalizationStrings[location].countryControl['United Kingdom'] + ' ';
} else {
if(jQuery('#mktoForm_16066').length > 0){
for (var key in formLocalizationStrings['default'].formSpecificCountry) {
if (key === country) continue;
countryReplacements += '' + formLocalizationStrings['default'].formSpecificCountry[key] + ' ';
}
}// POPS PROJECT 100823 : [Partner] Power BI Handraiser forms
else if(jQuery('#mktoForm_16415').length > 0 || jQuery('#mktoForm_16432').length > 0) {
for (var key in formLocalizationStrings['default'].Cont_meSpecificCountry) {
if (key === country) continue;
countryReplacements += '' + formLocalizationStrings['default'].Cont_meSpecificCountry[key] + ' ';
}
}
else {
var country = formLocalizationStrings[lcid].country;
countryReplacements += '' + formLocalizationStrings[location].countryControl[country] + ' ';
for (var key in formLocalizationStrings[location].countryControl) {
if (key === country) continue;
countryReplacements += '' + formLocalizationStrings[location].countryControl[key] + ' ';
}
}
}
return countryReplacements;
}
/**
* Rebuild the Country select input options based on the rules layout in the function call
*
* @function Select.replaceCountries
*/
// change the #Country select options and values
function replaceCountries() {
var country = jQuery('#Country');
(language === "EN") ? country.html(buildOptions('default')) : country.html(buildOptions(lcid));
}
/**
* Sort including foreign characters and alphabet orders
*
* @function Select#localeSort
* @access protected
*/
function localeSort(a, b) {
return a[0].localeCompare(b[0]);
}
/**
* Sort select options into ascending alphabetical order according to locale.
* Keep the first two options on top since they will be the select indicator and the target country.
*
* @function Select.localeAlphabetSort
*
* @param {string} selectInputOptions The jQuery selector for the select option in the chosen input
*/
function localeAlphabetSort(selectInputOptions) {
var selectOptions = []; // use array instead of object for sort() function
var selectCounter = 0; // need counter for each() to identify array index
// create multidimensional array of option values and text
jQuery(selectInputOptions).each(function(){
selectOptions.push([jQuery(this).text()]);
selectOptions[selectCounter].push(jQuery(this).val());
selectCounter ++;
});
// reset counter to use again
selectCounter = 0;
// grab subarray with "Select..." and another for "United States"
var topTwoOptions = selectOptions.splice(0, 2);
selectOptions = selectOptions.sort(localeSort);
// add "Select..." and "United States" back to array.
selectOptions.unshift(topTwoOptions[1]);
selectOptions.unshift(topTwoOptions[0]);
// change option value and text to be in alphabetical order
// may break in foreign lanugages
jQuery(selectInputOptions).each(function() {
if (selectCounter === 0) {
jQuery(this).text(selectOptions[selectCounter][0]);
}
else {
jQuery(this).text(selectOptions[selectCounter][0]).val(selectOptions[selectCounter][1]);
}
selectCounter ++;
});
}
/**
* Update the Country select option. This could be re-written for reusability.
*
* @function Select#buildcountryLists
*
* @access protected
*
* @param {string} optionValue What do you want the value for this option to be?
* @param {string} optionText What do you want the display text for this option to be?
* @param {string} conditional To run or not to run?
*/
function buildcountryLists(optionValue, optionText, conditional) {
var newOption = document.createElement('OPTION');
if(conditional) newOption.setAttribute('value', optionValue);
var newOptionText = document.createElement('span');
newOptionText.innerHTML = optionText;
newOption.appendChild(newOptionText);
document.getElementById('Country').appendChild(newOption);
if(jQuery('select#Country option:first span').length>=1){
var jobrolechage = jQuery('select#Country option span:first').text();
jQuery('select#Country option:first').remove('span').text(jobrolechage).attr("value", "");
}
RemoveCountry();
}
function getCountryList(productList){
if(product_countryList[productList]){
jQuery('#Country option').remove();
buildcountryLists('',formLocalizationStrings[lcid]['countryList'][productList]['Country/region *'],true);
var country = product_countryList[productList];
if(formLocalizationStrings[lcid]['countryControl']){
for(var i=0; i< country.length ; i++){
if(formLocalizationStrings[lcid]['countryControl'][country[i]]){
buildcountryLists(country[i], formLocalizationStrings[lcid]['countryControl'][country[i]], true);
}
}
}else{
for(var i=0; i< country.length ; i++){
if(formLocalizationStrings['default']['countryControl'][country[i]]){
buildcountryLists(country[i], formLocalizationStrings['default']['countryControl'][country[i]], true);
}
}
}
}
}
/** On change of product selection set it's related country and job role .
* See the function and all of it's comments for more information.
* @function Select.changeProductSelection
*/
function changeProductSelection(productList) {
if(jQuery('#mktoForm_16408').length > 0 || jQuery('#mktoForm_17119').length > 0){
if(formLocalizationStrings['default']['internalReferralCountryList'][productList]){
jQuery('#Country option').remove();
//jQuery('#Title option').remove();
}
for (key in formLocalizationStrings['default']['internalReferralCountryList'][productList]) {
buildcountryLists(key, formLocalizationStrings['default']['internalReferralCountryList'][productList][key], true);
}
// const selectedProduct = jQuery('#ce_productinterestlatest option:selected').val();
// if(jQuery('#mktoForm_16408').length > 0 && (selectedProduct == 'PowerBI' || selectedProduct == 'Power BI' || selectedProduct == 'Power Apps'|| selectedProduct == 'PowerApps')){
// jQuery("#Country option[value='Canada']").remove();
// jQuery("#Country option[value='United States']").remove();
// }
}else{
// if(formLocalizationStrings[lcid]['countryList'][productList]){
// jQuery('#Country option').remove();
// //jQuery('#Title option').remove();
// }
// for (key in formLocalizationStrings[lcid]['countryList'][productList]) {
// buildcountryLists(key, formLocalizationStrings[lcid]['countryList'][productList][key], true);
// }
getCountryList(productList);
}
// Remove countries from Microsoft Azure product from contact me forms
// let productUsedInContactMeForms = "#mktoForm_11544, #mktoForm_16408, #mktoForm_15316, #mktoForm_15317, #mktoForm_16911, #mktoForm_17132, #mktoForm_17049, #mktoForm_14284, #mktoForm_14288, #mktoForm_17147, #mktoForm_14287, #mktoForm_15216, #mktoForm_17133, #mktoForm_12456, #mktoForm_17119";
// if(jQuery(productUsedInContactMeForms).length > 0){
// if((jQuery('#CountrySelector').text()=="Microsoft Azure") ){
// var countryList = jQuery('#Country option');
// var removableList =["Belgium","China","Hong Kong SAR","Korea","Thailand"];
// for(var i=0; i< countryList.length; i++){
// for(var j=0; j 0){
document.getElementById('ce_industryname').appendChild(newOption);
jQuery('#ce_industryname option:first').val('');
}else if(jQuery('#Industry').length > 0){
document.getElementById('Industry').appendChild(newOption);
jQuery('#Industry option:first').val('');
}
}
/**
* Update the goverment voucher yes/no dropdown field based on json.
*
* @function Select#buildgovvoucher
*
* @access protected
*
* @param {string} optionValue What do you want the value for this option to be?
* @param {string} optionText What do you want the display text for this option to be?
* @param {string} conditional To run or not to run?
*/
function buildgovvoucher(optionValue, optionText, conditional) {
var newOption = document.createElement('OPTION');
newOption.setAttribute('value', optionValue);
if(conditional) newOption.setAttribute('value', optionValue);
newOption.innerHTML = formLocalizationStrings[lcid]['gov_voucher_select'][optionValue];
document.getElementById('governmentEmployee').appendChild(newOption);
jQuery('#governmentEmployee option:first').val('');
}
/**
* Update the Top risk area of interest dropdown field based on json.
*
* @function Select#buildTopRiskAreaOfInterest
*
* @access protected
*
* @param {string} optionValue What do you want the value for this option to be?
* @param {string} optionText What do you want the display text for this option to be?
* @param {string} conditional To run or not to run?
*/
function buildTopRiskAreaOfInterest(optionValue, optionText, conditional) {
var newOption = document.createElement('OPTION');
newOption.setAttribute('value', optionValue.split('_')[1]);
// if(conditional) newOption.setAttribute('value', optionValue);
newOption.innerHTML = formLocalizationStrings[lcid]['topRiskAreaOfInterest'][optionValue];
document.getElementById('requestEngagementProgram').appendChild(newOption);
}
/**
* Update the Industry dropdown field based on json.
*
* @function Select#buildIndustry
*
* @access protected
*
* @param {string} optionValue What do you want the value for this option to be?
* @param {string} optionText What do you want the display text for this option to be?
* @param {string} conditional To run or not to run?
*/
/**
* Changes product of interest select options based on hidden criteria on the page
*
* @function Select.changePOI
*/
function changePOI() {
// make sure we should even run it at all
if (jQuery('#web2Marketo').length > 0
&& jQuery('#poiDiv').length > 0
&& jQuery('#mktoForm_15179').length === 0) {
// set language to default if english or language if not
var poiLanguage = language === "EN" ? "default" : lcid;
if ("POI" in formLocalizationStrings[poiLanguage]) {
var poiTopic = jQuery('#poiDiv').text();
if (poiTopic !== "" && poiTopic !== "{{poi-select}}" && typeof poiTopic !== "undefined") {
poiTopic = poiTopic.trim().toLowerCase();
jQuery('#web2Marketo').html('');
for (var key in formLocalizationStrings[poiLanguage].POI[poiTopic]) {
if (key === "label") {
jQuery('#web2Marketo').append('' + formLocalizationStrings[poiLanguage].POI[poiTopic][key] + ' ');
}
else {
jQuery('#web2Marketo').append('' + key + ' ');
}
}
jQuery('#web2Marketo option:first-child').val('');
}
}
}
}
/**
* Remove US/CA from country dropdown for Power BI and Power Apps
*
*/
function removeCountryContactMe(){
if(jQuery("#mktoForm_11544, #mktoForm_15316, #mktoForm_15317, #mktoForm_16911, #mktoForm_17132, #mktoForm_17049, #mktoForm_14284, #mktoForm_14288, #mktoForm_17147, #mktoForm_14287, #mktoForm_15216, #mktoForm_17133, #mktoForm_18751").length > 0){
const product = jQuery('#CountrySelector');
if(product.length > 0){
if(product.text() == 'Power BI' || product.text() == 'PowerBI' || product.text() == 'Power Apps' || product.text() == 'PowerApps'){
jQuery("#Country option[value='Canada']").remove();
jQuery("#Country option[value='United States']").remove();
}
}else{
const selectedProduct1 = jQuery('#ce_productinterestlatest option:selected').val();
const selectedProduct2 = jQuery('#ce_crm2marketo option:selected').val();
if(selectedProduct1 == 'contactme-powerbi' || selectedProduct1 == 'contactme-powerapps' || selectedProduct2 == 'contactme-powerbi' || selectedProduct2 == 'contactme-powerapps' || selectedProduct1 == 'Power BI' || selectedProduct1 == 'PowerBI' || selectedProduct1 == 'Power Apps' || selectedProduct1 == 'PowerApps' || selectedProduct2 == 'Power BI' || selectedProduct2 == 'PowerBI' || selectedProduct2 == 'Power Apps' || selectedProduct2 == 'PowerApps'){
jQuery("#Country option[value='Canada']").remove();
jQuery("#Country option[value='United States']").remove();
}
}
}
}
return {
updateFirstOption : updateFirstOption,
localeAlphabetSort : localeAlphabetSort,
replaceCountries : replaceCountries,
changeProductSelection : changeProductSelection,
governmentvoucher : governmentvoucher,
getSelectOptions : getSelectOptions,
buildIndustry : buildIndustry,
buildgovvoucher : buildgovvoucher,
buildTopRiskAreaOfInterest: buildTopRiskAreaOfInterest,
changePOI : changePOI,
removeCountryContactMe: removeCountryContactMe
};
})();
// translate form validation error messages
/**
* Custom logic for Marketo error messages and our own add-on functionality
*
* @namespace Validation
*/
var Validation = (function () {
var validEmail = true, validPhone = true;
/**
* Checks if the form should be submittable or not
*
* @function Validation#formToggle
* @access protected
*/
var formToggle = function() {
var formButton = jQuery('form.mktoForm button.mktoButton');
(validEmail === false || validPhone === false) ? formButton.attr("disabled", "") : formButton.removeAttr('disabled');
};
/**
* Disables the form from submission if any of the required criteria aren't met.
*
* @function Validation.formDisable
*/
var formDisable = function() {
// if it exists and is required. Marketo doesn't use the required attribute unfortunately
// so we have to check if the label has an asterix
if (jQuery('#Phone').length > 0 && jQuery('label[for="Phone"] .mktoAsterix').length > 0) {
validPhone = true;
}
if (jQuery('#Email').length > 0 && jQuery('label[for="Email"] .mktoAsterix').length > 0) {
validEmail = false;
}
//formToggle();
};
/**
* Adds styling rules for error states of validated inputs.
*
* @function Validation.invalidStyles
*/
var invalidStyles = function() {
var invalid = document.createElement('style');
var invalidRules = document.createTextNode('.form-wrapper form.mktoForm input.invalid {border: 2px solid #e51b00;}');
invalid.appendChild(invalidRules);
document.getElementsByTagName('head')[0].appendChild( invalid );
};
/**
* Translates the static error message thrown by marketo
*
* @function Validation.errorMessageTranslation
*/
var errorMessageTranslation = function() {
if ("errorMessage" in formLocalizationStrings[lcid]) {
setTimeout(function(){
var errorDiv = jQuery('.mktoErrorMsg');
var errorText = errorDiv.text().trim();
errorDiv.html(formLocalizationStrings[lcid].errorMessage[errorText]);
errorDiv.attr('aria-live', 'polite');
}, 100);
}
};
/**
* Checks to see if the phone or email cookies exist. Sets them if they don't
*
* @function Validation.setUserID
*
* @inner
* @protected
*
*/
var setUserID = function(cookieName) {
var userID = Cookies.getCookie(cookieName);
if(userID === null || userID === undefined){
var generateuuid = generateUUID();
Cookies.createCookie(cookieName, generateuuid, 1);
return userID = generateuuid;
}else{
return userID;
}
};
var validateEmail = function () {
var params = {
// Request parameters
"Leads":
[
{
"LeadID": setUserID('FormEmailValidation'),
"Email": jQuery('#Email').val()
}
],
"Source": "ContactMeForm"
};
if (jQuery('#Email').val() !== "") {
jQuery.ajax({
url: "https://cdvs.trafficmanager.net/EmailValidation?EmailValidationType=full",
type: "POST",
contentType: "application/json",
dataType: "json",
data: JSON.stringify(params),
timeout: 4000
})
.done(function (data) {
if (!data.ServiceResponse.shift().IsValidEmail) {
if ("errorMessage" in formLocalizationStrings[lcid]) {
mktoForm.showErrorMessage(formLocalizationStrings[lcid].errorMessage.email, jQuery('#Email'));
validEmail = false;
jQuery('#Email').addClass('invalid');
formToggle();
}
}
else {
validEmail = true;
formToggle();
jQuery('#Email').removeClass('invalid');
}
})
.fail(function () {
validEmail = true;
formToggle();
jQuery('#Email').removeClass('invalid');
});
}
};
return {
errorMessageTranslation: errorMessageTranslation,
validateEmail: validateEmail,
formDisable: formDisable,
invalidStyles: invalidStyles
};
})();
/**
* Store all of our Accessibility functions.
* Marketo's limitations required many client side work-arounds to pass validation requirements.
*
* @namespace Accessibility
*/
var Accessibility = (function() {
/**
* Add aria labels to all of the forms. Use the form's actual label or placeholder as the aria-label value
*
* @function Accessibility.buildAria
*/
var buildAria = function() {
// get all labels
var labels = document.getElementsByTagName('LABEL');
var selectLabels = document.getElementsByTagName('SELECT');
var placeholders = document.getElementsByTagName('INPUT');
var textAreaLabels = document.getElementsByTagName('TEXTAREA');
// labels are visible. Aria-label is probably overkills, but what the heck...
if ( jQuery('label[for]').css('display') !== "none" || jQuery('label[for="FirstName"]').css('display') !== 'none') {
// use label text to set aria-label
for (i = 0; i\*<\/div>/g, ""));
jQuery('input[name="' + labels[i].htmlFor + '"]').attr('aria-label', labels[i].innerHTML.trim());
}
}
// labels are hidden, we need to set the aria-label
else {
for (i = 0; i 0){
placeholders[i].setAttribute('aria-label', placeholders[i].getAttribute('placeholder').replace('*', formLocalizationStrings[lcid]['required']));
}else{
placeholders[i].setAttribute('aria-label', placeholders[i].getAttribute('placeholder'));
}
}
}
// put aria-label on select inputs. Select ID is always descriptive enough for a label value
// put aria-label on select inputs. Select ID is always descriptive enough for a label value
for (var i = 0; i 0){
a_label = (jQuery('#'+ selectLabels[i].id + ' option:first').text()).replace('*','');
jQuery('select[name="' + selectLabels[i].id + '"]').attr('aria-label', a_label +""+ formLocalizationStrings[lcid]['required']);
}
else{
a_label = (jQuery('#'+ selectLabels[i].id + ' option:first').text());
jQuery('select[name="' + selectLabels[i].id + '"]').attr('aria-label', a_label);
}
}
for (var i = 0; i 0){
a_label = (jQuery('#'+ textAreaLabels[i].id).text()).replace('*','');
jQuery('textarea[name="' + textAreaLabels[i].id + '"]').attr('aria-label', a_label +""+ formLocalizationStrings[lcid]['required']);
}
else{
a_label = (jQuery('#'+ textAreaLabels[i].id).text());
jQuery('textarea[name="' + textAreaLabels[i].id + '"]').attr('aria-label', a_label);
}
//jQuery('textarea[name="' + textAreaLabels[i].id + '"]').attr('aria-label', textAreaLabels[i].placeholder.trim());
}
};
/**
* Marketo puts their form inside of a span for some reason. Forms inside of spans are invalid HTML.
* This function strips the HTML from the span, deletes the span, and adds the HTML back to the page inside of a div instead.
*
* @function Accessibility.changeFormParent
*/
var changeFormParent = function() {
// forms live in spans on marketo hosted pages, but not on embedded forms
if (jQuery('.formSpan').length > 0) {
// Get the parent that the span lives in
var formSpanParent = jQuery('.formSpan').parent();
// get the contents of the span
var formSpanChildren = jQuery('.formSpan').children();
// remove the children
formSpanChildren.detach();
// completely remove the span. It duplicates for some reason if we try to fill the parent any other way
jQuery('.formSpan').remove();
// add the proper parent container
formSpanParent.append('
');
// put the children back
jQuery('.formSpan').append(formSpanChildren);
}
};
// pages need a language tag at the html level, systems are in place to manually set it, but many pages don't have it set for some reason
/**
* Adds a language attribute to the HTML tag based on form LCID and removes it from the body if it is set there.
*
* @function Accessibility.setLanguageTag
*/
function setLanguageTag() {
var languageTag = Parameters.getLCID();
if (languageTag !== null && typeof languageTag !== "undefined") {
if (jQuery('body').attr('lang')) jQuery('body').removeAttr('lang');
jQuery('html').attr('lang', languageTag);
}
}
// change focus state for Azure forms, since the background color of the form is the same as the default input focus state color
/**
* Microsoft focus state is blue, but isn't visible on Azure form inputs, since the form background color is also blue.
* We can set this as a program token, but in the interest of deploying everywhere at once and avoiding page drafts, it has been deployed client side.
*
* @function Accessibility.azureOutlineColor
*/
function azureOutlineColor() {
if (brand === "AZURE" || brand === "Microsoft Azure") {
var azureStyles = document.createElement('style');
azureStyles.type = 'text/css';
azureStyles.innerHTML = '.form-wrapper .form-body form input:focus, .form-wrapper .form-body form select:focus, .form-wrapper .form-body form textarea:focus {outline: 2px solid black !important;}';
document.body.appendChild(azureStyles);
}
}
return {
buildAria: buildAria,
changeFormParent: changeFormParent,
setLanguageTag: setLanguageTag,
azureOutlineColor: azureOutlineColor
};
})();
/**
* Currently only LInkedIn, but will eventually be Facebook and Twitter plugins as well.
*
* @namespace Social
*/
var Social = (function () {
/**
* Create the script node with the linked API source. with Autogenerate linkedin button ( Created by Pravin)
*
* @function Social.createNewScriptNode
*/
function createNewScriptNode() {
var linkedInScript = document.createElement('script');
linkedInScript.type = "text/javascript";
linkedInScript.async = true;
linkedInScript.src = "https://www.linkedin.com/autofill/js/autofill.js";
jQuery('.social-signin-wrapper').append(linkedInScript);
}
/**
* Create the script node with the linked API source. For Autogenerate linkedin button ( created by Pravin)
*
* @function Social.createNewScriptNodeButton
*/
function createNewScriptNodeButton() {
var linkedInButtonScript = document.createElement('script');
var enabledlinkedinbutton = jQuery('form').attr('id');
linkedInButtonScript.type = "IN/Form2";
linkedInButtonScript.setAttribute("data-form", enabledlinkedinbutton);
// marketoForm.insertBefore(linkedInButton, marketoForm.childNodes[0]);
jQuery('.social-signin-wrapper').append(linkedInButtonScript).css('text-align','center');
}
return {
createNewScriptNode : createNewScriptNode,
createNewScriptNodeButton : createNewScriptNodeButton
};
})();
// disable form submission in order to submit to RU server first and await response
function russiaSelected() {
if (countrySelection == "RUSSIA") {
mktoForm.submittable(false);
russia = true;
}
else {
mktoForm.submittable(true);
russia = false;
}
}
// Russian leads need to be sent to a RU server before storing lead on our database
/**
* Sends all of our lead data to a Russian server for storage there before storage on Marketo's server.
* This is a requirement from legal and cannot be skipped or bipassed. Do not let anyone deploy without this.
*
* @function russianSubmit
*/
function russianSubmit() {
var russianIncrement = 1;
if (russia === true && mktoForm.submittable() === false) {
mktoForm.onValidate(function (valid) {
if (valid && russianIncrement < 2) {
mktoForm.submittable(false);
russianIncrement = russianIncrement + 1;
var successID = generateUUID();
form.addHiddenFields({"countryCompliantHash": "", "countryCompliantAuditID": ""});
jQuery('form.mktoForm button[type="submit"]').attr('disabled', '');
jQuery.ajax({
type: "POST",
url: "https://datacomplianceservice.azurewebsites.net/api/contactext/saveonlytorussiamkt",
data: {
"source": "OneGDC|FormFillOut",
"AddOrEdit": 0,
"Firstname": jQuery('#FirstName').val(),
"Lastname": jQuery('#LastName').val(),
"Jobtitle": jQuery('#Title').val(),
"EmailAddress1": jQuery('#Email').val(),
"Country": jQuery('#Country option:selected').val(),
"Telephone": jQuery('#Phone').val(),
"Department": "",
"Id": successID,
"Company": jQuery('#Company').val(),
"AdditionalInfo": "{ \"companySize\": " + jQuery('#employeeRange option:selected').val() + "}"
},
success: function(data) {
var headerResponse = data;
jQuery('input[name=countryCompliantHash]').val(headerResponse.HashedValue);
jQuery('input[name=countryCompliantAuditID]').val("OneGDC|FormFillout|" + successID);
mktoForm.submittable(true);
mktoForm.submit();
},
error: function() {
alert('К Ñожалению, ÑÐµÐ¹Ñ‡Ð°Ñ Ð¾Ñ‚Ð¿Ñ€Ð°Ð²Ð¸Ñ‚ÑŒ вашу форму невозможно. Повторите попытку позже.');
jQuery('form.mktoForm button[type="submit"]').removeAttr('disabled');
},
dataType: "JSON"
});
}
});
}
}
/* ------------------ function calls & open conditions ------------------------ */
var legalText = {};
legalText.textMicrosoft = jQuery('.content-text');
legalText.optIn = jQuery('#LblSystemContactPreferenceMirrorOptIn').length > 0 ? jQuery('#LblSystemContactPreferenceMirrorOptIn').closest('.mktoFieldWrap').children('label') : jQuery('#LblSystemContactPreferenceMirrorOptIn').closest('.mktoFieldWrap').children('label');
legalText.optOut = jQuery('#LblSystemContactPreferenceMirrorOptOut').length > 0 ? jQuery('#LblSystemContactPreferenceMirrorOptOut').closest('.mktoFieldWrap').children('label') : jQuery('#LblSystemContactPreferenceMirrorOptOut').closest('.mktoFieldWrap').children('label');
// add required classes for easy targeting and hide these on page load
legalText.textMicrosoft.closest('.mktoFormCol').addClass('textMicrosoft text-microsoft').hide();
legalText.optIn.closest('.mktoFormRow').addClass('optIn opt-in').hide();
legalText.optOut.closest('.mktoFormRow').addClass('optOut opt-out').hide();
var redirectURL = changeFormURL();
//Hide Manage cookies for Non EU regions
if(Cookies.getCookie('MSCC') == 'NR'){
jQuery('.manageCookies').hide();
}
//Hide what topic you are most interested in field by default
if(jQuery('#web2Marketo').length > 0 && jQuery('#mktoForm_15745').length > 0){
jQuery('#web2Marketo').parents(".mktoFormRow").hide();
}
//script for Honey pot onload
if(jQuery('input[name="primaryformvalue"]').length > 0){
jQuery('label[for="primaryformvalue"]').parents('.mktoFormRow').hide();
jQuery('input[name="primaryformvalue"]').attr('autocomplete','off');
}
// Onload hide error msg for specific form
if(jQuery('#mktoForm_15851').length > 0){
jQuery('#validationerror').parents('.mktoFormRow').hide();
}
//Clear cookie on thank you page
if((jQuery('#mktoForm_15647').length > 0) || (jQuery('#mktoForm_15982').length > 0) || (jQuery('#mktoForm_15316').length > 0) || (jQuery('#mktoForm_15524').length > 0) || (jQuery('#mktoForm_14284').length > 0)) {
//clearListCookies();
}
// some basic logic definitions for partner stuff used throughout the script
if (jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').length > -1) {
partnerPreferenceForm = true;
if (jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').attr('type') === 'hidden') {
partnerCombinedStatement = true;
}
}
//Make aria-required value false in checkbox
if(jQuery('#LblSystemContactPreferenceMirrorOptIn').length > 0){
jQuery('input[name="SystemContactPreferenceMirrorOptIn"]').prop('ariaRequired',false);
}
if(jQuery('#LblSystemContactPreferenceMirrorOptOut').length > 0){
jQuery('input[name="SystemContactPreferenceMirrorOptOut"]').prop('ariaRequired',false);
}
if(jQuery('#LblsystemPartnerPreferenceMirrorOptIn').length > 0){
jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').prop('ariaRequired',false);
}
if(jQuery('label[for=koreaOptIn]').length > 0){
jQuery('input[name="koreaOptIn"]').prop('ariaRequired',false);
}
//Call function only for 10595 (Marketo registration form of Webinar/Gated Conten)
if((Parameters.getLCID()).toLowerCase() ==='ja' || (Parameters.getLCID()).toLowerCase() ==='ja-jp'){
onWebgatedContent();
}
// Remove form from localization function
if(jQuery('#intranet-form').length !== 0){
jQuery(this).remove();
}
// make sure we have an actual translation to do stuff with
if (formLocalizationStrings[lcid]) {
// labels, placeholders, and select options to be translated
var textContainers = {};
textContainers.form = {};
// separate some variables between placeholder and label forms
if(jQuery('#mktoForm_16408, #mktoForm_18128').length <= 0){
if (jQuery('label[for]').css('display') == 'none' || jQuery('label[for="FirstName"]').css('display') == 'none') { // there are no visible labels
noLabels = true;
textContainers.form.firstName = jQuery('#FirstName');
textContainers.form.lastName = jQuery('#LastName');
textContainers.form.email = jQuery('#Email');
textContainers.form.phone = jQuery('#Phone');
textContainers.form.formComments = jQuery('textarea[name="comments"]');
textContainers.form.Address = jQuery('#Address');
textContainers.form.City = jQuery('#City');
textContainers.form.PostalCode = jQuery('#PostalCode');
textContainers.form.schoolDistrictName = jQuery('#schoolDistrictName');
if(jQuery('select[name="requestEngagementProgram"]').length > 0){
textContainers.form.topRiskAreaOfInterest = jQuery('select[name="requestEngagementProgram"] option:first-child');
}
if(jQuery('select[name="numberofStudentsinSchool"]').length > 0){
textContainers.form.numberofstudentsinSchool = jQuery('select[name="numberofStudentsinSchool"] option:first-child');
}
if(jQuery('input#Title').length > 0){
textContainers.form.jobRole = jQuery('#Title');
}
// translate placeholder text for EDU brand
if (brand === 'EDU' || brand === 'Microsoft Education' || (jQuery('#mktoForm_14970').length > 0)) {
textContainers.form.schoolName = jQuery('#Company');
} else {
textContainers.form.companyName = jQuery('#Company');
}
}
else { // labels are being used instead of placeholders
noLabels = false;
//Remove any placeholder text
jQuery('#FirstName, #LastName, #Email, #Company, #Phone, #Title, textarea[name="comments"]').attr("placeholder", "");
textContainers.form.firstName = jQuery('label[for=FirstName]');
textContainers.form.lastName = jQuery('label[for=LastName]');
textContainers.form.email = jQuery('label[for=Email]');
textContainers.form.phone = jQuery('label[for=Phone]');
textContainers.form.formComments = jQuery('label[for=comments]');
textContainers.form.topRiskAreaOfInterest = jQuery('label[for=requestEngagementProgram]');
// translate labels for EDU brand
if (brand === 'EDU' || brand === 'Microsoft Education' || (jQuery('#mktoForm_14970').length > 0)) {
textContainers.form.schoolName = jQuery('label[for=Company]');
} else {
textContainers.form.companyName = jQuery('label[for=Company]');
}
// These are select boxes, and do not need to be translated for placeholders
textContainers.form.jobRole = jQuery('label[for=Title]');
textContainers.form.country = jQuery('label[for=Country]');
// EDU brand number of student translation
if (brand === 'EDU' || brand === 'Microsoft Education' || (jQuery('#mktoForm_14970').length > 0)) {
textContainers.form.studentNumber = jQuery('label[for=employeeRange]');
} else {
if(jQuery('#mktoForm_17132, #mktoForm_18751').length > 0){
textContainers.form.companySize = jQuery('label[for=NumberOfEmployees]');
}else{
textContainers.form.companySize = jQuery('label[for=employeeRange]');
}
}
if(jQuery('#mktoForm_15745').length > 0){
textContainers.form.What_topic_are_you_most_interested_in = jQuery('label[for=web2Marketo]');
}
// End select boxes
}
}
// EDU brand number of student translation
if (brand === 'EDU' || brand === 'Microsoft Education' || (jQuery('#mktoForm_14970').length > 0)) {
textContainers.form.studentNumberSelect = jQuery('select[name="employeeRange"] option:first-child');
if(jQuery('select[name="numberofStudentsinSchool"]').length > 0){
textContainers.form.studentNumber = jQuery('select[name="numberofStudentsinSchool"] option:first-child');
}else if(jQuery('select[name="NumberOfEmployees"]').length > 0){
textContainers.form.studentNumber = jQuery('select[name="NumberOfEmployees"] option:first-child');
}
} else {
textContainers.form.companySizeSelect = jQuery('select[name="employeeRange"] option:first-child');
}
textContainers.form.languageInput = jQuery('input[name="ce_language"]');
if(jQuery('#mktoForm_17132, #mktoForm_18751').length > 0){
textContainers.form.companySizeSelect = jQuery('select[name="NumberOfEmployees"] option:first-child');
}
// get industry options
//Select.getSelectOptions("DTIndustry", "form select[name='Industry'] option");
// get industry options
//Select.getSelectOptions("DTIndustry", "form select[name='ce_industryname'] option");
// get country options
Select.getSelectOptions("formSelectCountry", "form select[name='Country'] option");
// get POI
Select.getSelectOptions("contactPOI", "form select[name='ce_crm2marketo'] option");
// get Product intrest options
Select.getSelectOptions("Dymotion", "form select[name='ce_topicofinterest'] option");
// get Top risk Area of interest options
if(jQuery('#requestEngagementProgram').length > 0){
jQuery('#requestEngagementProgram option').remove();
for (key in formLocalizationStrings[lcid]['topRiskAreaOfInterest']) {
Select.buildTopRiskAreaOfInterest(key, formLocalizationStrings[lcid]['topRiskAreaOfInterest'][key], true);
}
jQuery('#requestEngagementProgram option:first').val('');
}
/* end definitions and functions
start scripting and calling of functions*/
//Create industry dropdown in form
if(jQuery('#ce_industryname').length > 0){
jQuery('#ce_industryname option').remove();
for (key in formLocalizationStrings[lcid]['DTIndustry']) {
Select.buildIndustry(key, formLocalizationStrings[lcid]['DTIndustry'][key], true);
}
}else if(jQuery('#Industry').length > 0){
jQuery('#Industry option').remove();
for (key in formLocalizationStrings[lcid]['DTIndustry']) {
Select.buildIndustry(key, formLocalizationStrings[lcid]['DTIndustry'][key], true);
}
}
//create govvoucher dropdown in form
if(jQuery('#governmentEmployee').length > 0){
jQuery('#governmentEmployee option').remove();
for (key in formLocalizationStrings[lcid]['gov_voucher_select']) {
Select.buildgovvoucher(key, formLocalizationStrings[lcid]['gov_voucher_select'][key], true);
}
}
/* end definitions and functions
start scripting and calling of functions*/
// translate form button
var buttonTranslation = jQuery('#buttonTranslation');
if ( jQuery('#buttonTranslation').text().trim() === ""
|| buttonTranslation.text().trim() === " "
|| buttonTranslation.text().trim() === null
|| buttonTranslation.text().trim() === "Get the free e Book" // make sure the button text hasn't already been translated based on the legacy method of using 3 approved strings in the JSON
|| buttonTranslation.text().trim() === "Start your free tour"
|| buttonTranslation.text().trim() === "Submit Form"
|| buttonTranslation.text().trim() === "Get the free report" ) {
var submitButton = jQuery('button.mktoButton');
textContainers.formSubmit = {};
textContainers.formSubmit[submitButton.text().trim()] = submitButton;
}
else if (jQuery('#buttonTranslation').length > 0) {
if (jQuery('#buttonTranslation').text().trim() !== "") jQuery('button.mktoButton').html( buttonTranslation.text().trim() );
}
Select.updateFirstOption(textContainers, formLocalizationStrings);
swapLanguages(textContainers, formLocalizationStrings);
// only replace countries on pages that aren't office contact me pages
if ( !( window.location.href.match(/o365-contactus/i) ||
window.location.href.match(/o365-contactme/i) ||
window.location.href.match(/spe-contactus/i) ||
window.location.href.match(/m365-contactus/i) ) ) {
Select.replaceCountries();
}
if(jQuery('#mktoForm_14970').length > 0){
educountry();
}
//Select.changeJobRoles();
Select.changePOI();
//if(product_name !== '' && (jQuery('#mktoForm_14284').length === 1 || jQuery('#mktoForm_14287').length === 1)){
if(product_name !== '' && jQuery('#mktoForm_17132, #mktoForm_18751').length == 0){
Select.changeProductSelection(product_name);
RemoveCountry();
}
//M365 changes
if(jQuery('#mktoForm_14284').length > 0 && (jQuery('#m365limitcountries').text()).toLowerCase() == 'yes'){
var arr = customCountryList['m365'];
getCustomCountryList(arr);
}
//ContactMe Request Demo country list updation
if(jQuery('#mktoForm_16416').length > 0){
var arr = customCountryList['ContactMeRequestDemo'];
getCustomCountryList(arr);
//Select.localeAlphabetSort("form select[name='Country'] option");
}
//Universal Partner form
if(jQuery('#mktoForm_17049').length > 0){
var arr = customCountryList['Universal_Partner'];
getCustomCountryList(arr);
//Select.localeAlphabetSort("form select[name='Country'] option");
}
Select.localeAlphabetSort("form select[name='Country'] option");
//on select of goverment emp dropdown field
jQuery('.gov_notice').parents('.mktoFormRow').hide();
jQuery('#governmentEmployee').on('change blur click focus',function(){
if(jQuery(this).val()==''){
jQuery('#governmentEmployee').addClass('invalid');
if(jQuery('#governmentEmployee').parent('mktoFormRow').is(':visible') == true){
jQuery('form.mktoForm button.mktoButton').attr("disabled", "");
}
if ("errorMessage" in formLocalizationStrings[lcid]) {
mktoForm.showErrorMessage(formLocalizationStrings[lcid].errorMessage['This field is required.'], jQuery('select#governmentEmployee'));
jQuery('#governmentEmployee').next('.mktoError').show();
}
}else{
Validation.errorMessageTranslation;
jQuery('#governmentEmployee').removeClass('invalid');
jQuery('#governmentEmployee').next('.mktoError').hide();
jQuery('form.mktoForm button.mktoButton').removeAttr('disabled');
}
Select.governmentvoucher();
});
//Country code for Improve code
jQuery("#countryCodeList").on("focus change blur", function() {
if(jQuery('#mktoForm_18581, #mktoForm_18357').length == 0){
var countrycode = jQuery("#countryCodeList").val();
jQuery('#countryCodeList').attr("aria-invalid", "true")
if(countrycode == ''){
if ("errorMessage" in formLocalizationStrings[lcid]) {
jQuery('#countryContainer').addClass('invalid');
// jQuery('form.mktoForm button.mktoButton').attr("disabled", "");
mktoForm.showErrorMessage(formLocalizationStrings[lcid].errorMessage['This field is required.'], jQuery('#countryContainer'));
jQuery('#countryContainer').next('.mktoError').show();
jQuery('#countryContainer').next('.mktoError').css({'display' : 'block', 'left': '29.3542px', 'right': 'unset'})
if(jQuery(window).width() < 391){ //mobile device
jQuery('#countryContainer').next('.mktoError').css('bottom','49px');
}
return false;
}
}else{
jQuery('#countryContainer').next('.mktoError').css({'display' : 'none'});
jQuery('#countryCodeList').attr("aria-invalid", "false")
}
}
})
// set hidden language input used for tracking
textContainers.form.languageInput.val(formLocalizationStrings[lcid].form.languageInput);
// translate error messages
jQuery('input, select').on('blur click contextmenu focus mousedown mouseup', Validation.errorMessageTranslation);
if((jQuery('#mktoForm_18785').length > 0)){
// let mdfCheckBox = jQuery('input[name="mDFPartner"]');
// mdfCheckBox.on('change', function() {
// if (mdfCheckBox.prop('checked')) {
// let date = new Date();
// let mdfDateTime = date.toISOString();
// jQuery('input[name="mDFPartner"]').val(mdfDateTime);
// }
// else {
// jQuery('input[name="mDFPartner"]').val('');
// }
// });
jQuery('input[name="secondaryOptIn"]').parent().append('');
mktoForm.onSubmit(function(mktoForm){
if(jQuery('input[name="MDFPartnerConsent"]').prop('checked')){
let mdfPartnerName= jQuery('.MDF-Partner-Name').html();
let myDate = new Date();
let pstDate = myDate.toLocaleString("en-US", {
timeZone: "America/Los_Angeles"
})
// let secondaryOptInValue = mdfPartnerName + " | " + new Date().toISOString();
let secondaryOptInValue = mdfPartnerName + " | " + pstDate;
mktoForm.addHiddenFields({
secondaryOptIn : secondaryOptInValue
});
}
});
jQuery('label[for="MDFPartnerConsent"]').parents('.mktoFormRow').hide();
// jQuery('label[for="MDFPartnerConsent"]').html(''+jQuery('label[for="MDFPartnerConsent"]').html()+' ');
jQuery('label[for="MDFPartnerConsent"]').css('display','inline-block');
let mdfCheckboxColor = jQuery('.consentLabel').css("color");
jQuery('label[for="MDFPartnerConsent"] .mdfConsentLabel').css({'font-size':'17px','line-height':'20px', 'margin-left':'25px', 'color': '#fff'});
}
// webinar / Gated content Only for #mktoForm_10595, To start validation from lastname
jQuery('button.mktoButton').on('click', function(){
if(jQuery("#countryCodeList").length > 0){
var countrycode = jQuery("#countryCodeList").val();
if(jQuery('#Phone').val() !== '' && countrycode !==''){
var phonefield = (jQuery('#Phone').val()).trim();
if (phonefield.indexOf('+') === -1){
var concatcode = countrycode.concat(phonefield);
jQuery('#Phone').val(concatcode);
}
}
if(jQuery('#mktoForm_18581, #mktoForm_18357').length == 0){
if(countrycode == ''){
if ("errorMessage" in formLocalizationStrings[lcid]) {
jQuery('#countryContainer').addClass('invalid');
// jQuery('form.mktoForm button.mktoButton').attr("disabled", "");
mktoForm.showErrorMessage(formLocalizationStrings[lcid].errorMessage['This field is required.'], jQuery('#countryContainer'));
jQuery('#countryContainer').next('.mktoError').show();
jQuery('#countryContainer').next('.mktoError').css({'display' : 'block', 'left': '29.3542px', 'right': 'unset'});
if(jQuery(window).width() < 391){ //mobile device
jQuery('#countryContainer').next('.mktoError').css('bottom','49px');
}
document.getElementById("countryContainer").scrollIntoView();
return false;
}
}
}
}
// Validation of first name, last name and email
let nameReg = /^[a-zA-Z0-9 \.\-\']+$/;
let validEmailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
let firstName = jQuery('#FirstName').val();
let lastName = jQuery('#LastName').val();
let emailid = jQuery('#Email').val();
// if(firstName !== "" && (!nameReg.test(firstName) || firstName.length > 50)) {
if(firstName !== "" && (firstName.length > 50)) {
mktoForm.showErrorMessage("Please provide a valid first name", jQuery('input#FirstName'));
jQuery('#FirstName').addClass('invalid');
document.getElementById("FirstName").scrollIntoView();
return false;
}
else{
jQuery('#FirstName').removeClass('invalid');
Validation.errorMessageTranslation
}
// if(lastName !== "" && (!nameReg.test(lastName) || lastName.length > 50)) {
if(lastName !== "" && (lastName.length > 50)) {
mktoForm.showErrorMessage("Please provide a valid last name", jQuery('input#LastName'));
jQuery('#LastName').addClass('invalid');
document.getElementById("LastName").scrollIntoView();
return false;
}
else{
jQuery('#LastName').removeClass('invalid');
Validation.errorMessageTranslation
}
// if(emailid !== "" && (!validEmailRegex.test(emailid))) {
// mktoForm.showErrorMessage("Please provide a valid email address", jQuery('input#Email'));
// jQuery('#Email').addClass('invalid');
// document.getElementById("Email").scrollIntoView();
// return false;
// }
// else{
// jQuery('#Email').removeClass('invalid');
// Validation.errorMessageTranslation
// }
var countrySelection = jQuery('#Country option:selected').val().toUpperCase();
if(countrySelection == 'KOREA'){
if(jQuery('input[name="koreaOptIn"]').prop('checked')== false){
mktoForm.showErrorMessage(formLocalizationStrings[lcid].errorMessage['This field is required.'], jQuery('input[name="koreaOptIn"]'));
jQuery('input[name="koreaOptIn"]').addClass('invalid');
document.getElementById('koreaOptIn').scrollIntoView();
return false;
}
}
if((jQuery('#mktoForm_13633').length > 0) || (jQuery('#mktoForm_10595').length > 0) || (jQuery('#mktoForm_18785').length > 0) || (jQuery('#mktoForm_14282').length > 0) || (jQuery('#mktoForm_15866').length > 0) || (jQuery('#mktoForm_18567').length > 0) || (jQuery('#mktoForm_18590').length > 0) || (jQuery('#mktoForm_18591').length > 0) || (jQuery('#mktoForm_18592').length > 0) ||
(jQuery('#mktoForm_18769').length > 0) || (jQuery('#mktoForm_18613').length > 0) ||
(jQuery('#mktoForm_18614').length > 0) || (jQuery('#mktoForm_18615').length > 0)){
var lname = jQuery('#LastName').val();
if((lcid.indexOf('JA') > -1 || lcid.indexOf('JA-JP') > -1) && (lname =="")) {
mktoForm.showErrorMessage(formLocalizationStrings[lcid].errorMessage['This field is required.'], jQuery('input#LastName'));
}
} else{
Validation.errorMessageTranslation
}
//Remove phone topic if phone field is empty for standard GPS form
if(jQuery('#mktoForm_18357').length > 0){
if(jQuery('#Phone').val() == ''){
let pref2marketo = jQuery('input[name=pref2Marketo]').val().split(';');
let newPref2Marketo = [];
for(let topic of pref2marketo){
if(topic.indexOf('MicrosoftPH1') == -1){
newPref2Marketo.push(topic)
}
}
jQuery('input[name=pref2Marketo]').val(newPref2Marketo.join(';'));
}else{
getConsentSelection()
}
}
});
Validation.invalidStyles();
// Validation.formDisable();
//Validation.validateEmail();
//jQuery('#Email').on('blur', Validation.validateEmail);
//Clear cookie on thank you page
if((jQuery('#mktoForm_15647').length > 0) || (jQuery('#mktoForm_15982').length > 0) || (jQuery('#mktoForm_15316').length > 0) || (jQuery('#mktoForm_15524').length > 0) ) {
//clearListCookies();
}
}// end all translations - everything below is for all pages, including legacy static
// hide jobRoleSelector div
if (jQuery('#jobRoleSelector').length > 0) {
jQuery('#jobRoleSelector').parents('.mktoFormRow').hide();
}
if (jQuery('#poiDiv').length > 0) jQuery('#poiDiv').parents('.mktoFormRow').hide();
// remove legal notices, prepend them just above the button
// solution to progressive profiling not allowing items below progressive field
var legalRows = {};
var formButtonRow = jQuery('.mktoButtonRow');
if (jQuery('.optOut').length) {
legalRows.optOutRow = jQuery('.optOut');
legalRows.optInRow = jQuery('.optIn');
legalRows.noticeTextRow = jQuery('.textMicrosoft').parent('.mktoFormRow');
for (var row in legalRows) {
if (legalRows.hasOwnProperty(row)) {
legalRows[row].detach();
formButtonRow.before(legalRows[row]);
}
}
}
// put partner checkbox last, and hide it - OCP
if (partnerPreferenceForm) {
// separate partner pref notice and opt-in
if (!partnerCombinedStatement) { // input is a checkbox
//var partnerCheckBox = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]');
var partnerCheckboxRow = jQuery('#LblsystemPartnerPreferenceMirrorOptIn').closest('.mktoFormRow');
if ((language !== "EN") && (language !== "FR") && (language !== "ES") && (language !== "DE") && (language !== "PT") && (language !== "JA") && (language !== "RU") && (language !== "ZH") && (language !== "IT")) { // hide the second input if not English
partnerCheckboxRow.hide();
}else {
jQuery('#LblsystemPartnerPreferenceMirrorOptIn').html(''+formLocalizationStrings[lcid]["PartnerStatments"]["PartnerConsent"]+' ');
partnerCheckboxRow.detach();
formButtonRow.before(partnerCheckboxRow);
partnerCheckboxRow.hide();
}
}
}
// add multi-check if needed
Checkboxes.checkboxSubmission();
Checkboxes.checkForBoxes();
// set the systemformslanguagelocalproduct to have a brand even for dynamic pages
Parameters.setSystemFormsVal();
// if the redirect hidden div is present on the form it's row shows. Hide it.
if (jQuery('#formRedirect').length > 0) jQuery('#formRedirect').parents('.mktoFormRow').hide();
// set aria-label values to overcome marketo forms accessibility shortcomings
Accessibility.buildAria();
// forms live in spans for some weird reason
Accessibility.changeFormParent();
// set the html lang tag and remove it from the body if present
Accessibility.setLanguageTag();
// change input focus state color on Azure forms
Accessibility.azureOutlineColor();
// add linkedIn functionality but don't run where not authorized.
if (window.location.href.match('info.microsoft.com') || window.location.href.match('resources.office.com') || window.location.href.match('localhost')) {
try{
var findScript = jQuery('.social-signin-wrapper script').attr('src');
if((jQuery(".social-signin-wrapper").is(":visible")) && (jQuery('.social-signin-wrapper').length > 0) && ((jQuery('.social-signin-wrapper script').attr('src') === undefined) || (findScript.indexOf('autofill.js') < 0))){
Social.createNewScriptNode();
Social.createNewScriptNodeButton();
}
} catch (ex) {
// console.log('Exception in social block : ', ex);
}
}
Parameters.setMCID();
// if it's a now take flight window
if (jQuery('#flight').length > 0) {
if (jQuery('#flight').text().trim() === "true") {
// listen for nowTakeFlight variables
window.addEventListener('message', function (event) {
if ((event.origin === "https://nowtakeflight.com" || event.origin === "https://www.nowtakeflight.com") && typeof event.data == "string") {
flightURL = Parameters.captureFlightData(event.data);
}
});
}
}
// set the form limit to 5000 charcter across all marketo forms
jQuery('#formComments,#comments').attr('maxlength','5000');
//PBI request
if(jQuery('#mktoForm_16911').length > 0){
getCustomCountryList(customCountryList['PBIsupported_countrylist']);
RemoveCountry();
jQuery("#Country option[value='Myanmar']").remove();
}
// MW omnichannel country list
/*if(jQuery('#mktoForm_17132').length > 0){
getCustomCountryList(customCountryList['MWsupported_countrylist']);
}*/
/*-------------------------------- end ----------------------------------------------- */
/** Change the legal notice text to the right notice and language, based on complex rules.
* See the function and all of it's comments for more information.
* @function changeNotice
*/
//change newsletter notice consent
function changeNewsletterNotice(){
jQuery('.SBO-Topic-Business-Newsletter-Name').parent().parent().parent().parent('.mktoFormRow').hide()
var countrySelected = jQuery("#Country option:selected").val();
let brandText = '';
if(jQuery('input[name=systemFormsTopicGUID]').length > 0 && jQuery('input[name=systemFormsTopicGUID]').val() != ''){
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
if (topicId !== '00000000-0000-0000-0000-000000000001') { // Check to see if it's msft brand which doesn't use branding
// isBranded = "Brand";
// Translate the brand if one is available, otherwise use default object text
if((lcid in brandingText)) {
if(brandingText[lcid].hasOwnProperty('singleComTopicNewsletter') && topicId in brandingText[lcid]['singleComTopicNewsletter']){
brandText = brandingText[lcid]['singleComTopicNewsletter'][topicId];
}else{
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
}
// default brand text
else {
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
} else { // doesn't need a brand, so don't add one. DUH!
// isBranded = "";
}
//IF SBO-Topic-Business-Newsletter-Name IS EITHER SURAFE OR MICROSOFT
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'microsoft partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
if((lcid in brandingText)) {
brandText = brandingText[lcid]['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}
}
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'surface partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
if((lcid in brandingText)) {
brandText = brandingText[lcid]['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter'];
}
}
}
if(countrySelected){
jQuery("#LblSystemContactPreferenceMirrorOptIn").parent().parent().parent('.mktoFormRow').hide();
jQuery("#LblSystemContactPreferenceMirrorOptOut").parent().parent().parent('.mktoFormRow').hide();
jQuery("#LblsystemPartnerPreferenceMirrorOptIn").parent().parent().parent('.mktoFormRow').hide();
var brandedConsent = formLocalizationStrings[lcid]["noticeConsentForNewsletter"].replace("DYMPRODUCT", brandText);
if(jQuery("#mktoForm_18769").length > 0){
brandedConsent = formLocalizationStrings[lcid]["noticeConsentForNewsletterSBO"];
}
if(jQuery("#mktoForm_18592").length > 0){ //MPN Update
brandedConsent = formLocalizationStrings[lcid]["noticeConsentForMPNForm"].replace("DYMPRODUCT", brandText);
}
jQuery(".textMicrosoft span.consentLabel").html(brandedConsent);
jQuery(".textMicrosoft").show();
jQuery(".textMicrosoft .content-text").show();
var pref2marketoVal = topicId + '=OptInExplicit;';
jQuery('input[name=pref2Marketo]').val(pref2marketoVal);
}else{
jQuery(".textMicrosoft").hide();
jQuery('input[name=pref2Marketo]').val('');
}
}
//Test Form function - change newsletter notice consent
function changeNewsletterNoticeTest(){
jQuery('.SBO-Topic-Business-Newsletter-Name').parent().parent().parent().parent('.mktoFormRow').hide()
var countrySelected = jQuery("#Country option:selected").val();
let brandText = '';
if(jQuery('input[name=systemFormsTopicGUID]').length > 0 && jQuery('input[name=systemFormsTopicGUID]').val() != ''){
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
if (topicId !== '00000000-0000-0000-0000-000000000001') { // Check to see if it's msft brand which doesn't use branding
// isBranded = "Brand";
// Translate the brand if one is available, otherwise use default object text
if((lcid in brandingText)) {
if(brandingText[lcid].hasOwnProperty('singleComTopicNewsletter') && topicId in brandingText[lcid]['singleComTopicNewsletter']){
brandText = brandingText[lcid]['singleComTopicNewsletter'][topicId];
}else{
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
}
// default brand text
else {
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
} else { // doesn't need a brand, so don't add one. DUH!
// isBranded = "";
}
//IF SBO-Topic-Business-Newsletter-Name IS EITHER SURAFE OR MICROSOFT
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'microsoft partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
if((lcid in brandingText)) {
brandText = brandingText[lcid]['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}
}
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'surface partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
if((lcid in brandingText)) {
brandText = brandingText[lcid]['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter'];
}
}
}
if(countrySelected){
jQuery("#LblSystemContactPreferenceMirrorOptIn").parent().parent().parent('.mktoFormRow').hide();
jQuery("#LblSystemContactPreferenceMirrorOptOut").parent().parent().parent('.mktoFormRow').hide();
jQuery("#LblsystemPartnerPreferenceMirrorOptIn").parent().parent().parent('.mktoFormRow').hide();
var brandedConsent = formLocalizationStrings[lcid]["noticeConsentForNewsletter"].replace("DYMPRODUCT", brandText)
jQuery(".textMicrosoft span.consentLabel").html(brandedConsent);
jQuery(".textMicrosoft").show();
jQuery(".textMicrosoft .content-text").show();
var pref2marketoVal = topicId + '=OptInExplicit;';
jQuery('input[name=pref2Marketo]').val(pref2marketoVal);
}else{
jQuery(".textMicrosoft").hide();
jQuery('input[name=pref2Marketo]').val('');
}
}
// Change notice for SIngle commercial topic
function changeNoticeSingleTopic() {
// Exit function on specific form that has no localization
if (jQuery('#intranet-form').length !== 0) {
return;
}
// deal with block scope hoisting issues;
var notices; var legalNotice; var brandText; var brandSelect; var isBranded;
var product_selection = jQuery("#ce_crm2marketo option:selected").val();
var hiddenData = jQuery("input[name='systemFormsLanguageLocaleProduct']");
var masterSetting = hiddenData.val();
if(jQuery('input[name=systemFormsTopicGUID]').length > 0 && jQuery('input[name=systemFormsTopicGUID]').val() != ''){
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
if (topicId !== '00000000-0000-0000-0000-000000000001') { // Check to see if it's msft brand which doesn't use branding
isBranded = "Brand";
// Translate the brand if one is available, otherwise use default object text
if((lcid in brandingText) && ((countrySelection != "CANADA") || (lcid ==="FR-CA"))) {
if(brandingText[lcid].hasOwnProperty('singleComTopic') && topicId in brandingText[lcid]['singleComTopic']){
brandText = brandingText[lcid]['singleComTopic'][topicId];
}else{
brandText = brandingText.default['singleComTopic'][topicId];
}
}
// default brand text
else {
brandText = brandingText.default['singleComTopic'][topicId];
}
} else { // doesn't need a brand, so don't add one. DUH!
isBranded = "";
}
}else{
if (masterSetting.length > 5 && !masterSetting.match(/msft/i)) { // Check to see if it's msft brand which doesn't use branding
isBranded = "Brand";
brandSelect = Parameters.brandSelector();
// Translate the brand if one is available, otherwise use default object text
if((lcid in brandingText) && ((countrySelection != "CANADA") || (lcid ==="FR-CA"))) {
brandText = (brandSelect in brandingText[lcid]) ? brandingText[lcid][brandSelect] : brandingText.default[brandSelect];
}
// default brand text
else {
brandText = brandingText.default[brandSelect];
}
} else { // doesn't need a brand, so don't add one. DUH!
isBranded = "";
}
}
var noticeCanada = "noticeCanada" + isBranded;
var noticePartnerCombinedCanada = "noticePartnerCombinedCanada" + isBranded;
var noticePartnerCombined = "noticePartnerCombined" + isBranded;
var notice = "notice" + isBranded;
// special rules for en-us, en-ca, and fr-ca
if ((lcid == "EN-US" || lcid == "EN-CA" || lcid == "FR-CA") && (jQuery('#mktoForm_15866').length !== 1)) {
// EN-US only newsletter specific notices
if(isNewsLetter === true){
legalNotice = brandingText.default['singleComTopic']['newsletter'][topicId];
}else {
// canada specific notice only for en-us, en-ca, and fr-ca,
if ((countrySelection == "CANADA") && (lcid ==="FR-CA")) {
// if it is a partner form with a combined statement, then change the statement to the combined statement for canada, otherwise, just canada
legalNotice = partnerPreferenceForm === true && partnerCombinedStatement === true ? formLocalizationStrings[lcid].legal[noticePartnerCombinedCanada] : formLocalizationStrings[lcid].legal[noticeCanada];
if(jQuery('#mktoForm_17133').length > 0){
legalNotice = formLocalizationStrings[lcid]["legalNotice"]["NoticeMSRCannada"];
}
}else if ((countrySelection == "CANADA") && (lcid !=="FR-CA")) {
// if it is a partner form with a combined statement, then change the statement to the combined statement for canada, otherwise, just canada
legalNotice = partnerPreferenceForm === true && partnerCombinedStatement === true ? formLocalizationStrings["EN"].legal[noticePartnerCombinedCanada] : formLocalizationStrings["EN"].legal[noticeCanada];
if(jQuery('#mktoForm_17133').length > 0){
legalNotice = formLocalizationStrings[lcid]["legalNotice"]["NoticeMSRCannada"];
}
}
else {
legalNotice = partnerPreferenceForm === true && partnerCombinedStatement === true ? formLocalizationStrings[lcid].legal[noticePartnerCombined] : ChangeNewNoticeonlcid();
}
}
}
else if((jQuery('#mktoForm_15866').length !== 1)){
try{
if ((countrySelection == "CANADA") && (lcid ==="FR-CA")) {
// if it is a partner form with a combined statement, then change the statement to the combined statement for canada, otherwise, just canada
legalNotice = partnerPreferenceForm === true && partnerCombinedStatement === true ? formLocalizationStrings[lcid].legal[noticePartnerCombinedCanada] : formLocalizationStrings[lcid].legal[noticeCanada];
if(jQuery('#mktoForm_17133').length > 0){
legalNotice = formLocalizationStrings[lcid]["legalNotice"]["NoticeMSRCannada"];
}
}else if ((countrySelection == "CANADA") && (lcid !=="FR-CA")) {
// if it is a partner form with a combined statement, then change the statement to the combined statement for canada, otherwise, just canada
legalNotice = partnerPreferenceForm === true && partnerCombinedStatement === true ? formLocalizationStrings["EN"].legal[noticePartnerCombinedCanada] : formLocalizationStrings["EN"].legal[noticeCanada];
if(jQuery('#mktoForm_17133').length > 0){
legalNotice = formLocalizationStrings[lcid]["legalNotice"]["NoticeMSRCannada"];
}
}else{
legalNotice = partnerPreferenceForm === true && partnerCombinedStatement === true && language === "EN" ? formLocalizationStrings[lcid].legal[noticePartnerCombined] : ChangeNewNoticeonlcid();
}
}catch (ex) {
// console.log("Exception in Block A :", ex);
}
}
else {
legalNotice = ChangeNewNoticeonlcid();
}
function ChangeNewNoticeonlcid(){
if((jQuery('#mktoForm_15866').length !== 1)){
var const_lang_from='',const_lang='';
Selectbrand = Parameters.brandSelector();
countrySelection = jQuery('#Country option:selected').val().toUpperCase();
for (var key in legalReqs){
if (legalReqs.hasOwnProperty(key)) {
const_lang = legalReqs[key].indexOf(countrySelection) > -1 ? key : '';
if(const_lang == "optIn" || const_lang == "optOut"){
const_lang_from = "legal_optIn_OutNotice";
}else if(const_lang == "textMicrosoft"){
if(jQuery('#mktoForm_17049').length > 0){
const_lang_from = "legal_optIn_OutNotice";
}else{
const_lang_from = "legalNotice";
}
}
if(const_lang_from !=''){
break;
}
}
}
if(jQuery('input[name=systemFormsTopicGUID]').length > 0 && jQuery('input[name=systemFormsTopicGUID]').val() != ''){
if(topicId !== '00000000-0000-0000-0000-000000000001'){
legalNotice = formLocalizationStrings[lcid][const_lang_from]["NoticewithBrand"];
}else{
legalNotice = formLocalizationStrings[lcid][const_lang_from]["NoticewithoutBrand"];
if(jQuery('#mktoForm_17133').length > 0){
legalNotice = formLocalizationStrings[lcid][const_lang_from]["NoticeMSR"];
if(countrySelection == "CANADA"){
legalNotice = formLocalizationStrings[lcid][const_lang_from]["NoticeMSRCannada"];
}
}
}
}else{
if(Selectbrand !== 'MSFT'){
legalNotice = formLocalizationStrings[lcid][const_lang_from]["NoticewithBrand"];
}else{
legalNotice = formLocalizationStrings[lcid][const_lang_from]["NoticewithoutBrand"];
if(jQuery('#mktoForm_17133').length > 0){
legalNotice = formLocalizationStrings[lcid][const_lang_from]["NoticeMSR"];
if(countrySelection == "CANADA"){
legalNotice = formLocalizationStrings[lcid][const_lang_from]["NoticeMSRCannada"];
}
}
}
}
}else if((jQuery('#mktoForm_15866').length === 1) && (countrySelection == "CANADA") && (lcid == "EN-US" || lcid == "EN-CA")){
// if it is a partner form with a combined statement, then change the statement to the combined statement for canada, otherwise, just canada
legalNotice = partnerPreferenceForm === true && partnerCombinedStatement === true ? formLocalizationStrings[lcid].legal[noticePartnerCombinedCanada] : formLocalizationStrings[lcid].legal[noticeCanada];
}
else if((jQuery('#mktoForm_15866').length ===1) && lcid == "FR-CA"){
legalNotice = formLocalizationStrings[lcid]["frnoticeCanada"];
}
else {
legalNotice = formLocalizationStrings[lcid]["dcomm_legal"];
}
return legalNotice;
}
//End Comment for legalNotice change as per Product Name Change
if(jQuery('#mktoForm_15622').length){
if(jQuery('#ce_crm2marketo').val() != ""){
if( window.location.href.indexOf('lcid') > 1){
legalNotice = formLocalizationStrings[lcid].legal.noticeBrand;
}else{
legalNotice = formLocalizationStrings['EN'].legal.noticeBrand;
}
}else{
if( window.location.href.indexOf('lcid') > 1){
legalNotice = formLocalizationStrings[lcid].legal.notice;
}else{
legalNotice = formLocalizationStrings['EN'].legal.notice;
}
}
}
// put the brand in there if needed
try{
if(jQuery('#mktoForm_15622').length){
legalNotice = legalNotice.indexOf('REPLACEME') > -1 ? legalNotice.replace('REPLACEME', productPreferences[product_selection]) : legalNotice;
}else{
legalNotice = legalNotice.indexOf('REPLACEME') > -1 ? legalNotice.replace('REPLACEME', brandText) : legalNotice;
//Added comment Pravin - legalNotice change as per Product Name Change
legalNotice = legalNotice.indexOf('DYMPRODUCT') > -1 ? legalNotice.replace('DYMPRODUCT', brandText) : legalNotice;
if(jQuery('#mktoForm_17133').length > 0){
legalNotice = formLocalizationStrings[lcid]["legalNotice"]["NoticeMSR"];
if(countrySelection == "CANADA"){
legalNotice = formLocalizationStrings[lcid]["legalNotice"]["NoticeMSRCannada"];
}
}
}
}catch (ex) {
// console.log("Exception in Block A :", ex);
}
for (notices in legalText) {
if (legalText.hasOwnProperty(notices)) {
legalText[notices].html(''+legalNotice+' ');
}
}
// Russia needs additional legal text
if (countrySelection === "RUSSIA" && jQuery('.russia-legal').length < 1) {
jQuery(formLocalizationStrings["default"].russiaNotice).insertBefore('.mktoButtonRow');
}
else if (countrySelection !== "RUSSIA" && jQuery('.russia-legal').length > 0) {
jQuery('.russia-legal').remove();
}
}
/**
* Translates all of the text on form elements like labels or placeholders
*
* @function swapLanguages
* @param {object} textContainers An object containing all of the DOM elements matched against the JSON
* @param {object} formLocalizationStrings JSON translations contained in a JavaScript variable
*/
function swapLanguages(textContainers, formLocalizationStrings) {
//Takes values from 'formLocalizationStrings' and injects them into corresponding 'textContainers'
//See JSON file for 'formLocalizationStrings' formatting requirements
var hostSpecificPlaceholder = "Organization name *";
//Loop through each major group of text translations - EG: form, body, header, footer, etc
for (var key in formLocalizationStrings[lcid]) {//EG: 'key' would be 'form'
var subkey;
//Removes internal form from localization loop that doesn't need translations
if (jQuery('#intranet-form').length !== 0) {
break;
}
if (formLocalizationStrings[lcid].hasOwnProperty(key) && textContainers.hasOwnProperty(key)) {
if (key === 'form' && noLabels === true) {
for (subkey in formLocalizationStrings[lcid][key]) {//EG: 'subkey' would be 'firstName'
if (formLocalizationStrings[lcid][key].hasOwnProperty(subkey) && textContainers[key].hasOwnProperty(subkey) && formLocalizationStrings[lcid][key][subkey] !== "") {
if (subkey === 'firstName' ||
subkey === 'lastName' ||
subkey === 'email' ||
subkey === 'companyName' ||
subkey === 'companySizeSelect' ||
subkey === 'schoolName' ||
subkey === 'phone' ||
subkey === 'jobRole' ||
subkey === 'Address' ||
subkey === 'City' ||
subkey === 'PostalCode' ||
subkey === 'schoolDistrictName' ||
subkey === 'topRiskAreaOfInterest') {
// replace input placeholder text with html translations and parse to plain text
if(subkey === 'companyName' && window.location.host === 'note.microsoft.com' && lcid === 'EN-US'){ //For specific hostURL and LCID set Placeholder
textContainers[key][subkey].attr('placeholder', hostSpecificPlaceholder);
}else if(jQuery('#mktoForm_15745, #mktoForm_15776, #mktoForm_16141, #mktoForm_16140').length > 0 && subkey === 'companyName'){
textContainers[key][subkey].attr('placeholder', textContainers[key][subkey].html(formLocalizationStrings[lcid][key]['Organizationname'] + " *").text());
}else if(jQuery('#mktoForm_15745, #mktoForm_15776, #mktoForm_16141, #mktoForm_16140').length > 0 && subkey === 'companySizeSelect'){
textContainers[key][subkey].text(textContainers[key][subkey].html(formLocalizationStrings[lcid][key]['Organizationsize'] + " *").text());
}
else{
textContainers[key][subkey].attr('placeholder', textContainers[key][subkey].html(formLocalizationStrings[lcid][key][subkey]+ " *").text());
}
}
else if (jQuery('#mktoForm_15316, #mktoForm_15317').length !== 1 && subkey === 'formComments' && textContainers.form.formComments.length) {
textContainers[key][subkey].attr('placeholder', textContainers[key][subkey].html(formLocalizationStrings[lcid][key][subkey]).text());
if (/Edge/.test(navigator.userAgent)) {
textContainers[key][subkey].html('');
}
}
else if(jQuery('#mktoForm_15316, #mktoForm_15317').length === 1 && subkey === 'formComments' && textContainers.form.formComments.length) {
textContainers[key][subkey].attr('placeholder', textContainers[key][subkey].html(formLocalizationStrings[lcid][key][subkey+1]).text());
if (/Edge/.test(navigator.userAgent)) {
textContainers[key][subkey].html('');
}
}
else {
textContainers[key][subkey].html(formLocalizationStrings[lcid][key][subkey]);
}
}
}
}
else {
for (subkey in formLocalizationStrings[lcid][key]) {//EG: 'subkey' would be 'firstName'
if (formLocalizationStrings[lcid][key].hasOwnProperty(subkey) && textContainers[key].hasOwnProperty(subkey) && formLocalizationStrings[lcid][key][subkey] !== "") {
// replace input label text with html translations and parse to plain text
if (subkey === 'firstName' ||
subkey === 'lastName' ||
subkey === 'email' ||
subkey === 'companyName' ||
subkey === 'schoolName' ||
subkey === 'phone' ||
subkey === 'country' ||
subkey === 'companySize' ||
subkey === 'jobRole' ||
subkey === 'topRiskAreaOfInterest') {
if(subkey === 'companyName' && window.location.host == 'note.microsoft.com' && lcid == 'En-US'){
textContainers[key][subkey].html('*
Organization name');
}else if(jQuery('#mktoForm_17133').length > 0 && subkey === 'companyName'){
textContainers[key][subkey].html('*
Organization name');
}else{
textContainers[key][subkey].html('*
' + formLocalizationStrings[lcid][key][subkey]);
}
}
else {
textContainers[key][subkey].html(formLocalizationStrings[lcid][key][subkey]);
}
}
}
}
}
}
}
//[Concierge] Marketo registration form of Webinar/Gated Content
function onWebgatedContent(){
if((jQuery('#mktoForm_10595, #mktoForm_18785').length > 0)){
jQuery('#FirstName').parents('.mktoFormRow').css({'position':'relative','top':jQuery('input#FirstName').parents('.mktoFormRow').outerHeight()});
jQuery('#LastName').parents('.mktoFormRow').css({'position':'relative','top':-(jQuery('input#LastName').parents('.mktoFormRow').outerHeight())});
jQuery('#LastName').attr('tabindex','1');
jQuery('#FirstName').attr('tabindex','2');
jQuery('#Email').attr('tabindex','3');
jQuery('#Company').attr('tabindex','4');
jQuery('#employeeRange').attr('tabindex','5');
jQuery('#Title').attr('tabindex','6');
jQuery('#Phone').attr('tabindex','7');
jQuery('#Country').attr('tabindex','8');
jQuery('button[type="submit"]').attr('tabindex','9');
}else if((jQuery('#mktoForm_13633').length > 0)){
jQuery('#FirstName').parents('.mktoFormRow').css({'position':'relative','top':jQuery('input#FirstName').parents('.mktoFormRow').outerHeight()});
jQuery('#LastName').parents('.mktoFormRow').css({'position':'relative','top':-(jQuery('input#LastName').parents('.mktoFormRow').outerHeight())});
jQuery('#LastName').attr('tabindex','1');
jQuery('#FirstName').attr('tabindex','2');
jQuery('#Email').attr('tabindex','3');
jQuery('#Phone').attr('tabindex','4');
jQuery('#Title').attr('tabindex','5');
jQuery('#Company').attr('tabindex','6');
jQuery('#Country').attr('tabindex','7');
jQuery('#employeeRange').attr('tabindex','8');
}else if((jQuery('#mktoForm_14282').length > 0)){
jQuery('#FirstName').parents('.mktoFormRow').css({'position':'relative','top':jQuery('input#FirstName').parents('.mktoFormRow').outerHeight()});
jQuery('#LastName').parents('.mktoFormRow').css({'position':'relative','top':-(jQuery('input#LastName').parents('.mktoFormRow').outerHeight())});
jQuery('#LastName').attr('tabindex','1');
jQuery('#FirstName').attr('tabindex','2');
jQuery('#Email').attr('tabindex','3');
jQuery('#Phone').attr('tabindex','4');
jQuery('#Company').attr('tabindex','5');
jQuery('#Title').attr('tabindex','6');
jQuery('#Country').attr('tabindex','7');
}else if((jQuery('#mktoForm_18567, #mktoForm_18590, #mktoForm_18591, #mktoForm_18592, #mktoForm_18613, #mktoForm_18614, #mktoForm_18615, #mktoForm_18769').length > 0)){
jQuery('#FirstName').parents('.mktoFormRow').css({'position':'relative','top':jQuery('input#FirstName').parents('.mktoFormRow').outerHeight()});
jQuery('#LastName').parents('.mktoFormRow').css({'position':'relative','top':-(jQuery('input#LastName').parents('.mktoFormRow').outerHeight())});
jQuery('#LastName').attr('tabindex','1');
jQuery('#FirstName').attr('tabindex','2');
jQuery('#Email').attr('tabindex','3');
jQuery('#Phone').attr('tabindex','4');
jQuery('#Company').attr('tabindex','5');
jQuery('#Title').attr('tabindex','6');
jQuery('#Country').attr('tabindex','7');
}else if((jQuery('#mktoForm_15866').length > 0)){
jQuery('#FirstName').parents('.mktoFormRow').css({'position':'relative','top':jQuery('input#FirstName').parents('.mktoFormRow').outerHeight()});
jQuery('#LastName').parents('.mktoFormRow').css({'position':'relative','top':-(jQuery('input#LastName').parents('.mktoFormRow').outerHeight())});
jQuery('#LastName').attr('tabindex','1');
jQuery('#FirstName').attr('tabindex','2');
jQuery('#Email').attr('tabindex','3');
jQuery('#Company').attr('tabindex','4');
jQuery('#Country').attr('tabindex','5');
jQuery('#Title').attr('tabindex','6');
}
}
function getConsentSelection(){
var countrySelection = jQuery('#Country option:selected').val().toUpperCase();
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
var consent;
var pref2marketo = '';
var pref2marketo_val = '';
var msWideEmail = '00000000-0000-0000-0000-000000000001';
var msWidePhone = '00000000-0000-0000-0000-MicrosoftPH1';
var partnerEmail = '00000000-0000-0000-0000-000000000003';
var partnerPhone = '00000000-0000-0000-0000-00PartnerPH3';
for (var key in legalReqs){
if (legalReqs.hasOwnProperty(key)) {
consent= legalReqs[key].indexOf(countrySelection) > -1 ? key : '';
if(consent !=''){
break;
}
}
}
//Universal Partner form
if(jQuery('#mktoForm_17049').length > 0){
if(legalReqs['textMicrosoft'].indexOf(countrySelection) > -1){
consent = 'optOut';
}
}
//270706 Dynamics BC Partner Contact Me
if(jQuery('#mktoForm_16416').length > 0){
jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').prop('checked',true);
}
if(consent === 'textMicrosoft'){
if(jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').length > 0){
if(jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked')){
pref2marketo = topicId + '=OptInImplicit; ' + msWideEmail + '=OptInImplicit; ' + msWidePhone + '=OptInImplicit; ' + partnerEmail + '=OptInExplicit; ' + partnerPhone + '=OptInExplicit;';
}else{
pref2marketo = topicId + '=OptInImplicit; ' + msWideEmail + '=OptInImplicit; ' + msWidePhone + '=OptInImplicit; ' + partnerEmail + '=Unknown; ' + partnerPhone + '=Unknown;';
}
}else{
pref2marketo = topicId + '=OptInImplicit; ' + msWideEmail + '=OptInImplicit; ' + msWidePhone + '=OptInImplicit;';
}
}else if(consent === 'optIn'){
if(jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').length > 0){
if(jQuery('input[name=SystemContactPreferenceMirrorOptIn]').prop('checked') === true && jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked') === false){
pref2marketo = topicId + '=OptInExplicit; ' + msWideEmail + '=OptInExplicit; ' + msWidePhone + '=OptInExplicit; ' + partnerEmail + '=Unknown; ' + partnerPhone + '=Unknown;';
}else if(jQuery('input[name=SystemContactPreferenceMirrorOptIn]').prop('checked') === false && jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked') === true){
pref2marketo = topicId + '=Unknown; ' + msWideEmail + '=Unknown; ' + msWidePhone + '=Unknown; ' + partnerEmail + '=OptInExplicit; ' + partnerPhone + '=OptInExplicit; ';
}else if(jQuery('input[name=SystemContactPreferenceMirrorOptIn]').prop('checked') === true && jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked') === true){
pref2marketo = topicId + '=OptInExplicit; ' + msWideEmail + '=OptInExplicit; ' + msWidePhone + '=OptInExplicit; ' + partnerEmail + '=OptInExplicit; ' + partnerPhone + '=OptInExplicit;';
}else if(jQuery('input[name=SystemContactPreferenceMirrorOptIn]').prop('checked') === false && jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked') === false){
pref2marketo = topicId + '=Unknown; ' + msWideEmail + '=Unknown; ' + msWidePhone + '=Unknown; ' + partnerEmail + '=Unknown; ' + partnerPhone + '=Unknown;';
}
}else{
if(jQuery('input[name=SystemContactPreferenceMirrorOptIn]').prop('checked')){
pref2marketo = topicId + '=OptInExplicit; ' + msWideEmail + '=OptInExplicit; ' + msWidePhone + '=OptInExplicit;';
}else{
pref2marketo = topicId + '=Unknown; ' + msWideEmail + '=Unknown; ' + msWidePhone + '=Unknown;';
}
}
}else if(consent === 'optOut'){
if(jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').length > 0){
if(jQuery('input[name=SystemContactPreferenceMirrorOptOut]').prop('checked') === true && jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked') === false){
pref2marketo = topicId + '=OptInExplicit; ' + msWideEmail + '=OptInExplicit; ' + msWidePhone + '=OptInExplicit; ' + partnerEmail + '=Unknown; ' + partnerPhone + '=Unknown;';
}else if(jQuery('input[name=SystemContactPreferenceMirrorOptOut]').prop('checked') === false && jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked') === true){
pref2marketo = topicId + '=Unknown; ' + msWideEmail + '=Unknown; ' + msWidePhone + '=Unknown; ' + partnerEmail + '=OptInExplicit; ' + partnerPhone + '=OptInExplicit;';
}else if(jQuery('input[name=SystemContactPreferenceMirrorOptOut]').prop('checked') === true && jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked') === true){
pref2marketo = topicId + '=OptInExplicit; ' + msWideEmail + '=OptInExplicit; ' + msWidePhone + '=OptInExplicit; ' + partnerEmail + '=OptInExplicit; ' + partnerPhone + '=OptInExplicit;';
}else if(jQuery('input[name=SystemContactPreferenceMirrorOptOut]').prop('checked') === false && jQuery('input[name=systemPartnerPreferenceMirrorOptIn]').prop('checked') === false){
pref2marketo = topicId + '=Unknown; ' + msWideEmail + '=Unknown; ' + msWidePhone + '=Unknown; ' + partnerEmail + '=Unknown; ' + partnerPhone + '=Unknown;';
}
}else{
if(jQuery('input[name=SystemContactPreferenceMirrorOptOut]').prop('checked')){
pref2marketo = topicId + '=OptInExplicit; ' + msWideEmail + '=OptInExplicit; ' + msWidePhone + '=OptInExplicit;';
}else{
pref2marketo = topicId + '=Unknown; ' + msWideEmail + '=Unknown; ' + msWidePhone + '=Unknown;';
}
}
}
//When product is MSFT removed topicid from pref2marketo
if(topicId == "00000000-0000-0000-0000-000000000001"){
var msftconsent = pref2marketo.split('; ');
pref2marketo_val = pref2marketo.replace (msftconsent[0]+'; ',"");
}
else{
pref2marketo_val = pref2marketo;
}
//MSR forms
if(jQuery('#mktoForm_17133').length > 0){
if(consent === 'textMicrosoft'){
pref2marketo_val = topicId + '=OptInImplicit;';
}else if(consent === 'optIn'){
if(jQuery('input[name=SystemContactPreferenceMirrorOptIn]').prop('checked')){
pref2marketo_val = topicId + '=OptInExplicit;';
}else{
pref2marketo_val = topicId + '=Unknown;';
}
}else if(consent === 'optOut'){
if(jQuery('input[name=SystemContactPreferenceMirrorOptOut]').prop('checked')){
pref2marketo_val = topicId + '=OptInExplicit;';
}else{
pref2marketo_val = topicId + '=Unknown;'
}
}
}
//GPS & BPGI Form
if(jQuery('#mktoForm_18357, #mktoForm_18566, #mktoForm_18616').length > 0){
if(consent === 'textMicrosoft'){
pref2marketo_val = topicId + '=OptInImplicit; ' + msWideEmail + '=OptInImplicit; ' + msWidePhone + '=OptInImplicit;';
}else if(consent === 'optIn'){
if(jQuery('input[name=SystemContactPreferenceMirrorOptIn]').prop('checked')){
pref2marketo_val = topicId + '=OptInExplicit;'+ msWideEmail + '=OptInExplicit; ' + msWidePhone + '=OptInExplicit;';
}else{
pref2marketo_val = topicId + '=Unknown;' + msWideEmail + '=Unknown; ' + msWidePhone + '=Unknown;';
}
}else if(consent === 'optOut'){
if(jQuery('input[name=SystemContactPreferenceMirrorOptOut]').prop('checked')){
pref2marketo_val = topicId + '=OptInExplicit;' + msWideEmail + '=OptInExplicit; ' + msWidePhone + '=OptInExplicit;';
}else{
pref2marketo_val = topicId + '=Unknown;'+ msWideEmail + '=Unknown; ' + msWidePhone + '=Unknown;'
}
}
}
jQuery('input[name=pref2Marketo]').val(pref2marketo_val);
if(jQuery('#mktoForm_18764').length > 0){
var pref2mar = jQuery('input[name=pref2Marketo]').val();
if(pref2mar.indexOf('00000000-0000-0000-0000-MicrosoftPH1=OptInImplicit') > -1)
{
pref2mar = pref2mar.replace('00000000-0000-0000-0000-MicrosoftPH1=OptInImplicit;','');
}else if(pref2mar.indexOf('00000000-0000-0000-0000-MicrosoftPH1=Unknown') > -1)
{
pref2mar = pref2mar.replace('00000000-0000-0000-0000-MicrosoftPH1=Unknown;','');
}else if(pref2mar.indexOf('00000000-0000-0000-0000-MicrosoftPH1=OptInExplicit') > -1){
pref2mar = pref2mar.replace('00000000-0000-0000-0000-MicrosoftPH1=OptInExplicit;','');
}
jQuery('input[name=pref2Marketo]').val(pref2mar);
}
}
// 100270 : Update Countries list on Edu contact me form
function educountry(){
let formFields = jQuery('#FirstName, #LastName, #Phone, #Company, #Email, #Title, #numberofStudentsinSchool, #comments');
jQuery.each(formFields, function( key, value ) {
jQuery(value).parents('.mktoFormRow').hide();
});
jQuery(".mktoButton").attr("disabled", "disabled");
}
//Improve phone field to capture ISD and area codes
function buildcountryCode(optionValue, optionText) {
let name = optionValue;
if(name != 'Russia'){
if(formLocalizationStrings[lcid].countryControl){
name = formLocalizationStrings[lcid].countryControl[optionValue];
}
var option = '' + name + ' ('+optionText+') ' + ' ';
jQuery("#countryCodeList").append(option);
}
RemoveCountry();
}
//M365 Contact Me form
function getCustomCountryList(arr){
var m_lcid = Parameters.getLCID().toUpperCase();
var jsonlist, jsonlist2,jsonsize = '';
var country = jQuery('#Country');
var countryReplacements1 = [];
if(m_lcid.indexOf('EN') > -1){
jsonlist = formLocalizationStrings['default']['countryControl'];
countryReplacements1 = 'Country... * ';
}else{
jsonlist = formLocalizationStrings[m_lcid]['formSelectCountry'];
countryReplacements1 = '' + jsonlist['Country... *'] +' ';
}
jsonlist2 = formLocalizationStrings[m_lcid]['countryList']['Microsoft Azure'];
for(var i=0; i' + jsonlist[arr[i]] +'';
}else{
countryReplacements1 += '' + jsonlist2[arr[i]] +' ';
}
}else{
countryReplacements1 += '' + jsonlist2[arr[i]] +' ';
}
}
country.html(countryReplacements1);
RemoveCountry();
}
// Convert webinar time to sytem timezone
function getWebinarTime(){
var webinarDate = jQuery('.webinarDate').text();
var webinarStartTime = jQuery('.webinarStartTime').text();
var webinarEndTime = jQuery('.webinarEndTime').text();
var webinarTimeZone = jQuery('.webinarTimeZone').text();
var monthArr = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var webinarStartDate = webinarDate + ' ' + webinarStartTime + ' ' + webinarTimeZone;
var startDate, webinarEndDate, endDate, currentDate, currentTime, currentDateTime, presentDate, hours1, AmOrPm1, minutes1, hours2, minutes2, displayTimeZone, strTime, strToReplace, displayDate;
startDate = new Date(webinarStartDate);
hours1 = startDate.getHours();
AmOrPm1 = hours1 >= 12 ? 'PM' : 'AM';
hours1 = (hours1 % 12) || 12;
minutes1 = startDate.getMinutes();
minutes1 = minutes1 < 10 ? "0" + minutes1 : minutes1;
webinarEndDate = webinarDate + ' ' + webinarEndTime + ' ' + webinarTimeZone;
endDate = new Date(webinarEndDate);
hours2 = endDate.getHours();
AmOrPm2 = hours2 >= 12 ? 'PM' : 'AM';
hours2 = (hours2 % 12) || 12;
minutes2 = endDate.getMinutes();
minutes2 = minutes2 < 10 ? "0" + minutes2 : minutes2;
displayTimeZone = startDate.toString().match(/\(([^)]+)\)/)[1];
strTime = hours1 + ':' + minutes1 + ' ' + AmOrPm1 + ' - ' + hours2 + ':' + minutes2 + ' ' + AmOrPm2 + ' (' + displayTimeZone + ')';
displayDate = monthArr[startDate.getMonth()] + ' ' + startDate.getDate() + ', ' + startDate.getFullYear() + ' ' + strTime;
jQuery('#webinarDateReg').text(displayDate);
}
// PBI Handraiser methods
function getCompanySizeRange(){
var companySizeRange;
var companySize = jQuery('#NumberOfEmployees').val();
var sizeRange = dynamicForms[product_name]['companySizeRange'];
if(companySize != ''){
for(var range in sizeRange){
if(sizeRange[range].indexOf(companySize) > -1){
companySizeRange = range;
}
}
}
return companySizeRange;
}
function channelFormLogic(){
var country = jQuery('#Country').val();
var product_name;
if(jQuery('#mktoForm_18601,#mktoForm_18609').length<1){
product_name = jQuery('#CountrySelector').text();
}else{
product_name = jQuery('#ce_productinterestlatest option:selected').text();
}
var companySize = jQuery('#NumberOfEmployees').val();
var powerproduct = ['powerbi','power bi','power apps','powerapps','power virtual agent','power pages','power automate', 'powerautomate','microsoft copilot studio', 'power virtual agents', 'powervirtualagent', 'virtual agent', 'virtualagent'];
var supportedList = product_countryList[product_name];
// if(jQuery('#mktoForm_17132').length > 0){
// var supportedList = formLocalizationStrings['default'].countryList[product_name];
// }else{
// var supportedList = formLocalizationStrings[lcid].countryList[product_name];
// }
var LATAM = ["Argentina", "Belize", "Bolivia", "Chile", "Colombia", "Costa Rica", "Dominican Republic", "Ecuador", "El Salvador", "Guatemala", "Honduras", "Mexico", "Nicaragua", "Panama", "Paraguay", "Peru", "Puerto Rico", "Uruguay", "Venezuela"];
var fieldObjects, companySizeRange, countryObj, range;
var flag = false;
var optInDiv = jQuery('input[name="SystemContactPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var optOutDiv = jQuery('input[name="SystemContactPreferenceMirrorOptOut"]').parents('.mktoFormRow').hide();
var partnerDiv = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var partnerInput = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]');
if(legalReqs['textMicrosoft'].indexOf(country.toUpperCase()) != -1){
optInDiv.hide();
optOutDiv.hide();
}else if(legalReqs['optIn'].indexOf(country.toUpperCase()) != -1){
optInDiv.show();
optOutDiv.hide();
}else if(legalReqs['optOut'].indexOf(country.toUpperCase()) != -1){
optInDiv.hide();
optOutDiv.show();
}
partnerInput.prop('checked',false);
partnerDiv.hide();
jQuery('.mktoButton').html(buttontxt);
if(powerproduct.indexOf(product_name.toLowerCase()) < 0 ){
var routing = dynamicForms[product_name]['routing'];
if(country != '' && companySize != ''){
jQuery('.channel_consent').parents('.mktoFormRow').show();
jQuery(".mktoButton").removeAttr("disabled");
companySizeRange = getCompanySizeRange();
fieldObjects = jQuery('#FirstName, #LastName, #Email, #Company, #Title, #Phone, #comments');
if(supportedList.indexOf(country) >= 0){
if(LATAM.indexOf(country) != -1){
country = 'LATAM';
}
for(countryObj in routing){
if(countryObj == country){
flag = true;
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').show();
});
for(range in routing[country]){
if(range == companySizeRange){
if(routing[country][range] == 'Store' && product_name !== "Windows 365"){
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['Store']);
}else if(routing[country][range] == 'PartnerCenter' && product_name !== "Windows 365"){
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['PartnerCenter']);
partnerInput.prop('checked',true);
partnerInput.parent().hide();
jQuery('#LblsystemPartnerPreferenceMirrorOptIn .consentLabel').css('margin-left','0px');
}else if(routing[country][range] == 'InsideSales' && product_name !== "Windows 365"){
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['InsideSales']);
}else if(routing[country][range] == 'SelfService'){
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['SelfService']);
optInDiv.hide();
optOutDiv.hide();
jQuery('.mktoButton').html(formLocalizationStrings[lcid]['SelfServiceCTA']);
}else if(product_name == "Windows 365" && routing[country][range] !== 'SelfService'){
jQuery('.channel_consent').parents('.mktoFormRow').hide();
}
}
}
}
}
if(!flag){
for(range in routing['Other']){
if(range == companySizeRange){
if(routing['Other'][range] == 'Store'){
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').show();
});
if(product_name !== "Windows 365"){
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['Store']);
}else{
jQuery('.channel_consent').parents('.mktoFormRow').hide();
}
}else if(routing['Other'][range] == 'PartnerCenter'){
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').show();
});
if(product_name !== "Windows 365"){
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['PartnerCenter']);
}else{
jQuery('.channel_consent').parents('.mktoFormRow').hide();
}
//partnerDiv.show();
partnerInput.prop('checked',true);
partnerInput.parent().hide();
jQuery('#LblsystemPartnerPreferenceMirrorOptIn .consentLabel').css('margin-left','0px');
}else if(routing['Other'][range] == 'InsideSales'){
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').show();
});
if(product_name !== "Windows 365"){
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['InsideSales']);
}else{
jQuery('.channel_consent').parents('.mktoFormRow').hide();
}
}else if(routing['Other'][range] == 'SelfService'){
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').hide();
});
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['SelfService']);
optInDiv.hide();
optOutDiv.hide();
jQuery('.mktoButton').html(formLocalizationStrings[lcid]['SelfServiceCTA']);
}
}
}
}
}else{
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').hide();
});
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['channels_consent'][product_name]['SelfService']);
optInDiv.hide();
optOutDiv.hide();
jQuery('.mktoButton').html(formLocalizationStrings[lcid]['SelfServiceCTA']);
}
}else{
jQuery(".mktoButton").attr("disabled", "disabled");
jQuery('.channel_consent').parents('.mktoFormRow').hide();
}
jQuery( "p.channel_consent" ).parents('.mktoFormRow').insertBefore(jQuery('button.mktoButton').parents('.mktoButtonRow'));
}else{
if(country != '' && companySize != ''){
jQuery(".mktoButton").removeAttr("disabled");
fieldObjects = jQuery('#FirstName, #LastName, #Email, #Company, #Title, #Phone, #comments');
flag = true;
if(powerproducts['DR'].indexOf(country) >= 0){
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').show();
jQuery('button[type="submit"]').text(buttontxt);
});
}else{
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').hide();
jQuery('button[type="submit"]').text('Next');
});
}
}
}
}
function channelRouting(){
var cl = clcid[lcid];
var country = jQuery('#Country').val();
var companySize = jQuery('#NumberOfEmployees').val();
var product_name;
if(jQuery('#mktoForm_18601,#mktoForm_18609').length<1){
product_name = jQuery('#CountrySelector').text();
}else{
product_name = jQuery('#ce_productinterestlatest option:selected').text();
}
var powerproduct = ['powerbi','power bi','power apps','powerapps','power virtual agent','power pages','power automate', 'powerautomate','microsoft copilot studio', 'power virtual agent', 'power virtual agents', 'powervirtualagent', 'virtual agent', 'virtualagent'];
var supportedList = product_countryList[product_name];
// if(jQuery('#mktoForm_17132').length > 0){
// var supportedList = formLocalizationStrings['default'].countryList[product_name];
// }else{
// var supportedList = formLocalizationStrings[lcid].countryList[product_name];
// }
if(powerproduct.indexOf(product_name.toLowerCase()) < 0 ){
var routing = dynamicForms[product_name]['routing'];
if( product_name !== "Windows 365"){
var thankYouInsideSales = jQuery('#ThankYouInsideSales').text() + '?lcid=' + lcid;
var thankYouPartner = jQuery('#ThankYouPartner').text() + '?lcid=' + lcid;
var thankYouStore = jQuery('#ThankYouStore').text() + '?lcid=' + lcid;
var thankYouSelfServe = jQuery('#ThankYouSelfServe').text() + '?lcid=' + lcid;
}else{
var thankYouInsideSales = jQuery('#formAction').text() + '&CLCID=' + cl;
var thankYouPartner = jQuery('#formAction').text() + '&CLCID=' + cl;
var thankYouStore = jQuery('#formAction').text() + '&CLCID=' + cl;
var thankYouSelfServe = jQuery('#ThankYouSelfServe').text() + '&CLCID=' + cl;
}
var thankyouUrl, companySizeRange, countryObj, range;
var flag = false;
if(country != '' && companySize != ''){
companySizeRange = getCompanySizeRange();
if(!(supportedList.indexOf(country)>=0)){
window.location.href = thankYouSelfServe;
}else{
for(countryObj in routing){
if(countryObj == country){
flag = true;
for(range in routing[country]){
if(range == companySizeRange){
if(routing[country][range] == 'Store'){
thankyouUrl = thankYouStore;
}else if(routing[country][range] == 'PartnerCenter'){
thankyouUrl = thankYouPartner;
}else if(routing[country][range] == 'InsideSales'){
thankyouUrl = thankYouInsideSales;
}else if(routing[country][range] == 'SelfService'){
thankyouUrl = thankYouSelfServe;
}
}
}
}
}
if(!flag){
for(range in routing['Other']){
if(range == companySizeRange){
if(routing['Other'][range] == 'Store'){
thankyouUrl = thankYouStore;
}else if(routing['Other'][range] == 'PartnerCenter'){
thankyouUrl = thankYouPartner;
}else if(routing['Other'][range] == 'InsideSales'){
thankyouUrl = thankYouInsideSales;
}else if(routing['Other'][range] == 'SelfService'){
thankyouUrl = thankYouSelfServe;
}
}
}
}
if(thankyouUrl == thankYouSelfServe){
window.location.href = thankYouSelfServe;
}else{
jQuery('#formAction').html(thankyouUrl);
jQuery('#formRedirect').html(thankyouUrl);
}
}
}
}else{
if(country != '' && companySize != ''){
var thankYouInsideSales = jQuery('#ThankYouInsideSales').text() + '?lcid=' + lcid;
var thankYouSelfServe = jQuery('#ThankYouSelfServe').text() + '?lcid=' + lcid;
if(powerproducts['DR'].indexOf(country) < 0){
const thankYouSelfServe = jQuery('#ThankYouSelfServe').text() + '?lcid=' + lcid;
window.location.href = thankYouSelfServe;
}else{
thankyouUrl = jQuery('#ThankYouInsideSales').text() + '?lcid=' + lcid;
jQuery('#formAction').html(thankyouUrl);
jQuery('#formRedirect').html(thankyouUrl);
}
}
}
}
function processRoutingRule(){
var country = jQuery('#Country').val();
var product_name = jQuery('#CountrySelector').text().toLowerCase();
var thankYouSelfServe = jQuery('#ThankYouSelfServe').text();
var companySize = jQuery('#NumberOfEmployees').val();
if((product_name == 'microsoft viva' || product_name == 'microsoft teams' || product_name == 'm365' || product_name == 'm365 frontline workers') && (companySize !='')){
product_name = product_name.toLowerCase();
let hasProduct = product_countryList[product_name].filter(x => x == country)
if(hasProduct.length == 0){
window.location.href = thankYouSelfServe;
}
}
}
function supportedMWCountry(){
var country = jQuery('#Country').val();
fieldObjects = jQuery('#FirstName, #LastName, #Email, #Company, #Title, #Phone, #comments');
var product_name = jQuery('#CountrySelector').text().toLowerCase();
var companySize = jQuery('#NumberOfEmployees').val();
var optInDiv = jQuery('input[name="SystemContactPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var optOutDiv = jQuery('input[name="SystemContactPreferenceMirrorOptOut"]').parents('.mktoFormRow').hide();
var partnerDiv = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var partnerInput = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]');
jQuery('.textMicrosoft').parents('.mktoFormRow').show();
partnerInput.parents('.mktoFormRow').hide();
if(partnerForms.indexOf('#mktoForm_17132') >= 0){
if(country != 'Korea'){
partnerDiv.show();
}
}else{
partnerDiv.hide();
}
if(jQuery('.channel_consent').is(':visible') == true && jQuery('.channel_consent').text() == formLocalizationStrings[lcid]['globalSelfServeConsent']){
partnerDiv.hide();
optInDiv.hide();
optOutDiv.hide();
jQuery('.textMicrosoft').parents('.mktoFormRow').hide();
}
if((product_name == 'microsoft viva' || product_name == 'microsoft teams' || product_name == 'm365' || product_name == 'm365 frontline workers') && (companySize !='')){
let hasProduct = product_countryList[product_name].filter(x => x == country)
if(hasProduct.length > 0){
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').show();
});
if(legalReqs['textMicrosoft'].indexOf(country.toUpperCase()) != -1){
optInDiv.hide();
optOutDiv.hide();
jQuery('.textMicrosoft').parents('.mktoFormRow').show();
}else if(legalReqs['optIn'].indexOf(country.toUpperCase()) != -1){
optInDiv.show();
optOutDiv.hide();
}else if(legalReqs['optOut'].indexOf(country.toUpperCase()) != -1){
optInDiv.hide();
optOutDiv.show();
}
jQuery('.channel_consent').parents('.mktoFormRow').hide();
jQuery('.mktoButton').html(buttontxt);
}else{
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').hide();
});
jQuery('.textMicrosoft').parents('.mktoFormRow').hide();
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['globalSelfServeConsent']);
jQuery('.channel_consent').parents('.mktoFormRow').show();
optInDiv.hide();
optOutDiv.hide();
partnerDiv.hide();
jQuery('.mktoButton').html(formLocalizationStrings[lcid]['SelfServiceCTA']);
}
}
if(country != '' && companySize != ''){
jQuery(".mktoButton").removeAttr("disabled");
}
}
// Teams Webinar
function teamsWebinar(){
var webinarSDate = jQuery('#webinarStartDate').text();
var webinarEDate = jQuery('#webinarEndDate').text();
var webinarStartTime = jQuery('#webinarStartTime').text();
var webinarEndTime = jQuery('#webinarEndTime').text();
var webinarTimeZone = jQuery('#webinarTimeZone').text();
var monthArr = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var webinarStartDate = webinarSDate + ' ' + webinarStartTime + ' ' + webinarTimeZone;
var webinarEndDate = webinarEDate + ' ' + webinarEndTime + ' ' + webinarTimeZone;
var webinarSingleEndDate = webinarSDate + ' ' + webinarEndTime + ' ' + webinarTimeZone;
var startDate, endDate, currentDate, currentTime, currentDateTime, presentDate, hours1, AmOrPm1, minutes1, hours2, minutes2, displayTimeZone, strTime, strToReplace, displayDate, displayEndDate;
var initialRefresh, timeOut;
var duration = getDuration(webinarStartDate, webinarEndDate, webinarSingleEndDate);
startDate = new Date(webinarStartDate);
hours1 = startDate.getHours();
AmOrPm1 = hours1 >= 12 ? 'PM' : 'AM';
hours1 = (hours1 % 12) || 12;
minutes1 = startDate.getMinutes();
minutes1 = minutes1 < 10 ? "0" + minutes1 : minutes1;
startDate.setMinutes(startDate.getMinutes() - 15);
endDate = new Date(webinarStartDate); // Assign start date & add duration to get end date
endDate.setMinutes(endDate.getMinutes() + duration);
hours2 = endDate.getHours();
AmOrPm2 = hours2 >= 12 ? 'PM' : 'AM';
hours2 = (hours2 % 12) || 12;
minutes2 = endDate.getMinutes();
minutes2 = minutes2 < 10 ? "0" + minutes2 : minutes2;
displayTimeZone = startDate.toString().match(/\(([^)]+)\)/)[1];
strTime = hours1 + ':' + minutes1 + ' ' + AmOrPm1 + ' - ' + hours2 + ':' + minutes2 + ' ' + AmOrPm2 + ' (' + displayTimeZone + ')';
displayDate = monthArr[startDate.getMonth()] + ' ' + startDate.getDate() + ', ' + startDate.getFullYear();
displayEndDate = new Date(webinarEndDate);
if(displayEndDate instanceof Date && !isNaN(displayEndDate)){
displayDate += ' ' + hours1 + ':' + minutes1 + ' ' + AmOrPm1;
displayDate += ' - ' + monthArr[displayEndDate.getMonth()] + ' ' + displayEndDate.getDate() + ', ' + displayEndDate.getFullYear();
displayDate += ' ' + hours2 + ':' + minutes2 + ' ' + AmOrPm2 + ' (' + displayTimeZone + ')';
}else{
displayDate += ' ' + strTime;
}
jQuery('.webinarDateTime').text(displayDate);
currentDate = jQuery('#serverDate').text();
currentTime = jQuery('#serverTime').text();
currentDateTime = currentDate + ' ' + currentTime;
strToReplace = '(' + currentDateTime.toString().match(/\(([^)]+)\)/)[1] + ')';
currentDateTime = currentDateTime.replace(strToReplace,webinarTimeZone);
presentDate = new Date(currentDateTime);
initialRefresh = startDate.getTime() - presentDate.getTime();
if(initialRefresh > 0 && initialRefresh < 86400000){
setTimeout(function(){ location.reload(); }, initialRefresh);
}
timeOut = (endDate.getTime() + 60000) - presentDate.getTime();
if(timeOut > 0 && timeOut < 86400000){
setTimeout(function(){ location.reload(); }, timeOut);
}
if (presentDate.getTime() >= startDate.getTime() && presentDate.getTime() <= endDate.getTime()){
jQuery('#ThankyouFormArea').show();
jQuery('.waitText').hide();
jQuery('.endText').hide();
}else if(presentDate.getTime() < startDate.getTime()){
jQuery('#ThankyouFormArea').hide();
jQuery('.waitText').show();
jQuery('.endText').hide();
}else if(presentDate.getTime() > endDate.getTime()){
jQuery('#ThankyouFormArea').hide();
jQuery('.waitText').hide();
jQuery('.endText').show();
}
}
function getDuration(startDate, endDate, singleEndDate){
var duration, sdate, newEDate, edate;
sdate = new Date(startDate);
singleEdate = new Date(singleEndDate);
newEDate = new Date(endDate);
if(newEDate instanceof Date && !isNaN(newEDate)){
edate = newEDate;
}else{
edate = singleEdate;
}
duration = (edate.getTime() - sdate.getTime())/60000;
return duration;
}
function teamsRedirect(){
var redirectUrl = jQuery('#noHero-Button a').attr('href');
window.open(redirectUrl, '_blank');
}
//Dynamic Product
function productFormLogic(){
var country = jQuery('#Country').val();
var product_name = jQuery('#ce_productinterestlatest').val().replace("-DR","");;
var companySize = jQuery('#NumberOfEmployees').val();
var fieldObjects, companySizeRange, countryObj, range;
var flag = false;
var optInDiv = jQuery('input[name="SystemContactPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var optOutDiv = jQuery('input[name="SystemContactPreferenceMirrorOptOut"]').parents('.mktoFormRow').hide();
var partnerDiv = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var partnerInput = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]');
jQuery('#ThankYouInsideSales').parents('.mktoFormRow').hide();
//all not required fields hide()
jQuery('.channel_consent').parents('.mktoFormRow').hide();
fieldObjects = jQuery('#FirstName, #LastName, #Email, #Company, #Title, #Phone, #comments');
if(legalReqs['textMicrosoft'].indexOf(country.toUpperCase()) != -1){
optInDiv.hide();
optOutDiv.hide();
}else if(legalReqs['optIn'].indexOf(country.toUpperCase()) != -1){
optInDiv.show();
optOutDiv.hide();
}else if(legalReqs['optOut'].indexOf(country.toUpperCase()) != -1){
optInDiv.hide();
optOutDiv.show();
}
partnerInput.prop('checked',false);
partnerDiv.hide();
if(country != '' && companySize != '' && product_name !=''){
// for(let data in Dynamic_product[product_name]){
jQuery('.channel_consent').parents('.mktoFormRow').show();
jQuery('.textMicrosoft').parents('.mktoFormRow').show();
jQuery(".mktoButton").removeAttr("disabled");
let matchingItem = Dynamic_product[product_name]['DR'].filter(x => x == country);
if(matchingItem.length > 0){
flag = true;
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').show();
});
jQuery('.channel_consent').parents('.mktoFormRow').hide();
jQuery('button[type="submit"]').text(buttontxt);
}else{
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').hide();
});
jQuery('.textMicrosoft').parents('.mktoFormRow').hide();
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['globalSelfServeConsent']);
optInDiv.hide();
optOutDiv.hide();
jQuery('button[type="submit"]').text(formLocalizationStrings[lcid]['SelfServiceCTA']);
}
// }
}
}
function productRouting(){
var lcid = Parameters.getLCID();
var country = jQuery('#Country').val();
var product_name = jQuery('#ce_productinterestlatest').val().replace("-DR","");;
var companySize = jQuery('#NumberOfEmployees').val();
var thankYouInsideSales = jQuery('#ThankYouInsideSales').text() + '?lcid=' + lcid;
var thankYouSelfServe = jQuery('#ThankYouSelfServe').text() + '?lcid=' + lcid;
var thankyouUrl;
fieldObjects = jQuery('#FirstName, #LastName, #Email, #Company, #Title, #Phone, #comments');
if(country != '' && companySize != '' && product_name !=''){
thankyouUrl = thankYouSelfServe;
let matchingItem = Dynamic_product[product_name]['DR'].filter(x => x == country);
if(matchingItem.length > 0){
thankyouUrl = thankYouInsideSales;
var prodcutval = jQuery('#ce_productinterestlatest option:selected').val().replace("-DR","") + '-DR';
jQuery('#ce_productinterestlatest option:selected').val(prodcutval);
if(product_name == 'Business Central'){
jQuery('input[name="ce_crm2marketo"]').val('370754');
}else if(product_name == 'Commerce'){
jQuery('input[name="ce_crm2marketo"]').val('370758');
}else if(product_name == 'Customer Service'){
jQuery('input[name="ce_crm2marketo"]').val('370759');
}else if(product_name == 'Field Service'){
jQuery('input[name="ce_crm2marketo"]').val('370760');
}else if(product_name == 'Finance'){
jQuery('input[name="ce_crm2marketo"]').val('370761');
}else if(product_name == 'Fraud Protection'){
jQuery('input[name="ce_crm2marketo"]').val('370762');
}else if(product_name == 'Human Resources'){
jQuery('input[name="ce_crm2marketo"]').val('370763');
}else if(product_name == 'Intelligent Order Management'){
jQuery('input[name="ce_crm2marketo"]').val('370764');
}else if(product_name == 'Marketing'){
jQuery('input[name="ce_crm2marketo"]').val('370765');
}else if(product_name == 'Project Operations'){
jQuery('input[name="ce_crm2marketo"]').val('370766');
}else if(product_name == 'Supply Chain Management'){
jQuery('input[name="ce_crm2marketo"]').val('370770');
}
else if(product_name == 'Customer Insights'){
jQuery('input[name="ce_crm2marketo"]').val('370756');
}else if(product_name == 'Sales'){
jQuery('input[name="ce_crm2marketo"]').val('370767');
}
}else{
thankyouUrl = thankYouSelfServe;
}
if(thankyouUrl == thankYouSelfServe){
window.location.href = thankYouSelfServe;
}else{
jQuery('#formAction').html(thankyouUrl);
jQuery('#formRedirect').html(thankyouUrl);
}
}
}
/* -------------------------------- click, blur, onchange events ---------------- */
// Single commercial topic
jQuery(document).on('change','input[name="SystemContactPreferenceMirrorOptIn"], input[name="SystemContactPreferenceMirrorOptOut"], input[name="systemPartnerPreferenceMirrorOptIn"]', function(){
getConsentSelection();
});
jQuery('#ce_industryname').on('change',function(){
//Select.getSelectOptions("DTJobrole", "form select[name='Title'] option");
textContainers.form.phone = jQuery('#Phone');
swapLanguages(textContainers, formLocalizationStrings);
jQuery('#comments').text('')
});
if(jQuery('#mktoForm_16911,#mktoForm_17132, #mktoForm_18751').length > 0){
jQuery('#NumberOfEmployees').on('change',function(){
// PBI handraiser
var product_name = jQuery('#CountrySelector').text().toLowerCase();
if(product_name != 'microsoft viva' && product_name != 'microsoft teams' && product_name != 'm365' && product_name != 'm365 frontline workers'){
channelFormLogic();
getConsentSelection();
}
});
}
//power product dropdown
if(jQuery('#mktoForm_18601,#mktoForm_18609').length > 0){
jQuery('#ce_productinterestlatest,#Country,#NumberOfEmployees').on('change',function(){
if(jQuery('#Country').val() != '' && jQuery('#ce_productinterestlatest').val() !==''){
channelFormLogic();
getConsentSelection();
}
});
}
//power Product dropdown
if(jQuery('#mktoForm_18601,#mktoForm_18609').length>0){
var product_name = jQuery('#ce_productinterestlatest option:selected').text();
}
//Improve phone field to capture ISD and area codes
// if(jQuery('#mktoForm_17147').length > 0 || jQuery('#mktoForm_17132').length > 0){
jQuery("#countryCodeList").empty()
jQuery("#countryCodeList").append('' +formLocalizationStrings[lcid].countryPhonePlaceholder+' ');
var countryDropdownArray = jQuery("#Country option").map(function() {return jQuery(this).val();}).get();
for(var i=0; i -1 ? 'block' : 'none'; //If countrySelection is in current array, set displayValue to 'block', else 'none'
legalText[key].closest('.'+key).css('display', displayValue); //Get textContainer relevant to the current legalReqs key, find parent we want to show/hide, and apply CSS rule
legalText[key].closest('.'+key).find('label, p').css('display', displayValue);
if(key == "optIn" || key == "optOut") legalText[key].closest('.'+key).find('.mktoCheckboxList').css('display', displayValue);
}
}
}
if(countrySelection == ''){
jQuery('.russia-legal').hide();
}else if(countrySelection == 'RUSSIA'){
jQuery('.russia-legal').show();
}
//event on product selection
jQuery('#mktoForm_15622 #ce_crm2marketo').on('change', function() {
changeNoticeSingleTopic();
});
// if parthercheckbox exists and one of the 3 other notices is displayed, display partnercheckbox
if(typeof partnerCheckboxRow !== "undefined" &&
(language === "EN" || language === "FR" || language === "ES" || language === "DE" || language === "PT" || language === "JA" || language === "RU" || language === "ZH" || language === "IT") &&
( legalText.optIn.css('display') === 'block' ||
legalText.optOut.css('display') === 'block' ||
legalText.textMicrosoft.css('display') === 'block' ) ) {
partnerCheckboxRow.css('display', 'block');
}
// else if, partnercheckbox exists, but none of the other 3 notices are displayed, hide it
else if (typeof partnerCheckboxRow !== "undefined") {
partnerCheckboxRow.css('display', 'none');
}
changeNoticeSingleTopic(countrySelection);
if(jQuery('#mktoForm_18785').length > 0){
let mdfPartnerName= jQuery('.MDF-Partner-Name').html();
let mdfPartnerConsent = jQuery(".mdfConsentLabel").html();
let mdfPartnerPrivacyLink = jQuery('.MDF-Partner-Prvacy-Link').html();
if(mdfPartnerName != ''){
jQuery('.mdfConsentLabel').html(mdfPartnerConsent.replace('[MDF Partner Name]', mdfPartnerName));
jQuery('#mdfPrivacyLink').html(mdfPartnerName + " Privacy Statement");
}
if(mdfPartnerPrivacyLink != ''){
jQuery('#mdfPrivacyLink').attr("href", mdfPartnerPrivacyLink.trim());
}
jQuery('label[for="MDFPartnerConsent"]').parents('.mktoFormRow').show();
let mdfCheckboxColor = jQuery('.consentLabel').css("color");
jQuery('label[for="MDFPartnerConsent"] .mdfConsentLabel').css({'color': mdfCheckboxColor});
// jQuery('input[name="mDFPartner"]').parents('.mktoCheckboxList').show();
}
if(jQuery('#mktoForm_18566,#mktoForm_18567,#mktoForm_18568,#mktoForm_18590,#mktoForm_18591,#mktoForm_18592, #mktoForm_18769').length > 0){
if(countrySelection != 'KOREA' && countrySelection != 'CANADA'){
changeNewsletterNotice();
}else{
let brandText = '';
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'microsoft partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
topicId = 'e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter';
}
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'surface partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
topicId = 'e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter';
}
if((lcid in brandingText)) {
if(brandingText[lcid].hasOwnProperty('singleComTopicNewsletter') && topicId in brandingText[lcid]['singleComTopicNewsletter']){
brandText = brandingText[lcid]['singleComTopicNewsletter'][topicId];
}else{
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
}
// default brand text
else {
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
jQuery(".consentLabel").html(formLocalizationStrings[lcid]["legal"]['noticeCanadaNewsletterForm'].replace("REPLACEME", brandText));
if(countrySelection == 'KOREA'){
jQuery('.consentCss').remove();
jQuery("").appendTo("head");
}
if(countrySelection == 'CANADA'){
let consent = jQuery('.consentLabel').html();
consent = consent.replace(' and other Microsoft products, services, and events, including the latest solutions, tips, and exclusive offers','');
jQuery('.consentLabel').html(consent.replace('and phone ',''));
if(jQuery("#mktoForm_18769").length > 0){
let topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
if(lcid.indexOf('FR-CA') >= 0 ){
brandText = brandingText[lcid]['singleComTopic'][topicId];
}else{
brandText = brandingText['default']['singleComTopic'][topicId];
}
consent = formLocalizationStrings[lcid]['legal']['noticeCanadaBrand'].replace("REPLACEME",brandText)
jQuery('.consentLabel').html(consent)
}
if(jQuery('#mktoForm_18592').length > 0 && countrySelection == 'CANADA'){
if(lcid.indexOf('FR-CA') >= 0 ){
brandText = brandingText[lcid]['singleComTopicNewsletter'][topicId];
}else{
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
jQuery(".consentLabel").html(formLocalizationStrings[lcid]["legal"]['noticeCanadaNewsletterMPNForm'].replace("DYMPRODUCT", brandText));
}
jQuery('.mktoCheckboxList').hide();
jQuery('.mktoForm .mktoFormRow .mktoFieldDescriptor .mktoFieldWrap .consentLabel').css('margin-left','0');
}
topicId = topicId.replace('-Microsoft Partner Newsletter','').replace('-Surface Partner Newsletter','');
var pref2marketoVal = topicId + '=OptInExplicit;';
jQuery('input[name=pref2Marketo]').val(pref2marketoVal);
}
jQuery(function() {
jQuery('#LblsystemPartnerPreferenceMirrorOptIn').parent().parent().parent('.mktoFormRow').remove();
});
}
// TEST NEWSLETTER FORM START
if(jQuery('#mktoForm_18614,#mktoForm_18615,#mktoForm_18613,#mktoForm_18611,#mktoForm_18616').length > 0){
if(countrySelection != 'KOREA' && countrySelection != 'CANADA'){
changeNewsletterNoticeTest();
}else{
let brandText = '';
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'microsoft partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
topicId = 'e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter';
}
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'surface partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
topicId = 'e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter';
}
if((lcid in brandingText)) {
if(brandingText[lcid].hasOwnProperty('singleComTopicNewsletter') && topicId in brandingText[lcid]['singleComTopicNewsletter']){
brandText = brandingText[lcid]['singleComTopicNewsletter'][topicId];
}else{
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
}
// default brand text
else {
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
jQuery(".consentLabel").html(formLocalizationStrings[lcid]["legal"]['noticeCanadaNewsletterForm'].replace("REPLACEME", brandText));
if(countrySelection == 'KOREA'){
jQuery('.consentCss').remove();
jQuery("").appendTo("head");
}
if(countrySelection == 'CANADA'){
let consent = jQuery('.consentLabel').html();
consent = consent.replace(' and other Microsoft products, services, and events, including the latest solutions, tips, and exclusive offers','');
jQuery('.consentLabel').html(consent.replace('and phone ',''))
jQuery('.mktoCheckboxList').hide();
jQuery('.mktoForm .mktoFormRow .mktoFieldDescriptor .mktoFieldWrap .consentLabel').css('margin-left','0');
}
topicId = topicId.replace('-Microsoft Partner Newsletter','').replace('-Surface Partner Newsletter','');
var pref2marketoVal = topicId + '=OptInExplicit;';
jQuery('input[name=pref2Marketo]').val(pref2marketoVal);
}
jQuery(function() {
jQuery('#LblsystemPartnerPreferenceMirrorOptIn').parent().parent().parent('.mktoFormRow').remove();
});
}
// TEST NEWSLETTER FORM END
russiaSelected(countrySelection);
// don't run on PPE
if (!(window.location.href.match(/http:\/\/na-sj12\.marketo\.com/g))) russianSubmit(form, countrySelection);
//Remove checkbox label
jQuery('.mktoCheckboxList label').remove();
var partnerPrefInput = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]');
var partnerPrefLabel = jQuery('#LblsystemPartnerPreferenceMirrorOptIn');
var optOutInput = jQuery('input[name="SystemContactPreferenceMirrorOptOut"]');
var partnerDiv = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow');
if(legalReqs['optOut'].indexOf(countrySelection) != -1){
optOutInput.prop('checked',true);
}
jQuery('input[name="SystemContactPreferenceMirrorOptIn"]').prop('checked',false);
// Partner consent forms
if(jQuery(partnerForms).length > 0 && countrySelection != ''){
var globalbrand = Parameters.brandSelector();
var newNotice='',selectedBrand='';
newNotice = partnerPrefLabel.text();
partnerPrefLabel.html(''+formLocalizationStrings[lcid]["PartnerStatments"]["PartnerConsent"]+' ');
partnerNotice = partnerPrefLabel.html();
partnerPrefInput.parents('.mktoFormRow').show();
partnerPrefInput.prop('checked',false);
var NoticeSwap=jQuery('button.mktoButton').parents('.mktoButtonRow');
if(legalReqs['textMicrosoft'].indexOf(countrySelection) != -1){
jQuery('p.content-text').parents('.mktoFormRow').insertBefore(NoticeSwap);
var EleSwap=jQuery('p.content-text').parents('.mktoFormRow');
partnerPrefLabel.parents('.mktoFormRow').insertAfter(EleSwap);
}else{
partnerDiv.insertBefore(NoticeSwap);
}
}
//Universal Partner form
if(jQuery('#mktoForm_17049').length > 0){
jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').prop('checked',true);
jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').css('display','none');
jQuery('#LblsystemPartnerPreferenceMirrorOptIn .consentLabel').css('margin-left','0');
if(legalReqs['textMicrosoft'].indexOf(countrySelection) > -1){
jQuery('.content-text').parents('.mktoFormRow').hide();
jQuery('input[name="SystemContactPreferenceMirrorOptOut"]').parents('.mktoFormRow').show();
jQuery('input[name="SystemContactPreferenceMirrorOptOut"]').parent().show();
jQuery('#LblSystemContactPreferenceMirrorOptOut').show();
}
}
// PBI handraiser
if(jQuery('#mktoForm_16911,#mktoForm_17132, #mktoForm_18751').length > 0){
var product_name = jQuery('#CountrySelector').text().toLowerCase();
if(product_name != 'microsoft viva' && product_name != 'microsoft teams' && product_name != 'm365' && product_name != 'm365 frontline workers'){
channelFormLogic();
}
}
if(jQuery('#mktoForm_18566,#mktoForm_18567,#mktoForm_18568,#mktoForm_18590,#mktoForm_18591,#mktoForm_18592, #mktoForm_18614,#mktoForm_18615,#mktoForm_18613,#mktoForm_18611,#mktoForm_18616, #mktoForm_18769').length == 0){
getConsentSelection();
}
if(jQuery('#mktoForm_17132, #mktoForm_18751').length > 0){ //routing for new product
jQuery('#Country, #NumberOfEmployees').on('change',function(){
//purchasing preference field validation start
jQuery('#m365PurchasingPreference').parent().parent().parent('.mktoFormRow').hide();
jQuery('#m365PurchasingPreference').val('');
if(jQuery('#Country').val().toLowerCase() == 'united states' && jQuery('#NumberOfEmployees').val() != ''){
if(jQuery('#NumberOfEmployees').val() != '' && jQuery('#NumberOfEmployees').val() != 1001){
jQuery('#m365PurchasingPreference').parent().parent().parent('.mktoFormRow').show();
}
}
//purchasing preference field validation end
supportedMWCountry();
});
}
// trick to remove the "brand" text from mktoForm_13633 form
if(jQuery("#mktoForm_13633").length > 0){
if (jQuery(this).val() == "United States") {
var text = jQuery('.content-text').html();
text = text.replace(/Brand/g, "");
jQuery('.content-text').html(text);
}
}
// For form id
if(jQuery('#mktoForm_15393').length > 0){
if (countrySelection === 'UNITED STATES') {
jQuery('p.content-text').insertBefore('#LblsystemPartnerPreferenceMirrorOptIn');
}
}
// change checkbox css for arabic countries (right to left text)
if(lcid == 'AR' || lcid == 'AR-SA' || lcid == 'HE' || lcid == 'HE-IL' || lcid == 'BH-BH'){
jQuery('.mktoForm .mktoFormRow .mktoFieldDescriptor .mktoFieldWrap .mktoCheckboxList').css({'right':'0','padding-right':'0'});
jQuery('.mktoForm .mktoFormRow .mktoFieldDescriptor .mktoFieldWrap .consentLabel').css({'margin-right':'30px','text-align':'right'});
jQuery('.mktoForm .mktoFormRow .mktoFieldWrap p').css({'text-align':'right'});
}
//ContactMe Request Demo country list updation
if(jQuery('#mktoForm_16416').length > 0){
jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').prop('checked',true);
jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').css('display','none');
jQuery('#LblsystemPartnerPreferenceMirrorOptIn .consentLabel').css('margin-left','0');
}
/*************CHINESE COUNTRY CHANGE ******/
if(jQuery('#mktoForm_17133').length == 0){ //Without MSR NEWSLETTER
let countrySelection = jQuery('#Country option:selected').val().toUpperCase();
if (countrySelection === "CHINA" && jQuery('.chinese-legal').length < 1) {
if(lcid == 'ZH-CN'){
jQuery(formLocalizationStrings["default"].chineseFormNativeNotice).insertBefore('.mktoButtonRow:first');
}else{
jQuery(formLocalizationStrings["default"].chineseFormEngNotice).insertBefore('.mktoButtonRow:first');
}
jQuery(".mktoForm .chinese-legal .mktoLabel").css({
'width' : '100%',
'font-family': 'inherit',
'font-weight': 'inherit',
'margin-bottom': '30px',
});
}
else if (countrySelection !== "CHINA" && jQuery('.chinese-legal').length > 0) {
jQuery('.chinese-legal').remove();
}
if(countrySelection == 'RUSSIA'){
var russianConsent = jQuery(".russia-legal");
russianConsent.next().insertBefore(russianConsent);
}
}
//MSR NEWSLETTER NOTICE CONSENT
if(jQuery('#mktoForm_17133').length > 0){
var const_lang_from = '';
for (var key in legalReqs){
if (legalReqs.hasOwnProperty(key)) {
const_lang = legalReqs[key].indexOf(countrySelection) > -1 ? key : '';
if(const_lang == "optIn" || const_lang == "optOut"){
const_lang_from = "lecture_series_optIn_optOut";
}else if(const_lang == "textMicrosoft"){
const_lang_from = "lecture_series_notice_country";
}
if(const_lang_from !=''){
break;
}
}
}
if (countrySelection == "CANADA") {
const_lang_from = 'noticeCanadaBrand';
}
if(jQuery("#msr_newsletter_notice").text().toLowerCase() == 'yes'){
const_lang_from = 'msrNewsLetter';
if (countrySelection == "CANADA") {
const_lang_from = 'noticeCanadaBrandNewsletter';
}
}
//Fix template styling issue
jQuery('.text-microsoft .content-text').css("line-height","1.2em");
jQuery('.text-microsoft .mktoHtmlText.mktoHasWidth').css({"margin-bottom":"29px","margin-top":"1px"});
jQuery('.chinese-legal').remove();
if(countrySelection == 'RUSSIA'){
jQuery("#LblSystemContactPreferenceMirrorOptIn .consentLabel").html(formLocalizationStrings["default"]['consent_notice'][const_lang_from]);
//move eng privacy statement after russian text
var privacy = jQuery("#newsletter_ps");
jQuery('.russia-legal .mktoFormCol').append(privacy);
jQuery('.russia-legal').css("padding-bottom","24px");
}else if(countrySelection == 'CHINA'){
jQuery(".consentLabel").html(formLocalizationStrings["default"]['consent_notice'][const_lang_from]);
jQuery(formLocalizationStrings["default"].chineseFormEngNotice).insertBefore('.mktoButtonRow');
jQuery(".chinese-legal span.consentLabel a").hide();
jQuery(".mktoForm.mktoLayoutAbove .chinese-legal .mktoLabel").css({
'width' : '100%',
'font-family': 'inherit',
'font-weight': 'inherit',
'font-size': '16px',
});
var privacyChina = jQuery("#newsletter_ps");
privacyChina.css("margin-bottom","24px");
jQuery('.chinese-legal .consentLabel').append(privacyChina);//copy to the bottom
jQuery("#LblSystemContactPreferenceMirrorOptIn #newsletter_ps").css("display","none");//remove previous one
}else{
jQuery(".consentLabel").html(formLocalizationStrings["default"]['consent_notice'][const_lang_from]);
}
//Update Korea consent
if (countrySelection === "KOREA"){
var consentReq = '';
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
jQuery(".koreaConstRow").remove();
if (topicId == '00000000-0000-0000-0000-000000000001') {
consentReq = ''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaWideMSFT"]+' ';
jQuery('#LblSystemContactPreferenceMirrorOptIn').html(''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaOptionalWideMSFT"]+' ');
jQuery('#LblSystemContactPreferenceMirrorOptOut').html(''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaOptionalWideMSFT"]+' ');
}else{
consentReq = ''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKorea"]+' ';
jQuery('#LblSystemContactPreferenceMirrorOptIn').html(''+formLocalizationStrings["default"]['consent_notice']["lecture_series_optIn_optOut_korea"]+' ');
jQuery('#LblSystemContactPreferenceMirrorOptOut').html(''+formLocalizationStrings["default"]['consent_notice']["lecture_series_optIn_optOut_korea"]+' ');
}
var reqConsent = '';
jQuery("#LblsystemPartnerPreferenceMirrorOptIn").parent().parent().parent('.mktoFormRow').hide();
jQuery(reqConsent).insertBefore(".mktoFormRow.optOut.opt-out")
}else{
jQuery('.koreaConstRow').remove();
}
if(jQuery("#msr_newsletter_notice").text().toLowerCase() == 'yes'){
jQuery('input[name=SystemContactPreferenceMirrorOptIn]').parents('.mktoCheckboxList').remove();
jQuery('input[name=SystemContactPreferenceMirrorOptOut]').parents('.mktoCheckboxList').remove();
jQuery('.mktoForm .mktoFormRow .mktoFieldDescriptor .mktoFieldWrap .consentLabel').css('margin-left','0');
//pref2Marketo
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
let pref2marketo_val = topicId + '=OptInImplicit;';
jQuery('input[name=pref2Marketo]').val(pref2marketo_val);
}
jQuery('.text-microsoft').css({
'margin-bottom' : '0px',
'padding-bottom' : '0px',
});
}
//Update Korea consent for all countries except MSR
if(jQuery('#mktoForm_17133').length == 0){
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
let countrySelection = jQuery('#Country option:selected').val().toUpperCase();
if (countrySelection === "KOREA"){
var consentReq = '';
jQuery(".koreaConstRow").remove();
if (topicId == '00000000-0000-0000-0000-000000000001') {
consentReq = ''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaWideMSFT"]+' ';
jQuery('#LblSystemContactPreferenceMirrorOptIn').html(''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaOptionalWideMSFT"]+' ');
jQuery('#LblSystemContactPreferenceMirrorOptOut').html(''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaOptionalWideMSFT"]+' ');
}else{
consentReq = ''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKorea"]+' ';
let noticeOptional = '';
if(lcid.indexOf('EN') > -1){
noticeOptional = formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaOptional"].replace("DYMPRODUCT", brandingText['default']["singleComTopic"][topicId]);
}else{
noticeOptional = formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaOptional"].replace("DYMPRODUCT", brandingText[lcid]["singleComTopic"][topicId]);
}
jQuery('#LblSystemContactPreferenceMirrorOptIn').html(''+ noticeOptional +' ');
jQuery('#LblSystemContactPreferenceMirrorOptOut').html('' + noticeOptional + ' ');
}
var reqConsent = '';
jQuery("#LblsystemPartnerPreferenceMirrorOptIn").parent().parent().parent('.mktoFormRow').hide();
jQuery(reqConsent).insertBefore(".mktoFormRow.optOut.opt-out")
}else{
jQuery('.koreaConstRow').remove();
}
}
//Update Korea consent for New Newsletter Forms
if(jQuery('#mktoForm_18566,#mktoForm_18567,#mktoForm_18568,#mktoForm_18590,#mktoForm_18591,#mktoForm_18592, #mktoForm_18769').length > 0){
if (countrySelection === "KOREA"){
var brandText = '';
if((lcid in brandingText)) {
if(brandingText[lcid].hasOwnProperty('singleComTopicNewsletter') && topicId in brandingText[lcid]['singleComTopicNewsletter']){
brandText = brandingText[lcid]['singleComTopicNewsletter'][topicId];
}else{
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
}
// default brand text
else {
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'surface partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
if((lcid in brandingText)) {
brandText = brandingText[lcid]['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter'];
}
}
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'microsoft partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
if((lcid in brandingText)) {
brandText = brandingText[lcid]['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}
}
let consentReq = ''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaNewsletter"].replace('DYNPRODUCT',brandText) +' ';
if(jQuery('#mktoForm_18592').length > 0){
let brandText ='';
if(lcid.indexOf('EN') >= 0 ){
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter_KO-KR']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}
consentReq = ''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaNewsletterMPN"].replace('DYNPRODUCT',brandText) +' ';
}
jQuery('#LblkoreaOptIn').html(consentReq);
jQuery('#LblSystemContactPreferenceMirrorOptIn').parent().parent().parent('.mktoFormRow').hide();
}
}
if(jQuery("#mktoForm_18769").length > 0 && countrySelection == 'KOREA'){
let brandText ='';
if(lcid.indexOf('EN') >= 0 ){
brandText = brandingText['default']['singleComTopic'][topicId];
}else{
brandText = brandingText['default']['singleComTopicKO_KR'][topicId]; //new OBJ added to avoid error as KO-KR is not available for all LCID in brandText
}
let consentReq = ''+ formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaSBORequired"].replace('DYMPRODUCT',brandText) +' ';
jQuery('#LblkoreaOptIn').html(consentReq);
}
//TEST NEWSLETTER FORM START
if(jQuery('#mktoForm_18614,#mktoForm_18615,#mktoForm_18613,#mktoForm_18611,#mktoForm_18616').length > 0){
if (countrySelection === "KOREA"){
var brandText = '';
if((lcid in brandingText)) {
if(brandingText[lcid].hasOwnProperty('singleComTopicNewsletter') && topicId in brandingText[lcid]['singleComTopicNewsletter']){
brandText = brandingText[lcid]['singleComTopicNewsletter'][topicId];
}else{
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
}
// default brand text
else {
brandText = brandingText.default['singleComTopicNewsletter'][topicId];
}
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'surface partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
if((lcid in brandingText)) {
brandText = brandingText[lcid]['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Surface Partner Newsletter'];
}
}
if(jQuery('.SBO-Topic-Business-Newsletter-Name').text().length > 0 && jQuery('.SBO-Topic-Business-Newsletter-Name').text().toLowerCase() == 'microsoft partner newsletter' && topicId == 'e8bbc280-76ee-423a-9cc0-e8523bd2542b'){
if((lcid in brandingText)) {
brandText = brandingText[lcid]['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}else{
brandText = brandingText.default['singleComTopicNewsletter']['e8bbc280-76ee-423a-9cc0-e8523bd2542b-Microsoft Partner Newsletter'];
}
}
let consentReq = ''+formLocalizationStrings[lcid]["legalNotice"]["NoticeKoreaNewsletter"].replace('DYNPRODUCT',brandText) +' ';
jQuery('#LblkoreaOptIn').html(consentReq);
jQuery('#LblSystemContactPreferenceMirrorOptIn').parent().parent().parent('.mktoFormRow').hide();
// if(jQuery('#mktoForm_17845').length > 0){
// consentReq = consentReq.replace('undefined','Solutions for Businesses and Organizations and other Microsoft products, services, and events, including the latest solutions, tips, and exclusive offers');
// jQuery('#LblkoreaOptIn').html(consentReq);
// }
}
}
//TEST NEWSLETTER FORM END
//EDUCATION CONTACTME TO OMNICHANNEL
if(jQuery('#mktoForm_14970').length > 0){
let formFields = jQuery('#FirstName, #LastName, #Phone, #Company, #Email, #Title, #numberofStudentsinSchool, #comments');
jQuery(".education-unsupported-consent").remove();
if(countrySelection == 'UNITED STATES' || countrySelection == 'CANADA'){
jQuery.each(formFields, function( key, value ) {
jQuery(value).parents('.mktoFormRow').show();
});
jQuery(".mktoButton").removeAttr("disabled");
jQuery(".mktoButton").parents('.mktoButtonRow').show();
}else{
educountry();
jQuery('input[name="SystemContactPreferenceMirrorOptIn"], input[name="SystemContactPreferenceMirrorOptOut"], input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
jQuery('.textMicrosoft').hide();
jQuery(".mktoButton").parents('.mktoButtonRow').hide();
var m_lcid = Parameters.getLCID().toUpperCase();
let unSupportedConsent = '';
if(m_lcid.indexOf('EN') > -1){
unSupportedConsent = formLocalizationStrings['default']['educationUnsupportedCountryConsent'];
}else{
unSupportedConsent = formLocalizationStrings[m_lcid]['educationUnsupportedCountryConsent'];
}
jQuery(".mktoButton").parents('.mktoButtonRow').before(unSupportedConsent);
}
//remove universal consent for china & korea
jQuery('.chinese-legal').remove();
jQuery('.koreaConstRow').remove();
}
if(jQuery('#mktoForm_18778').length > 0){
let partnerName = jQuery("#partnerName").html();
let partnerLink = jQuery("#partnerPrivacyLink").html();
if(countrySelection == 'UNITED STATES'){
jQuery('.content-text').html(formLocalizationStrings['default'].PartnerAssistedDirectedContactMe.replaceAll("REPLACEPARTNERNAME", partnerName).replace("REPLACEPARTNERPRIVACYURL", partnerLink));
}
}
if(jQuery('#mktoForm_18785').length > 0){
jQuery('label[for="MDFPartnerConsent"]').parents('.mktoFormRow').insertBefore('.mktoButtonRow');
}
});
/* --------------- country change event code end -------------- */
if(jQuery('#mktoForm_18581, #mktoForm_18357').length > 0){
let countryCodePlaceholder = jQuery('select[name=Lblcountry_code] > option:first');
countryCodePlaceholder.text(countryCodePlaceholder.text().replace('*',''));
let phonePlaceholder = jQuery('#Phone').attr('placeholder');
jQuery('#Phone').attr("placeholder",phonePlaceholder.replace("*",""))
}
/*--- Some form related events ---*/
//on Change of product selection from dropdown change country dropdown and job dropdown respectively
jQuery('#mktoForm_15316 input, #mktoForm_15316 select, #mktoForm_15317 input, #mktoForm_15317 select').on('focus click change',function(){
// Onchange of country & jobtitle without product select
var erorrtext = "Please select the product you're most interested in";
var productDropdown = jQuery('#ce_crm2marketo');
if((jQuery(this).attr('id')==='Country') && (jQuery('#ce_crm2marketo').val()==='')){
jQuery('#Country').css('background',"#a5a5a5").attr('disabled','disabled');
productDropdown.parents('.mktoFieldWrap').css('float','left');
if((!productDropdown.next('div').hasClass('mktoError')) && ((productDropdown.next('div').hasClass('mktoClear')))){
productDropdown.next('div.mktoClear').replaceWith(''+formLocalizationStrings[lcid].errorMessage[erorrtext]+'
');
}else if(productDropdown.next('div').length < 1){
productDropdown.append(''+formLocalizationStrings[lcid].errorMessage[erorrtext]+'
');
}
}
//on change input or select other then country , job role & product
else if((jQuery(this).attr('id')!=='ce_crm2marketo') && (jQuery(this).attr('id') !=='Country')){
if(productDropdown.next('div').hasClass('mktoError')){
if(!(productDropdown.next('div').hasClass('mktoClear'))){
productDropdown.next('div').replaceWith('
');
}
else{
if(!(productDropdown.next('div').length < 1)){
productDropdown.next('div').replaceWith('
');
}
}
jQuery('#Country').css('background',"#FFFFFF").removeAttr('disabled');
}
}
//on product change
else if(jQuery(this).attr('id')==='ce_crm2marketo'){
if(jQuery(this).val()!==''){
prodselected = jQuery('#ce_crm2marketo option:selected').text();
jQuery('#Country').css('background',"#FFFFFF").removeAttr('disabled');
if(!(productDropdown.next('div').hasClass('mktoClear'))){
productDropdown.next('div').replaceWith('
');
jQuery('.mktoError').remove();
}
Select.changeProductSelection(prodselected);
jQuery('#Country option:first').val('');
}
else{
jQuery('#Country').css('background',"#a5a5a5").attr('disabled','disabled');
productDropdown.parents('.mktoFieldWrap').css('float','left');
if(!productDropdown.next('div').hasClass('mktoError')){
if(productDropdown.next('div').length > 0){
productDropdown.next('div.mktoClear').replaceWith(''+formLocalizationStrings[lcid].errorMessage[erorrtext]+'
');
}else if(productDropdown.next('div').length < 1){
productDropdown.append(''+formLocalizationStrings[lcid].errorMessage[erorrtext]+'
');
}
}
}
}
});
//power product dropdown
if(jQuery('#mktoForm_18601').length > 0){
jQuery('#ce_productinterestlatest,#Country,#NumberOfEmployees').on('change',function(){
var optInDiv = jQuery('input[name="SystemContactPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var optOutDiv = jQuery('input[name="SystemContactPreferenceMirrorOptOut"]').parents('.mktoFormRow').hide();
var partnerDiv = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var partnerInput = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]');
jQuery('.textMicrosoft').parents('.mktoFormRow').show();
partnerInput.parents('.mktoFormRow').hide();
if(jQuery('#Country').val() != '' && jQuery('#ce_productinterestlatest').val() !==''){
channelFormLogic();
getConsentSelection();
var country = jQuery('#Country').val();
//hide consent for self serve page
if(powerproducts['DR'].indexOf(country) >= 0){
if(legalReqs['textMicrosoft'].indexOf(country.toUpperCase()) != -1){
optInDiv.hide();
optOutDiv.hide();
jQuery('.textMicrosoft').parents('.mktoFormRow').show();
}else if(legalReqs['optIn'].indexOf(country.toUpperCase()) != -1){
optInDiv.show();
optOutDiv.hide();
}else if(legalReqs['optOut'].indexOf(country.toUpperCase()) != -1){
optInDiv.hide();
optOutDiv.show();
}
if(partnerForms.indexOf('#mktoForm_18601') >= 0){
partnerDiv.show();
}
jQuery('.channel_consent').parents('.mktoFormRow').hide();
}else{
jQuery('input[name="SystemContactPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
jQuery('input[name="SystemContactPreferenceMirrorOptOut"]').parents('.mktoFormRow').hide();
jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
jQuery('.consentLabel').parents('.mktoFormRow').hide();
partnerInput.parents('.mktoFormRow').hide();
jQuery('.textMicrosoft').parents('.mktoFormRow').hide();
jQuery('.channel_consent').parents('.mktoFormRow').show();
jQuery('.channel_consent').html(formLocalizationStrings[lcid]['globalSelfServeConsent']);
optInDiv.hide();
optOutDiv.hide();
}
}
});
}
//Honey Pot issue
if(jQuery(honeypotForms).length > 0){
jQuery('.mktoButton').on('click',function(){
if(jQuery('input[name="primaryformvalue"]').length > 0){
var honeypotArr = ['HJBDHVCJG','DGVUGUBH','UIHUCITYIU','ISHCOIHIJC','KGLIMCH','YGHTCV','KSHDJFHS','JASGDKD','DHJDDJJS','GDJHDJK'];
var honeypotElement = jQuery('input[name="primaryformvalue"]').val();
if(jQuery.trim(honeypotElement).length === 0){
var randomIndex = Math.floor(Math.random() * honeypotArr.length);
var randomElement = honeypotArr[randomIndex];
jQuery('input[name="primaryformvalue"]').val(randomElement);
}else{
// console.log('new value detected');
}
}
});
}
// PBI handraiser
if(jQuery('#mktoForm_16911,#mktoForm_17132,#mktoForm_18601,#mktoForm_18609, #mktoForm_18751').length > 0){
jQuery('.mktoButton').on('click',function(){
var product_name = jQuery('#CountrySelector').text().toLowerCase();
if(product_name != 'microsoft viva' && product_name != 'microsoft teams' && product_name != 'm365' && product_name != 'm365 frontline workers'){
channelRouting();
}
});
}
if(jQuery('#mktoForm_17132, #mktoForm_18751').length > 0){//routing for new product
jQuery('.mktoButton').on('click',function(){
//purchasing preference field validation start
if(jQuery('#Country').val().toLowerCase() == 'united states' && jQuery('#NumberOfEmployees').val() != '' && jQuery('#NumberOfEmployees').val() != 1001){
if(jQuery('#m365PurchasingPreference').val() == ''){
var invalidErrorMsg = formLocalizationStrings[lcid].errorMessage['This field is required.'];
mktoForm.showErrorMessage(invalidErrorMsg,jQuery('#m365PurchasingPreference'));
jQuery('#m365PurchasingPreference').addClass('invalid');
return false;
}else{
jQuery('#m365PurchasingPreference').next('.mktoError').remove();
return true;
}
}
//purchasing preference field validation end
processRoutingRule();
});
}
//Dynamic form-Product
if(jQuery('#mktoForm_18544, #mktoForm_18778').length > 0){
jQuery('.mktoButton').on('click',function(){
productRouting();
});
}
if(jQuery('#mktoForm_18778').length > 0){
jQuery('#countryCodeList option').each(function(){
if(jQuery(this).text() != 'United States (+1) '){
jQuery(this).remove();
}
});
}
if(jQuery('#mktoForm_18778').length > 0){
jQuery('#Country').val('United States');
if(jQuery('#mktoForm_18778').length > 0){
jQuery('#Country option').each(function(){
if(jQuery(this).val() != 'United States'){
jQuery(this).remove();
}
});
}
jQuery('#systemPartnerPreferenceMirrorOptIn').parents('.mktoFormRow').remove();
countrySelection = jQuery('#Country option:selected').val().toUpperCase();
for (var key in legalReqs){
if (legalReqs.hasOwnProperty(key)) {
var displayValue;
if (partnerCombinedStatement && language === "EN") {
displayValue = countrySelection !== "" ? 'block' : 'none';
legalText.optIn.closest('.'+key).css('display', displayValue); //Get textContainer relevant to the current legalReqs key, find parent we want to show/hide, and apply CSS rule
legalText.optIn.closest('.'+key).find('label, p').css('display', displayValue);
} else {
displayValue = legalReqs[key].indexOf(countrySelection) > -1 ? 'block' : 'none'; //If countrySelection is in current array, set displayValue to 'block', else 'none'
legalText[key].closest('.'+key).css('display', displayValue); //Get textContainer relevant to the current legalReqs key, find parent we want to show/hide, and apply CSS rule
legalText[key].closest('.'+key).find('label, p').css('display', displayValue);
if(key == "optIn" || key == "optOut") legalText[key].closest('.'+key).find('.mktoCheckboxList').css('display', displayValue);
}
}
}
if(countrySelection == ''){
jQuery('.russia-legal').hide();
}else if(countrySelection == 'RUSSIA'){
jQuery('.russia-legal').show();
}
// if parthercheckbox exists and one of the 3 other notices is displayed, display partnercheckbox
if(typeof partnerCheckboxRow !== "undefined" &&
(language === "EN" || language === "FR" || language === "ES" || language === "DE" || language === "PT" || language === "JA" || language === "RU" || language === "ZH" || language === "IT") &&
( legalText.optIn.css('display') === 'block' ||
legalText.optOut.css('display') === 'block' ||
legalText.textMicrosoft.css('display') === 'block' ) ) {
partnerCheckboxRow.css('display', 'block');
}
// else if, partnercheckbox exists, but none of the other 3 notices are displayed, hide it
else if (typeof partnerCheckboxRow !== "undefined") {
partnerCheckboxRow.css('display', 'none');
}
// changeNoticeSingleTopic(countrySelection);
let partnerName = jQuery("#partnerName").html();
let partnerLink = jQuery("#partnerPrivacyLink").html();
jQuery('.content-text').html(formLocalizationStrings['default'].PartnerAssistedDirectedContactMe.replaceAll("REPLACEPARTNERNAME", partnerName).replace("REPLACEPARTNERPRIVACYURL", partnerLink));
//Remove checkbox label
jQuery('.mktoCheckboxList label').remove();
var partnerPrefInput = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]');
var partnerPrefLabel = jQuery('#LblsystemPartnerPreferenceMirrorOptIn');
var optOutInput = jQuery('input[name="SystemContactPreferenceMirrorOptOut"]');
var partnerDiv = jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow');
if(legalReqs['optOut'].indexOf(countrySelection) != -1){
optOutInput.prop('checked',true);
}
jQuery('input[name="SystemContactPreferenceMirrorOptIn"]').prop('checked',false);
// Partner consent forms
if(jQuery(partnerForms).length > 0 && countrySelection != ''){
var globalbrand = Parameters.brandSelector();
var newNotice='',selectedBrand='';
newNotice = partnerPrefLabel.text();
partnerPrefLabel.html(''+formLocalizationStrings[lcid]["PartnerStatments"]["PartnerConsent"]+' ');
partnerNotice = partnerPrefLabel.html();
partnerPrefInput.parents('.mktoFormRow').show();
partnerPrefInput.prop('checked',false);
var NoticeSwap=jQuery('button.mktoButton').parents('.mktoButtonRow');
if(legalReqs['textMicrosoft'].indexOf(countrySelection) != -1){
jQuery('p.content-text').parents('.mktoFormRow').insertBefore(NoticeSwap);
var EleSwap=jQuery('p.content-text').parents('.mktoFormRow');
partnerPrefLabel.parents('.mktoFormRow').insertAfter(EleSwap);
}else{
partnerDiv.insertBefore(NoticeSwap);
}
}
// if(jQuery('#mktoForm_17845,#mktoForm_17847,#mktoForm_17848, #mktoForm_17868, #mktoForm_17870, #mktoForm_17871, #mktoForm_17950, #mktoForm_17985').length == 0){
// getConsentSelection();
// }
// change checkbox css for arabic countries (right to left text)
if(lcid == 'AR' || lcid == 'AR-SA' || lcid == 'HE' || lcid == 'HE-IL' || lcid == 'BH-BH'){
jQuery('.mktoForm .mktoFormRow .mktoFieldDescriptor .mktoFieldWrap .mktoCheckboxList').css({'right':'0','padding-right':'0'});
jQuery('.mktoForm .mktoFormRow .mktoFieldDescriptor .mktoFieldWrap .consentLabel').css('margin-right','30px');
}
// productFormLogic();
// jQuery('#ce_productinterestlatest').on('change',function(){
// productFormLogic();
// getConsentSelection();
// });
jQuery('#Country').on('change',function(){
// productFormLogic();
getConsentSelection();
});
if(jQuery('#systemPartnerPreferenceMirrorOptIn').length > 0 ){
jQuery('#systemPartnerPreferenceMirrorOptIn').parents('.mktoFormRow').remove();
}
}
// Dynamic Form - Products
if(jQuery('#mktoForm_18544').length > 0){
var option = 'Dynamics 365 Products ... ';
var fieldObjects;
for (var i=0;i' + Dynamic_productlist[i] + '';
}else{
option += '' + Dynamic_productlist[i] +" (Marketing)"+ ' ';
}
}
jQuery('#ce_productinterestlatest option').remove();
jQuery('#ce_productinterestlatest').append(option);
fieldObjects = jQuery('#FirstName, #LastName, #Email, #Company, #Title, #Phone, #comments');
jQuery.each(fieldObjects, function( key, value ) {
jQuery(value).parents('.mktoFormRow').hide();
});
productFormLogic();
jQuery('#ce_productinterestlatest').on('change',function(){
productFormLogic();
getConsentSelection();
});
jQuery('#Country').on('change',function(){
productFormLogic();
getConsentSelection();
});
}
//on Change of product selection from dropdown change country dropdown (//and job dropdown) respectively for form 16408 only
jQuery('#mktoForm_16408 select,#mktoForm_17119 select,#mktoForm_16408 input,#mktoForm_17119 input, #mktoForm_16460 select,#mktoForm_16460 input,#mktoForm_16387 input, #mktoForm_16387 select').on('focus click change',function(){
// Onchange of country & jobtitle without product select
var erorrtext = "Please select the product you're most interested in";
if((jQuery(this).attr('id')==='Country') && (jQuery('#ce_productinterestlatest').val()==='')){
jQuery('#Country').css('background',"#a5a5a5").attr('disabled','disabled');
jQuery('#ce_productinterestlatest').parents('.mktoFieldWrap').css('float','left');
if((!jQuery('#ce_productinterestlatest').next('div').hasClass('mktoError')) && ((jQuery('#ce_productinterestlatest').next('div').hasClass('mktoClear')))){
jQuery('#ce_productinterestlatest').next('div.mktoClear').replaceWith(''+formLocalizationStrings[lcid].errorMessage[erorrtext]+'
');
}else if(jQuery('#ce_productinterestlatest').next('div').length < 1){
jQuery('#ce_productinterestlatest').append(''+formLocalizationStrings[lcid].errorMessage[erorrtext]+'
');
}
}
//on change input or select other then country , job role & product
else if((jQuery(this).attr('id')!=='ce_productinterestlatest') && (jQuery(this).attr('id') !=='Country')){
if(jQuery('#ce_productinterestlatest').next('div').hasClass('mktoError')){
if(!(jQuery('#ce_productinterestlatest').next('div').hasClass('mktoClear'))){
jQuery('#ce_productinterestlatest').next('div').replaceWith('
');
}
else{
if(!(jQuery('#ce_productinterestlatest').next('div').length < 1)){
jQuery('#ce_productinterestlatest').next('div').replaceWith('
');
}
}
jQuery('#Country').css('background',"#FFFFFF").removeAttr('disabled');
}
}
//on product change
else if(jQuery(this).attr('id')==='ce_productinterestlatest'){
if(jQuery(this).val()!==''){
prodselected = jQuery('#ce_productinterestlatest option:selected').text();
jQuery('#Country').css('background',"#FFFFFF").removeAttr('disabled');
if(!(jQuery('#ce_productinterestlatest').next('div').hasClass('mktoClear'))){
jQuery('#ce_productinterestlatest').next('div').replaceWith('
');
jQuery('.mktoError').remove();
}
Select.changeProductSelection(prodselected);
jQuery('#Country option:first').val('');
}
else{
jQuery('#Country').css('background',"#a5a5a5").attr('disabled','disabled');
jQuery('#ce_productinterestlatest').parents('.mktoFieldWrap').css('float','left');
if(!jQuery('#ce_productinterestlatest').next('div').hasClass('mktoError')){
if(jQuery('#ce_productinterestlatest').next('div').length > 0){
jQuery('#ce_productinterestlatest').next('div.mktoClear').replaceWith(''+formLocalizationStrings[lcid].errorMessage[erorrtext]+'
');
}else if(jQuery('#ce_productinterestlatest').next('div').length < 1){
jQuery('#ce_productinterestlatest').append(''+formLocalizationStrings[lcid].errorMessage[erorrtext]+'
');
}
}
}
}
RemoveCountry();
});
//Fix for SQL Server form download
jQuery("#mktoForm_14511 #mktoCheckbox_226671_0").click(function() {
if(jQuery(this).prop('checked'))
{
jQuery(".mktoButton").removeAttr("disabled");
}else{
jQuery(".mktoButton").attr("disabled", "disabled");
}
});
// For Industry change function
if(jQuery('#mktoForm_15745').length > 0){
function URLLCID() {
var lcid;
if ( window.location.href.match(/LCID=(\w{2}(?:-\w{2})?)/i) ) {
lcid = window.location.href.match(/LCID=(\w{2}(?:-\w{2})?)/i);
if(lcid === null){
lcid = null;
}else{
lcid = lcid[1];
}
if(grouplcid.indexOf(lcid.toUpperCase()) == -1){
lcid = 'EN';
}
return lcid;
}
else if (window.location.href.match(/LCID-(\w{2}(?:-\w{2})?)/i) ) {
lcid = window.location.href.match(/LCID-(\w{2}(?:-\w{2})?)/i);
if(lcid === null){
lcid = null;
}else{
lcid = lcid[1];
}
if(grouplcid.indexOf(lcid.toUpperCase()) == -1){
lcid = "EN"
}
return lcid;
}
else if(jQuery("input[name='systemFormsLCID']").length > 0 && jQuery("input[name='systemFormsLCID']").val() != ''){
lcid = jQuery("input[name='systemFormsLCID']").val();
return lcid;
}
else if(jQuery("input[name='systemFormsLanguageLocaleProduct']").val().indexOf("-") !== 1){
lcid = jQuery("input[name='systemFormsLanguageLocaleProduct']").val();
if(lcid.trim().substr(0,1) != '-'){
lcid = typeof lcid !== "undefined" ? lcid.trim().substr(0,5) : null;
}else{
lcid = "EN-US";
}
return lcid;
}else{
lcid = "EN-US";
return lcid;
}
}
/**
* Update the what product select option. This could be re-written for reusability.
*
* @function Select#buildprodlistonindustry
*
* @access protected
*
* @param {string} optionValue What do you want the value for this option to be?
* @param {string} optionText What do you want the display text for this option to be?
* @param {string} conditional To run or not to run?
*/
function buildprodlistonindustry(optionValue, optionText, conditional) {
var newOption = document.createElement('OPTION');
newOption.setAttribute('value', optionValue);
if(conditional) newOption.setAttribute('value', optionValue);
var newOptionText = document.createElement('span');
newOptionText.innerHTML = optionValue;
newOption.appendChild(newOptionText);
document.getElementById('web2Marketo').appendChild(newOption);
jQuery('#web2Marketo option:first').val('');
}
//212362: DT & Industry Form - Wave 5 (Removed onchange functionality for EN-US)
/* jQuery('#Country, #ce_industryname').on('change', function() {
var lcidSelection = URLLCID().toUpperCase();
var countrySelection = jQuery('#Country option:selected').val();
var setindustry = jQuery('#ce_industryname option:selected').val();
if(lcidSelection === "EN-US" && countrySelection === "United States" && jQuery('#ce_industryname').val() !== '')
{
jQuery('#web2Marketo').parents(".mktoFormRow").show();
if(formLocalizationStrings['EN-US']['What_topic_are_you_most_interested_in'][setindustry] !== undefined){
jQuery('#web2Marketo option').remove();
//jQuery('#Title option').remove();
}
for (key in formLocalizationStrings['EN-US']['What_topic_are_you_most_interested_in'][setindustry]) {
buildprodlistonindustry(key, formLocalizationStrings['EN-US']['What_topic_are_you_most_interested_in'][setindustry], true);
}
}else {
jQuery('#web2Marketo').parents(".mktoFormRow").hide();
}
});*/
}
// internal refferel form testing
// jQuery("#mktoForm_16408 #ce_crm2marketo, #mktoForm_17119 #ce_crm2marketo, #mktoForm_18128 #ce_crm2marketo").parents(".mktoFormRow").css("display","none");
// jQuery("#mktoForm_16408 #ce_marketo2crm, #mktoForm_17119 #ce_crm2marketo, #mktoForm_18128 #ce_marketo2crm").change(function(){
// if ((jQuery(this).children("option:selected").val().indexOf("smblvt") > -1) && (jQuery(this).val().length > 0)) {
// jQuery("#mktoForm_16408 #ce_crm2marketo, #mktoForm_17119 #ce_crm2marketo, #mktoForm_18128 #ce_crm2marketo").parents(".mktoFormRow").slideDown(400);
// }else {
// jQuery("#mktoForm_16408 #ce_crm2marketo, #mktoForm_17119 #ce_crm2marketo, #mktoForm_18128 #ce_crm2marketo").parents(".mktoFormRow").slideUp(400);
// }
// });
jQuery("#mktoForm_16408 #ce_marketo2crm, #mktoForm_17119 #ce_crm2marketo").change(function(){
var productDropdown = document.getElementById("ce_productinterestlatest").getElementsByTagName("option");
if ((jQuery(this).children("option:selected").val().indexOf("partner-development-manager") > -1) && (jQuery(this).val().length > 0)) {
document.getElementById("ce_productinterestlatest").selectedIndex = 0;
for (var i = 0; i < productDropdown.length; i++) {
if(productDropdown[i].value !== "Azure Platform" && productDropdown[i].value !==''){
productDropdown[i].hidden = true;productDropdown[i].disabled = true
}else{
productDropdown[i].hidden = false;productDropdown[i].disabled = false ;
}
}
}else {
for (var i = 0; i < productDropdown.length; i++) {
productDropdown[i].hidden = false;productDropdown[i].disabled = false ;
}
}
});
jQuery("#mktoForm_16408 #formSubmitter, #mktoForm_17119 #formSubmitter #mktoForm_18128 #formSubmitter").blur(function() {
var pattern = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
var email = jQuery("#formSubmitter").val();
if(pattern.test(email)) {
jQuery('.custom-email-msg').remove();
jQuery( "input[name='mIPCustomerNeed']" ).val(email);
}
});
jQuery("#mktoForm_16408 .mktoButton,#mktoForm_17119 .mktoButton").click(function() {
if(jQuery('#ce_crm2marketo').is(':visible')){
var supportTkt = jQuery('#ce_crm2marketo').val();
if(supportTkt !== ''){
supportTkt = supportTkt.replace('Support Ticket Number:','');
jQuery('#ce_crm2marketo').val(supportTkt);
}
var support_id = (jQuery('#ce_crm2marketo').length > 0) ? jQuery('#ce_crm2marketo').val() : true
if(jQuery('#ce_marketo2crm').val() !=='' && (support_id !==''|| support_id === true)){
jQuery('#ce_crm2marketo').val('Support Ticket Number:'+support_id);
}
}
var email = jQuery("#formSubmitter").val();
var pattern = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if(pattern.test(email)) {
jQuery('.custom-email-msg').hide();
jQuery( "input[name='mIPCustomerNeed']" ).val(email);
//jQuery('.mktoButton').prop("disabled", false);
return true;
}
else {
jQuery('.custom-email-msg').show();
jQuery('Enter Valid Microsoft email. example@microsoft.com
').insertAfter("input#formSubmitter");
jQuery('html, body').animate({
scrollTop: jQuery("#formSubmitter").offset().top
}, 100);
//jQuery('.mktoButton').prop("disabled", true);
return false;
}
});
jQuery("#mktoForm_18128 .mktoButton").click(function() {
// if(jQuery('#ce_crm2marketo').is(':visible')){
// var supportTkt = jQuery('#ce_crm2marketo').val();
// if(supportTkt !== ''){
// supportTkt = supportTkt.replace('Support Ticket Number:','');
// jQuery('#ce_crm2marketo').val(supportTkt);
// }
// var support_id = (jQuery('#ce_crm2marketo').length > 0) ? jQuery('#ce_crm2marketo').val() : true
// if(jQuery('#ce_marketo2crm').val() !=='' && (support_id !==''|| support_id === true)){
// jQuery('#ce_crm2marketo').val('Support Ticket Number:'+support_id);
// }
// }
var email = jQuery("#formSubmitter").val();
var pattern = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if(pattern.test(email)) {
jQuery('.custom-email-msg').hide();
jQuery( "input[name='mIPCustomerNeed']" ).val(email);
//jQuery('.mktoButton').prop("disabled", false);
return true;
}
else {
jQuery('.custom-email-msg').show();
jQuery('Enter Valid Microsoft email. example@microsoft.com
').insertAfter("input#formSubmitter");
jQuery('html, body').animate({
scrollTop: jQuery("#formSubmitter").offset().top
}, 100);
//jQuery('.mktoButton').prop("disabled", true);
return false;
}
});
//rename temprory for turkey country
// if(jQuery('#mktoForm_17133').length>0){
// jQuery("#Country option[value='Turkey']").text('Türkiye').val('Türkiye')
// }
//Internal Ref. Single tab fuctionality
if(jQuery('#mktoForm_18128').length > 0){
jQuery('form').attr('autocomplete','off');
jQuery('label[for="ce_marketo2crm"]').show().addClass('labelalign').text('Select your role ');
jQuery('label[for="formSubmitter"]').show().addClass('labelalign').text('What is your @ microsoft.com email?');
jQuery('label[for="ce_productinterestlatest"]').show().addClass('labelalign').text('Select primary solution area that customer has interest in-');
jQuery('label[for="Company"]').show().addClass('labelalign').text('Company Name');
jQuery('label[for="employeeRange"]').show().addClass('labelalign').text('Company Size');
jQuery('label[for="Country"]').show().addClass('labelalign').text('Country');
jQuery('label[for="ce_language"]').show().addClass('labelalign').text('Language');
jQuery('label[for="FirstName"]').show().addClass('labelalign').text('Customer First Name');
jQuery('label[for="LastName"]').show().addClass('labelalign').text('Customer Last Name');
jQuery('label[for="Title"]').show().addClass('labelalign').text('Customer Role');
jQuery('label[for="comments"]').show().addClass('labelalign').text('Additional Comments'); jQuery('label[for="comments"]').css('font-weight','bold'); jQuery("#comments").attr('placeholder','Comments: “Provide the TPID and subscription id for an existing customer for Azure workload.”')
jQuery('label[for="Email"]').show().addClass('labelalign').text('Customer Email Address.');
jQuery('label[for="Phone"]').show().addClass('labelalign').text('Customer Phone No.');
//Create manual fields
jQuery('#ce_language').parents('.mktoFormRow').after('');
jQuery('#Company').parents('.mktoFormRow').after('');
jQuery('#ce_marketo2crm').parents('.mktoFormRow').after('');
jQuery('input').not(':input[name=SystemContactPreferenceMirrorOptIn], :input[name=SystemContactPreferenceMirrorOptOut]').parents('.mktoFormRow').hide();
jQuery('select').parents('.mktoFormRow').hide();
jQuery('textarea').parents('.mktoFormRow').hide();
jQuery('#ce_marketo2crm').parents('.mktoFormRow').show();
jQuery('button').parents('.mktoButtonRow').after(' Next Question
Previous Question
')
jQuery('button[type=submit]').parents('.mktoButtonRow').hide();
var pageNo = 1;
var page1 = ['ce_marketo2crm'];
var page2 = ['formSubmitter'];
var page4 = ['Company', 'employeeRange', 'Country', 'ce_language'];
var page3 = ['ce_productinterestlatest'];
var page5 = ['FirstName', 'LastName', 'Title', 'Email', 'countryCodeList', 'Phone', ];
var page6 = ['E_Comment'];
var page7 = ['refq_yes','s_solution'];
var page8 = ['partnerq_yes','partner_list'];
var page9 = ["comments"];
var currentPage;
jQuery("input,textarea").on("blur", function(event) {
var value = jQuery(this).val();
if(value){
jQuery(this).removeClass('invalid')
}else{
jQuery(this).addClass('invalid')
}
})
jQuery('#ce_marketo2crm').on('change',function(){
// if(jQuery('#ce_marketo2crm').val() == 'smblvt'){
// page1.push('ce_crm2marketo');
// jQuery('label[for="ce_crm2marketo"]').show().addClass('labelalign').text('Support Ticket ');
// }
// else{
// jQuery('label[for="ce_crm2marketo"]').hide().addClass('labelalign').text('Support Ticket ');
// }
if(jQuery(this).val() == 'other'){
const otherField = '';
jQuery('#ce_marketo2crm').closest('.mktoFormRow').after(otherField);
}else{
jQuery('.other-role').remove()
}
});
jQuery('input[type=radio][name=partnerq]').change(function() {
if(this.value == 'Yes'){
jQuery('#partner_list').closest('.mktoFormRow').show();
}else{
jQuery('#partner_list').closest('.mktoFormRow').hide();
}
});
jQuery('input[type=radio][name=refq]').change(function() {
if(this.value == 'Yes'){
jQuery('#s_solution').closest('.mktoFormRow').show();
}else{
jQuery('#s_solution').closest('.mktoFormRow').hide();
}
});
jQuery("select#partner_list").mousedown(function(e){
e.preventDefault();
let select = this;
let scroll = select.scrollTop;
e.target.selected = !e.target.selected;
setTimeout(function(){select.scrollTop = scroll;}, 0);
jQuery(select).focus();
}).mousemove(function(e){e.preventDefault()});
jQuery(document).on('click','#Next',function(){
if(pageNo == 1){
currentPage = page1;
}else if(pageNo == 2){
currentPage = page2;
}else if(pageNo == 3){
currentPage = page3;
}else if(pageNo == 4){
currentPage = page4;
}else if(pageNo == 5){
currentPage = page5;
}else if(pageNo == 6 && (jQuery('#ce_marketo2crm').val()== 'executive' || jQuery('#ce_marketo2crm').val()=='other')){
currentPage = page6;
}else if(pageNo == 6 && (jQuery('#ce_marketo2crm').val()!== 'executive' || jQuery('#ce_marketo2crm').val()!== 'other')){
currentPage = page7;
}else if(pageNo == 7){
currentPage = page7;
}else if(pageNo == 8){
currentPage = page8;
}else if(pageNo == 9){
currentPage = page9;
}
var checkPage = validate(currentPage);
if(checkPage){
if(pageNo == 6 && (jQuery('#ce_marketo2crm').val()== 'executive' || jQuery('#ce_marketo2crm').val()=='other')){
pageNo ++;
}else if(pageNo == 6 && (jQuery('#ce_marketo2crm').val()!== 'executive' || jQuery('#ce_marketo2crm').val()!== 'other')){
pageNo = 7;
pageNo++;
}else{
pageNo ++;
}
jQuery('input').not(':input[name=SystemContactPreferenceMirrorOptIn], :input[name=SystemContactPreferenceMirrorOptOut]').parents('.mktoFormRow').hide();
jQuery('select').parents('.mktoFormRow').hide();
jQuery('textarea').parents('.mktoFormRow').hide();
if(pageNo == 1){
currentPage = page1;
}else if(pageNo == 2){
currentPage = page2;
}else if(pageNo == 3){
currentPage = page3;
}else if(pageNo == 4){
currentPage = page4;
}else if(pageNo == 5){
currentPage = page5;
}else if(pageNo == 6 && (jQuery('#ce_marketo2crm').val()== 'executive' || jQuery('#ce_marketo2crm').val()=='other')){
currentPage = page6;
}else if(pageNo == 6 && (jQuery('#ce_marketo2crm').val()!== 'executive' || jQuery('#ce_marketo2crm').val()!== 'other')){
currentPage = page7;
}else if(pageNo == 7){
currentPage = page7;
}else if(pageNo == 8){
currentPage = page8;
}else if(pageNo == 9){
currentPage = page9;
}
for(var i=0; i 1){
jQuery('#prev').parents('.mktoButtonRow').show();
}
if(pageNo == 9){
jQuery('#Next').parents('.mktoButtonRow').hide();
jQuery('button[type=submit]').parents('.mktoButtonRow').show();
}else{
jQuery('button[type=submit]').parents('.mktoButtonRow').hide();
}
jQuery('.internal-form-heading').remove();
if(jQuery('#FirstName').is(":visible") || jQuery('#Company').is(":visible")){
jQuery("#mktoForm_18128").prepend('Tell us about the customer
');
}
jQuery('#Country').attr('disabled','disabled');
if(jQuery('#Company').is(":visible")){
jQuery('#Country').removeAttr('disabled');
}
}else{
return false;
}
return false;
});
jQuery(document).on('click','#prev',function(){
jQuery('#comments').val('');
if(pageNo == 7 && (jQuery('#ce_marketo2crm').val()== 'executive' || jQuery('#ce_marketo2crm').val()=='other')){
pageNo --;
}else if(pageNo == 7 && (jQuery('#ce_marketo2crm').val()!== 'executive' || jQuery('#ce_marketo2crm').val()!== 'other')){
pageNo = 6;
pageNo--;
}else{
pageNo --;
}
jQuery('input').not(':input[name=SystemContactPreferenceMirrorOptIn], :input[name=SystemContactPreferenceMirrorOptOut]').parents('.mktoFormRow').hide();
jQuery('select').parents('.mktoFormRow').hide();
jQuery('textarea').parents('.mktoFormRow').hide();
if(pageNo == 1){
currentPage = page1;
}else if(pageNo == 2){
currentPage = page2;
}else if(pageNo == 3){
currentPage = page3;
}else if(pageNo == 4){
currentPage = page4;
}else if(pageNo == 5){
currentPage = page5;
}else if(pageNo == 6 && (jQuery('#ce_marketo2crm').val()== 'executive' || jQuery('#ce_marketo2crm').val()=='other')){
currentPage = page6;
}else if(pageNo == 6 && (jQuery('#ce_marketo2crm').val()!== 'executive' || jQuery('#ce_marketo2crm').val()!== 'other')){
currentPage = page7;
}else if(pageNo == 7){
currentPage = page7;
}else if(pageNo == 8){
currentPage = page8;
}else if(pageNo == 9){
currentPage = page9;
}
for(var i=0; iTell us about the customer');
}
if(jQuery('#Company').is(":visible")){
jQuery('#Country').removeAttr('disabled');
}
return false;
});
jQuery('.sol_product input').on('change',function(){
if(jQuery('.sol_product input:checked').val()=='No'){
jQuery('#s_solution').closest('.mktoFormRow').hide();
jQuery('#s_solution').attr('disabled', 'disabled');
jQuery('#refq_yes').removeClass('invalid')
jQuery('#refq_yes').next('.mktoError').remove();
jQuery('#s_solution').removeClass('mktoRequired mktoInvalid invalid')
jQuery('#s_solution').next('.mktoError').remove();
return true;
}else{
jQuery('#s_solution').removeAttr('disabled');
jQuery('#s_solution').closest('.mktoFormRow').show();
}
});
jQuery('.partner input').on('change',function(){
if(jQuery('.partner input:checked').val()=='No'){
jQuery('#partner_list').attr('disabled', 'disabled');
jQuery('#partner_list').closest('.mktoFormRow').hide();
jQuery('#partnerq_yes').removeClass('invalid');
jQuery('#partnerq_yes').next('.mktoError').remove();
jQuery('#partner_list').removeClass('mktoRequired mktoInvalid invalid')
jQuery('#partner_list').next('.mktoError').remove();
return true;
}else{
jQuery('#partner_list').removeAttr('disabled');
jQuery('#partner_list').closest('.mktoFormRow').show();
}
});
jQuery('select#ce_productinterestlatest').on('change',function(){
// let prodselected = jQuery('#ce_productinterestlatest option:selected').text();
// Select.changeProductSelection(prodselected);
// jQuery('#Country option:first').val('');
jQuery('#Country').val('');
});
jQuery('button[type=submit]').on('click',function(){
var result=[];
if(jQuery('.partner input').is(":visible") && jQuery('.partner input:checked').val() == undefined){
jQuery('#partner_list').attr('disabled', 'disabled');
var invalidErrorMsg = formLocalizationStrings[lcid].errorMessage['This field is required.'];
mktoForm.showErrorMessage(invalidErrorMsg,jQuery('#partnerq_yes'));
jQuery('#partnerq_yes').addClass('invalid');
return false;
}
if(jQuery('.partner input:checked').val() == 'Yes' && jQuery('#partner_list').val().length==0){
var invalidErrorMsg = formLocalizationStrings[lcid].errorMessage['This field is required.'];
mktoForm.showErrorMessage(invalidErrorMsg,jQuery('#partner_list'));
jQuery('#partner_list').addClass('invalid');
return false;
}
let standardComment = jQuery('#comments').val();
if(standardComment){
result.push('Comment | ' + standardComment);
}
let Ecomment = (jQuery('#E_Comment').val()!=='')?jQuery('#E_Comment').val():'';
if(Ecomment !==''){
result.push('Relationship with Customer response | '+Ecomment);
}
let otherRoleVal = (jQuery('#otherRole').val()!=='')?jQuery('#otherRole').val():'';
if(otherRoleVal){
result.push('Submitter other role is | ' + otherRoleVal);
}
jQuery('#comments').val(result.join(', '));
if(jQuery('.partner input:checked').val() == 'Yes' && jQuery('#partner_list').val().length > 0){
jQuery('#partner_list').removeClass('mktoRequired mktoInvalid invalid')
jQuery('#partner_list').next('.mktoError').remove();
let role = (jQuery('#ce_marketo2crm').val() == 'executive' || jQuery('#ce_marketo2crm').val() == 'other') ? jQuery('#ce_marketo2crm').val() : '';
let s_solutionq = jQuery('.sol_product input:checked').val()=='Yes' ? 'Yes':'No';
let s_solution = jQuery('#s_solution').val() !==''? jQuery('#s_solution').val():'';
let partnerq = jQuery('.partner input:checked').val()=='Yes'? 'Yes':'No';
let partnermutliselect = jQuery("#partner_list :selected").map(function(i, el) { return jQuery(el).val(); }).get();
let str_partner = partnermutliselect.join();
if(role !==''){
result.push('Submitter role is | '+role)
}
if(s_solutionq =='Yes'){
result.push('Is referral an existing customer response | '+s_solutionq);
result.push('Solutions that customer already uses | ' + s_solution);
}else{
result.push('Is referral an existing customer response | '+s_solutionq);
}
if(partnerq=='Yes'){
result.push('Is referral being created on behalf of a partner response | ' + partnerq);
result.push('Type of assistance partner is seeking | '+ str_partner)
}else{
result.push('Is referral being created on behalf of a partner response | ' + partnerq);
}
// console.log(result.join());
jQuery('#comments').val(result.join(', '));
return true;
}
});
function validate(presentPage){
var error = 0;
var validRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var phoneregex = /^[0-9 +]+$/;///^([0-9])*$/;
var validatearr = []
for(var i=0; i 0){
var invalidErrorMsg = formLocalizationStrings[lcid].errorMessage['This field is required.'];
mktoForm.showErrorMessage('Microsoft email is not allowed',jQuery('#Email'));
jQuery('#Email').addClass('invalid');
return false;
}
if(jQuery('#Phone').val()!=='' && !(phoneregex.test(jQuery('#Phone').val()))){
var invalidErrorMsg = formLocalizationStrings[lcid].errorMessage['This field is required.'];
mktoForm.showErrorMessage('Please Enter numbers only',jQuery('#Phone'));
jQuery('#Phone').addClass('invalid');
return false;
}
if(jQuery('#'+presentPage[i]).attr('id') == 'formSubmitter' && formField != '' && jQuery('#'+presentPage[i]).val().toLowerCase().indexOf('@microsoft.com') < 0){
var invalidErrorMsg = formLocalizationStrings[lcid].errorMessage['This field is required.'];
mktoForm.showErrorMessage('Enter Valid Microsoft email. example@microsoft.com',jQuery('#formSubmitter'));
jQuery('#formSubmitter').addClass('invalid');
return false;
}
if(jQuery('#ce_marketo2crm').val() == 'other' && jQuery('#otherRole').is(":visible") && jQuery('#otherRole').val() == ''){
var invalidErrorMsg = formLocalizationStrings[lcid].errorMessage['This field is required.'];
mktoForm.showErrorMessage(invalidErrorMsg,jQuery('#otherRole'));
jQuery('#otherRole').addClass('invalid');
return false;
}
}
if(jQuery('#Country').val()!=='' && jQuery('#ce_productinterestlatest').val()!==''){
const selfServicePage = jQuery('#ThankYouSelfServe').text();
var empcount;
if(jQuery('#employeeRange').val() !=='' && jQuery('#employeeRange').val().indexOf('-')){
var empsize= jQuery('#employeeRange').val().split('-');
empcount= Math.max.apply(null,empsize);
}
if((jQuery('#ce_productinterestlatest').val()=='Azure Platform') && (internalReferralCountryForAzure.indexOf(jQuery('#Country').val()) < 0)){
error = 0
window.location.href = selfServicePage;
return false;
}else if((jQuery('#ce_productinterestlatest').val()=='DynSales') && (internalReferralCountryForDynamic.indexOf(jQuery('#Country').val()) < 0)){
error = 0;
window.location.href = selfServicePage;
return false;
}else if((jQuery('#ce_productinterestlatest').val()=='M365' || jQuery('#ce_productinterestlatest').val()=='Office 365') && (internalReferralCountryForM_AndOffice365.indexOf(jQuery('#Country').val()) < 0)){
error = 0;
window.location.href = selfServicePage;
return false;
}
else if((jQuery('#ce_productinterestlatest').val()=='Power Apps' || jQuery('#ce_productinterestlatest').val()=='PowerBI') && (internalReferralCountryForPowerApps.indexOf(jQuery('#Country').val()) < 0)){
error = 0;
window.location.href = selfServicePage;
return false;
}else if(jQuery('#ce_productinterestlatest').val()=='Surface'){
const mergeAll = [...internalReferralCountryForSurfaceManaged, ...internalReferralCountryForSurfaceUnManaged, ...internalReferralCountryForSurfaceAnySubSegment];
if(mergeAll.indexOf(jQuery('#Country').val()) < 0){
error = 0;
window.location.href = selfServicePage;
return false;
}
}
}
if(error > 0){
return false;
}else{
return true;
}
}
}
//GPS & BPGI Consent
//remove country from BPGI
if(topicId !== '' && topicId == '502014c3-cb9f-433c-984b-87c9ed719bea'){
jQuery("#Country option[value='China']").remove();
jQuery("#Country option[value='Korea']").remove();
}
if(jQuery('#mktoForm_18357, #mktoForm_18566, #mktoForm_18616').length > 0){
jQuery('#Country').on('change',function(){
jQuery('input[name="systemPartnerPreferenceMirrorOptIn"]').parents('.mktoFormRow').hide();
var topicId = jQuery('input[name=systemFormsTopicGUID]').val();
topicId = getTopicId(topicId);
if(topicId !== '' && topicId == '00000000-0000-0000-0000-000000000001'){
//jQuery('.consentLabel').parents('.mktoFieldWrap').find('.mktoCheckboxList').remove();
jQuery('.consentLabel').addClass('consent');
//jQuery('.consentLabel').css('margin-left','30');
if(jQuery('#Country').val !== 'Canada'){
jQuery('.consentLabel').html('I would like to receive information, tips, and offers about Microsoft products and services. Privacy Statement ');
}
}else if(topicId !== '' && topicId == '502014c3-cb9f-433c-984b-87c9ed719bea'){
jQuery("#Country option[value='China']").remove();
jQuery("#Country option[value='Korea']").remove();
jQuery('.form-wrapper form.mktoForm .mktoHtmlText.mktoHasWidth').css('margin-bottom',"0");
//jQuery('.consentLabel').parents('.mktoFieldWrap').find('.mktoCheckboxList').remove();
jQuery('.consentLabel').addClass('consent');
//jQuery('.consentLabel').css('margin-left','30');
if(jQuery('#Country').val() !== 'Canada'){
jQuery('.consentLabel').html('I would like information, tips, and offers about Black Partner Growth Initiative and other Microsoft products and services. Privacy Statement ');
}
}
});
}
//dynamic subheader token value update
if(jQuery('#mktoForm_18778').length > 0){
let partnerName = jQuery("#partnerName").html();
jQuery('#formHeading h3').html(jQuery('#formHeading h3').html().replace("REPLACEPARTNERNAME", partnerName));
}
/* -----------------------------All events end -------------------------------------------------- */
// Use user defined URL if needed. Create url string parameters before redirection
form.onSuccess(function() {
var res = form.vals();
if(res['Country'].toLowerCase() == code_country[0]){
jQuery('#Country').val('');
jQuery('button[type="submit"]').removeAttr('disabled');
return false;
}
var queryString = (GetURLParameter('ls') !== '') ? GetURLParameter('ls') : undefined;
var redirectURL = changeFormURL();
if (redirectURL !== null) {
// special rules for now take flight, check if it's their page
if (jQuery('#flight').length > 0) {
// iframe template may be used by non-take flight stuff make sure it's flight
if (jQuery('#flight').text().trim() === "true") {
// redefine the url with the url + params sent by parent page + form values
redirectURL = flightURL + Parameters.nowTakeFlight();
// redirect top window
if(((jQuery('#mktoForm_15316').length > 0)|| (jQuery('#mktoForm_14284').length > 0)) && (queryString !== '') && (queryString !== undefined) ){
clearListCookies();
window.top.location.href = redirectURL + "?lcid=" +Parameters.getLCID()+ "&ls="+queryString;
}else{
window.top.location.href = redirectURL;
}
return false;
}
// normal redirect
else {
if(((jQuery('#mktoForm_15316').length > 0)|| (jQuery('#mktoForm_14284').length > 0)) && (queryString !== '') && (queryString !== undefined)){
clearListCookies();
window.top.location.href = redirectURL + "?lcid=" +Parameters.getLCID()+ "&ls="+queryString;
}else{
window.top.location.href = redirectURL;
}
return false;
}
}
else {
if(((jQuery('#mktoForm_15316').length > 0)|| (jQuery('#mktoForm_14284').length > 0)) && (queryString !== '') && (queryString !== undefined)){
clearListCookies();
window.top.location.href = redirectURL + "?lcid=" +Parameters.getLCID()+ "&ls="+queryString;
}else{
window.top.location.href = redirectURL;
}
return false;
}
}
});
//Remove Russia & Belarus country from contact me & PBI handraiser form
function RemoveCountry(){
//if(jQuery(contactmeForm).length > 0){
jQuery("#Country option[value='Russia']").remove();
jQuery("#ce_language option[value='Russian']").remove();
//}
}
RemoveCountry();
//DT&I: Remove 'Defense' Industry from Universal Form
if(jQuery('#mktoForm_15745').length > 0){
jQuery('#ce_industryname option').each(function() {
if ( jQuery(this).val() == 'Defense and Intelligence' ) {
jQuery(this).remove();
}
});
}
//Remove China & Korea CO-Universal-1GDC-Long-Standard-MDF
if(jQuery('#mktoForm_18785').length > 0){
jQuery("#Country option[value='Korea']").remove();
jQuery("#Country option[value='China']").remove();
}
});
// Security code which does not allow special characters like <,>,",'
jQuery(function() {
jQuery("input,textarea").on("keyup blur click", function(event) {
var value = jQuery(this).val();
var special_char = value.indexOf('<') != -1 | value.indexOf('>') != -1;
if (special_char) {
jQuery(this).val(value.replace(/\>|\<|\:/gi, ""));
}else if(value.indexOf('javascript') != -1){
jQuery(this).val('');
}
})
});
//if body has attribute "dir=RTL" then added class "rtl" to body
if(jQuery('body').attr('dir') == 'rtl' && !(jQuery('body').hasClass('rtl'))){
jQuery('body').addClass('rtl');
}
//Removed right align padding from speaker img
var dir = jQuery('body').attr('dir');
if(dir.toLowerCase() == 'rtl'.toLowerCase()){
jQuery('.featured-guests aside div:first-child').css('float','right');
jQuery('.featured-guests aside img').css('padding','0')
}
//ADOBE ANALYTICS START
jQuery('#ce_productinterestlatest, #ce_crm2marketo').change(function(){
let selectedProduct = '';
if(jQuery('#ce_crm2marketo option:selected').val()){
selectedProduct = jQuery('#ce_crm2marketo option:selected').text();
}
if(jQuery( "#ce_productinterestlatest" ).length > 0){
if(jQuery('#ce_productinterestlatest option:selected').val()){
selectedProduct = jQuery('#ce_productinterestlatest option:selected').text();
}
}
jQuery('form.mktoForm[id]').removeAttr("data-bi-formnm data-bi-formid data-bi-field1");
jQuery('form.mktoForm[id]').removeClass('context-jsll-form');
if(selectedProduct){
var formName = jQuery('.lpeCElement').attr('class').split('lpeCElement ');
jQuery('form.mktoForm[id]').addClass('context-jsll-form');
jQuery('.context-jsll-form').attr('data-bi-formnm', formName[1]);
jQuery('.context-jsll-form').attr('data-bi-formid', jQuery('form.mktoForm[id]').attr('id'));
jQuery('form.mktoForm[id]').attr('data-bi-field1',selectedProduct);
}
});
jQuery("a").each(function(index) {
var biName = 'Link ' + jQuery(this).text();
var biID;
if(jQuery(this).attr('href').indexOf('mailto') > -1){
biName = 'Mailto Link';
}
jQuery(this).attr('data-bi-cn',biName);
if(jQuery(this).find('img').length > 0){
biID = 'Img_' + index + 1;
}else{
biID = 'Link_' + index + 1;
}
jQuery(this).attr('data-bi-id',biID);
});
/*************ADOBE ANALYTICS END************/
});
}
});