/*********************************************************************** * 3M.com CHP JavaScript v 2.01 * Copyright (c) 3M 2011. All rights reserved * Last Modified: 06/22/2011 * Asset UNIV ID: 1180604784301 * Author: @US338674 ************************************************************************/ var CHPaccheight = menutop = menuheight = totalBrands = count = 0; var Pcounter = Pmenuwidth = Pmenuleft = 0; var curBrand = 1; var CHPps1 = CHPps2 = ""; function createMenus() { var menuNum = 0; var DIVs = document.all ? document.all.tags("div") : document.getElementsByTagName("div"); for (d=0; d\ 0) { if (As[0].href == "#" || As[0].href == window.location.href + "#") { As[0].className = "CHPMenuHide"; } } var H3s = document.getElementById("CHPprod" + x).getElementsByTagName("h3"); if (H3s.length > 0) { document.getElementById("CHPaccMenuTitle").innerHTML = H3s[0].innerHTML.replace("onclick","oclick"); H3s[0].className = "CHPMenuHide"; } } var DIVs = document.all ? document.all.tags("div") : document.getElementsByTagName("div"); for (d=0; d"; } if (x == "lt") Pmenuleft += 342; else if (x == "rt") Pmenuleft -= 342; if (Pmenuleft < -2*Pmenuwidth) Pmenuleft += Pmenuwidth; if (Pmenuleft > -Pmenuwidth) Pmenuleft -= Pmenuwidth; document.getElementById("CHPpromomove").style.marginLeft = Pmenuleft + "px"; if (document.getElementById("CHPpromoleft") != null) document.getElementById("CHPpromoleft").style.paddingTop = ((document.getElementById("CHPpromomove").clientHeight / 2) - 20) + "px"; if (document.getElementById("CHPpromoright") != null) document.getElementById("CHPpromoright").style.paddingTop = ((document.getElementById("CHPpromomove").clientHeight / 2) - 20) + "px"; } */ var Bcounter = Bmenuwidth = Bmenuleft = 0; function Brotate(x,y) { if (Bmenuwidth == 0) { var Bthree = document.getElementById("CHPmultiplyB").innerHTML; Bmenuwidth = document.getElementById("Bitems").offsetWidth; document.getElementById("CHPbrandsmove").innerHTML = "" + Bthree + Bthree + Bthree + "
"; } if (y == 0) document.getElementById("CHPbrandstage").style.display = "none"; if (x == "lt") Bmenuleft += 170; else if (x == "rt") Bmenuleft -= 170; if (Bmenuleft < -2*Bmenuwidth) Bmenuleft += Bmenuwidth; if (Bmenuleft > -Bmenuwidth) Bmenuleft -= Bmenuwidth; document.getElementById("CHPbrandsmove").style.marginLeft = Bmenuleft + "px"; } /*FWIP code*/ Scroller = Class.create({ defaults: { size:2, duration:800, autoscroll:false }, initialize: function(element, options) { this.element = $(element); this.options = (options != null) ? options : this.defaults; this.pageSize = this.options.size; this.duration = this.options.duration; this.auto = this.options.autoscroll; this.scroller = this.element.down('div.items'); this.items = this.scroller.childElements(); this.locked = false; this.arrowL = this.element.down('a.prev'); this.arrowR = this.element.down('a.next'); this.positions= []; this.posIndex = 1; dcsMultiTrack('WT.cg_n','CHP Promotional Zone Scroll Events','WT.cg_s',this.posIndex,'WT.ad','','DCS.dcsuri','/en_US/chp/dcsevents/Promotions-Auto-Scroll-Start-First.html','WT.ti','Promotions First Scroll Start - showing 1 and 2'); $debug("tracked first scroll start - showing promos " + this.posIndex + " and " + (this.posIndex + 1),'CHP'); if (this.items.length > this.options.size) { this.pageWidth = this.items[0].offsetWidth; if (this.options.size == 2) { this.scroller.insert({ bottom:'
'+this.items[0].innerHTML+'
' }); this.scroller.insert({ top:'
'+this.items[this.items.length-1].innerHTML+'
' }); this.items.unshift(this.items.last()); for (var i=0; i < this.items.length; i++) { var position = -this.pageWidth * i; this.positions.push(position); }; this.items.push(this.items[1]); } else if (this.options.size == 4) { this.scroller.insert({ bottom:'
'+this.items[0].innerHTML+'
' }); this.scroller.insert({ bottom:'
'+this.items[1].innerHTML+'
' }); this.scroller.insert({ top:'
'+this.items[this.items.length-1].innerHTML+'
' }); this.scroller.insert({ top:'
'+this.items[this.items.length-2].innerHTML+'
' }); this.items.unshift(this.items[this.items.length-2], this.items[this.items.length-1]); for (var i=0; i < this.items.length-1; i++) { var position = -this.pageWidth * i; this.positions.push(position); }; this.items.push(this.items[1]); this.items.push(this.items[2]); this.posIndex = 2; } else { if (!window.console || !console.firebug){ // CONSOLE LOGGING FOR IE var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; window.console = {}; for (var i=0; i tallest) { tallest = thisHeight; } }); group.invoke('setStyle', { height:tallest+'px' }); this.centerVertically(tallest); }, centerVertically: function(tallest) { var arrowheight = this.arrowL.getHeight(); var pad = ((tallest + 15) / 2) - 21; this.arrowL.setStyle({ paddingTop:pad+'px' }); this.arrowR.setStyle({ paddingTop:pad+'px' }); }, next: function(event) { if ((event) && typeof event != 'number') event.stop(); if (this.posIndex == this.positions.length-1 && !this.locked) { this.posIndex = 0; this.updateScroller(true, 'next'); dcsMultiTrack('WT.cg_n','CHP Promotional Zone Scroll Events','WT.cg_s','showing promos ' + this.posIndex + ' and ' + (this.posIndex + 1),'WT.ad','','DCS.dcsuri','/en_US/chp/dcsevents/Promotions-Auto-Scroll-Start-Second.html','WT.ti','Promotions Scroll Second Start'); $debug("tracked second scroll start - showing promos " + this.posIndex + " and " + (this.posIndex + 1),'CHP'); } else if (!this.locked) { this.posIndex++; this.updateScroller(false, 'next'); if (this.posIndex == this.positions.length-1) {promonumbernext = 1} else {promonumbernext = this.posIndex + 1} promothis = promonumbernext - 1; if (promothis == 0) {promothis = this.positions.length - 1} dcsMultiTrack('WT.cg_n','CHP Promotional Zone Scroll Events','WT.cg_s','showing promos ' + promothis + ' and ' + promonumbernext,'WT.ad','','DCS.dcsuri','/en_US/chp/dcsevents/Promotions-Scroll.html','WT.ti','Promotions Advance'); $debug("tracked promo advance - showing promos " + promothis + " and " + promonumbernext,'CHP'); } }, prev: function(e) { e.stop(); if (this.posIndex == 0 && !this.locked) { this.posIndex = this.positions.length-1; this.updateScroller(true, 'prev'); } else if (!this.locked) { this.posIndex--; this.updateScroller(false, 'prev'); } if (this.posIndex == this.positions.length-1) {promonumbernext = 1} else {promonumbernext = this.posIndex + 1} promothis = promonumbernext - 1; if (promothis == 0) {promothis = this.positions.length - 1} dcsMultiTrack('WT.cg_n','CHP Promotional Zone Scroll Events','WT.cg_s','showing promos ' + promothis + ' and ' + promonumbernext,'WT.ad','','DCS.dcsuri','/en_US/chp/dcsevents/Promotions-Manual-Previous.html','WT.ti','Promotions Manual Previous'); $debug("tracked manual promo previous - showing promos " + promothis + " and " + promonumbernext,'CHP'); }, updateScroller: function(reset, dir) { if (reset == true && dir == 'next') { this.scroller.setStyle({ left:this.positions[this.posIndex] }); this.posIndex++; } else if (reset == true && dir == 'prev') { this.scroller.setStyle({ left:this.positions[this.positions.length-1]+'px' }); this.posIndex--; } if (!this.locked) { this.lock(); var effect = new Fx.Style(this.scroller, 'left', {duration: this.duration, onComplete: this.unlock.bind(this)}); effect.custom(this.scroller.offsetLeft, this.positions[this.posIndex]); } }, lock: function() { this.locked = true; }, unlock: function() { this.locked = false; } }); // Sets a Cookie with the given name and value. // name Name of the cookie // value Value of the cookie // [expires] Expiration date of the cookie (default: end of current session) // [path] Path where the cookie is valid (default: path of calling document) // [domain] Domain where the cookie is valid (default: domain of calling document) // [secure] Boolean value indicating if the cookie transmission requires a secure transmission function setUXCookie(name, value, expires, path, domain, secure) { document.cookie = escape(name) + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + "; path=/" + ((secure) ? "; secure" : ""); //window.alert(name + " set to " + getCookie(name)); // testing line to detect cookie existence } // Gets the value of the specified cookie. // name Name of the desired cookie. // Returns a string containing value of specified cookie, or null if cookie does not exist. function getUXCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = document.cookie.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); } // Deletes the specified cookie // name name of the cookie // [path] path of the cookie (must be same as path used to create cookie) // [domain] domain of the cookie (must be same as domain used to create cookie) function deleteUXCookie(name, path, domain) { if (getUXCookie(name)) document.cookie = name + "=" + "; path=/" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } function tookUXSurvey(lang) { //var now=new Date(); //rand_no_020 = (now.getSeconds())%5;//rand number between 0 and 4, 20% rand_no_020 = Math.floor((5)*Math.random()) //rand number between 0 and 4, 20% if (document.cookie && !getUXCookie("UXsurvey") && location.href.toString().indexOf("override") > 0)//right now fires ONLY when override is in the URL { var surveyURL = "none"; if (lang == "en_GB" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AU7SU259H"; if (lang == "ru_RU" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATS4WRRV2"; if (lang == "pl_PL" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATS6SRSZN"; if (lang == "nl_NL" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATPVSQEFD"; if (lang == "nl_BE" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATS4QRRRD"; if (lang == "fr_BE" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATWMHUJ65"; if (lang == "fr_FR" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATS4DRRJN"; if (lang == "ja_JP" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATWGKUF5N"; if (lang == "zh_CN" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATS6LRSVZ"; if (lang == "en_AU" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AU7SN255U"; if (lang == "zh_TW" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATS67RSN3"; if (lang == "en_IN" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AUBHU4DWJ"; if (lang == "en_SG" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AU7TH25NB"; if (lang == "zh_HK" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AUDD75J5Z"; if (lang == "es_MX" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AUDDU5JJT"; if (lang == "es_AR" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AUDEU5K6C"; if (lang == "es_CO" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AUDFH5KK6"; if (lang == "es_VE" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22AUDFY5KUC"; if (lang == "es_CL" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ATWBCUBXP"; if (lang == "en_US" && rand_no_020 == 0) surveyURL = "http://www.zoomerang.com/Survey/WEB22ASRH75ULR"; if (console) console.log(rand_no_020); if (surveyURL !== "none") { window.open(surveyURL,"UXsurveyWIN","top=10,left=10,height=500,width=810,scrollbars=1,resizable=1"); var UXexpire = new Date(); UXexpire.setFullYear(UXexpire.getFullYear() + 1,UXexpire.getMonth(),UXexpire.getDate()); setUXCookie("UXsurvey", "done", UXexpire); } } } function loadPage() { if (document.getElementById('mmmfooters') != null) { createMenus(); /*Protate(); if (Pmenuwidth <= (document.getElementById("CHPpromocarousel").offsetWidth + 1) && document.getElementById("CHPpromoright")) { document.getElementById("CHPpromoleft").innerHTML = " "; document.getElementById("CHPpromoright").innerHTML = " "; }*/ try { Brotate(); } catch(e) { //catch and supress error } if (location.href.toString().indexOf("menu") != -1) {toggleMenuB();displayMenu(1);} if (location.href.toString().indexOf("menu") != -1) displayMenu(1); try { OCunderline(); } catch(e) { //catch and supress error } } else { setTimeout("loadPage();",500); } } jQuery(document).ready(function() { try { jQuery('#contact input.btnyellow').addClass('primarybutton'); jQuery('.primarybutton').removeClass('btnyellow').button(); } catch(e) { //catch and supress error } }); function UXSurveyLoadPage() { if (document.getElementById('mmmfooters') != null) { try { var lang = ""; var Ms = document.all ? document.all.tags("meta") : document.getElementsByTagName("meta"); for (m=0; m