/******* Do not edit this file *******
Simple Custom CSS and JS - by Silkypress.com
Saved: Jun 12 2024 | 16:23:20 */
/*
* Forms script that adds recaptcha for some forms and hidden fields for all forms
*
* Version: 1.0.35
* Updated: Mar 10, 2020
*/

/*
	jQuery Masked Input Plugin
	Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
	Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
	Version: 1.4.1
*/
!function (a) { "function" == typeof define && define.amd ? define(["jquery"], a) : a("object" == typeof exports ? require("jquery") : jQuery) }(function (a) { var b, c = navigator.userAgent, d = /iphone/i.test(c), e = /chrome/i.test(c), f = /android/i.test(c); a.mask = { definitions: { 9: "[0-9]", a: "[A-Za-z]", "*": "[A-Za-z0-9]" }, autoclear: !0, dataName: "rawMaskFn", placeholder: "_" }, a.fn.extend({ caret: function (a, b) { var c; if (0 !== this.length && !this.is(":hidden")) return "number" == typeof a ? (b = "number" == typeof b ? b : a, this.each(function () { this.setSelectionRange ? this.setSelectionRange(a, b) : this.createTextRange && (c = this.createTextRange(), c.collapse(!0), c.moveEnd("character", b), c.moveStart("character", a), c.select()) })) : (this[0].setSelectionRange ? (a = this[0].selectionStart, b = this[0].selectionEnd) : document.selection && document.selection.createRange && (c = document.selection.createRange(), a = 0 - c.duplicate().moveStart("character", -1e5), b = a + c.text.length), { begin: a, end: b }) }, unmask: function () { return this.trigger("unmask") }, mask: function (c, g) { var h, i, j, k, l, m, n, o; if (!c && this.length > 0) { h = a(this[0]); var p = h.data(a.mask.dataName); return p ? p() : void 0 } return g = a.extend({ autoclear: a.mask.autoclear, placeholder: a.mask.placeholder, completed: null }, g), i = a.mask.definitions, j = [], k = n = c.length, l = null, a.each(c.split(""), function (a, b) { "?" == b ? (n--, k = a) : i[b] ? (j.push(new RegExp(i[b])), null === l && (l = j.length - 1), k > a && (m = j.length - 1)) : j.push(null) }), this.trigger("unmask").each(function () { function h() { if (g.completed) { for (var a = l; m >= a; a++)if (j[a] && C[a] === p(a)) return; g.completed.call(B) } } function p(a) { return g.placeholder.charAt(a < g.placeholder.length ? a : 0) } function q(a) { for (; ++a < n && !j[a];); return a } function r(a) { for (; --a >= 0 && !j[a];); return a } function s(a, b) { var c, d; if (!(0 > a)) { for (c = a, d = q(b); n > c; c++)if (j[c]) { if (!(n > d && j[c].test(C[d]))) break; C[c] = C[d], C[d] = p(d), d = q(d) } z(), B.caret(Math.max(l, a)) } } function t(a) { var b, c, d, e; for (b = a, c = p(a); n > b; b++)if (j[b]) { if (d = q(b), e = C[b], C[b] = c, !(n > d && j[d].test(e))) break; c = e } } function u() { var a = B.val(), b = B.caret(); if (o && o.length && o.length > a.length) { for (A(!0); b.begin > 0 && !j[b.begin - 1];)b.begin--; if (0 === b.begin) for (; b.begin < l && !j[b.begin];)b.begin++; B.caret(b.begin, b.begin) } else { for (A(!0); b.begin < n && !j[b.begin];)b.begin++; B.caret(b.begin, b.begin) } h() } function v() { A(), B.val() != E && B.change() } function w(a) { if (!B.prop("readonly")) { var b, c, e, f = a.which || a.keyCode; o = B.val(), 8 === f || 46 === f || d && 127 === f ? (b = B.caret(), c = b.begin, e = b.end, e - c === 0 && (c = 46 !== f ? r(c) : e = q(c - 1), e = 46 === f ? q(e) : e), y(c, e), s(c, e - 1), a.preventDefault()) : 13 === f ? v.call(this, a) : 27 === f && (B.val(E), B.caret(0, A()), a.preventDefault()) } } function x(b) { if (!B.prop("readonly")) { var c, d, e, g = b.which || b.keyCode, i = B.caret(); if (!(b.ctrlKey || b.altKey || b.metaKey || 32 > g) && g && 13 !== g) { if (i.end - i.begin !== 0 && (y(i.begin, i.end), s(i.begin, i.end - 1)), c = q(i.begin - 1), n > c && (d = String.fromCharCode(g), j[c].test(d))) { if (t(c), C[c] = d, z(), e = q(c), f) { var k = function () { a.proxy(a.fn.caret, B, e)() }; setTimeout(k, 0) } else B.caret(e); i.begin <= m && h() } b.preventDefault() } } } function y(a, b) { var c; for (c = a; b > c && n > c; c++)j[c] && (C[c] = p(c)) } function z() { B.val(C.join("")) } function A(a) { var b, c, d, e = B.val(), f = -1; for (b = 0, d = 0; n > b; b++)if (j[b]) { for (C[b] = p(b); d++ < e.length;)if (c = e.charAt(d - 1), j[b].test(c)) { C[b] = c, f = b; break } if (d > e.length) { y(b + 1, n); break } } else C[b] === e.charAt(d) && d++, k > b && (f = b); return a ? z() : k > f + 1 ? g.autoclear || C.join("") === D ? (B.val() && B.val(""), y(0, n)) : z() : (z(), B.val(B.val().substring(0, f + 1))), k ? b : l } var B = a(this), C = a.map(c.split(""), function (a, b) { return "?" != a ? i[a] ? p(b) : a : void 0 }), D = C.join(""), E = B.val(); B.data(a.mask.dataName, function () { return a.map(C, function (a, b) { return j[b] && a != p(b) ? a : null }).join("") }), B.one("unmask", function () { B.off(".mask").removeData(a.mask.dataName) }).on("focus.mask", function () { if (!B.prop("readonly")) { clearTimeout(b); var a; E = B.val(), a = A(), b = setTimeout(function () { B.get(0) === document.activeElement && (z(), a == c.replace("?", "").length ? B.caret(0, a) : B.caret(a)) }, 10) } }).on("blur.mask", v).on("keydown.mask", w).on("keypress.mask", x).on("input.mask paste.mask", function () { B.prop("readonly") || setTimeout(function () { var a = A(!0); B.caret(a), h() }, 0) }), e && f && B.off("input.mask").on("input.mask", u), A() }) } }) });
var prev_but_msg = 'Submit';



