nmxSiteAccessibilityR(40, 100);
function nmxSiteAccessibilityR(c, i){
if (c > 0){ c--;window.setTimeout(function(){ nmxSiteAccessibilityR(c--, i); },i); }
/* required for acs.css */
jQuery("html, body").attr("hostname",location.hostname.toLowerCase());
jQuery(".serv_content a.fright").each(function(){
jQuery(this).css("cursor","pointer").attr("xhref",jQuery(this).attr("href"));
jQuery(this).on("click",function(){
document.location = jQuery(this).attr("xhref");
});
jQuery(this).removeAttr("href");
});
if (navigator.userAgent.toLowerCase().indexOf("pope") > -1 || jQuery("#wave5topbar").length || jQuery("#wave_sidebar_container").length || top.location.href != self.location.href){
jQuery("noscript, a[href*='pdf']").remove();
// jQuery("a,form,img,button,:header").remove();
// jQuery("body").prepend("
not checked
");
// document.title = "(not checked)";
}
/* begin custom */
jQuery("a+span.collapse:hidden").remove();
jQuery('[hostname="www.nmxloyaltypromos.com"] [name="state"]').css("color","#333");
jQuery('[hostname="www.imuquin.com"] .sp-current-big').removeAttr("href");
jQuery('[hostname="www.nutramaxlabs.com"] .ui-collapsible-heading-status').remove();
jQuery('[hostname="www.nutramaxlabs.com"] span.ui-icon-loading').remove();
jQuery('[hostname="www.nutramaxlabs.com"] [alt="asia pac"],[hostname="www.nutramaxlabs.com"] [alt="europe"]').attr("alt","");
jQuery('[hostname="www.curaflex.com"] .floatLeft').removeAttr("href");
jQuery('[hostname="www.curaflex.com"] #content, [hostname="www.curaflex.com"] #content-top2').attr("role","main");
jQuery('[hostname="www.curaflex.com"] #footer').attr("role","footer");
/* end custom */
/* common shopify */
jQuery(".quickview:hidden").remove();
jQuery(".actions .addtocart .i").unwrap();
/* wrap in fieldset */
var wrap_in_fieldset_selector = ".swatch.size";
jQuery(wrap_in_fieldset_selector).each(function(){
if (!jQuery(this).parent("fieldset").length){
jQuery(this).wrap('');
}
});
/* add missing legends */
jQuery("fieldset").each(function(){
if (!jQuery(this).find("legend").length){
jQuery(this).prepend('');
}
});
/* remove duplicate labels */
jQuery("[for]").each(function(index){
if (jQuery('[for="'+jQuery(this).attr("for")+'"]').length > 1){
console.log("acs for: "+jQuery('[for="'+jQuery(this).attr("for")+'"]').length+" x "+jQuery(this).attr("for"));
jQuery('[for="'+jQuery(this).attr("for")+'"]:last').remove();
}
});
/* remove orphaned labels */
jQuery("[for]").each(function(index){
if (!jQuery("#"+jQuery(this).attr("for")).length && jQuery(this).attr("for").trim() == jQuery(this).text().trim()){
jQuery(this).remove();
}
});
/* add headings */
jQuery(':header').each(function(){
var level = jQuery(this).prop("tagName").replace("H","");
if (level > 1 && jQuery(this).parents().find("H"+(level-1))){
if (!jQuery(this).prev("h"+(level-1)).length){
jQuery(this).before('h'+(level-1)+'');
}
}
});
/* fix broken same page links */
jQuery('[href*="#"]').not('[href*="javascript"], [href*="maincontent"]').each(function(){
if (!jQuery('[name="'+jQuery(this).attr("href").replace("#","")+'"]').length){
var a = ''+jQuery(this).attr("href")+'';
jQuery("body").prepend(a);
}
});
/* this is ridiculous, but we can do this rather than removing from html */
jQuery("noscript").remove();
/* rather than dismiss all of these, we can do this - just e sure to check PDFs for accessibility */
// jQuery("a[href*='pdf']").each(function(index){
// if (jQuery(this).attr("href").indexOf("javascript")==-1){
// jQuery(this).attr("href",'javascript:(function(){ var i='+index+'; document.location="'+jQuery(this).attr("href")+'"; })();').attr("aria-hidden","true").attr("role","presentation");
// }
// });
/* add missing form field labels */
jQuery("input,select,textarea").not('[type="image"],[type="submit"],[type="reset"],[type="button"],[type="hidden"]').each(function(index){
if (!jQuery(this).filter("[id]").length){
jQuery(this).attr("id","fld"+index);
}
if (jQuery(this).filter("[id]").length){
if (!jQuery("[for='"+jQuery(this).attr("id")+"']").length){
if (jQuery(this).parent().is("label") && !jQuery(this).parent().has("[for]")){
jQuery(this).parent().attr("for",jQuery(this).attr("id"));
} else {
jQuery(this).before('');
}
}
}
});
// Add Skip to content link
if(!jQuery('.skip-to-content-link').length){
jQuery( "body" ).prepend( 'Skip to content' );
jQuery('header') ? jQuery( "header" ).after( '' ) : jQuery("body").children().eq(2).attr("id", "maincontent");
}
/* empty buttons and links */
jQuery("a[href], button").each(function(){
if (jQuery(this).text().trim() == ""){
jQuery(this).append(''+(jQuery(this).attr("title")+" "+jQuery(this).val()).trim()+'');
}
});
/* remove redundant titles */
jQuery("[title]").each(function(){
if (jQuery(this).text() == jQuery(this).attr("title") || jQuery(this).attr("alt") == jQuery(this).attr("title")){
jQuery(this).removeAttr("title");
}
});
/* shopify template fixes */
jQuery('.product-link [src*="noimage"]').parent().remove();
jQuery('.product-name > a').removeAttr("href");
/* fix layout table false-pos */
var non_layout_table_selector = "table";
jQuery(' tbody').prepend('- |
');
/* device dependant handler */
// jQuery('[onclick]').each(function(){
// jQuery(this).attr("onmousedown",jQuery(this).attr("onclick")).removeAttr("onclick");
// });
/* this is ridiculous - noscript cannot be used */
jQuery("noscript").remove();
/* redundant links */
// try {
// jQuery("a[href]").not("[acs]").each(function(index){
// var that = jQuery(this);
// var match = "diff";
// if (jQuery("[href='"+jQuery(this).attr("href")+"']").length > 1 && jQuery(this).not("[acs]")){
// jQuery("[href='"+jQuery(this).attr("href")+"']").attr("acs",1).attr("aria-hidden","true").attr("role","presentation");
// if (
// jQuery(this).parent().prev() == that.parent()
// || jQuery(this).parent() == that.parent()
// || jQuery(this).parent() == that.parent().parent()
// ){ match = "same"; }
// console.log("acs pg dup"+index+": "+jQuery(this).attr("href")+" / "+match+" / "+that.filter(":visible").length);
// }
// });
// } catch(err){
// console.log("acs pg dup: error");
// }
if (jQuery('[hostname="www.denamarin.com"]').length){
ScrollToMainLink();
jQuery('.skip-link').attr("href","#about-denamarin");
}
if (jQuery('[hostname="www.nmxwellnessinnovations.com"]').length){
ScrollToMainLink();
}
if (jQuery('[hostname="www.denosyl.com"]').length){
ScrollToMainLink();
jQuery('.skip-link').attr("href","javascript:ClickHowItWorksOnDenosyl();");
}
if (jQuery('[hostname="www.cobalequin.com"]').length){
jQuery("html").attr("lang","en");
jQuery(".center.h24.LH").attr("role","main");
ScrollToMainLink();
}
if (jQuery('[hostname="www.curaflex.com"]').length){
ScrollToMainLink();
}
if (jQuery('[hostname="www.consil.info"]').length){
ScrollToMainLink();
}
if (jQuery('[hostname="www.nutramaxmanufacturing.com"]').length){
ScrollToMainLink();
jQuery('.skip-link').attr("href","#about");
}
if (jQuery('[hostname="www.marinplusliver.com"]').length){
ScrollToMainLink();
jQuery('.skip-link').attr("href","#whymarinplus");
}
if (jQuery('[hostname="www.solliquin.com"]').length){
ScrollToMainLink();
jQuery('.skip-link').attr("href","javascript:ClickLink('#signsjump');");
}
if (jQuery('[hostname="www.nmxloyaltypromos.com"]').length){
jQuery(".form1").attr("role","main");
ScrollToMainLink();
}
if (jQuery('[hostname="loyalty.nutramaxlabs.com"]').length){
jQuery("#contact").attr("role","main");
ScrollToMainLink();
}
if (jQuery('[hostname="www.proviable.com"]').length){
jQuery("#slide4, #when-to-use-padding, #faq-content-padding").attr("role","main");
ScrollToMainLink();
}
if (jQuery('[hostname="www.imuquin.com"]').length){
jQuery(".maintext > .w3-content:first").attr("role","main");
ScrollToMainLink();
}
if (jQuery('[hostname="www.nutramaxlabs.com"]').length){
jQuery("[role='main']").removeAttr("role");
jQuery("#internationalMenu").attr("role","main");
ScrollToMainLink();
}
/* cleanup */
jQuery("[acs]:hidden").css("font-size","18px");
/* fix redundant alt tags */
jQuery('[alt]').each(function(){
if (jQuery(this).parent().text().indexOf(jQuery(this).attr("alt")) > -1){
jQuery(this).attr("alt","").attr("title","");
}
});
/* alt tags */
jQuery("img:not([alt]), button").each(function(){
var alt="";
jQuery(this).attr("alt", alt);
if (jQuery(this).filter("[src]").length){
alt = jQuery(this).attr("src").replace(".png","").replace(".svg","").replace(".jpg","").replace(".gif","").replace(/[-_]/g," ").replace(/^.*[\\\/]/, '');
console.log("acs alt "+alt);
jQuery(this).attr("alt", alt);
} else {
jQuery(this).attr("alt", "button");
}
});
jQuery('[hostname="www.marinplusliver.com"] a:contains("Do Not Sell")').unbind();
/* end accessibility */
}
function ClickLink(href){
jQuery('[href="'+href+'"]').click();
}
function ClickHowItWorksOnDenosyl(){
jQuery('[href="#howdoes"]').click();
}
//
function ScrollToMainLink(){
jQuery(".skip-to-content-link, a:contains('Skip to main')").not(".skip-link").remove();
// if (jQuery('[hostname="www.imuquin.com"]').length){
// jQuery(".maintext > .w3-content:first").attr("role","main");
// ScrollToMainLink();
// }
if (!jQuery(".skip-link").length){
jQuery("body").before('Skip to content');
jQuery("body").append('');
}
jQuery(".skip-link").attr("style","");
if (!jQuery("body[main]").length){
if (jQuery("[main]").length){ jQuery("body").attr("main","[main]"); }
else if (jQuery("[role='main']").length){ jQuery("body").attr("main","[role='main']"); }
else if (jQuery("#main").length){ jQuery("body").attr("main","#main"); }
else if (jQuery("section:first").length){ jQuery("body").attr("main","section:first"); }
else if (jQuery("div.main").length){ jQuery("body").attr("main","div.main"); }
else if (jQuery("[name='about-container']").length){ jQuery("body").attr("main","div.main"); }
else if (jQuery("section#one").length){ jQuery("body").attr("main","section#one"); }
else { jQuery("body").attr("main","[role='main']"); }
jQuery(jQuery("body").attr("main")).attr("role","main");
console.log("acs main: "+jQuery("body").attr("main"));
}
}
function ScrollToMain(){
console.log("acs scroll to main "+jQuery("body").attr("main"));
jQuery([document.documentElement, document.body]).animate({
scrollTop: jQuery(jQuery("body").attr("main")).offset().top
}, 100);
}
/* jb20200921a - added speak function for screen readers */
function Speak(text){ console.log("acs speak "+text); jQuery("#speakerbox").text(" "); window.setTimeout(function(){ jQuery("#speakerbox").text(text); }, 100); }
AddSpeakers();
function AddSpeakers(){
if (!jQuery("#speakerbox").length){ console.log("acs created speaker box"); jQuery("body").append(''); }
jQuery('[hostname="www.imuquin.com"] .sliderarrows .prev').not("[speak]").attr("speak","previous").off("click").on("click",function(){ Speak("Previous slide"); });
jQuery('[hostname="www.imuquin.com"] .sliderarrows .next').not("[speak]").attr("speak","next").off("click").on("click",function(){ Speak("Next slide"); });
window.setTimeout(function(){ AddSpeakers(); }, 1000);
}
function CheckTabNav(){
$("html").off("keyup").on("keyup",function(e) {
var keyCode = e.keyCode;
if (keyCode == 9) {
e.preventDefault();
if (!$("body[tabage]").length){ $("body").attr("tabage",0); }
$("body").attr("tabage", ($("body").attr("tabage")*1)+1);
console.log("acs tabage "+$("body").attr("tabage"));
}
});
}
function CheckMouseNav(){
$("body").unbind("mousemove").on("mousemove",function(e) {
if (!$("body[mouseage]").length){ $("body").attr("mouseage",0); }
$("body").attr("mouseage", ($("body").attr("mouseage")*1)+(e.pageX*1)+(e.pageY*1));
console.log("acs mouseage "+$("body").attr("mouseage"));
});
}
function luminanace(r, g, b){
var a = [r, g, b].map(function (v) {
v /= 255;
return v <= 0.03928 ? v / 12.92 : Math.pow( (v + 0.055) / 1.055, 2.4 );
});
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
}
function contrast(rgb1, rgb2){
var lum1 = luminanace(rgb1[0], rgb1[1], rgb1[2]);
var lum2 = luminanace(rgb2[0], rgb2[1], rgb2[2]);
var brightest = Math.max(lum1, lum2);
var darkest = Math.min(lum1, lum2);
return (brightest + 0.05) / (darkest + 0.05);
}
//contrast([255, 255, 255], [255, 255, 0]); // 1.074 for yellow
//contrast([255, 255, 255], [0, 0, 255]); // 8.592 for blue
var hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
function rgb2hex(rgb){
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
function hex(x) {
return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];
}
function invertColor(hex, bw){
if (hex.indexOf('#') === 0) {
hex = hex.slice(1);
}
// convert 3-digit hex to 6-digits.
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
if (hex.length !== 6) {
throw new Error('Invalid HEX color.');
}
var r = parseInt(hex.slice(0, 2), 16),
g = parseInt(hex.slice(2, 4), 16),
b = parseInt(hex.slice(4, 6), 16);
if (bw) {
// http://stackoverflow.com/a/3943023/112731
return (r * 0.299 + g * 0.587 + b * 0.114) > 186 ? '#000000' : '#FFFFFF';
}
// invert color components
r = (255 - r).toString(16);
g = (255 - g).toString(16);
b = (255 - b).toString(16);
// pad each with zeros and return
return "#" + padZero(r) + padZero(g) + padZero(b);
}