//FF10+ - temporary browser check fix for orderTools if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits); if(getCookie("browserIsSupported") == "") { var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number if (ffversion>=10) { setCookie("browserIsSupported","true","365"); } } } //create or delete remember me cookie function setRememberMeCookie() { //set cookie if($("#rememberme").is(':checked')) { var userNme = document.headerSISU.username.value; document.cookie="cpo_cpidRemember=" +userNme +"; expires=Thu, 23 Dec 2083 12:00:00 UTC; path=/"; } else { //delete cookie document.cookie="cpo_cpidRemember=; expires=Thu, 2 Dec 2010 12:00:00 UTC; path=/"; } } //Old method should be removed but for now we will just call the new method. function setLoginCookie(c_name, value, expiredays, domain) { setRememberMeCookie(); } function setCookie(c_name, value, expiredays) { var exdate = new Date(); var expiredate; exdate.setDate(exdate.getDate() + expiredays); if(expiredays != 0){ expiredate = exdate.toGMTString(); }else{ expiredate = 0; } document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + expiredate + ";path=/"); } function getCookie(c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) { c_end = document.cookie.length; } return unescape(document.cookie.substring(c_start, c_end)); } } return ""; } if (getCookie("ct") == "") { if (window.location.pathname != GLOBALOBJ.contextPath + "/mc/content/error/cookieDisabled.jsf") { setCookie("ct", "true", 1); if (getCookie("ct") == "") { window.location = GLOBALOBJ.contextPath + "/mc/content/error/cookieDisabled.jsf"; } } } function resetFeaturedItems() { $("#verticalTabsOptions").removeAttr("style"); if ($("#verticalTabsOptions").height() < $("#verticalTabsContent").height()) { $("#verticalTabsOptions").css("height", $("#verticalTabsContent").height()); } } function swapSubmit() { var inputArr = document.getElementsByTagName("input"); for (var i = 0; i < inputArr.length; i++) { if ((document.styleSheets.length) && (inputArr[i].type == "submit") && (inputArr[i].src)) { // change type from submit to image, in order to display graphical submit button var inputSubmit = inputArr[i]; // copy previous submit button attributes to new submit, and replace element var imageSubmit = document.createElement("input"); imageSubmit.type = "image"; if (inputSubmit.size) { imageSubmit.size = inputSubmit.size; } if (inputSubmit.value) { imageSubmit.value = inputSubmit.value; } if (inputSubmit.name) { imageSubmit.name = inputSubmit.name; } if (inputSubmit.id) { imageSubmit.id = inputSubmit.id; } if (inputSubmit.className) { imageSubmit.className = inputSubmit.className; } if (inputSubmit.src) { imageSubmit.src = inputSubmit.src; } inputSubmit.parentNode.replaceChild(imageSubmit, inputSubmit); } } } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } function openNav(id) { var navList = $("#navigation li a"); var contentList = $("#layout .content"); navList.removeClass("active"); contentList.hide(); $(navList[id - 1]).addClass("active"); $(contentList[id - 1]).show(); } function showContent(content) { $('#hiddenContent').children().hide(); $('#' + content).show(); } //old width=670 function popitup(url) { newwindow=window.open(url,'name','top=150,left=200,height=660,width=780,scrollbars=1'); if (window.focus) {newwindow.focus()} } //old width=670 function popituptandc(url) { newwindow=window.open(url,'name','top=150,left=200,height=470,width=780,scrollbars=1'); if (window.focus) {newwindow.focus()} } function popitupsized(url,h,w) { newwindow=window.open(url,'name','top=150,left=200,height='+h+',width='+w+',scrollbars=1'); if (window.focus) {newwindow.focus()} } function getCookieFromAC(c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) { c_end = document.cookie.length; } return unescape(document.cookie.substring(c_start, c_end)); } } return ""; } function getArrayFromCookie(name) { var ary = ['']; //to make sure we never retun an arry of null; var ent = getCookieFromAC(name); if (ent) { ary = ent.split('^'); } $.each(ary, function( i, value ){ if ($.trim(value)==''){ ary.splice(i,1); } }); return ary; } function resetReg3(){ // if region3 exists, do this, otherwise ignore if($("#region3").length > 0) { $("#region3:not([class*='noBg'])").removeAttr("style"); var reg3Height = $("#region3:not([class*='noBg'])").height(); if (reg3Height != null && reg3Height < $("#main").height()) { $("#region3").css("height", $("#main").height()); } } } $.fn.setAllToMaxHeight = function(){ return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) ) } $.fn.checknAdjustClass = function(chkcl, action){ if(action == 0) { if($(this).hasClass(chkcl)) { $(this).removeClass("active actv"); } else { $(this).removeClass("active"); } } else if (action == 1) { if($(this).hasClass(chkcl) && action == 1) { $(this).addClass("active actv"); } else { $(this).addClass("active"); } } return this; } jQuery.preloadImages = function() { for(var i = 0; i").attr("src", arguments[i]); } } // toast settings and functions var animSpeedUp = 500; var animSpeedDown = 300; function goUp($el) { var isHidden = $el.find('div.panel_body:hidden').length > 0; $el.not(".showing") .addClass("showing") .find("div.panel_body") .queue("fx", []) .stop() .animate({height: (isHidden ? 'show' : '100%')}, animSpeedUp , function () { $(this).height(""); }); } function goDown($el) { $el.filter(".showing") .removeClass("showing") .find("div.panel_body") .queue("fx", []) .stop() .animate({height:'hide'}, animSpeedDown, function () { $(this).height(""); }); } $(document).ready(function () { if($("#topSiteMessageWrapper").length > 0) { var _now = Date.now || function() { return new Date().getTime(); }; // outage bar resize var _debounceAlertBar = function(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }; } //Added Feb 13 2015 by Aaron Lawrence //When vistor click accordion it will anchor the active accordion to the top of the page. $(".accordion").on("click", "dd:not(.active)", function (original) { original = $(this); setTimeout(function(){ var offset = original.offset().top - $('#header').height() - 10; $('html,body').animate({ scrollTop: offset }, 0); }, 100); }); //added trigger to the close button inside of a fdrop $('div.f-dropdown a.clearing-close').click(function(){ $("a[data-dropdown='" + $(this).parent().attr('id') + "']").trigger('click'); }); //read remember me cookie value and set login username and checkbox var remembermeVal = getCookieFromAC("cpo_cpidRemember"); if (document.headerSISU != null && remembermeVal.length >0) { document.headerSISU.rememberme.checked=true; document.headerSISU.username.value=remembermeVal; } /*Code to open accordion tabs based on hashtag*/ var hasHash = !!window.location.hash; if(hasHash) { if($(".accordion:has([id='" + window.location.hash + "'])").length > 0) { var hash = window.location.hash; $('[data-accordion] dd > a[href="' + hash + '"]').trigger('click.fndtn.accordion'); console.log('hasHash'); } } /****DO NOT REMOVE**/ /****This is a fix to the equalizer not working inside the accordion due to the display:none property on the hidden boxes**/ /******/ var isIE8 = $('body').hasClass('lt-ie9'); if(!isIE8) { if($(".accordion:has([data-equalizer])").length > 0) { // get initially opened by default blade id if (!hasHash) { var activeId = $("dd > .content.active").attr('id'); } $("dd > .content").addClass('active'); $(document).foundation('equalizer','reflow'); $("dd > .content").filter(function(index) {return ((hasHash) ? $(this).attr('id') !== window.location.hash.split('#')[1] : $(this).attr('id') !== activeId);}).removeClass('active'); } } // fix for IE8 - tab and and embedded accordian menu if(isIE8) { $( ".tabs.control-accordion" ).on( "click", ".tab-title>a", function() { var panel = $(this).attr('href').substr(1); var accordianElem = $( ".accordion.control-tabs > .accordion-navigation" ); $( ".tabs.control-accordion .tab-title" ).removeClass('active'); $(this).parent().addClass('active'); accordianElem.removeClass('active'); accordianElem.find('>div.content').removeClass('active').css('display','none'); accordianElem.find('div#'+panel+'acc').addClass('active').css('display','block'); accordianElem.find('div#'+panel+'acc').parent().addClass('active'); }); } // $(".sso_link, .sso_form, .signinlink").each(function() { // var lang = ($(this).attr("ssoLang") ? $(this).attr("ssoLang").toLowerCase() : GLOBALOBJ.locale); // var source_url = $(this).attr('urlsource') || $(this).attr('sourceurl'); // var sourceUrl = (source_url ? source_url : window.location.href); // var target_url = $(this).attr('urltarget') || $(this).attr('targeturl'); // var targetUrl = (target_url ? target_url : sourceUrl); // var businessUrl=$(this).attr('businessurl'), personalUrl=$(this).attr('personalurl'); // var overrides = (businessUrl!=undefined? '&businessUrl='+encodeURIComponent(addForceVouchFor(businessUrl)):'')+(personalUrl!=undefined? '&personalUrl='+encodeURIComponent(addForceVouchFor(personalUrl)):''); // var hasher = (targetUrl.indexOf("#") > -1 ? hasher = targetUrl.split("#").pop() : ''); // var finalTargetUrl = (hasher.length > 0 ? targetUrl.split("#").shift() : targetUrl) + (targetUrl.indexOf("forceVouchFor") == -1 ? (targetUrl.indexOf("?") > -1 ? "&forceVouchFor=true" : "?forceVouchFor=true") : "") + (hasher.length > 0 ? "#" + hasher : ''); // var ssoMode = ($(this).attr('mode') ? $(this).attr('mode') : '1'); // var templateId = ($(this).attr('templateid') ? $(this).attr('templateid') : 'cpcapps'); // var manifestId = ($(this).attr('manifestid') ? $(this).attr('manifestid') : 'cpgSecurity'); // var stepUp = ( $(this).attr('stepup') == 2 ? 'stepupId=smb_mode' + ssoMode : $(this).attr('stepup') == 1 ? 'stepupId=smb_mode2,consumer,commercial_link,smb_link' : $(this).attr('stepup') == 3 ? 'stepupId=smb_mode'+ssoMode+',commercial_link,smb_link' : $(this).attr('stepup') == 'ncoa' ? 'stepupId=smb_mode2,commercial_link,smb_link' : $(this).attr('stepup') == 4 ? 'stepupId=smb_mode'+ssoMode+',smb_link' : ''); // var loginurl = ($(this).hasClass('sso_form') ? $(this).attr('action') + "?" + stepUp + "&templateId=" + templateId + "&language=" + lang + "&manifestId=" + manifestId + ($(this).attr('source') ? '&sourceApp=' + $(this).attr('source').toUpperCase() : '') + "&sourceUrl=" + encodeURIComponent(sourceUrl) + "&targetUrl=" + encodeURIComponent(finalTargetUrl) + overrides : $(this).attr('href') + "?" + stepUp + "&templateId=" + templateId + "&language=" + lang + "&manifestId=" + manifestId + ($(this).attr('source') ? '&sourceApp=' + $(this).attr('source').toUpperCase() : '') + "&sourceUrl=" + encodeURIComponent(sourceUrl) + "&targetUrl=" + encodeURIComponent(finalTargetUrl) + overrides); // ($(this).hasClass('sso_form') ? $(this).attr('action', loginurl) : $(this).attr('href', loginurl)); // }); $(".sso_link, .sso_form, .signinlink").each(function() { var lang = ($(this).attr("ssoLang") ? $(this).attr("ssoLang").toLowerCase() : GLOBALOBJ.locale); var source_url = $(this).attr('urlsource') || $(this).attr('sourceurl'); var sourceUrl = (source_url ? source_url : window.location.href); var target_url = $(this).attr('urltarget') || $(this).attr('targeturl'); var targetUrl = (target_url ? target_url : sourceUrl); var businessUrl=$(this).attr('businessurl'), personalUrl=$(this).attr('personalurl'); var overrides = (businessUrl!=undefined? '&businessUrl='+encodeURIComponent(addForceVouchFor(businessUrl)):'')+(personalUrl!=undefined? '&personalUrl='+encodeURIComponent(addForceVouchFor(personalUrl)):''); var hasher = (targetUrl.indexOf("#") > -1 ? hasher = targetUrl.split("#").pop() : ''); var finalTargetUrl = (hasher.length > 0 ? targetUrl.split("#").shift() : targetUrl) + (targetUrl.indexOf("forceVouchFor") == -1 ? (targetUrl.indexOf("?") > -1 ? "&forceVouchFor=true" : "?forceVouchFor=true") : "") + (hasher.length > 0 ? "#" + hasher : ''); var ssoMode = ($(this).attr('mode') ? $(this).attr('mode') : '1'); var stepupType = ($(this).attr('stepuptype') ? $(this).attr('stepuptype') : 'false'); var templateId = ($(this).attr('templateid') ? $(this).attr('templateid') : 'cpcapps'); var manifestId = ($(this).attr('manifestid') ? $(this).attr('manifestid') : 'cpgSecurity'); if(templateId != 'ncoa'){ if(stepupType != 'false'){ var availableStepUpArray = ["smb_mode1", "consumer", "commercial_link", "smb_link"]; var stepupParamArray = stepupType.split(","); if(stepupParamArray.length == availableStepUpArray.length){ for (var i = 0; i <= availableStepUpArray.length; i++) { if(stepupParamArray[i] == 0) { availableStepUpArray[i] = ''; }else if(stepupParamArray[i] == 2) { availableStepUpArray[i] = 'smb_mode2'; } } } var cleanArray = availableStepUpArray.clean(""); var stepUp = "stepupId="+cleanArray.join(); }else{ var stepUp = ( $(this).attr('stepup') == 2 ? 'stepupId=smb_mode' + ssoMode : $(this).attr('stepup') == 1 ? 'stepupId=smb_mode' + ssoMode + ',consumer,commercial_link,smb_link' : $(this).attr('stepup') == 3 ? 'stepupId=smb_mode'+ssoMode+',commercial_link,smb_link' : $(this).attr('stepup') == 'ncoa' ? 'stepupId=smb_mode2,commercial_link,smb_link' : $(this).attr('stepup') == 4 ? 'stepupId=smb_mode'+ssoMode+',smb_link' : ''); } }else{ var stepUp = "ncoa=1"; } var loginurl = ($(this).hasClass('sso_form') ? $(this).attr('action') + "?" + stepUp + "&templateId=" + templateId + "&language=" + lang + "&manifestId=" + manifestId + ($(this).attr('source') ? '&sourceApp=' + $(this).attr('source').toUpperCase() : '') + "&sourceUrl=" + encodeURIComponent(sourceUrl) + "&targetUrl=" + encodeURIComponent(finalTargetUrl) + overrides : $(this).attr('href') + "?" + stepUp + "&templateId=" + templateId + "&language=" + lang + "&manifestId=" + manifestId + ($(this).attr('source') ? '&sourceApp=' + $(this).attr('source').toUpperCase() : '') + "&sourceUrl=" + encodeURIComponent(sourceUrl) + "&targetUrl=" + encodeURIComponent(finalTargetUrl) + overrides); ($(this).hasClass('sso_form') ? $(this).attr('action', loginurl) : $(this).attr('href', loginurl)); }); function addForceVouchFor(url){ var hasher = (url.indexOf("#") > -1 ? hasher = url.split("#").pop() : ''); var finalURL = (hasher.length > 0 ? url.split("#").shift() : url) + (url.indexOf("forceVouchFor") == -1 ? (url.indexOf("?") > -1 ? "&forceVouchFor=true" : "?forceVouchFor=true") : "") + (hasher.length > 0 ? "#" + hasher : ''); console.log(finalURL); return finalURL; } $(".nav-toggle").each(function( index ) { $(this).click(function(e){e.preventDefault();$(this).parent().toggleClass('nav-drop-active');}) }); $(".off-canvas-toggle .toggler, .off-canvas-toggle .nav-toggle, .authenticated.off-canvas-toggle > a:first-child").each(function( index ) { $(this).click(function(e){e.preventDefault();$(this).parent().toggleClass('active');}) }); (getCookieFromAC("shoppingcartqty") > 0 ? $(".cartQty").html(getCookieFromAC("shoppingcartqty")) : ""); function urlAddParams(url, params){ if(params == undefined) return url; if(url){ url = url.indexOf ("?")<0 ? url + "?": url; var arr = params.split("&"); for(i=0;i 0) { var n = $(".tabs .tabContent").index($(location.hash)); if (-1 != n) { $(".tabs div.tabContent").filter(":visible").hide().end().filter( function(index){ return index==n; } ).show(); $(".tabs ul.topMenu li").filter(":visible").removeClass("active").filter( function(index){ return index==n; } ).addClass("active"); } } } if(typeof uriDirectories != 'undefined' && (uriDirectories.match("/cpo/mc/business/productsservices/marketing/") || uriDirectories.match("/cpo/mc/business/productsservices/atoz/"))){ $("div.tabContent").each(function(n){ var item = $(this); item.removeAttr("id"); }); } // global title variable for tooltips var saveTitle; $("a.doubleDashed").hover( function () { saveTitle = $(this).attr("title"); $(this).attr("title", ""); }, function () { $(this).attr("title", saveTitle); } ).bind("click", function (e) { // hide any tooltip that may be open, only one tip should show per click $(".toolTip").hide(); $(this).attr("title", saveTitle); var e = (!e) ? window.event : e; if (e.pageX) { yCord = e.pageY; } else if (e.clientX) { yCord = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } // test if new dynamic tip or old style static tip, if old tip, move to region3Content, display and return // otherwise if already in region3Content, display if($("#" + this.getAttribute("title")).length > 0 && $("#region3Content #" + this.getAttribute("title")).length == 0) { $("#" + this.getAttribute("title")).prependTo("#region3Content").css("top", (yCord - 200)).show(); $(".toolTip span.closeIcon").bind("click", function () { $(this).parent().parent().hide(); }); return false; } else if ($("#" + this.getAttribute("title")).length > 0) { $("#" + this.getAttribute("title")).css("top", (yCord - 200)).show(); $(".toolTip span.closeIcon").bind("click", function () { $(this).parent().parent().hide(); }); return false; } // if new style tip, since first instanc of tooltip, dynamically create tooltip div if($("#dynaTip").length == 0) { $('