/*
* Variables
*/
var cid;
var gclid;
var submitted_form = false;
var modalCompany_opened = false;
var modalEmail_opened = false;
var debug_uni = true;


if (debug_uni) console.log('v1.0.32');


/*
* Utilities
*/
function getUrlParam(name) {
	name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
	var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
	var results = regex.exec(location.search);
	return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}

function equalheight2(group) {
	group = jQuery(group);
	group.css('height', '');
	var tallest = 0;

	group.each(function () {
		var thisHeight = jQuery(this).height();
		if (thisHeight > tallest) {
			tallest = thisHeight;
		}
	});

	if (jQuery(window).width() >= 992) {
		group.parent().height(tallest);
	}
}

//get cookie function
function getCookie(cname) {
	var name = cname + "=";
	var ca = document.cookie.split(';');
	for (var i = 0; i < ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0) == ' ') c = c.substring(1);
		if (c.indexOf(name) == 0)
			return c.substring(name.length, c.length);
	}
	return "";
}

/*
* Actions
*/
function setHiddenFields() {
	jQuery('.mktoForm').each(function () {
		//set afl utm cookie url 
		var afl_last_url_encoded = getCookie('afl_wc_utm_1_utm_url');
		var afl_last_url_decoded = decodeURIComponent(afl_last_url_encoded);
		var params_string =  afl_last_url_decoded.split('?')[1];
		var params = new URLSearchParams(params_string);
		var afl_utm_campaign = params.get('utm_campaign') != null ? params.get('utm_campaign'): '';
		var afl_utm_content = params.get('utm_content') != null ? params.get('utm_content') : '';
		var afl_utm_medium = params.get('utm_medium') != null ? params.get('utm_medium') : '';
		var afl_utm_source = params.get('utm_source');
		var afl_utm_term = params.get('utm_term') != null ? params.get('utm_term') : '';
		var afl_adgroup = params.get('utm_adgroup') != null ? params.get('utm_adgroup') : '';
		var afl_adposition = params.get('adposition') != null ? params.get('adposition') : '';
		var afl_placement = params.get('placement') != null ? params.get('placement') : '';
		var afl_gclid = params.get('gclid') != null ? params.get('gclid') : '';

		console.log(params_string, afl_utm_source,afl_adgroup, afl_utm_term, afl_utm_medium, afl_utm_content, afl_utm_campaign, afl_adposition, afl_placement, afl_gclid);

		//afl utm utm != null, use those values, else use urlparams
		if (params_string !== '') {
			var ols = afl_utm_source + '|' + afl_utm_medium;
			var olsd = afl_utm_campaign + '|' + afl_utm_term + '|' + afl_utm_content + '|' + afl_placement + '|' + afl_adposition + '|' + afl_adgroup;
			var ls = ols;
			var lsd = olsd;
			var uone_ls = ols + '||' + ls;
			var uone_lsd = olsd + '||' + lsd;
			var asset_requested = afl_utm_content;
			var gclid = afl_gclid;
			var cid = '';
			if (typeof ga !== 'undefined' && ga !== 'undefined' && typeof ga.getAll !== 'undefined') {
				try {
					cid = ga.getAll()[0].get('clientId');
				} catch (err) {

				}
			}
			if (debug_uni) {
				console.log('gclid', afl_gclid);
				console.log('cid', cid);
				console.log('ols', ols);
				console.log('olsd', olsd);
			}
			//var cid = (typeof(ga)!=="undefined")?ga.getAll()[0].get('clientId'):'';

			//if(typeof ga !=="undefined") checkGA();

			var hidden_fields = {
				'assetRequested': asset_requested,
				'originalLeadSource': ls,
				'originalLeadSourceDetail': lsd,
				'LeadSource': ls,
				'leadSourceDetail': lsd,
				'uONELS': uone_ls,
				'uONELSD': uone_lsd,
				'gCLID': afl_gclid,
				'cID': cid,
				'routeToFRS': 'false',
				//'accountIDUONE':lsd,
				'adgroup': afl_adgroup,
				'adposition': afl_adposition,
				'utm_campaign': afl_utm_campaign,
				'utm_content': afl_utm_content,
				'utm_medium': afl_utm_medium,
				'placement': afl_placement,
				'utm_source': afl_utm_source,
				'utm_term': afl_utm_term,
				'can_submit': 0,
				'discard': 'false'
			};
		} else {
			var ols = getUrlParam('utm_source') + '|' + getUrlParam('utm_medium');
			var olsd = getUrlParam('utm_campaign') + '|' + getUrlParam('utm_term') + '|' + getUrlParam('utm_content') + '|' + getUrlParam('placement') + '|' + getUrlParam('adposition') + '|' + getUrlParam('adgroup');
			var ls = ols;
			var lsd = olsd;
			var uone_ls = ols + '||' + ls;
			var uone_lsd = olsd + '||' + lsd;
			var asset_requested = getUrlParam('utm_content');
			var gclid = getUrlParam('gclid');
			var cid = '';
			if (typeof ga !== 'undefined' && ga !== 'undefined' && typeof ga.getAll !== 'undefined') {
				try {
					cid = ga.getAll()[0].get('clientId');
				} catch (err) {

				}
			}
			if (debug_uni) {
				console.log('gclid', gclid);
				console.log('cid', cid);
				console.log('ols', ols);
				console.log('olsd', olsd);
			}
			//var cid = (typeof(ga)!=="undefined")?ga.getAll()[0].get('clientId'):'';

			//if(typeof ga !=="undefined") checkGA();

			var hidden_fields = {
				'assetRequested': asset_requested,
				'originalLeadSource': ls,
				'originalLeadSourceDetail': lsd,
				'LeadSource': ls,
				'leadSourceDetail': lsd,
				'uONELS': uone_ls,
				'uONELSD': uone_lsd,
				'gCLID': gclid,
				'cID': cid,
				'routeToFRS': 'false',
				//'accountIDUONE':lsd,
				'adgroup': getUrlParam('adgroup'),
				'adposition': getUrlParam('adposition'),
				'utm_campaign': getUrlParam('utm_campaign'),
				'utm_content': getUrlParam('utm_content'),
				'utm_medium': getUrlParam('utm_medium'),
				'placement': getUrlParam('placement'),
				'utm_source': getUrlParam('utm_source'),
				'utm_term': getUrlParam('utm_term'),
				'can_submit': 0,
				'discard': 'false'
			};
		}


		for (var o in hidden_fields) {
			if (jQuery('input[name="' + o + '"]').length == 0) jQuery("<input>").attr({ type: "hidden", name: o, value: hidden_fields[o] }).appendTo('form.mktoForm');
			else jQuery('input[name="' + o + '"]').val(hidden_fields[o]);
		}
		//for(var o in hidden_fields){
		//                                        jQuery("<input>").attr({ type: "hidden", name: o, value: hidden_fields[o] }).appendTo('form.mktoForm');
		//                        }

	});
}

function checkGA() {
	if (debug_uni) console.log('recheck ga');
	if (typeof ga !== 'undefined' && ga !== 'undefined' && typeof ga.getAll !== 'undefined') {
		try {
			jQuery('#cID').val(ga.getAll()[0].get('clientId'));
		} catch (err) {

		}
	}
	//else setTimeout( checkGA, 1000);
}
if (typeof ga !== 'undefined') ga(function () { checkGA(); });

// Sometimes Company doesn't show initially.  This is a fix for that
var comp_intvl = setInterval(function () {
	if (jQuery('input[name=Company]').length > 0) {
		clearInterval(comp_intvl);
		jQuery('input[name=Company]').blur(function () {
			check_company();
		});
	}
}, 500);

function check_form_fields() {
	if (debug_uni) console.log('starting loop to check form fields');
	var checkform_intvl = setInterval(function () {
		var disable_submit = false;
		var homepage_els = ['freightClass', 'Equipment', 'isUNICustomer', 'weight'];

		// Loop through form fields
		jQuery('input,select').each(function () {
			var el = jQuery(this);

			// Don't look at hidden fields
			if (el.prop('type') != 'hidden') {
				// Don't worry about address 2 field
				if (el.prop('name') !== 'address2' && el.prop('name') !== 's') {

					// If it's blank then disable submit (unless it's form fields on the homepage)
					if (jQuery('input[name=formid]').val() == 1041) {
						if (el.val() == '' && jQuery.inArray(el.prop('name'), homepage_els) && el.closest('.conditionalMktoField').css('display') != 'none') disable_submit = true;
						else if (el.val() == '' && !jQuery.inArray(el.prop('name'))) disable_submit = true;

					} else if (el.val() == '') disable_submit = true;

				}
			}
		});

		if (disable_submit) jQuery('form.mktoForm .mktoButton').prop('disabled', true);
		else jQuery('form.mktoForm .mktoButton').prop('disabled', false);
	}, 500);
}