').prependTo("#region3Content"); // bind onclick close tooltip function $(".toolTip span.closeIcon").bind("click", function () { $(this).parent().parent().hide(); }); } // if :: seperator variable included in title, then split into proper segments for h3 title and tip content if($(this).attr('title').indexOf("=@@=") > 0) { $("#dynaTip .toolTipContent h3").html($(this).attr('title').split("=@@=")[0]); $("#dynaTip .toolTipContent p").html($(this).attr('title').split("=@@=")[1].replace(/\\n/g, '

')); // replace any newlines with a double break } else { $("#dynaTip .toolTipContent p").html($(this).attr('title')); } $('#dynaTip').css('top', (yCord - 200)).show() ; return false; }); $("#libraryMenu h3").click(function () { $(this).toggleClass("active").next().toggle(); return false; }); $(".toastHolder").bind("mouseover", function () { goUp($(this)); }); $(".toastHolder").bind("mouseleave", function () { goDown($(this)) }); // makes the text caption follow the image's width + 5px for breathing room $('.imageCaption').each(function(){ var item = $(this); item.css('width', $('img', this).eq(0).attr('width')); }); $("#verticalTabsOptions:not([class='defProp']) li:has(a)").bind("click", function () { var n = $("#verticalTabsOptions li:has(a)").index(this); $("#verticalTabsContent div.tabContent").filter(":visible").removeClass("active").end().filter(":eq(" + n + ")").addClass("active"); $("#verticalTabsOptions li").filter(":visible").checknAdjustClass("double-line", 0).end().filter(":eq(" + n + ")").checknAdjustClass("double-line", 1); resetFeaturedItems(); resetReg3(); return false; }); $("#verticalTabsOptions ul li").each(function() { if($(this).height() > parseInt($(this).css("line-height"))) { $(this).addClass("double-line"); } }); resetReg3(); //Top nav Highlighting of ITEMS $('#header a').each(function() { //if ($(this).prop('href') == window.location.href) { if(window.location.href.indexOf($(this).prop('href')) > -1) { $(this).addClass('current'); $(this).parent().parent().parent().find('>a').addClass('current'); $(this).parent().parent().parent().parent().parent().find('>a').addClass('current'); } }); // add last-child to ie8 $(".lt-ie9 ul#breadcrumb li:last-child").addClass("last-child"); }); $(window).load(function () { if ($(".miniSpotLight h2").hasOwnProperty("setAllToMaxHeight")) { //fixes container height to cater to content $(".miniSpotLight h2").setAllToMaxHeight(); $(".miniSpotLight .miniSpotImg").setAllToMaxHeight(); $(".miniSpotLight").setAllToMaxHeight(); $(".marqueeItem .sectionTitle").setAllToMaxHeight(); $(".marqueeItem .sectionBorder").setAllToMaxHeight(); } if (typeof $("img").noContext == "function") { $("img").noContext(); } resetReg3(); }); //CPO on-page (non-Search Results UI) Search form function doSearch(formNameObj){ //The Form object (this) should be passed to doSearch(). If not, then assume the form name is "searchForm" if ((typeof formNameObj == 'undefined') || formNameObj == null) { var formName = document.searchForm; } else { var formName = formNameObj; } var searchterm = formName.query.value.toLowerCase(); if (searchterm == "" || searchterm == "search" || searchterm == "recherche"){ return false; } if (searchterm != 'search' && searchterm != 'recherche' && searchterm != ''){ formName.submit(); } } //CPO Header Search form function doSearchHeader(){ var searchterm = document.sitesearch.searchInput.value.toLowerCase(); if (searchterm == "" || searchterm == "search" || searchterm == "recherche"){ return false; } if (searchterm != 'search' && searchterm != 'recherche' && searchterm != ''){ document.sitesearch.submit(); } } //Search Results UI profile generated "Search whole site" link //set scope element to empty function doMainSearch(){ var searchterm = document.searchFormUI.query.value.toLowerCase(); document.searchFormUI.scope.value = ' '; document.searchFormUI.store.value = ' '; if (searchterm == "" || searchterm == "search" || searchterm == "recherche"){ return false; } if (searchterm != 'search' && searchterm != 'recherche' && searchterm != ''){ document.searchFormUI.submit(); } } //Search Results UI on-page form //retains all current element values, including scope if set function doMainSearchUI(){ var searchterm = document.searchFormUI.query.value.toLowerCase(); if (searchterm == "" || searchterm == "search" || searchterm == "recherche"){ return false; } if (searchterm != 'search' && searchterm != 'recherche' && searchterm != ''){ document.searchFormUI.submit(); } } Array.prototype.clean = function(deleteValue) { for (var i = 0; i < this.length; i++) { if (this[i] == deleteValue) { this.splice(i, 1); i--; } } return this; };