function check_company() {
	if (debug_uni) console.log('checking comp');
	// Custom validation
	if (jQuery('input[name=Company]').length > 0) {
		var issue_found = false;
		var company = jQuery('input[name=Company]').val().toLowerCase();
		var bad_list = ['abc', 'bbb', 'blah', 'ccc', 'christmas', 'company', 'ddd', 'fu', 'home', 'Home', 'idk', 'individual', 'me', 'mine', 'mr', 'mr.', 'mrs', 'mrs.', 'ms.', 'my business', 'n/a', 'na', 'no', 'no co', 'no company', 'no name', 'name', 'no one', 'non', 'none', 'not a business', 'not applicable', 'not given', 'personal', 'private', 'resedential', 'resident', 'residence', 'residential', 'self', 'self employed', 'student', 'suffix', 'test', 'unishippers', 'ups', 'xxx', 'your company', 'home owned', 'yourself', 'yyy', 'zzz', 'fuck', 'fuck you', 'fuckyou', 'go fuck yourself', 'gofuck', 'fuckoff', 'shit', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
		if (jQuery.inArray(company, bad_list) != -1) issue_found = true;
		else if (company.match(/^[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/0-9]+$/) != null) issue_found = true;
		else if (company.length < 2) issue_found = true;

		if (issue_found && modalCompany_opened == false) {
			modalCompany_opened = true;


			var offset = jQuery('#Company').offset();
			var topY = (offset && offset.top > 0) ? (offset.top - 200) : 200;
			jQuery('html, body').animate({ scrollTop: topY - 50 }, 500);
			jQuery('.hxm_modal').hxm_modal_box({
				top: topY + "px",
			});
			return false;
		} else return true;
	} else return true;
}


// Sometimes Email doesn't show initially.  This is a fix for that
var emailIntvl1 = setInterval(function () {
	if (jQuery('input[name=Email]').length > 0) {
		if (debug_uni) console.log('found Email');
		clearInterval(emailIntvl1);
		jQuery('input[name=Email]').blur(function () {
			check_email();
		});
	}
}, 500);

function check_email() {
	if (debug_uni) console.log('checking eml');
	if (jQuery('input[name=Email]').length > 0) {
		var issue_found = false;
		var email = jQuery('input[name=Email]').val().toLowerCase().split('@');
		var email_end = (email.length > 1) ? email[1] : '';
		var bad_list = ['outlook.com', 'gmail.com', 'msn.com', 'aol.com', 'hotmail.com', 'yahoo.com', 'comcast.net', 'icloud.com', 'centurylink.net', 'me.com', 'ymail.com', 'att.net', 'lycos.com'];

		if (jQuery.inArray(email_end, bad_list) != -1) issue_found = true;

		if (issue_found && modalEmail_opened == false) {
			modalEmail_opened = true;
			var offset = jQuery('#Email').offset();
			var topY = (offset && offset.top > 0) ? (offset.top - 100) : 200;
			jQuery('html, body').animate({ scrollTop: topY - 50 }, 500);

			jQuery('.hxm_modal').hxm_modal_box({
				height: "300",
				top: topY + "px",
				title: 'ALERT',
				description: "<div>It looks like the email address you entered is from a personal account. Because our shipping solutions are designed for businesses, please confirm that you are a business shipper.</div><div style=\"padding-top:20px\"><div class=\"mktoButtonWrap mktoSimple\"><a href=\"javascript:;\" id=\"hxm_yes_business\"><button class=\"mktoButton\">I'm a Business Shipper</button></a></div></div><div><br>Shipping personal goods? Consider <a href=\https://www.theupsstore.com/\>The UPS Store</a>.</div>"
			});
			return false;
		} else {

			// just check if it's a unishippers email
			if (email_end == 'unishippers.com') {
				var offset = jQuery('#Email').offset();
				var topY = (offset && offset.top > 0) ? (offset.top - 100) : 200;
				jQuery('.hxm_modal').hxm_modal_box({
					height: "200",
					top: topY + "px",
					title: 'ALERT',
					description: "<div>It looks like you have a Unishippers email address. Please DO NOT use this form to submit a test lead. For information about the Marketing Fund program, please visit SupportNet.</div>"
				});
				return false;

			} else return true;
		}
	} else return true;
}

var custIntvl1 = setInterval(function () {
	if (jQuery('select[name=isUNICustomer2]').length > 0) {
		clearInterval(custIntvl1);
		jQuery('select[name=isUNICustomer2]').change(function () {
			check_isUNICustomer2(false);
		});
	}
}, 500);

function check_isUNICustomer2(submitting) {
	if (submitting == true) {
		var offset = jQuery('select[name=isUNICustomer2]').closest('form').find('button[type=submit]').offset();
		var topY = (offset && offset.top > 0) ? (offset.top - 50) : 200;
	} else {
		var offset = jQuery('select[name=isUNICustomer2]').offset();
		var topY = (offset && offset.top > 0) ? (offset.top - 50) : 200;
	}

	// Custom validation
	if (jQuery('select[name=isUNICustomer2]').val() == 'Active' || jQuery('select[name=isUNICustomer2]').val() == 'Yes' || jQuery('select[name=isUNICustomer2]').val() == 'No, but my organization does') {
		var desc = "This form is meant for new or inactive customers only. Please <a href=\https://my.unishippers.com/eship/Login.action\ style=\"color:#BF311A;\">login to your account</a> or reach out to your Unishippers franchise location to receive a quote that is specific to your custom pricing program.";

		if (jQuery('select[name=isUNICustomer2]').val() == 'No, but my organization does') {
			desc = 'This form is meant for new or inactive customers only. Please call 1.800.999.8721 to be set up with a Unishippers account and receive a quote that is specific to your custom pricing program.';
		}

		jQuery('.hxm_modal').hxm_modal_box({
			height: "185",
			top: topY + "px",
			title: 'Whoops!',
			description: desc
		});
		return false;
	} else return true;

}


function onloadCallback() {
	if (debug_uni) console.log('recaptcha callback called');
	setTimeout(function () {
		if (jQuery('#mktoForm_1009').length != 1) complete_event_setup();
	}, 200);
}


function complete_event_setup() {
	if (debug_uni) console.log('complete event setup called 2');

	setHiddenFields();

	// Check company
	if (jQuery('input[name=Company]').length > 0) {
		jQuery('input[name=Company]').blur(function () {
			check_company();
		});
	}

	// Check Email
	if (jQuery('input[name=Email]').length > 0) {
		jQuery('input[name=Email]').blur(function () {
			check_email();
		});
	}



	jQuery('button[type=submit].mktoButton').text(prev_but_msg);


	jQuery('form.mktoForm .mktoButton').prop('disabled', true);
	check_form_fields();


	// when it's any of these specific forms do this
	if (debug_uni) console.log('form ID: ' + page_form_id);
	var ty_url = '';

	// Forms requiring captcha
	// if(form.getId()==1074 || form.getId()==1068 || form.getId()==1032 || form.getId()==1041 || form.getId()==1071 || form.getId()==1075){
	var recaptcha_form_ids = [1074, 1068, 1032, 1041, 1071, 1075];
	if (recaptcha_form_ids.indexOf(page_form_id) >= 0) {
		// Insert the recap div after the last form row
		jQuery('.mktoLastField').after('<div id="recaptcha" style="padding-bottom:20px;"></div>');

		setTimeout(function () {
			grecaptcha.render('recaptcha', {
				'sitekey': '6LcvthUUAAAAAARI-4RO-xYWsImmgZAtmisPT_rX'
			});
			// Validate form based on Recap
			jQuery('form.mktoForm .mktoButton').click(function () {
				var v = grecaptcha.getResponse();
				if (v.length == 0) {
					event.preventDefault();
					jQuery('form.mktoForm .mktoButton').prop('disabled', true);
					// You can put some css error response here if you want
				} else {
					jQuery('input[name="recaptcha_response_field"]').val(jQuery('#g-recaptcha-response').val());
					//jQuery('input[name="recaptcha_response_field"]').val( 'HyperX:EO82SIOQ67' );//jQuery('#g-recaptcha-response').val()
					if (jQuery('input[name="can_submit"]').val() == 1) jQuery('form.mktoForm .mktoButton').prop('disabled', false);
				}
			});
		}, 1000);


		if (debug_uni) console.log('checking thank you url');
		if (typeof thankyou_url !== 'undefined' && thankyou_url > '' && debug_uni) console.log('found thank you url');
	}






	jQuery(document).on('click', 'form.mktoForm .mktoButton', function (e) {
		e.preventDefault();

		if (debug_uni) console.log('submitting');
		if (jQuery('.mktoButton').closest('form').prop('id') != 'mktoForm_1009') {
			jQuery('.mktoButton').html('Sending...');
			jQuery('.mktoButton').prop('disabled', true);


			// if(typeof ga!== 'undefined' && ga!=='undefined'){
			//     cid = ga.getAll()[0].get('clientId');
			//     jQuery('input[name="cID"]').val(ga.getAll()[0].get('clientId'));
			// }




			if (check_company() == false) return false;
			if (check_email() == false) return false;
			if (check_isUNICustomer2(true) == false) return false;






			// Update ols/olsd
			if (jQuery('input[name="can_submit"]').val() == 0) {
				if (debug_uni) console.log('submit 1');
				// $('form.mktoForm .mktoButton').prop('disabled', true);
				// jQuery.ajax({
				//   url:get_ols_url,
				//   data:{ email:jQuery('input[name="Email"]').val() },
				//   cache: false,
				//   type:'post'
				// }).done(function(result){

				if (debug_uni) console.log('submit 1 - complete');
				if (jQuery('#recaptcha').length == 1 && jQuery('#g-recaptcha-response').val() == '') {
					alert('Captcha is required');
					jQuery('.mktoButton').html(prev_but_msg);
					jQuery('.mktoButton').prop('disabled', false);
				} else {
					jQuery('form.mktoForm .mktoButton').prop('disabled', false);

					jQuery('input[name="can_submit"]').val(1);


					if (debug_uni) console.log('submit 2');
					// form.onValidate(function(status) {
					//                 if(status==true && submitted_form==false){
					if (debug_uni) console.log('checking thank you url');
					if (typeof thankyou_url !== 'undefined' && thankyou_url > '') {
						submitted_form = true;

						var ty_url = 'contactFirstName=' + escape(jQuery('#FirstName').val());
						ty_url += '&contactLastName=' + escape(jQuery('#LastName').val());
						ty_url += '&contactPhone=' + escape(jQuery('#Phone').val());
						ty_url += '&contactEmail=' + escape(jQuery('#Email').val());
						ty_url += '&companyName=' + escape(jQuery('#Company').val());
						ty_url += '&companyAddress=' + escape(jQuery('#Address').val());
						ty_url += '&companyCity=' + escape(jQuery('#City').val());
						ty_url += '&companyState=' + escape(jQuery('#State').val());
						ty_url += '&companyZip=' + escape(jQuery('#PostalCode').val());
						//ty_url+= '&gclid='+escape(jQuery('input[name="gCLID"]').val());
						ty_url += '&cid=' + escape(jQuery('input[name="cID"]').val());
						ty_url += '&referrerURL=' + escape(location.href);
						ty_url += '&responseType=HTML';

						updateRouteToFRS();
						updateDiscard();
						ty_url += '&routeToFRS=' + escape(jQuery('input[name="routeToFRS"]').val());
						ty_url += '&discard=' + escape(jQuery('input[name="discard"]').val());

						var product_interest = '';
						if (jQuery('select[name="productInterest"]').length > 0) product_interest = jQuery('select[name="productInterest"]').val();
						if (jQuery('input[name="productInterest"]').length > 0) product_interest = jQuery('input[name="productInterest"]').val();

						// optional
						if (typeof jQuery('input[name="leadSource"]').val() !== "undefined") ty_url += '&leadSource=' + escape(jQuery('input[name="LeadSource"]').val());
						if (typeof jQuery('input[name="leadSourceDetail"]').val() !== "undefined") ty_url += '&leadSourceDetail=' + escape(jQuery('input[name="leadSourceDetail"]').val());
						if (typeof jQuery('input[name="originalLeadSource"]').val() !== "undefined") ty_url += '&originalLeadSource=' + escape(jQuery('input[name="originalLeadSource"]').val());
						if (typeof jQuery('input[name="originalLeadSourceDetail"]').val() !== "undefined") ty_url += '&originalLeadSourceDetail=' + escape(jQuery('input[name="originalLeadSourceDetail"]').val());
						if (typeof jQuery('input[name="Address2"]').val() !== "undefined") ty_url += '&companyAddress2=' + escape(jQuery('#Address2').val());
						if (typeof jQuery('input[name="assetRequested"]').val() !== "undefined") ty_url += '&assetRequested=' + escape(jQuery('input[name="assetRequested"]').val());
						if (typeof jQuery('input[name="freightClass"]').val() !== "undefined") ty_url += '&freightClass=' + escape(jQuery('#freightClass').val());
						if (typeof jQuery('input[name="requestType"]').val() !== "undefined") ty_url += '&requestType=' + escape(jQuery('input[name="requestType"]').val());
						else if (typeof jQuery('select[name="requestType"]').val() !== "undefined") ty_url += '&requestType=' + escape(jQuery('select[name="requestType"]').val());
						if (typeof jQuery('input[name="postalCodeTo"]').val() !== "undefined") ty_url += '&toZip=' + escape(jQuery('input[name="postalCodeTo"]').val());
						if (typeof jQuery('input[name="postalCodeFrom"]').val() !== "undefined") ty_url += '&fromZip=' + escape(jQuery('input[name="postalCodeFrom"]').val());
						if (typeof jQuery('input[name="shipmentNotes"]').val() !== "undefined") ty_url += '&notes=' + escape(jQuery('input[name="shipmentNotes"]').val());
						if (typeof jQuery('input[name="Equipment"]').val() !== "undefined") ty_url += '&Equipment=' + escape(jQuery('input[name="Equipment"]').val());
						if (typeof jQuery('input[name="weight"]').val() !== "undefined") ty_url += '&weight=' + escape(jQuery('input[name="weight"]').val());
						if (product_interest > '') ty_url += '&productInterest=' + escape(product_interest);
						if (typeof jQuery('select[name="isUNICustomer"]').val() !== "undefined") ty_url += '&upsCustomer=' + escape(jQuery('select[name="isUNICustomer"]').val());

						// add captcha token
						if (jQuery('#g-recaptcha-response').val() !== "undefined") ty_url += '&captchaCode=' + jQuery('#g-recaptcha-response').val();

						// send them to url
						var discard_url = 'https://www.unishippers.com/confirmation-thanks/';

						if (jQuery("[name=discard]").val() === 'true') {
							if (debug_uni) console.log('discard: ', discard_url + '?data=' + ty_url);
							window.location = discard_url + '?data=' + ty_url;

						} else {
							if (debug_uni) console.log('thankyou: ', thankyou_url + '?data=' + ty_url);
							window.location = thankyou_url + '?data=' + ty_url;
						}
					}
				}
			}
		}
		return false;
	});
}


// Check equal heights
setInterval(function () {
	equalheight2('.eqcol');
}, 500);


/*
* YouTube to Marketo
*
* AUTHOR: HyperXMedia
* UPDATED: June 27, 2017
* VERSION: 1.0.0
* DESCRIPTION: Script will search for iframes and attach listeners for events from YouTube.  When events happen, they are then sent to Marketo via the Munchkin code (so be sure to have that installed).
*
*/


// Add API to page
var tag = document.createElement('script');
tag.src = 'https://www.youtube.com/iframe_api';
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);



// Get YT ID
function YouTubeGetID(url) {
	url = url.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
	return (url[2] !== undefined) ? url[2].split(/[^0-9a-z_\-]/i)[0] : url[0];
}





var player, timer, timeSpent = [];
function onYouTubeIframeAPIReady() {
	if (debug_uni) console.log('yt ready');
	var iframes = document.getElementsByTagName('iframe');

	for (var i in iframes) {
		if (iframes.hasOwnProperty(i)) {
			if (iframes[i].src.indexOf('?enablejsapi=1') != -1) {
				player = new YT.Player(iframes[i], {
					events: {
						'onStateChange': onPlayerStateChange
					}
				});
				player.vid_id = YouTubeGetID(iframes[i].src);
			}
		}
	}
}


// Event for when states change
function onPlayerStateChange(event) {
	var video = event.target;
	if (debug_uni) console.log('state', event.data);
	if (event.data === 1) { // Started playing
		if (!video.vid_events_list) video.vid_events_list = [25, 50, 75, 90, 999];

		timer = setInterval(function () { record(video); }, 100);
	} else {
		clearInterval(timer);
	}
}


// Interval called and tracks percent of video
function record(video) {
	var p = video.getCurrentTime(); //get video position
	var d = video.getDuration(); //get video duration
	var percent = Math.round(p / d * 100); //calculate % complet
	if (percent > video.vid_events_list[0]) {
		var event_per = video.vid_events_list.shift();
		if (debug_uni) console.log(video.vid_id + '|' + event_per + '%');

		// Send to Marketo
		Munchkin.munchkinFunction('visitWebPage', {
			url: window.location.href,
			params: 'youTubeVideoStatus=' + escape(video.vid_id + '|' + event_per + '%')
		});
	}
}


// Get ID's
var player_list = {};
jQuery(function () {
	if (debug_uni) console.log('setup');
	var iframe = document.querySelectorAll('iframe');
	for (i = 0; i < iframe.length; i++) {
		if (iframe[i].src.includes("youtube.com")) {

			var yt_id = YouTubeGetID(iframe[i].src);
			if (debug_uni) console.log('YouTube ID: ' + yt_id);
			iframe[i].src = iframe[i].src + '?enablejsapi=1'
		}
	}
});


/*
* Swap utm_source and utm_medium in links with what's in the pages' url
*
*/
jQuery('a').each(function () {
	var url = jQuery(this).prop('href');
	if (getUrlParam('utm_medium') > '') url = url.replace(/(utm_medium=)[^\&]+/, '$1' + getUrlParam('utm_medium'));
	if (getUrlParam('utm_source') > '') url = url.replace(/(utm_source=)[^\&]+/, '$1' + getUrlParam('utm_source'));
	jQuery(this).prop('href', url);
});


/* UNI Script */
function updateDiscard() {
	jQuery('[name=discard]').val(false);

	var discard = false;

	var companyName = jQuery('[name=Company]').val();
	if (companyName > '') companyName = companyName.toLowerCase();
	var companyNamesToDiscard = ['abc', 'bbb', 'blah', 'ccc', 'christmas', 'company', 'ddd', 'fu', 'home', 'Home', 'idk', 'individual', 'me', 'mine', 'mr', 'mr.', 'mrs', 'mrs.', 'ms.', 'my business', 'n/a', 'na', 'no', 'no co', 'no company', 'no name', 'name', 'no one', 'non', 'none', 'not a business', 'not applicable', 'not given', 'personal', 'private', 'resedential', 'resident', 'residence', 'residential', 'self', 'self employed', 'student', 'suffix', 'test', 'unishippers', 'ups', 'xxx', 'your company', 'yourself', 'home owned', 'yyy', 'zzz', 'fuck', 'fuck you', 'fuckyou', 'go fuck yourself', 'example', 'example company', 'gofuck', 'fuckoff', 'shit', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
	for (var i = 0; i < companyNamesToDiscard.length; i++) {
		if (companyNamesToDiscard[i] === companyName) {
			discard = true;
			break;
		}
	}

	var contactEmail = jQuery('[name=Email]').val().toLowerCase();
	var contactEmailDomainsToDiscard = ['hotmail', 'outlook', 'aol', 'yahoo', 'comcast', 'test', 'mail', 'unishippers', 'ups', 'wwex', 'fastmail', 'centurylink', 'me', 'cox', 'bellsouth', 'ymail', 'att', 'dxc-corps', 'oceanautoparts', 'oceanmotorparts'];

	for (var i = 0; i < contactEmailDomainsToDiscard.length; i++) {
		if (contactEmail.indexOf('@' + contactEmailDomainsToDiscard[i] + '.') >= 0) {
			discard = true;
			break;
		}
	}

	jQuery('[name=discard]').val(discard);

	if (discard) {
		jQuery('[name=routeToFRS]').val(false);
	}
}


function updateRouteToFRS() {
	jQuery('[name=routeToFRS]').val(false);

	var companyName = jQuery('[name=Company]').val();
	if (companyName > '') companyName = companyName.toLowerCase();
	var companyNamesToRoute = ['.', 'unishippers'];

	for (var i = 0; i < companyNamesToRoute.length; i++) {
		if (companyNamesToRoute[i] === companyName) {
			jQuery('[name=routeToFRS]').val(true);
			return;
		}
	}

	var contactEmail = jQuery('[name=Email]').val().toLowerCase();
	var contactEmailDomainsToRoute = ['gmail'];

	for (var i = 0; i < contactEmailDomainsToRoute.length; i++) {
		if (contactEmail.indexOf('@' + contactEmailDomainsToRoute[i] + '.') >= 0) {
			jQuery('[name=routeToFRS]').val(true);
			return;
		}
	}
}


/*
* Modal
*
*/
(function ($) {

	// Defining our jQuery plugin


	$.fn.hxm_modal_box = function (prop) {

		// Default parameters
		var options = $.extend({
			height: "320",
			width: "500",
			title: "ALERT",
			description: "We didn't recognize the business name you entered. Because our shipping solutions are designed for businesses, please confirm that you are a <span class=\"nowrap\">business shipper.</span><br><div style=\"padding-top:20px\"><div class=\"mktoButtonWrap mktoSimple\"><a href=\"javascript:;\" id=\"hxm_yes_business\"><button class=\"mktoButton\">I'm a Business Shipper</button></a></div><div style=\"margin-top:18px;\">Shipping personal goods? Consider <a href=\https://www.theupsstore.com/\>The UPS Store</a>.</div></div>",
			top: "200px",
			left: "50%",
		}, prop);


		add_block_page();
		add_popup_box();
		add_styles();

		jQuery('.hxm_modal_box').fadeIn();


		function add_styles() {
			jQuery('.nowrap').css({
				'white-space': 'nowrap'
			});

			jQuery('.hxm_modal_box').css({
				'position': 'absolute',
				'left': options.left,
				'top': options.top,
				'display': 'none',
				'margin-left': '-250px',
				'min-height': options.height + 'px',
				'width': options.width + 'px',
				'border': '1px solid #fff',
				'box-shadow': '0px 2px 7px #292929',
				'-moz-box-shadow': '0px 2px 7px #292929',
				'-webkit-box-shadow': '0px 2px 7px #292929',
				'border-radius': '10px',
				'-moz-border-radius': '10px',
				'-webkit-border-radius': '10px',
				'background': '#f2f2f2',
				'z-index': '50',
			});
			jQuery('.hxm_modal_close').css({
				'position': 'relative',
				'top': '-25px',
				'left': '20px',
				'float': 'right',
				'display': 'block',
				'height': '50px',
				'width': '50px',
				'background': 'url(https://www.unishippers.com/content/images/close.png) no-repeat',
			});
			jQuery('.hxm_inner_modal_box .mktoButton').css({
				'font-family': 'Helvetica, Arial, sans-serif',
				'background-image': 'none',
				'border': 'none',
				'background-color': '#BF311A',
				'color': 'white',
				'text-transform': 'uppercase',
				'font-size': '16px',
				'padding': '12px 24px',
				'display': 'inline-block',
				'border-radius': '4px'
			});
			/*Block page overlay*/
			var pageHeight = jQuery(document).height();
			var pageWidth = jQuery(window).width();

			jQuery('.hxm_block_page').css({
				'position': 'absolute',
				'top': '0',
				'left': '0',
				'background-color': 'rgba(0,0,0,0.6)',
				'height': pageHeight,
				'width': pageWidth,
				'z-index': '10'
			});
			jQuery('.hxm_inner_modal_box').css({
				'background-color': '#fff',
				//'height':(options.height - 30) + 'px',
				'width': (options.width - 30) + 'px',
				'padding': '15px 10px',
				'margin': '15px',
				'border-radius': '10px',
				'-moz-border-radius': '10px',
				'-webkit-border-radius': '10px'
			});

			if (jQuery(window).width() < 510) {
				jQuery('.hxm_modal_box').css({
					'width': '300px',
					'margin-left': '-150px'
				});
				jQuery('.hxm_inner_modal_box').css({ 'width': '268px' });
				jQuery('.hxm_inner_modal_box p').css({ 'font-size': '14px' });
				jQuery('.hxm_inner_modal_box button.mktoButton').css({
					'font-size': '14px',
					'padding': '6px 12px'
				});
			}
		}

		function add_block_page() {
			var block_page = jQuery('<div class="hxm_block_page"></div>');

			jQuery(block_page).appendTo('body');
		}

		function add_popup_box() {
			var pop_up = jQuery('<div class="hxm_modal_box"><a href="javascript:;" class="hxm_modal_close"></a><div class="hxm_inner_modal_box" style="text-align:center"><h2>' + options.title + '</h2><div style="font-size:18px;">' + options.description + '</div></div></div>');
			jQuery(pop_up).appendTo('.hxm_block_page');

			jQuery('.hxm_modal_close, #hxm_yes_business').click(function () {
				jQuery(this).parent().fadeOut().remove();
				jQuery('.hxm_block_page').fadeOut().remove();
				jQuery('.mktoButton').html(prev_but_msg);
				jQuery('.mktoButton').prop('disabled', false);
			});
		}

		return this;
	};



	var found_phone = false;
	var find_phone_int = setInterval(function () {
		if (jQuery('#Phone').length > 0 && !found_phone) {
			found_phone = true;
			phone_mask();
		} else if (jQuery('#Phone').length == 0) found_phone = false;
	}, 1000);



	function phone_mask() {
		jQuery('#Phone').mask('999-999-9999');
		jQuery('#Phone').prop('required', true);
	}

})(jQuery);


jQuery(document).ready(function ($) {
	$(".showhideProductSelect").change(function () {
		if (this.value === 'UPS') {
			$('#isUNICustomerDiv').show();
			$('#weightDiv').show();
			$('#freightClassDiv').hide();
			$('#equipmentDiv').hide();
		}
		else if (this.value === "LTL") {
			$('#isUNICustomerDiv').hide();
			$('#freightClassDiv').show();
			$('#weightDiv').show();
			$('#equipmentDiv').hide();
		}
		else if (this.value === "FTL") {
			$('#isUNICustomerDiv').hide();
			$('#freightClassDiv').hide();
			$('#weightDiv').hide();
			$('#equipmentDiv').show();
		}
	});


	$("#mktoForm_1075 select[name=Equipment]").change(function () {
		if (this.value != '') $('#showhide').show();
		else $('#showhide').hide();
	});

	$("#mktoForm_1032 select[name=isUNICustomer]").change(function () {
		if (this.value != '') $('#showhide').show();
		else $('#showhide').hide();
	});

	$("#mktoForm_1071 select[name=productInterest]").change(function () {
		if (this.value != '') $('#showhide').show();
		else $('#showhide').hide();
	});

	$("#mktoForm_1041 select[name=freightClass]").change(function () {
		if (this.value != '') $('#showhide').show();
		else $('#showhide').hide();
	});


	$(".selectBoxExpandPanel").change(function () {
		$('#showhide').show();
	});

	$(".inputFocusExpandPanel").focus(function () {
		$('#showhide').show();
	});

});



jQuery(document).ready(function ($) {

	function customizeSelects() {
		$("select:not([data-sc-field-name='List Box'])").each(function () {
			var n = $(this),
				e = n.find("option"),
				t = $(this).children("option").length;
			var i = n.next("div.styledSelect");
			$('[selected="selected"]').addClass("selected");
			var o = n.find(".selected");
			n.val() ? n.parent(".select").closest(".form-group, .mktoFieldWrap").addClass("hasValue") : n.parent(".select").closest(".form-group, .mktoFieldWrap").removeClass("hasValue"),
				e.hasClass("selected") ? i.text(o.text()) : i.text(n.children("option").eq(0).text());
			for (var r = $("<ul />", { class: "options" }).insertAfter(i), a = 0; a < t; a++) $("<li />", { text: n.children("option").eq(a).text(), rel: n.children("option").eq(a).val(), tabIndex: "0" }).appendTo(r);
			var s = r.children("li"),
				l = r.children("li:nth-child(2)");
			function c(e) {
				e.stopPropagation();
				e = $(e.target);
				e.next("ul.options").toggle(0).animate({ maxHeight: "30rem" }, 50, "linear"), e.toggleClass("active");
			}
			function d(e) {
				e.stopPropagation();
				var t = $(e.target);
				i.text(t.text()).removeClass("active");
				e = t.attr("rel");
				n.val(e),
					n.trigger("focus"),
					n.trigger("click"),
					n.trigger("input"),
					n.trigger("change"),
					n.trigger("click"),
					n.trigger("blur"),
					r.hide(),
					t.text(),
					n.val(),
					n.val()
						? (n.parent(".select").closest(".form-group, .mktoFieldWrap").addClass("hasValue"),
							n.hasClass("input-validation-error") && (n.removeClass("input-validation-error"), n.parent(".select").next(".field-validation-error").removeClass("field-validation-error").addClass("field-validation-valid")))
						: n.parent(".select").closest(".form-group, .mktoFieldWrap").removeClass("hasValue");
			}
			function u() {
				i.removeClass("active"), r.animate({ maxHeight: "0" }, 50), r.hide();
			}
			i.on("click", function (e) {
				$(this).hasClass("active") ||
					($(this).removeClass("active").next("ul.options").toggle(),
						setTimeout(function () {
							c(e);
						}, 20));
			}),
				i.on("keydown", function (e) {
					13 === e.which || 32 === e.which ? (e.preventDefault(), c(e)) : 40 === e.which ? (e.preventDefault(), $(this).next(".options").find(l).focus()) : 27 === e.which && (e.preventDefault(), u());
				}),
				s.on("click", d),
				s.on("keydown", function (e) {
					13 === e.which || 32 === e.which
						? (e.preventDefault(), d(e))
						: 40 === e.which
							? (e.preventDefault(), $(this).next(s).focus())
							: 38 === e.which
								? (e.preventDefault(), $(this).prev(s).focus())
								: 27 === e.which && (e.preventDefault(), u());
				}),
				$(document).on("click", function (e) {
					u();
				});
		});
	}

	$("input, textarea, select").each(function () {
		var e = $(this);
		e.val() ? e.parent(".form-group, .mktoFieldWrap").addClass("hasValue") : e.parent(".form-group, .mktoFieldWrap").removeClass("hasValue"),
			e.on("focusout", function () {
				e.val() ? e.parent(".form-group, .mktoFieldWrap").addClass("hasValue") : e.parent(".form-group, .mktoFieldWrap").removeClass("hasValue");
			});
	});
});

