PageSourceSearch

https://ctslink.com/img/corptrust/global.js

js ctslink.com collected 2026-10-05 19:14:28 UTC 287,949 bytes, 8,962 lines download raw bytes

1var WF = {};
2$.each("address|article|aside|audio|canvas|command|datalist|details|dialog|figure|figcaption|footer|header|hgroup|keygen|mark|meter|menu|nav|progress|ruby|section|time".split("|"), function(idx, val) {
3  document.createElement(val);
4});
5$("html").removeClass("no-js");
6if ($("html").attr("class") == "") {
7  $("html").removeAttr("class");
8}
9WF.Browser = {};
10WF.Component = {};
11WF.Strings = {
12  "Components": {
13    "BalloonHelp": {
14      "beginningOfPopup": {
15        "en": "Beginning of popup",
16        "es": "Comienzo de ventana emergente"
17      },
18      "endOfPopup": {
19        "en": "End of popup",
20        "es": "Fin de ventana emergente"
21      }
22    },
23    "FAQ": {
24      "imgOpen": {
25        "en": "Collapse",
26        "es": "Contraer"
27      },
28      "imgClosed": {
29        "en": "Expand",
30        "es": "Mostrar"
31      }
32    },
33    "LightboxOverlay": {
34      "closeDialog": {
35        "en": "Close Dialog",
36        "es": "Cierre diálogo"
37      },
38      "errorEncountered": {
39        "en": "Error Encountered",
40        "es": "Se ha encontrado un error"
41      },
42      "oneMomentPlease": {
43        "en": "One moment, please...",
44        "es": "Espere un momento, por favor..."
45      },
46      "plsWaitGettingInfo": {
47        "en": "Please wait. We're getting your information.",
48        "es": "Por favor espere. Estamos buscando su información."
49      },
50      "infoCurrUnavail": {
51        "en": "This information is currently unavailable.",
52        "es": "En este momento esta información no está disponible."
53      },
54      "apologizeTryAgain": {
55        "en": "We apologize for this inconvenience. Please try again later.",
56        "es": "Lamentamos el inconveniente ocasionado. Vuelva a intentarlo más tarde."
57      }
58    },
59    "MultimediaTranscript": {
60      "more": {
61        "en": "More",
62        "es": "Más "
63      },
64      "less": {
65        "en": "Less",
66        "es": "Menos"
67      }
68    },
69    "ShowHide": {
70      "imgOpen": {
71        "en": "Hide",
72        "es": "Cierre"
73      },
74      "imgClosed": {
75        "en": "Show",
76        "es": "Mostrar"
77      }
78    },
79    "ShowMore": {
80      "noMoreArticles": {
81        "en": "All Articles Displayed",
82        "es": "Todos los artículos"
83      }
84    },
85    "SocialShare": {
86      "Share": {
87        "en": "Share",
88        "es": "Comparta"
89      },
90      "DisclosureHeader": {
91        "en": "share this page",
92        "es": "Comparta esta página"
93      },
94      "DisclosureText": {
95        "en": "Choose a link above.  We provide these links to external websites for your convenience. " + "Wells Fargo does not endorse and is not responsible for their content, links, privacy policies, or security policies.",
96        "es": "Seleccione uno de los enlaces electrónicos arriba. Para su conveniencia, le proporcionamos estos enlaces electrónicos a sitios de Internet externos." + "Wells Fargo no avala ni se hace responsable por el contenido, los enlaces electrónicos, las políticas de privacidad o las políticas de seguridad de esos " + "sitios de Internet."
97      },
98      "ShareUpfront": {
99        "en": '<a  href="/exit/social?site=facebook" class="c52fb c28aLink" tab-index="0"><span class="jaws_hidden" tab-index="-1">Facebook</span></a>' + '<a href="/exit/social?site=twitter" class="c52twitter c28aLink" tab-index="0"><span class="jaws_hidden" tab-index="-1">Twitter</span></a>',
100        "es": '<a href="/es/exit/social?site=facebook" class="c52fb c28aLink" tab-index="0"><span class="jaws_hidden" tab-index="-1">Facebook</span></a>' + '<a href="/es/exit/social?site=twitter" class="c52twitter c28aLink" tab-index="0"><span class="jaws_hidden" tab-index="-1">Twitter</span></a>'
101      },
102      "Disclosure": {
103        "en": '<span class="hide" tabindex="0">Begin popup</span><h2>Share this page</h2>' + '<ul><li><a href="#linkedin" class="c52linkedin">LinkedIn</a></li>' + '<li><a href="#googleplus" class="c52googleplus">Google+</a></li>' + '<li><a href="#email" class="c52email">Email</a></li></ul>' + "<p>Choose a link above.  We provide these links to external websites for your convenience. " + 'Wells Fargo does not endorse and is not responsible for their content, links, privacy policies, or security policies.</p><span class="hide">End popup</span>',
104        "es": '<span class="hide" tabindex="0" lang="en">Begin popup</span><h2>Comparta esta p&aacute;gina</h2>' + '<ul><li><a href="#linkedin" class="c52linkedin">LinkedIn</a></li>' + '<li><a href="#googleplus" class="c52googleplus">Google+</a></li>' + '<li><a href="#email" class="c52email">Email</a></li></ul>' + "<p>Seleccione uno de los enlaces electr&oacute;nicos arriba. Para su conveniencia, le proporcionamos estos enlaces electr&oacute;nicos a sitios de Internet externos." + "Wells Fargo no avala ni se hace responsable por el contenido, los enlaces electr&oacute;nicos, las pol&iacute;ticas de privacidad o las pol&iacute;ticas de seguridad de esos " + 'sitios de Internet.</p><span class="hide" lang="en">End popup</span>'
105      },
106      "EmailInsert": {
107        "en": "Hi,\n\nI thought you'd be interested in this page I found on wellsfargo.com: \n\n",
108        "es": "Pens&eacute; que podr&iacute;a interesarle esta p&aacute;gina que encontr&eacute; en wellsfargo.com/spanish:"
109      }
110    }
111  },
112  "Shared": {
113    "Trademark": {
114      "Facebook": {
115        "en": "Facebook",
116        "es": "Facebook"
117      },
118      "Google": {
119        "en": "Google",
120        "es": "Google"
121      },
122      "GooglePlus": {
123        "en": "Google+",
124        "es": "Google+"
125      },
126      "Instagram": {
127        "en": "Instagram",
128        "es": "Instagram"
129      },
130      "LinkedIn": {
131        "en": "LinkedIn",
132        "es": "LinkedIn"
133      },
134      "Pinterest": {
135        "en": "Pinterest",
136        "es": "Pinterest"
137      },
138      "Twitter": {
139        "en": "Twitter",
140        "es": "Twitter"
141      }
142    },
143    "beginItemNo": {
144      "en": "Begin item #",
145      "es": "Comienzo del &iacute;tem #"
146    },
147    "beginningOfPopup": {
148      "en": "Beginning of popup",
149      "es": "Comienzo de ventana emergente"
150    },
151    "cancel": {
152      "en": "Cancel",
153      "es": "Cancele"
154    },
155    "close": {
156      "en": "Close",
157      "es": "Cierre"
158    },
159    "continue": {
160      "en": "Continue",
161      "es": "Contin&uacute;e"
162    },
163    "endItemNo": {
164      "en": "End item #",
165      "es": "Fin del &iacute;tem #"
166    },
167    "endOfPopup": {
168      "en": "End of popup",
169      "es": "Fin de ventana emergente"
170    },
171    "item": {
172      "en": "item",
173      "es": "&iacute;tem"
174    },
175    "next": {
176      "en": "Next",
177      "es": "Siguiente"
178    },
179    "popupBlocker": {
180      "en": "You may have a popup blocker preventing this window from opening.",
181      "es": "Un bloqueador de ventana emergente puede estar evitando que se abra esta ventana."
182    },
183    "prev": {
184      "en": "Previous",
185      "es": "Anterior"
186    },
187    "print": {
188      "en": "Print",
189      "es": "Imprima"
190    },
191    "WFHomePage": {
192      "en": "Wells Fargo home page",
193      "es": "P&aacute;gina principal de Wells Fargo"
194    }
195  }
196};
197(function($) {
198  $.fn.touchwipe = function(settings) {
199    var config = {
200      min_move_x: 20,
201      min_move_y: 20,
202      wipeLeft: function(e) {},
203      wipeRight: function(e) {},
204      wipeUp: function(e) {},
205      wipeDown: function(e) {},
206      preventDefaultEvents: false
207    };
208    if (settings) {
209      $.extend(config, settings);
210    }
211    this.each(function() {
212      var startX;
213      var startY;
214      var isMoving = false;
215
216      function cancelTouch() {
217        this.removeEventListener("touchmove", onTouchMove);
218        startX = null;
219        isMoving = false;
220      }
221
222      function onTouchMove(e) {
223        if (config.preventDefaultEvents) {
224          e.preventDefault();
225        }
226        if (isMoving) {
227          var x = e.touches[0].pageX;
228          var y = e.touches[0].pageY;
229          var dx = startX - x;
230          var dy = startY - y;
231          if (Math.abs(dx) >= config.min_move_x) {
232            cancelTouch();
233            if (dx > 0) {
234              config.wipeLeft(e);
235            } else {
236              config.wipeRight(e);
237            }
238          } else {
239            if (Math.abs(dy) >= config.min_move_y) {
240              cancelTouch();
241              if (dy > 0) {
242                config.wipeUp(e);
243              } else {
244                config.wipeDown(e);
245              }
246            }
247          }
248        }
249      }
250
251      function onTouchStart(e) {
252        if (e.touches.length == 1) {
253          startX = e.touches[0].pageX;
254          startY = e.touches[0].pageY;
255          isMoving = true;
256          this.addEventListener("touchmove", onTouchMove, false);
257        }
258      }
259      if ("ontouchstart" in document.documentElement) {
260        this.addEventListener("touchstart", onTouchStart, false);
261      }
262    });
263    return this;
264  };
265})(jQuery);
266WF.Utils = {
267  addUrlParam: function(baseUrl, name, val) {
268    var add = name + "=" + val;
269    if (baseUrl.indexOf("#") == -1) {
270      if (baseUrl.indexOf("?") == -1) {
271        return baseUrl + "?" + add;
272      } else {
273        return baseUrl + "&" + add;
274      }
275    } else {
276      if (baseUrl.indexOf("?") == -1) {
277        return baseUrl.replace("#", "?" + add + "#");
278      } else {
279        return baseUrl.replace("#", "&" + add + "#");
280      }
281    }
282  },
283  ajaxLog: function(err) {
284    var url = "/as/common/jslog";
285    var query = {
286      "errorString": err.message,
287      "pageUrl": window.location.href
288    };
289    if (err.fileName) {
290      query.jsFileUrl = err.fileName;
291    } else {
292      if (err.sourceURL) {
293        query.jsFileUrl = err.sourceURL;
294      }
295    }
296    if (err.stack) {
297      var stack = WF.Utils.parseErrorStack(err.stack);
298      if (stack[0]) {
299        if (stack[0].name) {
300          query.errorFunctionName = stack[0].name;
301        }
302        if (stack[0].line) {
303          query.errorLineNumber = stack[0].line;
304        }
305        if (!query.jsFileUrl) {
306          query.jsFileUrl = stack[0].url;
307        }
308        if (stack[0].args) {
309          query.additionalInfo = "arguments: " + stack[0].args;
310        }
311      }
312      if (stack[1] && stack[1].name) {
313        query.callingFunctionName = stack[1].name;
314      }
315    } else {
316      query.errorFunctionName = WF.Utils.getNameFromCallee(arguments.callee.caller);
317      query.callingFunctionName = WF.Utils.getNameFromCallee(arguments.callee.caller.caller);
318    }
319    if (err.line) {
320      query.errorLineNumber = err.line;
321    }
322    $.get(url, query);
323  },
324  childWindow: function(theLink) {
325    var options = {};
326    var defaults = {
327      "directories": "no",
328      "location": "no",
329      "menubar": "no",
330      "resizable": "yes",
331      "scrollbars": "yes",
332      "status": "no",
333      "titlebar": "yes",
334      "toolbar": "no"
335    };
336    var largeDefaults = {
337      "directories": "yes",
338      "location": "yes",
339      "menubar": "yes",
340      "resizable": "yes",
341      "scrollbars": "yes",
342      "status": "yes",
343      "titlebar": "yes",
344      "toolbar": "yes"
345    };
346    var smallSize = {
347      "width": 200,
348      "height": 300
349    };
350    var mediumSize = {
351      "width": 350,
352      "height": 500
353    };
354    var largeSize = {
355      "width": 400,
356      "height": 700
357    };
358    var pdfSize = {
359      "width": 860,
360      "height": 700
361    };
362    var linkOptions;
363    if ((typeof theLink !== "undefined") && (theLink.tagName === "A")) {
364      linkOptions = $(theLink).attr("data-win-options");
365      switch (linkOptions) {
366        case "small":
367          $.extend(options, defaults, smallSize);
368          break;
369        case "large":
370          $.extend(options, largeDefaults, largeSize);
371          break;
372        case "medium":
373        case "":
374          $.extend(options, defaults, mediumSize);
375          break;
376        case "pdf":
377          $.extend(options, largeDefaults, pdfSize);
378          break;
379        default:
380          var customOptions = {};
381          try {
382            customOptions = $.parseJSON(linkOptions);
383          } catch (e) {
384            customOptions = mediumSize;
385            throw new Error("There was an error parsing the window options. Error reported: " + e.message);
386          }
387          $.extend(options, defaults, customOptions);
388          break;
389      }
390      var win = window.open(theLink.href, "child", WF.Utils.objectToString(options));
391      if (!win) {
392        var lang = WF.Page.lang || "en";
393        window.alert(WF.Strings.Shared.popupBlocker[lang]);
394      }
395      return win;
396    } else {
397      throw new Error("WF.Utils.childWindow() requires a reference to a link.");
398    }
399    return null;
400  },
401  convertVarsToNamespaces: function() {
402    var props;
403    if ("getOwnPropertyNames" in Object) {
404      props = Object.getOwnPropertyNames(window);
405    } else {
406      props = [];
407      for (var prop in window) {
408        props.push(prop);
409      }
410    }
411    for (var i = 0; i < props.length; i++) {
412      if (props[i].search(/__/) > 0) {
413        var names = props[i].split("__"),
414          parent = window,
415          child;
416        while (names.length > 1) {
417          child = names.shift();
418          if (!parent[child]) {
419            parent[child] = {};
420          }
421          parent = parent[child];
422        }
423        parent[names[0]] = window[props[i]];
424        try {
425          delete window[props[i]];
426        } catch (e) {}
427      }
428    }
429  },
430  generateUniqueId: function(elem) {
431    var id = "";
432    while (elem.tagName != "BODY") {
433      id = ($(elem).prevAll().length + 1) + "_" + id;
434      if (!elem.parentNode) {
435        var arr = "0123456789abcdef".split("");
436        for (var i = 0; i < 16; i++) {
437          id += arr[Math.floor(Math.random() * arr.length)];
438        }
439        break;
440      }
441      elem = elem.parentNode;
442    }
443    return "NID" + id.substr(0, id.length - 1);
444  },
445  getAnyType: function(thing) {
446    if (thing === null) {
447      return "null";
448    } else {
449      if (thing instanceof Array) {
450        return "array";
451      } else {
452        if (thing instanceof jQuery) {
453          return "jQuery";
454        } else {
455          if (thing && thing.nodeType && thing.nodeType == 1) {
456            return "HTMLElement";
457          } else {
458            return typeof thing;
459          }
460        }
461      }
462    }
463  },
464  getBrowserSupport: function() {
465    var ret = {};
466    var input = $('<input id="WFtemp" />').get(0);
467    ret.placeholder = ("placeholder" in input);
468    $("#WFtemp").remove();
469    ret.tel = false;
470    var userAgent = navigator.userAgent;
471    var mobileStrings = ["iPhone", "Android", "BlackBerry", "Mobile"];
472    $.each(mobileStrings, function(idx, val) {
473      if (new RegExp(val, "i").test(userAgent)) {
474        ret.tel = true;
475        return true;
476      }
477    });
478    ret.touch = !!("ontouchstart" in window);
479    ret.IE7mode = false;
480    if ($("html").hasClass("ie7")) {
481      ret.IE7mode = true;
482    }
483    if (document.documentMode != undefined && document.documentMode < 8) {
484      ret.IE7mode = true;
485    }
486    ret.isIE = (userAgent.indexOf("MSIE") != -1);
487    return ret;
488  },
489  getLanguage: function() {
490    return document.getElementsByTagName("html")[0].lang;
491  },
492  getClist: function(elem) {
493    if (elem.tagName.toUpperCase() == "BODY") {
494      return "";
495    }
496    var clist = $(elem).data("cid") + "~" + $(elem).data("ctid");
497    if (clist.search("undef") != -1) {
498      return WF.Utils.getClist(elem.parentNode);
499    }
500    return clist;
501  },
502  getDimensions: function(elem) {
503    return {
504      "width": $(elem).width(),
505      "height": $(elem).height()
506    };
507  },
508  getNameFromCallee: function(callee) {
509    var hope = callee.toString().match(/^function (\w*)\(/);
510    if (hope && hope[1]) {
511      return hope[1];
512    }
513    if (callee.toString().search(/^function ?\(/) != -1) {
514      return "[anonymous function]";
515    }
516    return false;
517  },
518  getTasCallData: function(elem, useDisplayed) {
519    elem = $(elem).get(0);
520    var $elem = $(elem),
521      ret = {},
522      slotId, COID;
523    if ($elem.prop("tagName").toLowerCase() != "a") {
524      if ($(elem).find(".iaRendered").length) {
525        elem = $(elem).find(".iaRendered").get(0);
526      } else {
527        elem = $(elem).find("a").get(0);
528      }
529      $elem = $(elem);
530    } else {
531      if (!$elem.data("offerId") && $elem.parents(".iaRendered").length) {
532        elem = $elem.parents(".iaRendered").get(0);
533        $elem = $(elem);
534      }
535    }
536    if (elem.className.search(/^tasRendered/) != -1) {
537      COID = elem.className.replace(/tasRendered/, "");
538      slotId = $elem.find("img").get(0).id;
539    } else {
540      if ($elem.data("offerId")) {
541        COID = $elem.data("offerId");
542        slotId = $elem.data("slotId");
543      } else {
544        if (useDisplayed) {
545          return {
546            "displayed": null
547          };
548        }
549        return null;
550      }
551    }
552    if (useDisplayed) {
553      ret.displayed = slotId + ":" + COID;
554    } else {
555      ret.COID = COID;
556      ret.slotId = slotId;
557    }
558    return ret;
559  },
560  getViewportSize: function() {
561    return {
562      "width": $(window).width(),
563      "height": $(window).height()
564    };
565  },
566  getPageTitle: function() {
567    return $("h1.c11").html();
568  },
569  getMediaElementTypeTitle: function() {
570    if ($("audio").length > 0) {
571      $("audio").each(function(index, value) {
572        if ($(this).closest("div.c51.audio").find("h1").html() != "undefined") {
573          return $(this).closest("div.c51.audio").find("h1").html();
574        }
575      });
576    }
577    if ($("video").length > 0) {
578      $("video").each(function(index, value) {
579        if ($(this).closest("div.c51").find("h1").html() != "undefined") {
580          return $(this).closest("div.c51").find("h1").html();
581        }
582      });
583    }
584    return $("#title").find("h1").html();
585  },
586  handleVjsMultimediaPlayerEvent: function(evt, player) {
587    var eName;
588    var applicationCode = "VID";
589    var optData = {
590      "data[playerId]": player.id,
591      "data[interaction]": evt,
592      "data[eventName]": eName,
593      "data[mediaType]": "VID",
594      "data[currentTime]": player.currentTime(),
595      "data[remainingTime]": player.remainingTime(),
596      "data[duration]": player.duration()
597    };
598    var additionalData = {
599      "eventStructure[MediaInteractionCreator]": applicationCode + "_interaction",
600      "headerStructure[HeaderCreator]": "header_" + applicationCode
601    };
602    if (evt == "FIRSTPLAY") {
603      eName = "Presentment";
604      additionalData = {
605        "eventsOrder": [{
606          "ApplvisitCreator": " 1"
607        }, {
608          "BrowserCreator": "2"
609        }, {
610          "MediaDisplayCreator": "3"
611        }, {
612          "MediaPresentmentCreator": "4"
613        }, {
614          "CustomertypeCreator": "5"
615        }],
616        "eventStructure[MediaPresentmentCreator]": applicationCode + "_presentment",
617        "eventStructure[ApplvisitCreator]": applicationCode + "_applvisit",
618        "eventStructure[BrowserCreator]": applicationCode + "_browser",
619        "eventStructure[MediaDisplayCreator]": applicationCode + "_Display",
620        "eventStructure[CustomertypeCreator]": applicationCode + "_customertype",
621        "headerStructure[HeaderCreator]": "header_" + applicationCode
622      };
623    } else {
624      if (evt == "ENDED") {
625        eName = "Completion";
626        additionalData = {
627          "eventStructure[MediaCompletionCreator]": applicationCode + "_completion",
628          "headerStructure[HeaderCreator]": "header_" + applicationCode
629        };
630      } else {
631        if (evt == "PLAY" || evt == "PAUSE") {
632          eName = "Interaction";
633        } else {
634          eName = "Interaction";
635        }
636      }
637    }
638    $.extend(optData, additionalData);
639    if (!(evt == "PAUSE" && player.currentTime() == player.duration())) {
640      WF.Utils.logC2tEvent(optData);
641    }
642  },
643  handleMejsMultimediaPlayerEvent: function(evt, player) {
644    var eName;
645    var applicationCode = "AUD";
646    var optData = {
647      "data[playerId]": player.id,
648      "data[interaction]": evt,
649      "data[eventName]": eName,
650      "data[mediaType]": "AUD",
651      "data[currentTime]": player.getCurrentTime(),
652      "data[remainingTime]": player.getDuration() - player.getCurrentTime(),
653      "data[duration]": player.getDuration()
654    };
655    var additionalData = {
656      "eventStructure[MediaInteractionCreator]": applicationCode + "_interaction",
657      "headerStructure[HeaderCreator]": "header_" + applicationCode
658    };
659    if (evt == "FIRSTPLAY") {
660      eName = "Presentment";
661      additionalData = {
662        "eventsOrder": [{
663          "ApplvisitCreator": " 1"
664        }, {
665          "BrowserCreator": "2"
666        }, {
667          "MediaDisplayCreator": "3"
668        }, {
669          "MediaPresentmentCreator": "4"
670        }, {
671          "CustomertypeCreator": "5"
672        }],
673        "eventStructure[MediaPresentmentCreator]": applicationCode + "_presentment",
674        "eventStructure[ApplvisitCreator]": applicationCode + "_applvisit",
675        "eventStructure[BrowserCreator]": applicationCode + "_browser",
676        "eventStructure[MediaDisplayCreator]": applicationCode + "_Display",
677        "eventStructure[CustomertypeCreator]": applicationCode + "_customertype",
678        "headerStructure[HeaderCreator]": "header_" + applicationCode
679      };
680    } else {
681      if (evt == "ENDED" || evt == "ended") {
682        eName = "Completion";
683        additionalData = {
684          "eventStructure[MediaCompletionCreator]": applicationCode + "_completion",
685          "headerStructure[HeaderCreator]": "header_" + applicationCode
686        };
687      } else {
688        if (evt == "PLAY" || evt == "PAUSE") {
689          eName = "Interaction";
690        } else {
691          eName = "Interaction";
692        }
693      }
694    }
695    $.extend(optData, additionalData);
696    if (!(evt == "PAUSE" && player.getCurrentTime() == player.getDuration())) {
697      WF.Utils.logC2tEvent(optData);
698    }
699  },
700  logC2tEvent: function(options, callback) {
701    var stdOptions = {
702      "data[log]": 1,
703      "data[pid]": $("#shell").data("pid"),
704      "data[url]": window.location.href,
705      "data[applicationCode]": "MEDIA",
706      "data[pageTitle]": "MEDIA_INPUT_PAGE",
707      "data[mediaName]": WF.Utils.getMediaElementTypeTitle(),
708      "data[cb]": new Date().valueOf()
709    };
710    var asyncMode = true;
711    var trackInfo = stdOptions;
712    $.extend(trackInfo, options);
713    $.each(trackInfo, function(idx, val) {
714      if (typeof val == "string") {
715        trackInfo[idx] = WF.Utils.stripTcm(val);
716      }
717    });
718    if (trackInfo.suppressAsync) {
719      asyncMode = false;
720    }
721    delete trackInfo.suppressAsync;
722    $.ajax({
723      url: "/c2tEvents/event",
724      type: "POST",
725      async: asyncMode,
726      data: trackInfo,
727      success: function(data) {
728        if (callback != null) {
729          callback();
730        }
731      }
732    });
733  },
734  objectToQueryString: function(obj) {
735    return WF.Utils.objectToString(obj, {
736      "fieldSeparator": "&",
737      "uriEncode": true
738    });
739  },
740  objectToString: function(obj, options) {
741    var defaults = {
742      "keyValSeparator": "=",
743      "fieldSeparator": ",",
744      "uriEncode": false,
745      "properJson": false
746    };
747    options = $.extend({}, defaults, options);
748    if (options.properJson) {
749      options = {
750        "properJson": true,
751        "uriEncode": false,
752        "keyValSeparator": ":",
753        "fieldSeparator": ","
754      };
755    }
756    var arr = [],
757      ret, key, val;
758    switch (typeof obj) {
759      case "string":
760      case "number":
761        ret = obj;
762        break;
763      case "boolean":
764        ret = new Boolean(obj).toString();
765        break;
766      case "function":
767        ret = "function";
768        break;
769      case "undefined":
770        ret = "undefined";
771        break;
772      default:
773        if (obj == null) {
774          return "null";
775        }
776        if (obj instanceof Array) {
777          return "[" + obj.toString() + "]";
778        }
779        for (key in obj) {
780          if (obj.hasOwnProperty(key)) {
781            val = obj[key];
782            if (options.uriEncode) {
783              val = encodeURIComponent(val);
784            }
785            if (options.properJson) {
786              if (typeof val == "string") {
787                val = '"' + val + '"';
788              }
789              if (val instanceof Array) {
790                val = $.map(val, function(item, idx) {
791                  if (typeof item == "string") {
792                    item = '"' + item + '"';
793                  }
794                  return item;
795                }).join(",");
796                val = "[" + val + "]";
797              }
798              arr.push('"' + key + '"' + options.keyValSeparator + val);
799            } else {
800              if (val instanceof Array) {
801                val = "[" + val + "]";
802              }
803              arr.push(key + options.keyValSeparator + val);
804            }
805          }
806        }
807        ret = arr.join(options.fieldSeparator);
808    }
809    if (options.properJson) {
810      ret = "{" + ret + "}";
811    }
812    return ret;
813  },
814  parseErrorStack: function(stack, errName) {
815    var isChrome = (stack.search(/\n +at/) != -1);
816    stack = stack.replace(/(\d+):\d+\)\n/g, "$1\n");
817    var lines = stack.split(/\n(?: +at )?/);
818    if (isChrome) {
819      lines.shift();
820    }
821    var ret = [],
822      funcname;
823    for (var i = 0; i < lines.length; i++) {
824      var item = {};
825      if (isChrome) {
826        funcname = lines[i].split(/ /).shift();
827      } else {
828        funcname = lines[i].split(/\@/).shift();
829      }
830      var match = funcname.match(/\((.*)\)$/);
831      if (match) {
832        item.args = match[1];
833        funcname = funcname.substr(0, funcname.indexOf("("));
834      }
835      item.name = funcname;
836      item.line = lines[i].split(/:/).pop();
837      lines[i] = lines[i].replace(/:\d+$/, "");
838      item.url = lines[i].split(/[\(@]/).pop();
839      ret.push(item);
840    }
841    return ret;
842  },
843  removeHtmlTags: function(content) {
844    if (content === null) {
845      return "";
846    }
847    if (content.indexOf("<") != -1) {
848      content = content.slice(0, content.indexOf("<")) + content.slice(content.indexOf(">") + 1);
849      content = arguments.callee(content);
850    }
851    content = content.replace(/(^\s+|\s+$)/g, "");
852    return content;
853  },
854  replaceEncodedWhiteListChars: function(str) {
855    str = str.replace("&amp;", "&");
856    return str;
857  },
858  setDelayedScrollTo: function(elem) {
859    var targetElement;    
860    // Handle string input
861    if (typeof elem === 'string') {
862      // Remove the # prefix if present
863      var id = elem.charAt(0) === '#' ? elem.substring(1) : elem;
864      
865      // Use native getElementById
866      targetElement = document.getElementById(id);
867    } else {
868      // Handle DOM element or jQuery object
869      targetElement = $(elem).get(0);
870    }    
871    if (targetElement === undefined || targetElement === null) {
872      return;
873    }    
874    setTimeout(function() {
875      targetElement.scrollIntoView(true);
876    }, 500);
877  },//2025-12
878  setImageSrcFromBackground: function(img, code) {
879    try {
880      var $img = $(img),
881        bgImgPath = $img.css("background-image"),
882        msg = "WF.Utils.setImageSrcFromBackground() couldn't get background-image",
883        imgDesc, parents;
884      if ($img.get(0).tagName.toLowerCase() != "img") {
885        return false;
886      }
887      imgDesc = "IMG";
888      if ($img.attr("class")) {
889        imgDesc += "." + $img.attr("class");
890      }
891      if (bgImgPath == "none") {
892        if (code) {
893          msg += ';\ncalled from codepoint "' + code + '"';
894        }
895        parents = $.map($img.parents(), function(elem) {
896          elem = $(elem).get(0);
897          if (elem.tagName == "INPUT") {
898            return elem.tagName + "[" + elem.type + "]." + elem.className;
899          }
900          ret = elem.tagName;
901          if (elem.id != "") {
902            ret += "#" + elem.id;
903          }
904          if (elem.className != "") {
905            ret += "." + elem.className;
906          }
907          return ret;
908        }).reverse().join(" > ");
909        parents += " > " + imgDesc;
910        msg += ";\nDOM chain: " + parents;
911        WF.Utils.ajaxLog({
912          "message": msg
913        });
914        return false;
915      }
916      bgImgPath = bgImgPath.replace(/['"]?\)$/, "");
917      bgImgPath = bgImgPath.replace(/^url\(['"']?/, "");
918      $img.attr("src", bgImgPath);
919      return true;
920    } catch (e) {
921      WF.Utils.ajaxLog(e);
922      return false;
923    }
924  },
925  stripTcm: function(str) {
926    return str.replace(/(^|\~)tcm:/g, "$1");
927  },
928  trackTas: function(tasData, callback) {
929    if (typeof tasInfo == "undefined" || !tasInfo) {
930      return false;
931    }
932    if (tasData.displayed === null || tasData.displayed === "null") {
933      return false;
934    }
935    var stdOptions = {
936      "App_ID": tasInfo.App_ID,
937      "pageID": tasInfo.pageID,
938      "pageUrl": window.location.href,
939      "RequestType": "Click"
940    };
941    var asyncMode = true,
942      destinationUrl = tasInfo.Url,
943      trackInfo = stdOptions;
944    $.extend(trackInfo, tasData);
945    if (trackInfo.suppressAsync) {
946      asyncMode = false;
947    }
948    if (trackInfo.destinationUrl) {
949      destinationUrl = trackInfo.destinationUrl;
950    }
951    delete trackInfo.suppressAsync;
952    if (trackInfo.RequestType == "Click" && tasInfo.deviceType) {
953      trackInfo.deviceType = tasInfo.deviceType;
954    }
955    delete trackInfo.destinationUrl;
956    tasData.App_ID = tasInfo.App_ID;
957    tasData.pageID = tasInfo.pageID;
958    $.ajax({
959      url: destinationUrl,
960      type: "POST",
961      async: asyncMode,
962      data: trackInfo,
963      success: function() {
964        if (callback != null) {
965          callback();
966        }
967      }
968    });
969  },
970  trackVS: function(options, callback) {
971    var stdOptions = {
972      "log": 1,
973      "pid": $("#shell").data("pid"),
974      "pageUrl": window.location.href,
975      "cb": new Date().valueOf()
976    };
977    var asyncMode = true;
978    var trackInfo = stdOptions;
979    $.extend(trackInfo, options);
980    $.each(trackInfo, function(idx, val) {
981      if (typeof val == "string") {
982        trackInfo[idx] = WF.Utils.stripTcm(val);
983      }
984    });
985    if (trackInfo.suppressAsync) {
986      asyncMode = false;
987    }
988    delete trackInfo.suppressAsync;
989    $.ajax({
990      url: "/img/corptrust/s.gif",
991      type: "GET",
992      async: asyncMode,
993      data: trackInfo,
994      success: function() {
995        if (callback != null) {
996          callback();
997        }
998      }
999    });
1000  },
1001  ucfirst: function(str) {
1002    var first = str.substr(0, 1);
1003    var rest = str.substr(1);
1004    return first.toUpperCase() + rest.toLowerCase();
1005  },
1006  untaintAndParse: function(str) {
1007    if (str.substr(0, 100).search(/for *\(;;/) == -1) {
1008      WF.Utils.ajaxLog({
1009        "message": "Expected JSON result but got: " + str.substr(0, 100) + "..."
1010      });
1011      return str;
1012    }
1013    try {
1014      str = str.replace(/^\s*for *\(;;\) *;?\s*/, "");
1015      str = str.replace(/^\s*\/\*\s*\w+%\s+\{/, "{").replace(/\}\s+%\w+\s*\*\/\s*$/, "}");
1016      return jQuery.parseJSON(str);
1017    } catch (err) {
1018      WF.Utils.ajaxLog(err);
1019    }
1020  },
1021  fireC2TonLoadEvents: function(applicationCode) {
1022    var stdOptions = {
1023      "log": 1,
1024      "url": window.location.href,
1025      "eventsOrder": [{
1026        "PresentmentCreator": "1"
1027      }, {
1028        "ApplvisitCreator": " 2"
1029      }, {
1030        "BrowserCreator": "3"
1031      }, {
1032        "CustomertypeCreator": "4"
1033      }, {
1034        "FormdisplayCreator": "5"
1035      }],
1036      "eventStructure[PresentmentCreator]": applicationCode + "_presentment",
1037      "eventStructure[ApplvisitCreator]": applicationCode + "_applvisit",
1038      "eventStructure[BrowserCreator]": applicationCode + "_browser",
1039      "eventStructure[CustomertypeCreator]": applicationCode + "_customertype",
1040      "eventStructure[FormdisplayCreator]": applicationCode + "_Display",
1041      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1042    };
1043    WF.Utils.logC2TtoolEvent(stdOptions);
1044  },
1045  fireC2THMRPConLoadEvents: function(applicationCode, subproduct) {
1046    if (subproduct == "Home Equity") {
1047      subproduct = "HomeEquity";
1048    }
1049    var stdOptions = {
1050      "log": 1,
1051      "url": window.location.href,
1052      "eventsOrder": [{
1053        "PresentmentCreator": "1"
1054      }, {
1055        "ApplvisitCreator": " 2"
1056      }, {
1057        "BrowserCreator": "3"
1058      }, {
1059        "CustomertypeCreator": "4"
1060      }, {
1061        "FormdisplayCreator": "5"
1062      }],
1063      "eventStructure[PresentmentCreator]": applicationCode + "_" + subproduct + "_presentment",
1064      "eventStructure[ApplvisitCreator]": applicationCode + "_applvisit",
1065      "eventStructure[BrowserCreator]": applicationCode + "_browser",
1066      "eventStructure[CustomertypeCreator]": applicationCode + "_customertype",
1067      "eventStructure[FormdisplayCreator]": applicationCode + "_Display",
1068      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1069    };
1070    WF.Utils.logC2TtoolEvent(stdOptions);
1071  },
1072  fireC2TformonLoadEvent: function(formId, product, subproduct) {
1073    var applicationCode = "CUF";
1074    var stdOptions = {
1075      "log": 1,
1076      "url": window.location.href,
1077      "eventsOrder": [{
1078        "ApplvisitCreator": "1"
1079      }, {
1080        "BrowserCreator": "2"
1081      }, {
1082        "CUFFormApplstartCreator": "3"
1083      }, {
1084        "CustomertypeCreator": "4"
1085      }, {
1086        "FormdisplayCreator": "5"
1087      }],
1088      "eventStructure[ApplvisitCreator]": applicationCode + "_applvisit",
1089      "eventStructure[BrowserCreator]": applicationCode + "_browser",
1090      "eventStructure[CUFFormApplstartCreator]": applicationCode + "_applstart",
1091      "eventStructure[CustomertypeCreator]": applicationCode + "_customertype",
1092      "eventStructure[FormdisplayCreator]": formId + "_Display",
1093      "headerStructure[CUFHeaderCreator]": "header_" + formId,
1094      "data[pageID]": formId,
1095      "data[product]": product,
1096      "data[subProduct]": subproduct,
1097      "data[headerIdentifer]": "header_" + applicationCode
1098    };
1099    WF.Utils.logC2TtoolEvent(stdOptions);
1100  },
1101  fireC2TConsiderationEvent: function(applicationCode, clickName, clickType) {
1102    var stdOptions = {
1103      "log": 1,
1104      "url": window.location.href,
1105      "eventsOrder": [{
1106        "ConsiderationCreator": " 1"
1107      }, {
1108        "ClickCreator": "2"
1109      }],
1110      "eventStructure[ConsiderationCreator]": applicationCode + "_Consideration",
1111      "eventStructure[ClickCreator]": applicationCode + "_" + clickType + "_Click",
1112      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1113      "data[clickType]": clickType,
1114      "data[clickItemName]": clickName
1115    };
1116    WF.Utils.logC2TtoolEvent(stdOptions);
1117  },
1118  fireC2THMRPCConsiderationEvent: function(applicationCode, subproduct, clickName, clickType) {
1119    if (subproduct == "Home Equity") {
1120      subproduct = "HomeEquity";
1121    }
1122    var stdOptions = {
1123      "log": 1,
1124      "url": window.location.href,
1125      "eventsOrder": [{
1126        "ConsiderationCreator": "1"
1127      }, {
1128        "ClickCreator": "2"
1129      }],
1130      "eventStructure[ClickCreator]": applicationCode + "_" + clickType + "_Click",
1131      "eventStructure[ConsiderationCreator]": applicationCode + "_" + subproduct + "_Consideration",
1132      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1133      "data[clickType]": clickType,
1134      "data[clickItemName]": clickName
1135    };
1136    WF.Utils.logC2TtoolEvent(stdOptions);
1137  },
1138  fireC2TCompletionEvent: function(applicationCode, clickName, clickType) {
1139    var stdOptions = {
1140      "log": 1,
1141      "url": window.location.href,
1142      "eventsOrder": [{
1143        "CompletionCreator": "1"
1144      }, {
1145        "ClickCreator": "2"
1146      }],
1147      "eventStructure[ClickCreator]": applicationCode + "_" + clickType + "_Click",
1148      "eventStructure[CompletionCreator]": applicationCode + "_Completion",
1149      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1150      "data[clickType]": clickType,
1151      "data[clickItemName]": clickName
1152    };
1153    WF.Utils.logC2TtoolEvent(stdOptions);
1154  },
1155  fireC2THMRPCCompletionEvent: function(applicationCode, subproduct, clickName, clickType) {
1156    if (subproduct == "Home Equity") {
1157      subproduct = "HomeEquity";
1158    }
1159    var stdOptions = {
1160      "log": 1,
1161      "url": window.location.href,
1162      "eventsOrder": [{
1163        "CompletionCreator": "1"
1164      }, {
1165        "ClickCreator": "2"
1166      }],
1167      "eventStructure[ClickCreator]": applicationCode + "_" + clickType + "_Click",
1168      "eventStructure[CompletionCreator]": applicationCode + "_" + subproduct + "_Completion",
1169      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1170      "data[clickType]": clickType,
1171      "data[clickItemName]": clickName
1172    };
1173    WF.Utils.logC2TtoolEvent(stdOptions);
1174  },
1175  fireC2TPCTCompletionEvent: function(applicationCode, subproduct, clickName, clickType) {
1176    var stdOptions = {
1177      "log": 1,
1178      "url": window.location.href,
1179      "eventsOrder": [{
1180        "CompletionCreator": " 1"
1181      }, {
1182        "ClickCreator": "2"
1183      }],
1184      "eventStructure[ClickCreator]": applicationCode + "_" + subproduct + "_Click",
1185      "eventStructure[CompletionCreator]": applicationCode + "_" + subproduct + "_Completion",
1186      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1187      "data[clickType]": clickType,
1188      "data[clickItemName]": clickName
1189    };
1190    WF.Utils.logC2TtoolEvent(stdOptions);
1191  },
1192  fireC2TPCTConsiderationEvent: function(applicationCode, subproduct, clickName, clickType) {
1193    var stdOptions = {
1194      "log": 1,
1195      "url": window.location.href,
1196      "eventsOrder": [{
1197        "ConsiderationCreator": " 1"
1198      }, {
1199        "ClickCreator": "2"
1200      }],
1201      "eventStructure[ClickCreator]": applicationCode + "_" + subproduct + "_Click",
1202      "eventStructure[ConsiderationCreator]": applicationCode + "_" + subproduct + "_Consideration",
1203      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1204      "data[clickType]": clickType,
1205      "data[clickItemName]": clickName
1206    };
1207    WF.Utils.logC2TtoolEvent(stdOptions);
1208  },
1209  fireC2TInteractionEvent: function(applicationCode, clickName, clickType) {
1210    var stdOptions = {
1211      "log": 1,
1212      "url": window.location.href,
1213      "eventsOrder": [{
1214        "InteractionCreator": " 1"
1215      }, {
1216        "ClickCreator": "2"
1217      }],
1218      "eventStructure[InteractionCreator]": applicationCode + "_Interaction",
1219      "eventStructure[ClickCreator]": applicationCode + "_" + clickType + "_Click",
1220      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1221      "data[clickType]": clickType,
1222      "data[clickItemName]": clickName
1223    };
1224    WF.Utils.logC2TtoolEvent(stdOptions);
1225  },
1226  fireC2THMRPCUserErrorEvent1: function(applicationCode, product, subProduct, loanPurpose, homeValue, downPayment, loanAmount, hasError, downPayment_error, homeValue_error, propertyLoc_Error, propertyState, propertyCounty) {
1227    var stdOptions = {
1228      "log": 1,
1229      "url": window.location.href,
1230      "eventsOrder": [{
1231        "InteractionCreator": " 1"
1232      }, {
1233        "ClickCreator": "2"
1234      }, {
1235        "HMRPCUsererrorCreator": "3"
1236      }],
1237      "eventStructure[ClickCreator]": applicationCode + "_BUTTON_Click",
1238      "eventStructure[HMRPCUsererrorCreator]": applicationCode + "_UserError",
1239      "eventStructure[InteractionCreator]": applicationCode + "_" + loanPurpose + "_Interaction",
1240      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1241      "data[product]": product,
1242      "data[subProduct]": subProduct,
1243      "data[clickType]": "BUTTON",
1244      "data[clickItemName]": "Calculate",
1245      "data[submitButton]": "Calculate",
1246      "data[loanPurpose]": loanPurpose,
1247      "data[homeValue]": homeValue,
1248      "data[downPayment]": downPayment,
1249      "data[loanAmount]": loanAmount,
1250      "data[hasError]": hasError,
1251      "data[downPayment_error]": downPayment_error,
1252      "data[homeValue_error]": homeValue_error,
1253      "data[propertyLoc_Error]": propertyLoc_Error,
1254      "data[state]": propertyState,
1255      "data[county]": propertyCounty
1256    };
1257    WF.Utils.logC2TtoolEvent(stdOptions);
1258  },
1259  fireC2THMRPCUserErrorEvent2: function(applicationCode, product, subProduct, loanPurpose, homeValue, loanAmount, hasError, loanAmount_error, homeValue_error, propertyLoc_Error, propertyState, propertyCounty) {
1260    var stdOptions = {
1261      "log": 1,
1262      "url": window.location.href,
1263      "eventsOrder": [{
1264        "InteractionCreator": " 1"
1265      }, {
1266        "ClickCreator": "2"
1267      }, {
1268        "HMRPCUsererrorCreator": "3"
1269      }],
1270      "eventStructure[ClickCreator]": applicationCode + "_BUTTON_Click",
1271      "eventStructure[HMRPCUsererrorCreator]": applicationCode + "_UserError",
1272      "eventStructure[InteractionCreator]": applicationCode + "_" + loanPurpose + "_Interaction",
1273      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1274      "data[product]": product,
1275      "data[subProduct]": subProduct,
1276      "data[clickType]": "BUTTON",
1277      "data[clickItemName]": "Calculate",
1278      "data[submitButton]": "Calculate",
1279      "data[loanPurpose]": loanPurpose,
1280      "data[homeValue]": homeValue,
1281      "data[loanAmount]": loanAmount,
1282      "data[hasError]": hasError,
1283      "data[loanAmount_error]": loanAmount_error,
1284      "data[homeValue_error]": homeValue_error,
1285      "data[propertyLoc_Error]": propertyLoc_Error,
1286      "data[state]": propertyState,
1287      "data[county]": propertyCounty
1288    };
1289    WF.Utils.logC2TtoolEvent(stdOptions);
1290  },
1291  fireC2THMRPCUserErrorEvent3: function(applicationCode, product, subProduct, loanPurpose, homeValue, mortgageBalance, loanAmount, hasError, mortgageBalance_error, loanAmount_error, homeValue_error, propertyLoc_Error, propertyState, propertyCounty) {
1292    var stdOptions = {
1293      "log": 1,
1294      "url": window.location.href,
1295      "eventsOrder": [{
1296        "InteractionCreator": " 1"
1297      }, {
1298        "ClickCreator": "2"
1299      }, {
1300        "HMRPCUsererrorCreator": "3"
1301      }],
1302      "eventStructure[ClickCreator]": applicationCode + "_BUTTON_Click",
1303      "eventStructure[HMRPCUsererrorCreator]": applicationCode + "_UserError",
1304      "eventStructure[InteractionCreator]": applicationCode + "_" + loanPurpose + "_Interaction",
1305      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1306      "data[product]": product,
1307      "data[subProduct]": subProduct,
1308      "data[clickType]": "BUTTON",
1309      "data[clickItemName]": "Calculate",
1310      "data[submitButton]": "Calculate",
1311      "data[loanPurpose]": loanPurpose,
1312      "data[homeValue]": homeValue,
1313      "data[mortgageBalance]": mortgageBalance,
1314      "data[loanAmount]": loanAmount,
1315      "data[hasError]": hasError,
1316      "data[mortgageBalance_error]": mortgageBalance_error,
1317      "data[homeValue_error]": homeValue_error,
1318      "data[loanAmount_error]": loanAmount_error,
1319      "data[propertyLoc_Error]": propertyLoc_Error,
1320      "data[state]": propertyState,
1321      "data[county]": propertyCounty
1322    };
1323    WF.Utils.logC2TtoolEvent(stdOptions);
1324  },
1325  fireC2TALRFUserErrorEvent: function(applicationCode, product, subProduct, currentbalance, cashNeeded, interest, payments, hasError, currentbalance_error, cashNeeded_error, interest_error) {
1326    var stdOptions = {
1327      "log": 1,
1328      "url": window.location.href,
1329      "eventsOrder": [{
1330        "InteractionCreator": " 1"
1331      }, {
1332        "ClickCreator": "2"
1333      }, {
1334        "ALRFUsererrorCreator": "3"
1335      }],
1336      "eventStructure[ClickCreator]": applicationCode + "_BUTTON_Click",
1337      "eventStructure[ALRFUsererrorCreator]": applicationCode + "_UserError",
1338      "eventStructure[InteractionCreator]": applicationCode + "_Interaction",
1339      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1340      "data[product]": product,
1341      "data[subProduct]": subProduct,
1342      "data[clickType]": "BUTTON",
1343      "data[clickItemName]": "Calculate",
1344      "data[submitButton]": "Calculate",
1345      "data[currentbalance]": currentbalance,
1346      "data[cashNeeded]": cashNeeded,
1347      "data[interest]": interest,
1348      "data[payments]": payments,
1349      "data[hasError]": hasError,
1350      "data[currentbalance_error]": currentbalance_error,
1351      "data[cashNeeded_error]": cashNeeded_error,
1352      "data[interest_error]": interest_error
1353    };
1354    WF.Utils.logC2TtoolEvent(stdOptions);
1355  },
1356  fireC2TALRFFormDataSubmitEvent: function(applicationCode, product, subProduct, currentbalance, cashNeeded, interest, payments, hasError, currentbalance_error, cashNeeded_error, interest_error) {
1357    var stdOptions = {
1358      "log": 1,
1359      "url": window.location.href,
1360      "eventsOrder": [{
1361        "InteractionCreator": " 1"
1362      }, {
1363        "ClickCreator": "2"
1364      }, {
1365        "ALRFFormSubmitCreator": "3"
1366      }],
1367      "eventStructure[ClickCreator]": applicationCode + "_BUTTON_Click",
1368      "eventStructure[ALRFFormSubmitCreator]": applicationCode + "_Submit",
1369      "eventStructure[InteractionCreator]": applicationCode + "_Interaction",
1370      "headerStructure[HeaderCreator]": "header_" + applicationCode,
1371      "data[product]": product,
1372      "data[subProduct]": subProduct,
1373      "data[clickType]": "BUTTON",
1374      "data[clickItemName]": "Calculate",
1375      "data[submitButton]": "Calculate",
1376      "data[currentbalance]": currentbalance,
1377      "data[cashNeeded]": cashNeeded,
1378      "data[interest]": interest,
1379      "data[payments]": payments,
1380      "data[hasError]": hasError,
1381      "data[currentbalance_error]": currentbalance_error,
1382      "data[cashNeeded_er
1382ror]": cashNeeded_error,
1383      "data[interest_error]": interest_error
1384    };
1385    WF.Utils.logC2TtoolEvent(stdOptions);
1386  },
1387  logC2TtoolEvent: function(toolsData) {
1388    var asyncMode = true;
1389    $.ajax({
1390      url: "/c2tEvents/event",
1391      type: "POST",
1392      async: asyncMode,
1393      data: toolsData,
1394      success: function(data) {}
1395    });
1396  },
1397  fireC2TShareWidgetEvent: function(applicationCode, obj) {
1398    if (!$(obj).hasClass("c52Link")) {
1399      var linkType = "";
1400      if ($(obj).hasClass("c7")) {
1401        linkType = "BUTTON";
1402      } else {
1403        linkType = "LINK";
1404      }
1405      var clickItemName = $(obj).html();
1406      if ($(obj).hasClass("c52fb")) {
1407        clickItemName = "Facebook";
1408      } else {
1409        if ($(obj).hasClass("c52twitter")) {
1410          clickItemName = "Twitter";
1411        }
1412      }
1413      WF.Utils.fireC2TConsiderationEvent(applicationCode, clickItemName, linkType);
1414    }
1415  },
1416  toolPresentmentEvent: function(applicationCode, logicalPageTitle, product, subProduct) {
1417    var stdOptions = {
1418      "log": 1,
1419      "url": window.location.href,
1420      "eventName": "Presentment",
1421      "applicationCode": applicationCode,
1422      "logicalPageTitle": logicalPageTitle,
1423      "cb": new Date().valueOf(),
1424      "product": product,
1425      "subProduct": subProduct
1426    };
1427    WF.Utils.logC2TtoolEvent(stdOptions);
1428  },
1429  toolConsiderationEvent: function(applicationCode, logicalPageTitle, product, subProduct, clickName, clickType) {
1430    var stdOptions = {
1431      "log": 1,
1432      "url": window.location.href,
1433      "eventName": "Consideration",
1434      "applicationCode": applicationCode,
1435      "logicalPageTitle": logicalPageTitle,
1436      "product": product,
1437      "subProduct": subProduct,
1438      "cb": new Date().valueOf(),
1439      "clickType": clickType,
1440      "clickItemName": clickName
1441    };
1442    WF.Utils.logC2TtoolEvent(stdOptions);
1443  },
1444  toolInteractionEvent: function(applicationCode, logicalPageTitle, product, subProduct, clickName, clickType) {
1445    var stdOptions = {
1446      "log": 1,
1447      "url": window.location.href,
1448      "eventName": "Interaction",
1449      "applicationCode": applicationCode,
1450      "logicalPageTitle": logicalPageTitle,
1451      "cb": new Date().valueOf(),
1452      "product": product,
1453      "subProduct": subProduct,
1454      "clickType": clickType,
1455      "clickItemName": clickName
1456    };
1457    WF.Utils.logC2TtoolEvent(stdOptions);
1458  },
1459  toolCompletionEvent: function(applicationCode, logicalPageTitle, product, subProduct, clickName, clickType) {
1460    var stdOptions = {
1461      "log": 1,
1462      "url": window.location.href,
1463      "eventName": "Completion",
1464      "applicationCode": applicationCode,
1465      "logicalPageTitle": logicalPageTitle,
1466      "cb": new Date().valueOf(),
1467      "product": product,
1468      "subProduct": subProduct,
1469      "clickType": clickType,
1470      "clickItemName": clickName
1471    };
1472    WF.Utils.logC2TtoolEvent(stdOptions);
1473  },
1474  FormPresentmentEvent: function(applicationCode, formId, logicalPageTitle, product, subProduct) {
1475    var stdOptions = {
1476      "log": 1,
1477      "url": window.location.href,
1478      "eventName": "ApplStart",
1479      formId: formId,
1480      "applicationCode": applicationCode,
1481      "logicalPageTitle": logicalPageTitle,
1482      "cb": new Date().valueOf(),
1483      "product": product,
1484      "subProduct": subProduct,
1485      "clickType": "",
1486      "clickItemName": ""
1487    };
1488    WF.Utils.logC2TFormEvent(stdOptions);
1489  },
1490  logC2TFormEvent: function(formData) {
1491    var asyncMode = true;
1492    $.ajax({
1493      url: "/c2tEvents/form",
1494      type: "POST",
1495      async: asyncMode,
1496      data: formData,
1497      success: function(data) {}
1498    });
1499  },
1500};
1501var childWindow = null;
1502WF.OnLoads = {
1503  doAll: function(root) {
1504    if (typeof root == "undefined") {
1505      root = $("body");
1506    }
1507    $.each(WF.OnLoads, function(name) {
1508      if (name != "doAll" && typeof WF.OnLoads[name] == "function") {
1509        try {
1510          WF.OnLoads[name](root);
1511        } catch (e) {
1512          WF.Utils.ajaxLog(e);
1513        }
1514      }
1515    });
1516  },
1517  initLiveChat: function(root) {
1518    $(root).on("click", ".live-chat-link", function() {
1519      var href = $(this).attr("href"),
1520        referer = "&referer=" + encodeURIComponent(document.location.href);
1521      if (href.length + referer.length <= 2000) {
1522        href += referer;
1523      }
1524      window.clickChat = "false";
1525      window.open(href, "", "scrollbars=yes,toolbar=no,resizable=yes,width=348,height=548");
1526      return false;
1527    });
1528  },
1529  initVideoChildWindows: function(root) {
1530    var childWindoWidth, childWindoHeight;
1531    if (navigator.userAgent.indexOf("MSIE") != -1) {
1532      var detectIEregexp = /MSIE (\d+\.\d+);/;
1533    } else {
1534      var detectIEregexp = /Trident.*rv[ :]*(\d+\.\d+)/;
1535    }
1536    if (detectIEregexp.test(navigator.userAgent)) {
1537      childWindoWidth = "476";
1538      childWindoHeight = "426";
1539    } else {
1540      var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
1541      if (isSafari) {
1542        if (screen.width == 1280 && screen.height == 800) {
1543          childWindoWidth = "480";
1544          childWindoHeight = "475";
1545        } else {
1546          if (screen.width == 1920 && screen.height == 1080) {
1547            childWindoWidth = "480";
1548            childWindoHeight = "453";
1549          } else {
1550            childWindoWidth = "480";
1551            childWindoHeight = "430";
1552          }
1553        }
1554      } else {
1555        childWindoWidth = "480";
1556        childWindoHeight = "430";
1557      }
1558    }
1559    $(root).find("a.videoChatWindow").off("click").click(function(e) {
1560      if ((childWindow == null) || (childWindow.closed)) {
1561        childWindow = window.open($(this).attr("href"), "Video Chat", "directories=no,menubar=no,scrollbars=no,location=no,status=no,titlebar=yes,toolbar=no,dialog=yes,resizable=no, width= " + childWindoWidth + ", height= " + childWindoHeight);
1562        childWindow.focus();
1563      } else {
1564        childWindow.focus();
1565      }
1566      return false;
1567    });
1568  },
1569  customEvents: function() {
1570    $(document).on("resizePage", function() {});
1571  },
1572  apply3rdPartyLinkTracking: function(root) {
1573    if (typeof root == "undefined") {
1574      root = $("body");
1575    }
1576    $(root).find("a[href^='http']").each(function() {
1577      if (this.href.search(/^https?:\/\/(www\.)?wellsfargo\.com\//) == -1) {
1578        var clist = WF.Utils.getClist(this);
1579        $(this).bind("click keypress", function(evt) {
1580          if (evt.type == "keypress" && evt.keyCode != 13) {
1581            return;
1582          }
1583          WF.Utils.trackVS({
1584            "suppressAsync": true,
1585            "event": "LinkActivated",
1586            "eventType": evt.type,
1587            "eventDescription": "outsideDomain",
1588            "destinationUrl": this.href,
1589            "linkText": $(this).text(),
1590            "clist": clist
1591          });
1592          if (evt.type == "keypress") {
1593            window.location.href = this.href;
1594            evt.preventDefault();
1595          }
1596        });
1597      }
1598    });
1599  },
1600  applyRotTracking: function(root) {
1601    if (typeof root == "undefined") {
1602      root = $("body");
1603    }
1604    $(root).find("a.rot").click(function(e) {
1605      var _this = $(this),
1606        curr = new Date(),
1607        time = curr.valueOf(),
1608        rotsrc = "//adfarm.mediaplex.com/ad/tr/7892-155493-3840-0?mpt=" + time + "&mpre=https%3A//adfarm.mediaplex.com/ad/ck/" + _this.attr("data-rotTracking") + "%3Fmpro%3Dhttps%3A//www.wellsfargo.com/images/s.gif%3F" + time,
1609        timer = window.setTimeout(function() {
1610          document.location.href = _this.attr("href");
1611        }, 4000);
1612      if (!document.getElementById("rottracker")) {
1613        $("body").append('<img id="rottracker" src="' + rotsrc + '" style="width:0;height:0;line-height:0"/>');
1614        $("#rottracker").ready(function() {
1615          window.clearTimeout(timer);
1616          timer = null;
1617          document.location.href = _this.attr("href");
1618        });
1619      } else {
1620        $("#rottracker").attr("src", rotsrc);
1621      }
1622      e.preventDefault();
1623    });
1624  },
1625  applySyllabusTracking: function(root) {
1626    if (typeof root == "undefined") {
1627      root = $("body");
1628    }
1629    $(root).find("ul.c49nav a").bind("click keypress", function(evt) {
1630      if (evt.type == "keypress" && evt.keyCode != 13) {
1631        return;
1632      }
1633      var clist = WF.Utils.getClist(this);
1634      var pos = $(this).closest(".c49").parent().children(".sideUtility").attr("class");
1635      pos = $.trim(pos.replace(/sideUtility/, ""));
1636      WF.Utils.trackVS({
1637        "suppressAsync": true,
1638        "event": "LinkActivated",
1639        "eventType": evt.type,
1640        "eventDescription": "syllabusLink",
1641        "destinationUrl": this.href,
1642        "position": WF.Utils.ucfirst(pos),
1643        "clist": clist
1644      });
1645      if (evt.type == "keypress") {
1646        evt.preventDefault();
1647        window.location.href = this.href;
1648      }
1649    });
1650  },
1651  applyTasV2Tracking: function(root) {
1652    if (typeof root == "undefined") {
1653      root = $("body");
1654    }
1655    $(root).find(".iaRendered").each(function() {
1656      this.elem = this;
1657      var $el = $(this);
1658      var offerId = $el.data("offerId"),
1659        slotId = $el.data("slotId"),
1660        $cta = $el.find(".c7, .c13, .c22");
1661      if ($cta.length == 0) {
1662        return true;
1663      }
1664      if ($cta.length > 1) {
1665        $cta = $cta[0];
1666      }
1667      var postData = {
1668        "pageURL": "https://www.wellsfargo.com/Clickthrough",
1669        "RequestType": "Click",
1670        "COID": offerId,
1671        "App_ID": tasInfo.App_ID,
1672        "slotId": slotId,
1673        "pageID": tasInfo.pageID
1674      };
1675      if (tasInfo.deviceType) {
1676        postData.deviceType = tasInfo.deviceType;
1677      }
1678      $cta.bind("click", function(evt) {
1679        $.ajax({
1680          url: tasInfo.Url,
1681          type: "POST",
1682          async: false,
1683          data: postData
1684        });
1685      });
1686    });
1687    if ($(root).find(".iaRendered").length == $(root).find(".iaRendered.cmsDefault").length && $(root).find(".iaRendered").length > 0) {
1688      $.ajax({
1689        url: "/img/corptrust/s.gif",
1690        type: "GET",
1691        data: {
1692          "Log": 1,
1693          "Program": "EventReporting",
1694          "Event": "IADefaultOffer",
1695          "Page": window.location.pathname + window.location.search,
1696          "cb": new Date().valueOf()
1697        }
1698      });
1699    }
1700  },
1701  applyTourTracking: function(root) {
1702    if (typeof root == "undefined") {
1703      root = $("body");
1704    }
1705    $(root).find(".c61 a").bind("click keypress", function(evt) {
1706      if (evt.type == "keypress" && evt.keyCode != 13) {
1707        return;
1708      }
1709      var clist = WF.Utils.getClist(this);
1710      var dir = WF.Utils.ucfirst($(this).text());
1711      var pos = ($(this).closest("#contentBottom").length) ? "Bottom" : "Top";
1712      WF.Utils.trackVS({
1713        "suppressAsync": true,
1714        "event": "LinkActivated",
1715        "eventType": evt.type,
1716        "eventDescription": "TourNavLink",
1717        "destinationUrl": this.href,
1718        "direction": dir,
1719        "position": pos,
1720        "clist": clist
1721      });
1722      if (evt.type == "keypress") {
1723        window.location.href = this.href;
1724        evt.preventDefault();
1725      }
1726    });
1727  },
1728  applyTelephoneStyling: function(root) {
1729    if (typeof root == "undefined") {
1730      root = $("body");
1731    }
1732    if (WF.Browser.supports.tel) {
1733      $(root).find(".c12").each(function() {
1734        var url = this.innerHTML.replace(/\D/g, "");
1735        if (url.length == 10) {
1736          url = "1" + url;
1737        }
1738        this.innerHTML = '<a href="tel:+' + url + '">' + this.innerHTML + "</a>";
1739      });
1740    } else {
1741      $(root).find(".c12").each(function() {
1742        this.innerHTML = "<strong>" + this.innerHTML + "</strong>";
1743      });
1744    }
1745  },
1746  fixExploreYourWay: function(root) {
1747    var pid = $("#shell").data("pid");
1748    if (!pid) {
1749      return;
1750    }
1751    pid = pid.replace(/^tcm:/, "");
1752    $(root).find(".c82").find("a.c82tile").each(function() {
1753      if ($(this).data("targetId").replace(/^tcm:/, "") == pid) {
1754        var newDiv = $('<div class="c82tile">');
1755        $(this).after(newDiv);
1756        $(this).children().each(function() {
1757          $(this).clone(true).appendTo(newDiv);
1758        });
1759        $(this).remove();
1760      }
1761    });
1762  },
1763  fixSkipNavLinks: function(root) {
1764    if (typeof root == "undefined") {
1765      root = $("body");
1766    }
1767    $(root).find('a[href="#skip"]').each(function() {
1768      $(this).click(function() {
1769        $($("#skip")[0]).focus();
1770      });
1771    });
1772  },
1773  numberFootnotes: function(root) {
1774    if (typeof root == "undefined") {
1775      root = $("body");
1776    }
1777    $(root).find('.c20body[data-numbered="true"]').each(function() {
1778      var cid = $(this).data("cid");
1779      if (WF.Page.Components.Footnotes[cid]) {
1780        if ($(this).find(".c20no").length === 0) {
1781          $(this).prepend('<span class="c20no">' + WF.Page.Components.Footnotes[cid] + ".</span>");
1782          $(this).attr("data-no", WF.Page.Components.Footnotes[cid]);
1783        }
1784      } else {
1785        if ($("body").find('sup.c20ref[data-footnote="' + cid + '"]').length == 0) {
1786          $(this).remove();
1787          return;
1788        }
1789        WF.Page.Components.Footnotes.last++;
1790        WF.Page.Components.Footnotes[cid] = WF.Page.Components.Footnotes.last;
1791        if ($(this).find(".c20no").length === 0) {
1792          $(this).prepend('<span class="c20no">' + WF.Page.Components.Footnotes.last + ".</span>");
1793          $(this).attr("data-no", WF.Page.Components.Footnotes.last);
1794        }
1795      }
1796    });
1797    $(root).find("sup.c20ref").each(function(key) {
1798      var footnote = $('.c20body[data-cid="' + $(this).attr("data-footnote") + '"]');
1799      if (footnote[0]) {
1800        $(this).html(footnote.attr("data-no"));
1801      }
1802    });
1803  },
1804  placeholderPolyfill: function(root) {
1805    if (typeof root == "undefined") {
1806      root = $("body");
1807    }
1808    if (!WF.Browser.supports.placeholder) {
1809      $(root).find("input[placeholder]").each(function() {
1810        var $this = $(this);
1811        if (!this.value) {
1812          this.value = $(this).attr("placeholder");
1813        }
1814        $(this).focus(function() {
1815          if (this.value == $(this).attr("placeholder")) {
1816            this.value = "";
1817          }
1818        }).blur(function() {
1819          if (this.value.length < 1) {
1820            this.value = $(this).attr("placeholder");
1821          }
1822        });
1823        $this.closest("form").submit(function() {
1824          if ($this.val() == $this.attr("placeholder")) {
1825            $this.val("");
1826          }
1827        });
1828      });
1829    }
1830  },
1831  preventFraming: function() {
1832    if (self != top) {
1833      if (top.location.hostname.search(/wellsfargo.com$/) != -1 && top.location.pathname.search(/\bDashboard\b/) != -1 && top.location.pathname.search(/\bC
1833ME\b/) != -1) {
1834        return true;
1835      }
1836      var tlh = top.location.hostname;
1837      if (tlh.search(/\.wellsfargo\.com$/)) {
1838        tlh = tlh.replace(/\.wellsfargo\.com$/, "");
1839        if (tlh.search(/^(dev|cte|slsi|oxi)-(wfadvisors|investing|wfawellstrade)$/) != -1 || tlh.search(/^(dev|cte|sls|ox)-(wfadvisors|investing|wfawellstrade)broker$/) != -1 || tlh.search(/^(wfadvisors|investing|wfawellstrade)$/) != -1 || tlh.search(/^(dev-m\.|cte-m\.|slsi-m-|oxi-m-)(wfadvisors|investing|wfawellstrade)(broker)?$/) != -1 || tlh.search(/^m\.(wfadvisors|investing|wfawellstrade)(broker)?$/) != -1) {
1840          return true;
1841        }
1842      }
1843      if (location.replace) {
1844        top.location.replace(window.location.href);
1845      } else {
1846        top.location = window.location.href;
1847      }
1848    }
1849  },
1850  setupAudioComponents: function(root) {
1851    if (typeof root == "undefined") {
1852      root = $("body");
1853    }
1854    $(".c51 video").each(function() {
1855      var vid = VideoJS(this.id);
1856      var posterAlt = $(this).attr("alt");
1857      vid.volume(0.8);
1858      $(this).attr("preload", "metadata");
1859      $(this).next("img.vjs-poster").attr("alt", posterAlt);
1860      if ($(this).closest(".c51.audio").length) {
1861        return;
1862      }
1863      setTimeout(function SetupVideoAnalytics() {
1864        vid.volume(1);
1865        var events = ["PLAY", "PAUSE", "FIRSTPLAY", "ENDED"];
1866        $.each(events, function setupVideoEvt(idx, evt) {
1867          vid.addEvent(evt.toLowerCase(), function() {
1868            WF.Utils.handleVjsMultimediaPlayerEvent(evt, vid);
1869          });
1870        });
1871        WF.Utils.handleVjsMultimediaPlayerEvent("FIRSTPLAY", vid);
1872      }, 100);
1873    });
1874    $(".c51 audio").each(function() {
1875      var aud = mediatrack;
1876      console.log($($(aud.container)[0]).find("button"));
1877      $(this).attr("preload", "metadata");
1878      $($(aud.container)[0]).find("button").click(function() {
1879        if ($(this).parent().hasClass("mejs-pause")) {
1880          WF.Utils.handleMejsMultimediaPlayerEvent("PAUSE", aud);
1881        }
1882        if ($(this).parent().hasClass("mejs-play")) {
1883          WF.Utils.handleMejsMultimediaPlayerEvent("PLAY", aud);
1884        }
1885      });
1886      WF.Utils.handleMejsMultimediaPlayerEvent("FIRSTPLAY", aud);
1887    });
1888  },
1889  setupBackLink: function(root) {
1890    $(root).find("a.backLink").click(function(e) {
1891      history.go(-1);
1892      e.preventDefault();
1893    });
1894  },
1895  setupMultimediaTranscripts: function(root) {
1896    if (typeof root == "undefined") {
1897      root = $("body");
1898    }
1899    var getFirstPart = function(html, limit) {
1900      if (isNaN(limit)) {
1901        limit = 150;
1902      }
1903      if (limit > html.length) {
1904        return html;
1905      }
1906      var stack = [],
1907        count = 0,
1908        ret = "",
1909        chr, tmp;
1910      var getFirstFromHtml = function(what) {
1911        var localRet;
1912        if (typeof what == "string") {
1913          localRet = html.substr(0, html.indexOf(what) + what.length);
1914          html = html.substr(html.indexOf(what) + what.length);
1915        } else {
1916          if (typeof what == "number") {
1917            localRet = html.substr(0, what);
1918            html = html.substr(what);
1919          } else {
1920            if (what instanceof RegExp) {
1921              var match = what.exec(html);
1922              if (match) {
1923                localRet = html.substr(0, match[0].length);
1924                html = html.substr(match[0].length);
1925              } else {
1926                localRet = "";
1927              }
1928            }
1929          }
1930        }
1931        return localRet;
1932      };
1933      var transferFromHtml = function(what) {
1934        var localRet = getFirstFromHtml(what);
1935        ret += localRet;
1936        return localRet;
1937      };
1938      while (count <= limit) {
1939        chr = getFirstFromHtml(1);
1940        if (chr.search(/\s/) != -1) {
1941          ret += chr;
1942        } else {
1943          if (chr == "<") {
1944            ret += chr;
1945            if (html.substr(0, 1) == "/") {
1946              tmp = transferFromHtml(">");
1947              tmp = tmp.substr(1, tmp.length - 2);
1948              if (stack[stack.length - 1] == tmp) {
1949                stack.pop();
1950              }
1951            } else {
1952              tmp = transferFromHtml(/^[a-zA-Z]+/);
1953              stack.push(tmp);
1954              transferFromHtml(">");
1955            }
1956          } else {
1957            count++;
1958            ret += chr;
1959          }
1960        }
1961      }
1962      transferFromHtml(/[a-zA-Z0-9_-]+/);
1963      ret += "&hellip;";
1964      for (var i = stack.length - 1; i >= 0; i--) {
1965        ret += "</" + stack[i] + ">";
1966      }
1967      return ret;
1968    };
1969    $(root).find(".c51transcript, .c63transcript").each(function() {
1970      var jq = $(this);
1971      var justH2 = jq.html().match(/^\s{0,50}<h2>[^\>]+<\/h2>/i);
1972      if (justH2) {
1973        justH2 = justH2[0];
1974      } else {
1975        justH2 = "";
1976      }
1977      var afterH2 = jq.html().substr(justH2.length);
1978      var teaser = getFirstPart(afterH2);
1979      var clist = WF.Utils.getClist(this);
1980      if (teaser == afterH2) {
1981        jq.parent().find("noscript").remove();
1982        return;
1983      }
1984      jq.html(justH2 + '<div class="teaser">' + teaser + '<a href="#" class="moreLess more">' + WF.Strings.Components.MultimediaTranscript.more[WF.Page.lang] + '</a></div><div class="fullText"><a href="#" class="moreLess less">' + WF.Strings.Components.MultimediaTranscript.less[WF.Page.lang] + "</a>" + afterH2 + "</div>");
1985      jq.find("a.less").click(function(evt) {
1986        jq.addClass("closed");
1987        jq.removeClass("open");
1988        $(document).trigger("resizePage");
1989        var applicationCode = "VID";
1990        if (jq.parent().hasClass(".audio")) {
1991          applicationCode = "AUD";
1992        }
1993        WF.Utils.logC2tEvent({
1994          "data[eventName]": "TranscriptsActivated",
1995          "data[transcriptsOn]": false,
1996          "data[mediaType]": applicationCode,
1997          "data[eventType]": evt.type,
1998          "data[eventDescription]": "TranscriptLessLink",
1999          "data[clist]": clist,
2000          "eventStructure[MediaTranscriptsActivatedCreator]": applicationCode + "_TranscriptsActivated",
2001          "headerStructure[HeaderCreator]": "header_" + applicationCode
2002        });
2003        evt.preventDefault();
2004      });
2005      jq.find("a.more").click(function(evt) {
2006        jq.addClass("open");
2007        jq.removeClass("closed");
2008        $(document).trigger("resizePage");
2009        WF.Utils.trackVS({
2010          "event": "LinkActivated",
2011          "eventType": evt.type,
2012          "eventDescription": "TranscriptMoreLink",
2013          "clist": clist
2014        });
2015        var applicationCode = "VID";
2016        if (jq.parent().hasClass(".audio")) {
2017          applicationCode = "AUD";
2018        }
2019        WF.Utils.logC2tEvent({
2020          "data[eventName]": "TranscriptsActivated",
2021          "data[transcriptsOn]": true,
2022          "data[mediaType]": applicationCode,
2023          "data[eventType]": evt.type,
2024          "data[eventDescription]": "TranscriptMoreLink",
2025          "data[clist]": clist,
2026          "eventStructure[MediaTranscriptsActivatedCreator]": applicationCode + "_TranscriptsActivated",
2027          "headerStructure[HeaderCreator]": "header_" + applicationCode
2028        });
2029        evt.preventDefault();
2030      });
2031      if ($.fn.touchwipe) {
2032        jq.touchwipe({
2033          wipeDown: function() {
2034            jq.addClass("open");
2035            jq.removeClass("closed");
2036            evt.preventDefault();
2037          },
2038          wipeUp: function() {
2039            jq.addClass("closed");
2040            jq.removeClass("open");
2041            evt.preventDefault();
2042          }
2043        });
2044      }
2045      jq.addClass("closed");
2046      jq.parent().find("noscript").remove();
2047    });
2048  },
2049  setupPdfLink: function(root) {
2050    $(root).find('a[data-pdf="true"]').bind("click", function(e) {
2051      $(this).attr("data-win-options", "pdf");
2052      WF.Utils.childWindow(this);
2053      e.preventDefault();
2054    });
2055  },
2056  setupPrintLink: function(root) {
2057    $(root).find("a.printLink").click(function(e) {
2058      window.print();
2059      e.preventDefault();
2060    });
2061  },
2062  setupMarqueeContainerHeight: function(root) {
2063    $(root).find(".c3.type7").each(function(mIdx, marquee) {
2064      var _marquee = $(marquee);
2065      _marquee.find(".marqueecontainer").each(function(mcIdx, marqueeContainer) {
2066        var _marqueeContainerHeight = $(marqueeContainer).height();
2067        if (_marqueeContainerHeight > 215) {
2068          _marquee.css("margin-bottom", (_marqueeContainerHeight - 215) + "px");
2069        }
2070      });
2071    });
2072  },
2073/*  setupSpanishToggle: function(root) {
2074    $(".spToggle").click(function(e) {
2075      e.preventDefault();
2076      var _this = this,
2077        lang = $("html").attr("lang"),
2078        altUrl = "";
2079      if (lang == "en") {
2080        altUrl = "/es" + location.pathname;
2081      } else {
2082        altUrl = location.pathname.slice(location.pathname.indexOf("es") + 2);
2083      }
2084      if ($("#c29link00").length == 0) {
2085        $.ajax({
2086          url: altUrl,
2087          type: "GET",
2088          statusCode: {
2089            404: function() {
2090              e.preventDefault();
2091              $(_this).attr("id", "c29link00");
2092              var balloon = new WF.Component.BalloonHelp(_this);
2093              balloon.elem.click();
2094            },
2095            200: function() {
2096              document.location.href = altUrl;
2097            }
2098          }
2099        });
2100      }
2101    });
2102  },*/
2103/*  setupSpanishTogglePersonal: function(root) {
2104    $(".spTogglePersonal").on("click", function(e) {
2105      e.preventDefault();
2106      e.stopPropagation();
2107      var _this = this,
2108        lang = $("html").attr("lang"),
2109        altUrl = "";
2110      if (lang == "en") {
2111        altUrl = "/es" + location.pathname;
2112      } else {
2113        altUrl = location.pathname.slice(location.pathname.indexOf("es") + 2);
2114      }
2115      $.ajax({
2116        url: altUrl,
2117        type: "GET",
2118        statusCode: {
2119          404: function() {
2120            if (lang == "en") {
2121              altUrl = "/spanish";
2122            } else {
2123              altUrl = "/";
2124            }
2125            document.location.href = altUrl;
2126          },
2127          200: function() {
2128            document.location.href = altUrl;
2129          }
2130        }
2131      });
2132    });
2133  },*/
2134  displayBrowserDetectionMessage: function() {
2135    if ($("#browserUpgradeMessagePanel").length === 1) {
2136      var browserDetectionMessagePanel = $("#browserUpgradeMessagePanel").detach();
2137      $("#shell").prepend(browserDetectionMessagePanel);
2138      browserDetectionMessagePanel.show();
2139      browserDetectionMessagePanel.attr("aria-hidden", "false");
2140      WF.Utils.trackVS({
2141        "suppressAsync": true,
2142        "event": "LinkActivated",
2143        "eventType": "autoload",
2144        "eventDescription": "DisplayBrowserInfoMessage",
2145        "clist": "tcm:182-47775-16~tcm:91-2049-32"
2146      });
2147      browserDetectionMessagePanel.find("#browserUpgradeMessageClose > a").on("click", function(evt) {
2148        browserDetectionMessagePanel.hide();
2149        browserDetectionMessagePanel.attr("aria-hidden", "true");
2150        evt.preventDefault();
2151        evt.stopPropagation();
2152      });
2153      browserDetectionMessagePanel.find("a.browserSupportLink").on("click keypress", function(evt) {
2154        if (evt.type == "keypress" && evt.keyCode != 13) {
2155          return;
2156        }
2157        WF.Utils.trackVS({
2158          "suppressAsync": true,
2159          "event": "LinkActivated",
2160          "eventType": evt.type,
2161          "eventDescription": "ClickSupportedBrowserLink",
2162          "destinationUrl": this.href,
2163          "linkText": $(this).text(),
2164          "clist": "tcm:182-47775-16~tcm:91-2049-32"
2165        });
2166        if (evt.type == "keypress") {
2167          window.location.href = this.href;
2168          evt.preventDefault();
2169          evt.stopPropagation();
2170        }
2171      });
2172    }
2173  },
2174  marketDataCarousel: function(root) {
2175    if (typeof root == "undefined") {
2176      root = $("body");
2177    }
2178    var slickClass = "marketDataCarousel";
2179    var shimClass = "wf_carousel_clickshim";
2180    $(root).find("." + slickClass).each(function(index, item) {
2181      var carouselId = "marketcarousel" + index;
2182      this.id = carouselId;
2183      $(this).slick({
2184        accessibility: true,
2185        animateArrows: true,
2186        alwaysShowArrows: false,
2187        arrows: true,
2188        autoplay: false,
2189        autoplaySpeed: 2000,
2190        centerMode: false,
2191        currentSlideMessage: "You Are Here",
2192        dots: true,
2193        dotsClass: "slick-dots",
2194        dotName: "dotButton" + carouselId,
2195        dotType: "button",
2196        draggable: false,
2197        fade: false,
2198        focusOnSelect: false,
2199        infinite: true,
2200        maxSlideHeightClassName: "carouselSlide",
2201        onceThroughEnabled: true,
2202        pauseOnHover: true,
2203        peekaboo: false,
2204        slidesToShow: 1,
2205        slidesToScroll: 1,
2206        showArrowsOnInteract: true,
2207        slideItemClass: "carouselSlide",
2208        speed: 400,
2209        stopAutoPlayEnabled: true,
2210        useMaxHeight: true,
2211        adaptiveHeight: true
2212      });
2213    });
2214  }
2215};
2216$(document).ready(function() {
2217  WF.Browser.supports = WF.Utils.getBrowserSupport();
2218  WF.OnLoads.doAll();
2219});
2220WF.OnLoads.selectLoanCTA = function() {
2221  $("input[name=subProductCode]").on("click", function() {
2222    $(".autoLoanApply").find(".buttonBar").find("#c28lastFocusable").removeAttr("disabled").removeClass("faded");
2223  });
2224  $(".autoLoanApply").find(".buttonBar").find("#c28lastFocusable").on("click", function() {
2225    var code = $("input:radio[name='subProductCode']:checked").val();
2226    if (code == "SVN") {
2227      var url = "/auto-loans/finance/specialty-vehicle-financing-options/";
2228      window.location.href = url;
2229    } else {
2230      var url = "/wf/product/apply?prodSet=APP2K&prodCode=AUTO-" + code;
2231      window.location.href = url;
2232    }
2233  });
2234};
2235WF.Page = {
2236  "lang": $("html").attr("lang") || "en",
2237  "Components": {
2238    getByType: function(type) {
2239      switch (type) {
2240        case "c29":
2241        case "BalloonHelp":
2242          return this.BalloonHelps;
2243          break;
2244        case "CTA":
2245          return this.CTAs;
2246          break;
2247        case "c58":
2248        case "FAQ":
2249          return this.FAQs;
2250          break;
2251        case "c28a":
2252        case "LightBox":
2253          return this.LightBoxes;
2254          break;
2255        case "c28b":
2256        case "Overlay":
2257          return this.Overlays;
2258          break;
2259        case "c16":
2260        case "ShowHide":
2261          return this.ShowHides;
2262          break;
2263        case "c26":
2264        case "Tip":
2265          return this.Tips;
2266          break;
2267        default:
2268          return [];
2269      }
2270    },
2271    "BalloonHelps": [],
2272    "Carousels": [],
2273    "CTAs": [],
2274    "FAQs": [],
2275    "FatNav": false,
2276    "Footnotes": {
2277      "last": 0
2278    },
2279    "LightBoxes": [],
2280    "Overlays": [],
2281    "RibbonCarousels": [],
2282    "ShowHides": [],
2283    "Tips": []
2284  }
2285};
2286WF.Component.Carousel = function(el, options) {
2287  if (!el.id) {
2288    el.id = WF.Utils.generateUniqueId(el);
2289  }
2290  var self = this;
2291  var stdOptions = {
2292    "autostart": false,
2293    "autoloop": false,
2294    "frameRate": 8000,
2295    "loop": true,
2296    "paddles": "dynamic",
2297    "speed": 500,
2298    "componentType": "Carousel"
2299  };
2300  if (!options) {
2301    options = {};
2302  }
2303  for (var o in stdOptions) {
2304    if (typeof options[o] == "undefined") {
2305      options[o] = stdOptions[o];
2306    }
2307  }
2308  if (options.paddles == "dynamic") {
2309    if (WF.Browser.supports && WF.Browser.supports.touch) {
2310      options.paddles = "off";
2311    }
2312    if ($("html").hasClass("ie7")) {
2313      options.paddles = "on";
2314    }
2315  }
2316  options.width = $(el).width();
2317  options.padding = $(el).css("padding-left");
2318  var timer, curFrame, incomingFrame;
2319  this.elem = el;
2320  this.id = "Carousel_" + el.id;
2321  this.start = function() {
2322    timer = setInterval(function() {
2323      self.next(false, {
2324        "event": "LinkActivated",
2325        "eventType": "autoload",
2326        "eventDescription": evtDesc
2327      });
2328    }, options.frameRate);
2329  };
2330  this.stop = function() {
2331    clearInterval(timer);
2332  };
2333  this.pause = function() {
2334    this.stop();
2335  };
2336  this.next = function(human, track) {
2337    if (human) {
2338      clearInterval(timer);
2339    }
2340    var showing = curFrame;
2341    var opts = {
2342      dir: "right"
2343    };
2344    if (showing >= bodies.length) {
2345      if (!options.loop) {
2346        return;
2347      }
2348      showing = 1;
2349    } else {
2350      showing++;
2351    }
2352    if (track) {
2353      if (options.componentType == "Tip") {
2354        track.clist = WF.Utils.getClist(el);
2355        track.tipNumber = showing;
2356      } else {
2357        track.clist = WF.Utils.getClist(bodies[showing - 1]);
2358      }
2359      WF.Utils.trackVS(track);
2360    }
2361    this.showFrame(showing, opts);
2362    if (showing == 1 && !options.autoloop && !human) {
2363      clearInterval(timer);
2364    }
2365  };
2366  this.prev = function(human, track) {
2367    if (human) {
2368      clearInterval(timer);
2369    }
2370    var showing = curFrame;
2371    var opts = {
2372      dir: "left"
2373    };
2374    if (showing <= 1) {
2375      if (!options.loop) {
2376        return;
2377      }
2378      showing = bodies.length;
2379    } else {
2380      showing--;
2381    }
2382    if (track) {
2383      if (options.componentType == "Tip") {
2384        track.clist = WF.Utils.getClist(el);
2385        track.tipNumber = showing;
2386      } else {
2387        track.clist = WF.Utils.getClist(bodies[showing - 1]);
2388      }
2389      WF.Utils.trackVS(track);
2390    }
2391    this.showFrame(showing, opts);
2392  };
2393  this.copyFrame = function(from, to) {
2394    to.html(from.html());
2395    $.each(["cid", "ctid", "presentation"], function(i, val) {
2396      to.data(val, from.data(val));
2397    });
2398  };
2399  this.showFrame = function(num, opts) {
2400    if (num == curFrame) {
2401      return;
2402    }
2403    var incFrame = $(el).find(".carouselFrame.item" + num);
2404    self.copyFrame(incFrame, incomingFrame);
2405    var animOpts = {
2406      queue: false,
2407      left: 0
2408    };
2409    var plusWidth = options.width + "px";
2410    var minusWidth = "-" + options.width + "px";
2411    if (opts.dir == "left") {
2412      incomingFrame.css("left", minusWidth);
2413    } else {
2414      if (opts.dir == "right") {
2415        incomingFrame.css("left", plusWidth);
2416      } else {
2417        if (num > curFrame) {
2418          incomingFrame.css("left", plusWidth);
2419        } else {
2420          incomingFrame.css("left", minusWidth);
2421        }
2422      }
2423    }
2424    incomingFrame.show();
2425    $(el).find(".controls a").removeClass("current").removeAttr("tabindex");
2426    incomingFrame.animate(animOpts, options.speed, "swing", function() {
2427      incomingFrame.hide();
2428      $(el).find(".carouselFrame:visible").attr("aria-hidden", "true").hide();
2429      incFrame.attr("aria-hidden", "false").show();
2430      $(el).find(".controls a.show" + num).addClass("current").attr("tabindex", -1);
2431    });
2432    if (opts.stopAutoplay) {
2433      self.stop();
2434    }
2435    if (options.componentType == "Marquee" && num != 1) {
2436      var tasCallData = WF.Utils.getTasCallData(incomingFrame, true);
2437      if (tasCallData) {
2438        tasCallData.RequestType = "ServeConfirm";
2439        WF.Utils.trackTas(tasCallData);
2440      }
2441    }
2442    curFrame = num;
2443  };
2444  this.count = function() {
2445    return bodies.length;
2446  };
2447  var evtDesc;
2448  switch (options.componentType) {
2449    case "Marquee":
2450    case "MarqueeCarousel":
2451      evtDesc = "DisplayMarqueeCarouselItem";
2452      break;
2453    case "Small":
2454    case "SmallCarousel":
2455      evtDesc = "DisplaySmallCarouselItem";
2456      break;
2457    case "Tip":
2458    default:
2459      evtDesc = "DisplayTip";
2460  }
2461  var clist = WF.Utils.getClist(el);
2462  var bodies = $(el).find(".carouselFrame, .c26body");
2463  $.each(bodies, function(idx, body) {
2464    body = $(body);
2465    body.addClass("item" + (idx + 1));
2466  });
2467  if (bodies.length > 1) {
2468    incomingFrame = $('<div class="carouselFrame incomingFrame"/>');
2469    incomingFrame.attr("aria-hidden", "true");
2470    $(el).append(incomingFrame);
2471    var controls = $('<div class="controls"/>');
2472    for (var i = 1; i <= bodies.length; i++) {
2473      $(bodies[i - 1]).prepend($('<span class="hidden">' + WF.Strings.Shared.beginItemNo[WF.Page.lang] + i + "</span>"));
2474      $(bodies[i - 1]).append($('<span class="hidden">' + WF.Strings.Shared.endItemNo[WF.Page.lang] + i + "</span>"));
2475      var dot = $('<a href="#' + el.id + "_frame" + i + '" class="show' + i + '">&bull;<span class="hidden">' + WF.Strings.Shared.item[WF.Page.lang] + " " + i + "</span></a>");
2476      dot.bind("click keypress", function(evt) {
2477        var num = this.className.match(/show(\d+)/)[1];
2478        if (evt.type == "keypress" && evt.keyCode != 13) {
2479          return;
2480        }
2481        WF.Utils.trackVS({
2482          "event": "LinkActivated",
2483          "eventType": evt.type,
2484          "eventDescription": evtDesc,
2485          "clist": clist,
2486          "tipNumber": num,
2487          "elementActivated": "Bottom"
2488        });
2489        if (evt.type == "keypress") {
2490          evt.preventDefault();
2491          self.showFrame(this.className.replace(/\D/g, ""), {
2492            stopAutoplay: true
2493          });
2494        }
2495      });
2496      $(controls).append(dot);
2497      if (i == 1) {
2498        $(controls).find(".show" + i).addClass("current").attr("tabindex", -1);
2499      }
2500      $(controls).find(".show" + i).click(function(evt) {
2501        evt.preventDefault();
2502        self.showFrame(this.className.replace(/\D/g, ""), {
2503          stopAutoplay: true
2504        });
2505      });
2506      $(bodies[i - 1]).attr("aria-hidden", "true").hide();
2507      if ($.fn.touchwipe) {
2508        $(bodies[i - 1]).touchwipe({
2509          wipeLeft: function(evt) {
2510            evt.preventDefault();
2511            self.next(true);
2512          },
2513          wipeRight: function(evt) {
2514            evt.preventDefault();
2515            self.prev(true);
2516          }
2517        });
2518      }
2519    }
2520    $(el).append(controls);
2521    if (options.paddles != "off") {
2522      var paddles = $('<div id="constructingPaddles">'),
2523        paddle1 = $('<div class="paddles"/>'),
2524        paddle2 = $('<div class="paddles"/>'),
2525        link1 = $("<a/>"),
2526        link2 = $("<a/>"),
2527        img1 = $("<img/>"),
2528        img2 = $("<img/>");
2529      paddles.append(paddle1);
2530      paddles.append(paddle2);
2531      var setTabindex = false;
2532      if (options.paddles == "on") {
2533        paddles.find(".paddles").addClass("alwaysOn");
2534      } else {
2535        setTabindex = true;
2536        setInterval(function() {
2537          if (paddle1.find("a.left").css("left") == "-27px") {
2538            paddle1.css("visibility", "hidden").attr("aria-hidden", "true");
2539            paddle2.css("visibility", "hidden").attr("aria-hidden", "true");
2540          } else {
2541            paddle1.css("visibility", "visible").attr("aria-hidden", "false");
2542            paddle2.css("visibility", "visible").attr("aria-hidden", "false");
2543          }
2544        }, 10);
2545      }
2546      link1.attr({
2547        "href": "#" + el.id + "_prevFrame",
2548        "class": "left"
2549      });
2550      if (setTabindex) {
2551        link1.attr("tabindex", -1);
2552      }
2553      img1.attr("alt", WF.Strings.Shared.prev[WF.Page.lang]);
2554      paddle1.append(link1);
2555      link1.append(img1);
2556      link2.attr({
2557        "href": "#" + el.id + "_nextFrame",
2558        "class": "right"
2559      });
2560      if (setTabindex) {
2561        link2.attr("tabindex", -1);
2562      }
2563      img2.attr("alt", WF.Strings.Shared.next[WF.Page.lang]);
2564      paddle2.append(link2);
2565      link2.append(img2);
2566      paddles.find("a").mouseover(function() {
2567        var img = $(this).find("img").get(0);
2568        img.src = img.src.replace(/grey/, "blue");
2569      }).mouseout(function() {
2570        var img = $(this).find("img").get(0);
2571        img.src = img.src.replace(/blue/, "grey");
2572      });
2573      paddles.find(".left").data("vsObj", {
2574        "event": "LinkActivated",
2575        "eventDescription": evtDesc,
2576        "clist": clist,
2577        "elementActivated": "LeftPaddle"
2578      });
2579      paddles.find(".left").click(function(evt) {
2580        evt.preventDefault();
2581        self.prev(true, $.extend($(this).data("vsObj"), {
2582          eventType: evt.type
2583        }));
2584      });
2585      paddles.find(".left").bind("click keypress", function(evt) {
2586        if (evt.type == "keypress" && evt.keyCode != 13) {
2587          return;
2588        }
2589        if (evt.type == "keypress") {
2590          evt.preventDefault();
2591          self.prev(true, $.extend($(this).data("vsObj"), {
2592            eventType: evt.type
2593          }));
2594        }
2595      });
2596      paddles.find(".right").data("vsObj", {
2597        "event": "LinkActivated",
2598        "eventDescription": evtDesc,
2599        "clist": clist,
2600        "elementActivated": "RightPaddle"
2601      });
2602      paddles.find(".right").click(function(evt) {
2603        evt.preventDefault();
2604        self.next(true, $.extend($(this).data("vsObj"), {
2605          eventType: evt.type
2606        }));
2607      });
2608      paddles.find(".right").bind("click keypress", function(evt) {
2609        if (evt.type == "keypress" && evt.keyCode != 13) {
2610          return;
2611        }
2612        if (evt.type == "keypress") {
2613          evt.preventDefault();
2614          self.next(true, $.extend($(this).data("vsObj"), {
2615            eventType: evt.type
2616          }));
2617        }
2618      });
2619      $(el).prepend(paddle1);
2620      $(el).append(paddle2);
2621      WF.Utils.setImageSrcFromBackground(img1, "10Carousel 387; img1");
2622      WF.Utils.setImageSrcFromBackground(img2, "10Carousel 388; img2");
2623    }
2624    $(el).find(".carouselFrame.item1").show();
2625    incomingFrame.hide();
2626    curFrame = 1;
2627    if (options.autostart) {
2628      this.start();
2629    }
2630  } else {
2631    $(bodies[0]).show();
2632  }
2633  if (options.componentType.substr(0, 5) == "Small") {
2634    clist = WF.Utils.getClist(bodies[0]);
2635  }
2636  WF.Utils.trackVS({
2637    "event": "PageLoad",
2638    "eventDescription": evtDesc,
2639    "clist": clist
2640  });
2641  if (options && options.componentType == "Tip") {
2642    WF.Page.Components.Tips.push(this);
2643  }
2644  WF.Page.Components.Carousels.push(this);
2645  return this;
2646};
2647WF.OnLoads.setupCarousels = function(root) {
2648  if (typeof root == "undefined") {
2649    root = $("body");
2650  }
2651  $(root).find(".c26").each(function() {
2652    new WF.Component.Carousel(this, {
2653      componentType: "Tip",
2654      autostart: true
2655    });
2656  });
2657  $(root).find(".c3wrapper").each(function() {
2658    new WF.Component.Carousel(this, {
2659      componentType: "Marquee",
2660      paddles: "off",
2661      autostart: true,
2662      speed: 800
2663    });
2664  });
2665  $(root).find(".c64main").each(function() {
2666    new WF.Component.Carousel(this, {
2667      componentType: "Small",
2668      paddles: "on",
2669      autostart: true
2670    });
2671  });
2672};
2673WF.Component.CTA = function(el) {
2674  if (!el.id) {
2675    el.id = WF.Utils.generateUniqueId(el);
2676  }
2677  this.elem = el;
2678  this.id = "CTA_" + el.id;
2679  var clist = WF.Utils.getClist(el);
2680  $(el).bind("click keypress", function(evt) {
2681    if (evt.type == "keypress" && evt.keyCode != 13) {
2682      return;
2683    }
2684    WF.Utils.trackVS({
2685      "event": "LinkActivated",
2686      "eventType": evt.type,
2687      "eventDescription": "CTAText",
2688      "destinationUrl": this.href,
2689      "linkText": $(this).text(),
2690      "clist": clist,
2691      "presentation": $(this).data("presentation"),
2692      "suppressAsync": true
2693    });
2694    if (evt.type === "keypress" && typeof(this.href) !== "undefined") {
2695      evt.preventDefault();
2696      window.location.href = this.href;
2697    }
2698  });
2699  WF.Page.Components.CTAs.push(this);
2700  return this;
2701};
2702WF.OnLoads.setupCTAs = function(root) {
2703  if (typeof root == "undefined") {
2704    root = $("body");
2705  }
2706  $(root).find(".c7, .c13, .c22").each(function() {
2707    new WF.Component.CTA(this);
2708  });
2709};
2710WF.Component.LightBox = function(trigger, options) {
2711  if (!trigger.id) {
2712    trigger.id = WF.Utils.generateUniqueId(trigger);
2713  }
2714  this.elem = trigger;
2715  this.id = "LightBox_" + trigger.id;
2716  this.version = "1.0.1";
2717  var self = this;
2718  var cache = "",
2719    contentContainer = $("<div/>"),
2720    darkBackdrop = $("#c28backdrop"),
2721    defaultHeight = 500,
2722    defaultWidth = 722,
2723    destPid = "",
2724    dimensions = {},
2725    dir = "",
2726    exitHeightAdjust = 190,
2727    exitWidthAdjust = 0,
2728    fadeTime = 300,
2729    helperDialog = $("<div/>"),
2730    mainContainer = $("#c28lightbox"),
2731    margin = 50,
2732    maxHeight = 500,
2733    maxWidth = 722,
2734    showHideSpeed = 600,
2735    stdHeightAdjust = 39,
2736    stdWidthAdjust = 0,
2737    targetPageExtraJs = [],
2738    timer, videoWidth = 775;
2739  var stdOptions = {
2740    pleaseWaitDelay: 1500,
2741    timeout: 10000,
2742    onTimeout: false,
2743    postInit: false,
2744    beforeOpenFunc: false,
2745    afterCloseFunc: false,
2746    disableCache: false,
2747    isExit: false,
2748    isQuiz: false,
2749    exitPageDestination: "",
2750    noCloseButton: false,
2751    showPrintIcon: false,
2752    url: "",
2753    method: "GET",
2754    parameters: {}
2755  };
2756  this.addDialogCloseButton = function() {
2757    helperDialog.append('<div class="closeButton"><a href="#" class="c7 utilitybtn" role="button">' + WF.Strings.Components.LightboxOverlay.closeDialog[WF.Page.lang] + "</a></div>");
2758    helperDialog.find(".c7").click(function(evt) {
2759      evt.preventDefault();
2760      helperDialog.fadeOut(fadeTime, function() {
2761        helperDialog.remove();
2762      });
2763    });
2764  };
2765  this.addLightboxEvents = function() {
2766    mainContainer.find("a.c28close, a.c28cancel").click(function(evt) {
2767      evt.preventDefault();
2768      self.hide();
2769    });
2770    mainContainer.keydown(function(evt) {
2771      if (evt.keyCode == 27) {
2772        self.hide();
2773      }
2774    });
2775    $(window).resize(function() {
2776      self.positionLightbox();
2777    });
2778  };
2779  this.createLightboxHtml = function(content, titleAndSubhead, evt) {
2780    mainContainer.unbind().empty();
2781    var topContainer = $("<div/>").addClass("c28topContainer");
2782    topContainer.appendTo(mainContainer);
2783    if (options.noCloseButton === false) {
2784      var closeButton = $("<img/>").attr({
2785        "alt": WF.Strings.Shared.close[WF.Page.lang],
2786        "role": "button"
2787      });
2788      topContainer.html('<a class="c28close" id="c28close" href="#"></a>');
2789      topContainer.find("a").append(closeButton);
2790      WF.Utils.setImageSrcFromBackground(closeButton, "12Lightbox 85; closeButton");
2791    }
2792    var topFocus = $("<span/>").attr({
2793      "id": "c28topFocus",
2794      "class": "hidden",
2795      "tabindex": 0
2796    });
2797    topFocus.focus(function(evt) {
2798      if (dir == "back") {
2799        $("#c28bottomFocus").get(0).focus();
2800      } else {
2801        $("#c28close").focus();
2802      }
2803    }).prependTo(mainContainer);
2804    $("#c28close").focus(function() {
2805      dir = "back";
2806    });
2807    contentContainer.addClass("c28contentContainer");
2808	  var sanitizedContent = $.parseHTML(content, document, false); //2025-12; false = don't execute scripts
2809	  contentContainer.html(sanitizedContent).appendTo(mainContainer);//2025-12
2810    if (options.isExit) {
2811      topContainer.addClass("exitPage");
2812      var exitLogo = $("<img/>").attr({
2813        "alt": WF.Strings.Shared.WFHomePage[WF.Page.lang],
2814        "id": "exitLogo"
2815      });
2816      topContainer.append(exitLogo);
2817      WF.Utils.setImageSrcFromBackground(exitLogo, "12Lightbox 109; exitLogo");
2818      mainContainer.append($('<div class="c28bottomButtons"><a href="#" class="c28cancel">' + WF.Strings.Shared.cancel[WF.Page.lang] + '</a><a href="' + options.exitUrl + '" class="c7 utilitybtn" role="button">' + WF.Strings.Shared["continue"][WF.Page.lang] + "</a></div>"));
2819      var $actionButton = mainContainer.find(".c28bottomButtons").find("a.c7");
2820      $actionButton.attr("target", "_blank");
2821      $actionButton.bind("click keypress", function(evt) {
2822        if (evt.type == "keypress" && evt.keyCode != 13) {
2823          return;
2824        }
2825        WF.Utils.trackVS({
2826          "suppressAsync": true,
2827          "event": "LinkActivated",
2828          "eventType": evt.type,
2829          "eventDescription": "exitPageContinue",
2830          "destinationUrl": this.href
2831        });
2832      });
2833      if (options.exitPageDestination) {
2834        $actionButton.attr("href", options.exitPageDestination);
2835        $actionButton.attr("target", "_blank");
2836      }
2837      mainContainer.find(".c28bottomButtons").find("a.c28cancel").bind("click keypress", function(evt) {
2838        if (evt.type == "keypress" && evt.keyCode != 13) {
2839          return;
2840        }
2841        WF.Utils.trackVS({
2842          "event": "LinkActivated",
2843          "eventType": evt.type,
2844          "eventDescription": "exitPageCancel"
2845        });
2846        if (evt.type == "keypress") {
2847          self.hide();
2848          evt.preventDefault();
2849        }
2850      });
2851      $(".c28bottomButtons").find("a.c7").attr("id", "c28lastFocusable");
2852    } else {
2853      topContainer.removeClass("exitPage");
2854      var heightAdj = "";
2855      if (options.isQuiz) {
2856        stdHeightAdjust += 12;
2857      }
2858      if (titleAndSubhead.title) {
2859        topContainer.append("<h2>" + titleAndSubhead.title + "</h2>");
2860        heightAdj += "Title";
2861      }
2862      if (titleAndSubhead.subhead) {
2863        topContainer.append("<h3>" + titleAndSubhead.subhead + "</h3>");
2864        heightAdj += "Subhead";
2865      }
2866      if (options.showPrintIcon) {
2867        topContainer.append($('<a href="javascript:window.print();" class="c28print">' + WF.Strings.Shared.print[WF.Page.lang] + "</a>"));
2868        heightAdj += "Print";
2869      }
2870      switch (heightAdj) {
2871        case "Title":
2872        case "TitlePrint":
2873          stdHeightAdjust += 18;
2874          break;
2875        case "TitleSubhead":
2876        case "TitleSubheadPrint":
2877          stdHeightAdjust += 38;
2878          break;
2879        case "Print":
2880          stdHeightAdjust += 14;
2881          break;
2882      }
2883      var btmFocus = mainContainer.find("a, input, select");
2884      if (btmFocus.length) {
2885        btmFocus = $(btmFocus[btmFocus.length - 1]);
2886      } else {
2887        btmFocus = topContainer.find("a.c28print");
2888      }
2889      btmFocus.attr("id", "c28lastFocusable");
2890    }
2891    var bottomFocus = $("<span/>").attr({
2892      "id": "c28bottomFocus",
2893      "class": "hidden",
2894      "tabindex": 0
2895    });
2896    bottomFocus.focus(function(evt) {
2897      if (dir == "back") {
2898        contentContainer.get(0).focus();
2899      } else {
2900        $("#c28topFocus").get(0).focus();
2901      }
2902    }).appendTo(mainContainer);
2903    $("#c28lastFocusable").focus(function() {
2904      dir = "forward";
2905    });
2906    self.setLightboxSizes();
2907    self.addLightboxEvents();
2908    $.each(targetPageExtraJs, function(i, src) {
2909      $("body").append($('<script src="' + src + '"><\/script>'));
2910    });
2911    cache = mainContainer.contents().clone(true);
2912    self.show(evt);
2913  };
2914  this.createLoadingDialogHtml = function() {
2915    helperDialog.html("").attr("class", "c28loading");
2916    helperDialog.append("<h2>" + WF.Strings.Components.LightboxOverlay.oneMomentPlease[WF.Page.lang] + "</h2>");
2917    var loadingImg = $('<img class="loadImg"/>');
2918    helperDialog.append(loadingImg);
2919    helperDialog.append(WF.Strings.Components.LightboxOverlay.plsWaitGettingInfo[WF.Page.lang]);
2920    $("body").append(helperDialog);
2921    WF.Utils.setImageSrcFromBackground(loadingImg, "12Lightbox 204; loadingImg");
2922  };
2923  this.doTimeout = function() {
2924    helperDialog.html("<h2>" + WF.Strings.Components.LightboxOverlay.infoCurrUnavail[WF.Page.lang] + "</h2>").addClass("timeout");
2925    helperDialog.append("<p>" + WF.Strings.Components.LightboxOverlay.apologizeTryAgain[WF.Page.lang] + "</p>");
2926    self.addDialogCloseButton();
2927    helperDialog.fadeIn(fadeTime);
2928  };
2929  this.getContentRegion = function(data) {
2930	  data = $.parseHTML(data, document, false); //2025-12; false = don't execute scripts
2931    data = "<div>" + data + "</div>";
2932    var content = $(data).find("#content");
2933    if (content.length) {
2934      if (content.hasClass(".exitPageContent")) {
2935        options.isExit = true;
2936      }
2937    } else {
2938      content = $(data).find(".exitPageContent");
2939      if (content.length) {
2940        options.isExit = true;
2941      }
2942    }
2943    if (!content.length) {
2944      content = $(data).find(".mainContentCol:first");
2945    }
2946    if (content.find(".Onquiz").length) {
2947      options.isQuiz = true;
2948    }
2949    return content;
2950  };
2951  this.getContentTrackingData = function(data) {
2952	  data = $.parseHTML(data, document, false); //2025-12; false = don't execute scripts
2953    data = "<div>" + data + "</div>";
2954    var pid = $(data).find("#shell").data("pid");
2955    var ptid = $(data).find("#shell").data("ptid");
2956    return pid + "~" + ptid;
2957  };
2958  this.getDimensions = function(html) {
2959    var ret = {
2960      width: 0,
2961      height: 0
2962    };
2963    var match;
2964    html = $.parseHTML(html, document, false); //2025-12; false = don't execute scripts
2965    html = "<div>" + html + "</div>";
2966    var node = $(html).find("#shell");
2967    if (node.length) {
2968      if (node.data("lightboxWidth") && node.data("lightboxHeight")) {
2969        ret.width = node.data("lightboxWidth");
2970        ret.height = node.data("lightboxHeight");
2971      } else {
2972        match = node.attr("class").match(/\b(\d\d\d?\d?)x(\d\d\d?\d?)\b/);
2973        if (match) {
2974          ret.width = parseInt(match[1], 10);
2975          ret.height = parseInt(match[2], 10);
2976        }
2977      }
2978    }
2979    if (!ret.width) {
2980      $.each(["#content", ".exitPageContent", ".mainContentCol:first"], function(i, css) {
2981        node = $(html).find(css);
2982        if (node.length && node.attr("class")) {
2983          match = node.attr("class").match(/\b(\d\d\d?\d?)x(\d\d\d?\d?)\b/);
2984          if (match) {
2985            ret.width = parseInt(match[1], 10);
2986            ret.height = parseInt(match[2], 10);
2987            return false;
2988          }
2989        }
2990      });
2991    }
2992    if (!ret.width) {
2993      ret = {
2994        width: defaultWidth,
2995        height: defaultHeight
2996      };
2997    }
2998    if (ret.width > maxWidth) {
2999      ret.width = maxWidth;
3000    }
3001    if (ret.height > maxHeight) {
3002      ret.height = maxHeight;
3003    }
3004    if ($(html).find(".c51").not(".audio").length) {
3005      ret.width = videoWidth;
3006    }
3007    return ret;
3008  };
3009  this.getExitPageUrl = function(html) {
3010    html = "<div>" + html + "</div>";
3011    var link = $(html).find(".t7buttons a.c7");
3012    if (link.length) {
3013      return link.attr("href");
3014    }
3015    link = $(html).find('a.c7:contains("' + WF.Strings.Shared["continue"][WF.Page.lang] + '")');
3016    if (link.length) {
3017      return link.attr("href");
3018    }
3019    return "";
3020  };
3021  this.getOptionsFromTrigger = function() {
3022    if ($(trigger).hasClass("c28cLink")) {
3023      options.isExit = true;
3024    }
3025    if (trigger.tagName.toLowerCase() == "a") {
3026      if (trigger.href.indexOf("?") != -1) {
3027        options.url = trigger.href.substr(0, trigger.href.indexOf("?"));
3028        var params = trigger.href.substr(trigger.href.indexOf("?") + 1);
3029        params = params.split(/&(?:amp;)?/);
3030        $.each(params, function(idx, param) {
3031          var p = param.split("=");
3032          options.parameters[p[0]] = p[1];
3033        });
3034      } else {
3035        options.url = trigger.href;
3036      }
3037    }
3038    if ($(trigger).data("lightboxOptions")) {
3039      var dataOpts = $(trigger).data("lightboxOptions");
3040      if (typeof dataOpts == "string") {
3041        dataOpts = JSON.parse(dataOpts);
3042      }
3043      $.extend(true, options, dataOpts);
3044    }
3045  };
3046  this.getTitleAndSubhead = function(data) {
3047    data = $.parseHTML(data, document, false); //2025-12; false = don't execute scripts
3048    data = "<div>" + data + "</div>";
3049    var ret = {
3050      "title": "",
3051      "subhead": ""
3052    };
3053    if (options.isQuiz) {
3054      return ret;
3055    }
3056    ret.title = $(data).find("h1.c11").text();
3057    ret.subhead = $(data).find("p.subhead").text();
3058    return ret;
3059  };
3060  this.handleAjaxResponse = function(data, evt) {
3061	  data = $.parseHTML(data, document, false); //2025-12; false = don't execute scripts
3062    var content = self.getContentRegion(data);
3063    self.populateTargetPageExtraJs(data);
3064    destPid = self.getContentTrackingData(data);
3065    var titleAndSubhead = self.getTitleAndSubhead(data);
3066    dimensions = self.getDimensions(data);
3067    options.showPrintIcon = false;
3068    if (options.isExit) {
3069      options.exitUrl = self.getExitPageUrl(data);
3070    } else {
3071      if (self.hasContentPrintOption(data)) {
3072        options.showPrintIcon = true;
3073      }
3074    }
3075    self.createLightboxHtml(content, titleAndSubhead, evt);
3076  };
3077  this.hasContentPrintOption = function(data) {
3078    data = "<div>" + data + "</div>";
3079    var shell = $(data).find("#shell");
3080    if (shell.data("lightboxPrint")) {
3081      return new Boolean(shell.data("lightboxPrint").toString());
3082    }
3083    return false;
3084  };
3085  this.hide = function() {
3086    $("body").removeClass("lightboxOpen");
3087    mainContainer.find(".c51 video, .c51 object").not(".c51.audio object").each(function() {
3088      try {
3089        var vid = VideoJS(this.id);
3090        vid.pause();
3091      } catch (err) {
3092        WF.Utils.ajaxLog(err);
3093      }
3094    });
3095    mainContainer.find(".c51 audio, .c51.audio object").each(function() {
3096      try {
3097        if (this.player) {
3098          this.player.pause();
3099        } else {
3100          if (this.parentNode.player) {
3101            this.parentNode.player.pause();
3102          }
3103        }
3104      } catch (err) {
3105        WF.Utils.ajaxLog(err);
3106      }
3107    });
3108    mainContainer.find(".c28topContainer").find("a.c28close").hide();
3109    mainContainer.attr("aria-hidden", "true").fadeOut(showHideSpeed, function() {
3110      darkBackdrop.addClass("hide");
3111      if ($(trigger).is(":visible")) {
3112        trigger.focus();
3113      }
3114      if (options.afterCloseFunc && typeof options.afterCloseFunc == "function") {
3115        options.afterCloseFunc();
3116      }
3117    });
3118    helperDialog.fadeOut(showHideSpeed);
3119  };
3120  this.init = function(evt) {
3121    self.hideOpenSocialShares();
3122    if (cache) {
3123      self.show(evt);
3124    } else {
3125      self.requestContent(evt);
3126    }
3127    if (typeof options.postInit == "function") {
3128      options.postInit;
3129    }
3130  };
3131  this.populateTargetPageExtraJs = function(data) {
3132    var hostPageJsSources = [],
3133      targetJsSources = data.match(/<script[^>]+src=['"]([^'"]+)['"]/g);
3134    $("script[src]").each(function() {
3135      hostPageJsSources.push($(this).attr("src"));
3136    });
3137    if (targetJsSources != null) {
3138      targetJsSources = $.map(targetJsSources, function(str) {
3139        str = str.replace(/<script[^>]+src=['"]/, "");
3140        str = str.replace(/['"]$/, "");
3141        return str;
3142      });
3143      $.each(targetJsSources, function(idx, val) {
3144        if ($.inArray(val, hostPageJsSources) == -1) {
3145          targetPageExtraJs.push(val);
3146        }
3147      });
3148    }
3149  };
3150  this.positionLightbox = function() {
3151    var screenWidth = $(window).width();
3152    var screenHeight = $(window).height();
3153    var dlgWidth = mainContainer.width();
3154    var dlgHeight = mainContainer.height();
3155    var scrollX = (window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
3156    var scrollY = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
3157    var left = Math.floor((screenWidth / 2) - (dlgWidth / 2)) + scrollX;
3158    var top = Math.floor((screenHeight / 2) - (dlgHeight / 2)) + scrollY;
3159    mainContainer.css({
3160      "top": top + "px",
3161      "left": left + "px"
3162    });
3163    darkBackdrop.css({
3164      "width": screenWidth + "px",
3165      "height": $(document).height() + "px"
3166    });
3167  };
3168  this.positionLoadingDialog = function() {
3169    var screenWidth = $(window).width();
3170    var screenHeight = $(window).height();
3171    var dlgWidth = helperDialog.width();
3172    var dlgHeight = helperDialog.height();
3173    var left = Math.floor((screenWidth / 2) - (dlgWidth / 2));
3174    var top = Math.floor((screenHeight / 2) - (dlgHeight / 2));
3175    helperDialog.css({
3176      "top": top + "px",
3177      "left": left + "px"
3178    });
3179  };
3180  this.requestContent = function(evt) {
3181    var inlineLightBox = $(trigger).attr("data-lbcontentId") || $(trigger).data("lbcontentId") || "";
3182    self.createLoadingDialogHtml();
3183    timer = setTimeout(function() {
3184      self.positionLoadingDialog();
3185      helperDialog.fadeIn(fadeTime);
3186    }, options.pleaseWaitDelay);
3187    if (options.disableCache) {
3188      options.parameters.cb = new Date().valueOf();
3189    }
3190    if (inlineLightBox === "") {
3191      $.ajax({
3192        url: options.url,
3193        type: options.method,
3194        data: options.parameters,
3195        timeout: options.timeout,
3196        error: function(XMLHttpRequest, textStatus, errorThrown) {
3197          if (textStatus == "timeout") {
3198            self.doTimeout();
3199            if (options.onTimeout) {
3200              options.onTimeout.call(this, XMLHttpRequest, textStatus, errorThrown);
3201            }
3202          } else {
3203            self.showErrorDialog(XMLHttpRequest, textStatus, errorThrown);
3204          }
3205        },
3206        success: function(data) {
3207          clearTimeout(timer);
3208          self.handleAjaxResponse(data, evt);
3209        }
3210      });
3211    } else {
3212      self.handleAjaxResponse($("#" + inlineLightBox).html(), evt);
3213    }
3214  };
3215  this.setLightboxSizes = function() {
3216    var heightAdjust = stdHeightAdjust,
3217      widthAdjust = stdWidthAdjust,
3218      screenWidth = $(window).width(),
3219      screenHeight = $(window).height();
3220    if (options.isExit) {
3221      heightAdjust = exitHeightAdjust;
3222      widthAdjust = exitWidthAdjust;
3223    }
3224    contentContainer.css({
3225      "width": dimensions.width + "px",
3226      "height": dimensions.height + "px"
3227    });
3228    mainContainer.css({
3229      "width": (dimensions.width + widthAdjust) + "px",
3230      "height": (dimensions.height + heightAdjust) + "px"
3231    });
3232  };
3233  this.show = function(evt) {
3234    helperDialog.fadeOut(showHideSpeed, function() {
3235      if (options.beforeOpenFunc && typeof options.beforeOpenFunc == "function") {
3236        options.beforeOpenFunc();
3237      }
3238    });
3239    if (options.disableCache) {
3240      cache = "";
3241    } else {
3242      mainContainer.empty();
3243      mainContainer.append(cache.clone(true));
3244    }
3245    if ($(".zipCodeDialog").attr("data-closebutton") == "hide") {
3246      mainContainer.addClass("zipdialogloaded");
3247      mainContainer.find(".c28close").click(function(evt) {
3248        window.location.href = "/";
3249      });
3250      setTimeout(function() {
3251        $(".zipCodeDialog").empty();
3252      }, 1000);
3253    }
3254    var divContent = $("#c28lightbox").find("div#content");
3255    var divContentClass = divContent.attr("class");
3256    if (divContentClass == "362x166") {
3257      $("#c28lightbox").find(".c28contentContainer").css("overflow", "hidden");
3258    }
3259    self.setLightboxSizes();
3260    self.positionLightbox();
3261    darkBackdrop.removeClass("hide");
3262    $("body").addClass("lightboxOpen");
3263    mainContainer.fadeIn(showHideSpeed, function() {
3264      $(this).attr({
3265        "aria-labelledby": trigger.id,
3266        "aria-hidden": "false"
3267      }).find("a.c28close").show().focus();
3268      var h1 = contentContainer.find("h1, h2, h3")[0];
3269    });
3270    WF.OnLoads.doAll(mainContainer);
3271    WF.Utils.trackVS({
3272      "event": "LinkActivated",
3273      "eventType": evt.type,
3274      "eventDescription": "lightboxOpen",
3275      "linkText": $(trigger).text(),
3276      "destinationUrl": trigger.href,
3277      "destinationPid": destPid,
3278      "clist": clist
3279    });
3280    if (mainContainer.find(".vjs-default-skin").length > 0) {
3281      try {
3282        var vidID = mainContainer.find(".vjs-default-skin").attr("id");
3283        _V_.players[vidID] = null;
3284        var vid = window.VideoJS(vidID);
3285      } catch (e) {}
3286    }
3287  };
3288  this.showErrorDialog = function(XMLHttpRequest, textStatus, errorThrown) {
3289    helperDialog.html("<h2>" + WF.Strings.Components.LightboxOverlay.errorEncountered[WF.Page.lang] + "</h2>").attr("class", "c28error");
3290    helperDialog.append("<div>" + XMLHttpRequest.status + "</div>");
3291    helperDialog.append("<div>" + errorThrown + "</div>");
3292    self.addDialogCloseButton();
3293    $("body").append(helperDialog);
3294    self.positionLoadingDialog();
3295    helperDialog.fadeIn(fadeTime);
3296  };
3297  this.hideOpenSocialShares = function() {
3298    $(".c52Link.active").removeClass("active");
3299    $("div.c52").addClass("hide").attr("aria-hidden", "true");
3300    $(".SocialShare .Popup").hide();
3301  };
3302  if (!options) {
3303    options = {
3304      parameters: {}
3305    };
3306  }
3307  if (trigger.href !== "") {
3308    self.getOptionsFromTrigger();
3309  }
3310  for (var o in stdOptions) {
3311    if (typeof options[o] == "undefined") {
3312      options[o] = stdOptions[o];
3313    }
3314  }
3315  var clist = WF.Utils.getClist(trigger);
3316  $(trigger).attr("aria-haspopup", "true").bind("click keypress", function(evt) {
3317    if (evt.type == "keypress" && evt.keyCode != 13) {
3318      return;
3319    }
3320    if ($(this).attr("data-disable-cache") == "true") {
3321      options.disableCache = true;
3322    }
3323    evt.preventDefault();
3324    self.init(evt);
3325  });
3326  WF.Page.Components.LightBoxes.push(this);
3327  return this;
3328};
3329WF.OnLoads.setupLightboxes = function(root) {
3330  if (typeof root == "undefined") {
3331    root = $("body");
3332  }
3333  if (!$("#c28backdrop").length) {
3334    $('<div id="c28backdrop"/>').appendTo($("body"));
3335  }
3336  if (!$("#c28lightbox").length) {
3337    $('<div id="c28lightbox" class="c28mainContainer" role="region" aria-hidden="true" />').appendTo($("body"));
3338  }
3339  $(root).find(".c28aLink, .c28cLink").each(function() {
3340    new WF.Component.LightBox(this);
3341  });
3342};
3343WF.Component.ShowHide = function(el, slideSpeed) {
3344  if (!el.id) {
3345    el.id = WF.Utils.generateUniqueId(el);
3346  }
3347  this.elem = el;
3348  this.id = "ShowHide_" + el.id;
3349  var self = this;
3350  if (typeof slideSpeed == "undefined") {
3351    slideSpeed = 400;
3352  } else {
3353    if (typeof slideSpeed == "object") {
3354      slideSpeed = slideSpeed.speed;
3355    }
3356  }
3357  var openText = WF.Strings.Components.ShowHide.imgOpen[WF.Page.lang];
3358  var closeText = WF.Strings.Components.ShowHide.imgClosed[WF.Page.lang];
3359  var hdr = $(el).find("h2,h3")[0];
3360  var a = $("<a/>").html($(hdr).html()).attr("href", "#" + closeText);
3361  var img = $("<img/>").attr({
3362    "class": "c16control",
3363    alt: closeText
3364  });
3365  var contentDiv = $(hdr).next(".c16content");
3366  if (!contentDiv.attr("id")) {
3367    contentDiv.attr("id", WF.Utils.generateUniqueId(contentDiv.get(0)));
3368  }
3369  $(hdr).addClass("closed").html("").append(a.prepend(img));
3370  WF.Utils.setImageSrcFromBackground(img, "13ShowHide 32; img");
3371  a.attr("aria-controls", contentDiv.attr("id"));
3372  var clist = WF.Utils.getClist(el);
3373  this.show = function() {
3374    var el = $(this.elem).children("h2,h3");
3375    var img = $(this.elem).find("img").get(0);
3376    el.removeClass("closed");
3377    contentDiv.animate({
3378      height: "toggle",
3379      opacity: "toggle"
3380    }, slideSpeed, function() {
3381      $(document).trigger("resizePage");
3382    }).attr("aria-hidden", "false");
3383    img.src = img.src.replace(/plus/, "minus");
3384    img.alt = openText;
3385  };
3386  this.hide = function() {
3387    var el = $(this.elem).children("h2,h3");
3388    var img = $(this.elem).find("img").get(0);
3389    el.addClass("closed");
3390    contentDiv.animate({
3391      height: "toggle",
3392      opacity: "toggle"
3393    }, slideSpeed, function() {
3394      $(document).trigger("resizePage");
3395    }).attr("aria-hidden", "true");
3396    img.src = img.src.replace(/minus/, "plus");
3397    img.alt = closeText;
3398    $.each(WF.Page.Components.getByType("BalloonHelp"), function(idx, bh) {
3399      $.each($(bh.elem).parents(".c16"), function(idx, elem) {
3400        if (elem.id === self.elem.id) {
3401          bh.hide(undefined, 0);
3402        }
3403      });
3404    });
3405  };
3406  var trackVSData = {
3407    "event": "LinkActivated",
3408    "eventDescription": "ExpandShowHide",
3409    "clist": clist
3410  };
3411  if ($(this.elem).closest(".c68").length) {
3412    trackVSData.eventDescription = "ExpandContactBar";
3413    trackVSData.option = $(hdr).text();
3414  }
3415  a.bind("click keypress", function(evt) {
3416    if (evt.type == "keypress" && evt.keyCode != 13) {
3417      return;
3418    }
3419    evt.preventDefault();
3420    var el = $(this).parent("h2,h3");
3421    var applicationCode = "VID";
3422    if (el.hasClass("closed")) {
3423      self.show();
3424      if (el.closest(".c51 > .c51video + .c16").length > 0) {
3425        if (el.closest(".c51.audio").length > 0) {
3426          applicationCode = "AUD";
3427        }
3428        WF.Utils.logC2tEvent({
3429          "data[eventName]": "TranscriptsActivated",
3430          "data[transcriptsOn]": true,
3431          "data[mediaType]": applicationCode,
3432          "data[eventType]": evt.type,
3433          "data[clist]": clist,
3434          "eventStructure[MediaTranscriptsActivatedCreator]": applicationCode + "_TranscriptsActivated",
3435          "headerStructure[HeaderCreator]": "header_" + applicationCode
3436        });
3437      }
3438      trackVSData.eventType = evt.type;
3439      WF.Utils.trackVS(trackVSData);
3440    } else {
3441      self.hide();
3442      if (el.closest(".c51 > .c51video + .c16").length > 0) {
3443        if (el.closest(".c51.audio").length > 0) {
3444          applicationCode = "AUD";
3445        }
3446        WF.Utils.logC2tEvent({
3447          "data[eventName]": "TranscriptsActivated",
3448          "data[transcriptsOn]": false,
3449          "data[mediaType]": applicationCode,
3450          "data[eventType]": evt.type,
3451          "data[eventDescription]": "TranscriptLessLink",
3452          "data[clist]": clist,
3453          "eventStructure[MediaTranscriptsActivatedCreator]": applicationCode + "_TranscriptsActivated",
3454          "headerStructure[HeaderCreator]": "header_" + applicationCode
3455        });
3456      }
3457    }
3458    el.blur();
3459  });
3460  $(hdr).next(".c16content").hide().attr("aria-hidden", "true");
3461  if (window.location.hash) {
3462    if (window.location.hash.replace(/^#/, "") == this.id.replace(/^ShowHide_/, "")) {
3463      self.show();
3464      WF.Utils.setDelayedScrollTo(this.elem);
3465    }
3466  }
3467  if ($(this.elem).data("defaultOpen")) {
3468    self.show();
3469  }
3470  WF.Page.Components.ShowHides.push(this);
3471  return this;
3472};
3473WF.OnLoads.setupShowHides = function(root) {
3474  if (typeof root == "undefined") {
3475    root = $("body");
3476  }
3477  $(root).find(".c16").each(function() {
3478    new WF.Component.ShowHide(this);
3479  });
3480};
3481WF.Component.BalloonHelp = function(trigger, options) {
3482  if (!$(trigger).data("contentId")) {
3483    WF.Utils.ajaxLog({
3484      "message": 'A Balloon Help link (CSS class c29link) must have a data-content-id attribute, but "' + $(trigger).text() + "\" doesn't!"
3485    });
3486    return false;
3487  }
3488  this.elem = trigger;
3489  if (!trigger.id) {
3490    trigger.id = WF.Utils.generateUniqueId(trigger);
3491  }
3492  this.id = "BalloonHelp_" + trigger.id;
3493  var self = this;
3494  var link_id = trigger.id,
3495    content_id, content_div, mouseoutDelay = 300,
3496    suppressNext = false;
3497  var stdOptions = {
3498    "offsetX": -10,
3499    "offsetY": 8,
3500    "popupSpeed": 500,
3501    "paddingTop": 20,
3502    "paddingBottom": 20,
3503    "marginBottom": 10
3504  };
3505  if ($(trigger).data("contentId")) {
3506    content_id = $(trigger).data("contentId");
3507    content_div = $('.c29content[data-content-id="' + content_id + '"]:first');
3508  } else {
3509    if (trigger.id && trigger.id.search(/link/) != -1) {
3510      content_id = link_id.replace(/link/, "content");
3511      content_div = $("#" + content_id);
3512    } else {
3513      WF.Utils.ajaxLog({
3514        "message": "Can't find Balloon Help content identifier for link with text \"" + $(trigger).text() + '"!'
3515      });
3516      return false;
3517    }
3518  }
3519  if (!options) {
3520    options = {};
3521  }
3522  for (var o in stdOptions) {
3523    if (typeof options[o] == "undefined") {
3524      options[o] = stdOptions[o];
3525    }
3526  }
3527  trigger = $(trigger);
3528  if (trigger.attr("href") == "#") {
3529    trigger.attr("href", "");
3530  }
3531  var clist = trigger.data("cid") + "~" + trigger.data("ctid");
3532  if (content_div.length != 1) {
3533    WF.Utils.ajaxLog({
3534      "message": "Can't find Balloon Help content div #" + content_id + " to match link #" + link_id + "!"
3535    });
3536    return false;
3537  }
3538  if ($.trim(trigger.text()).length < 1 && trigger.html().search(/<img /) != -1) {
3539    trigger.addClass("imgOnly");
3540  }
3541  if (content_div.attr("role") != "complementary") {
3542    var closeBtn = $("<img/>").attr({
3543      "alt": WF.Strings.Shared.close[WF.Page.lang]
3544    });
3545    content_div.prepend($('<span class="c29close"><a href=""></a></span>')).find(".c29close a").bind("click keypress", function(evt) {
3546      self.hide(evt);
3547      evt.preventDefault();
3548      $(trigger).focus();
3549    });
3550    content_div.find(".c29close a").append(closeBtn);
3551    WF.Utils.setImageSrcFromBackground(closeBtn, "14BalloonHelp 75; closeBtn");
3552    content_div.append($('<span class="c29hook"></span>'));
3553    content_div.prepend($('<span class="hide c29begin">' + WF.Strings.Components.BalloonHelp.beginningOfPopup[WF.Page.lang] + "</span>"));
3554    content_div.append($('<span class="hide">' + WF.Strings.Components.BalloonHelp.endOfPopup[WF.Page.lang] + "</span>"));
3555    content_div.attr({
3556      "role": "complementary",
3557      "aria-labelledby": link_id
3558    });
3559  }
3560  this.getQuadrant = function(pos, size) {
3561    var scroll = {
3562      "top": $(window).scrollTop(),
3563      "left": $(window).scrollLeft()
3564    };
3565    var bounds = WF.Utils.getViewportSize();
3566    var vert = "b",
3567      horz = "l";
3568    if ((pos.top - scroll.top) < bounds.height / 2) {
3569      vert = "t";
3570    }
3571    if ((pos.left - scroll.left) > bounds.width / 2) {
3572      horz = "r";
3573    }
3574    return vert + horz;
3575  };
3576  this.hide = function(evt, speed) {
3577    if (typeof evt != "undefined") {
3578      if (evt.type == "keypress" && evt.keyCode != 13 && evt.keyCode != 27) {
3579        return;
3580      }
3581      evt.preventDefault();
3582    }
3583    if (typeof speed == "undefined") {
3584      speed = options.popupSpeed;
3585    }
3586    content_div.data("stayOpen", "false");
3587    trigger.removeClass("hover");
3588    content_div.fadeOut(speed, function() {
3589      $(this).attr("aria-hidden", "true").removeAttr("tabindex");
3590      if (typeof evt != "undefined" && (evt.type == "keypress" || evt.type == "click")) {
3591        suppressNext = true;
3592        if (typeof evt == "keypress") {
3593          trigger.focus();
3594        }
3595      }
3596    });
3597  };
3598  this.maybeHide = function(evt) {
3599    if (content_div.data("stayOpen") == "true" || trigger.data("active") == "true") {
3600      return;
3601    }
3602    self.hide(evt);
3603  };
3604  this.setPosition = function() {
3605    var trigger_pos = trigger.offset();
3606    var trigger_size = WF.Utils.getDimensions(trigger);
3607    var dir = self.getQuadrant(trigger_pos);
3608    switch (dir) {
3609      case "tl":
3610        content_div.css({
3611          "top": (trigger_pos.top + trigger_size.height + options.marginBottom + options.offsetY) + "px",
3612          "left": (trigger_pos.left + options.offsetX) + "px",
3613          "right": "auto"
3614        });
3615        break;
3616      case "tr":
3617        content_div.css({
3618          "top": (trigger_pos.top + trigger_size.height + options.marginBottom + options.offsetY) + "px",
3619          "right": ($("body").width() - (trigger_pos.left + trigger_size.width) + options.offsetX) + "px",
3620          "left": "auto"
3621        });
3622        break;
3623      case "bl":
3624        content_div.css({
3625          "top": (trigger_pos.top - content_div.height() - options.offsetY - options.paddingBottom - options.paddingTop - options.marginBottom) + "px",
3626          "left": (trigger_pos.left + options.offsetX) + "px",
3627          "right": "auto"
3628        });
3629        break;
3630      case "br":
3631        content_div.css({
3632          "top": (trigger_pos.top - content_div.height() - options.offsetY - options.paddingBottom - options.paddingTop - options.marginBottom) + "px",
3633          "right": ($("body").width() - (trigger_pos.left + trigger_size.width) + options.offsetX) + "px",
3634          "left": "auto"
3635        });
3636        break;
3637    }
3638    content_div.removeClass("tl").removeClass("tr").removeClass("bl").removeClass("br").addClass(dir);
3639  };
3640  this.show = function(evt) {
3641    if ((evt.type == "keyup" && evt.keyCode != 13) || evt.type == "focus") {
3642      return;
3643    }
3644    if (content_div.is(":visible")) {
3645      content_div.find(".c29begin.hide").attr("tabindex", 0).focus();
3646      return;
3647    }
3648    self.setPosition();
3649    trigger.addClass("hover");
3650    content_div.fadeIn(options.popupSpeed, function() {
3651      $(this).attr("aria-hidden", "false");
3652      $(this).attr("tabindex", -1);
3653      if (evt.type != "mouseover") {
3654        $(this).focus();
3655      }
3656    });
3657    var trgt = evt.target || evt.srcElement;
3658    if (trgt.getAttribute("isClickable") != "true") {
3659      evt.preventDefault();
3660    }
3661  };
3662  trigger.bind("click", function(evt) {
3663    var trgt = evt.target || evt.srcElement;
3664    if (trgt.getAttribute("isClickable") != "true") {
3665      evt.stopPropagation();
3666      evt.preventDefault();
3667    }
3668    $(".c29content").data("stayOpen", "false");
3669    content_div.data("stayOpen", "true");
3670    $.each(WF.Page.Components.BalloonHelps, function(i, bh) {
3671      if (bh.id != self.id) {
3672        bh.maybeHide();
3673      }
3674    });
3675    self.show(evt);
3676    WF.Utils.trackVS({
3677      "event": "LinkActivated",
3678      "eventType": "click",
3679      "eventDescription": "DisplayBalloonHelp",
3680      "clist": clist
3681    });
3682    var trgt = evt.target || evt.srcElement;
3683    if (trgt.getAttribute("isClickable") != "true") {
3684      evt.stopPropogation();
3685      evt.preventDefault();
3686    }
3687  });
3688  trigger.bind("keypress", function(evt) {
3689    if (evt.keyCode != 13) {
3690      return;
3691    }
3692    evt.preventDefault();
3693    $(this).keyup();
3694  });
3695  trigger.bind("keyup", function(evt) {
3696    if (evt.keyCode != 13) {
3697      return;
3698    }
3699    evt.preventDefault();
3700    $(".c29content").data("stayOpen", "false");
3701    content_div.data("stayOpen", "true");
3702    $.each(WF.Page.Components.BalloonHelps, function(i, bh) {
3703      if (bh.id != self.id) {
3704        bh.maybeHide();
3705      }
3706    });
3707    self.show(evt);
3708    WF.Utils.trackVS({
3709      "event": "LinkActivated",
3710      "eventType": "keypress",
3711      "eventDescription": "DisplayBalloonHelp",
3712      "clist": clist
3713    });
3714  });
3715  trigger.bind("mouseover", function(evt) {
3716    if (trigger.attr("triggerHover") == "false") {
3717      return;
3718    }
3719    trigger.data("active", "true").addClass("hover");
3720    if (suppressNext) {
3721      suppressNext = false;
3722      return;
3723    }
3724    if ($(".c29content:visible").length) {
3725      return;
3726    }
3727    self.show(evt);
3728  });
3729  trigger.bind("mouseout blur", function(evt) {
3730    if (trigger.attr("triggerHover") == "false") {
3731      return;
3732    }
3733    trigger.data("active", "false");
3734    if (content_div.is(":focus")) {
3735      trigger.removeClass("hover");
3736    }
3737    setTimeout(function(ev) {
3738      self.maybeHide(ev);
3739    }, mouseoutDelay);
3740  });
3741  content_div.bind("focus mouseover", function(evt) {
3742    trigger.data("active", "true").addClass("hover");
3743    self.show(evt);
3744  });
3745  content_div.bind("mouseout blur", function(evt) {
3746    trigger.data("active", "false").removeClass("hover");
3747    setTimeout(function(ev) {
3748      self.maybeHide(ev);
3749    }, mouseoutDelay);
3750  });
3751  content_div.bind("keypress", function(evt) {
3752    if (evt.keyCode == 27) {
3753      self.hide(evt);
3754    }
3755  });
3756  trigger.attr("aria-haspopup", "true");
3757  WF.Page.Components.BalloonHelps.push(this);
3758  return this;
3759};
3760WF.OnLoads.setupBalloonHelps = function(root) {
3761  if (typeof root == "undefined") {
3762    root = $("body");
3763  }
3764  $(root).find(".c29link").each(function() {
3765    new WF.Component.BalloonHelp(this);
3766  });
3767};
3768var balloons = $(".c29content");
3769$("body").append(balloons);
3770$("#balloonsContainerSrc").html("");
3771WF.Component.FAQ = function(el, slideSpeed) {
3772  if (!el.id) {
3773    el.id = WF.Utils.generateUniqueId(el);
3774  }
3775  this.elem = el;
3776  this.id = "FAQ_" + el.id;
3777  var self = this;
3778  if (typeof slideSpeed == "undefined") {
3779    slideSpeed = 400;
3780  } else {
3781    if (typeof slideSpeed == "object") {
3782      slideSpeed = slideSpeed.speed;
3783    }
3784  }
3785  var openText = WF.Strings.Components.FAQ.imgOpen[WF.Page.lang];
3786  var closeText = WF.Strings.Components.FAQ.imgClosed[WF.Page.lang];
3787  var hdr = $(el).find("h3")[0];
3788  var a = $("<a/>").html($(hdr).html()).attr("href", "#" + closeText);
3789  var img = $("<img/>").attr({
3790    "class": "c58control",
3791    alt: closeText
3792  });
3793  var contentDiv = $(hdr).next(".c58answer");
3794  if (!contentDiv.attr("id")) {
3795    contentDiv.attr("id", WF.Utils.generateUniqueId(contentDiv.get(0)));
3796  }
3797  $(hdr).addClass("closed").html("").append(a.prepend(img));
3798  WF.Utils.setImageSrcFromBackground(img, "16FAQ 32; img");
3799  a.attr("aria-controls", contentDiv.attr("id"));
3800  var clist = WF.Utils.getClist(el);
3801  a.bind("click keypress", function(evt) {
3802    if (evt.type == "keypress" && evt.keyCode != 13) {
3803      return;
3804    }
3805    evt.preventDefault();
3806    var el = $(this).parent("h3");
3807    var img = $(this).find("img").get(0);
3808    if (el.hasClass("closed")) {
3809      el.removeClass("closed");
3810      el.next(".c58answer").animate({
3811        height: "toggle",
3812        opacity: "toggle"
3813      }, slideSpeed, function() {
3814        $(document).trigger("resizePage");
3815      }).attr("aria-hidden", "false");
3816      img.src = img.src.replace(/plus/, "minus");
3817      img.alt = openText;
3818      WF.Utils.trackVS({
3819        "event": "LinkActivated",
3820        "eventType": evt.type,
3821        "eventDescription": "ExpandFAQ",
3822        "clist": clist
3823      });
3824    } else {
3825      el.addClass("closed");
3826      el.next(".c58answer").animate({
3827        height: "toggle",
3828        opacity: "toggle"
3829      }, slideSpeed, function() {
3830        $(document).trigger("resizePage");
3831      }).attr("aria-hidden", "true");
3832      img.src = img.src.replace(/minus/, "plus");
3833      img.alt = closeText;
3834      $.each(WF.Page.Components.getByType("BalloonHelp"), function(idx, bh) {
3835        $.each($(bh.elem).parents(".c58"), function(idx, elem) {
3836          if (elem.id === self.elem.id) {
3837            bh.hide(undefined, 0);
3838          }
3839        });
3840      });
3841    }
3842    el.blur();
3843  });
3844  $(hdr).next(".c58answer").hide().attr("aria-hidden", "true");
3845  if (window.location.hash) {
3846    if (window.location.hash.replace(/^#/, "") == this.id.replace(/^FAQ_/, "")) {
3847      a.click();
3848      WF.Utils.setDelayedScrollTo(this.elem);
3849    }
3850  }
3851  WF.Page.Components.FAQs.push(this);
3852  return this;
3853};
3854WF.OnLoads.setupFAQs = function(root) {
3855  if (typeof root == "undefined") {
3856    root = $("body");
3857  }
3858  $(root).find(".c58").each(function() {
3859    new WF.Component.FAQ(this);
3860  });
3861};
3862WF.Component.FatNav = function(el) {
3863  var _this = this,
3864    navSelected = null,
3865    timer, isDisplaying = false,
3866    hoverShowDelay = 300,
3867    clickShowDelay = 0,
3868    triggerHideDelay = 250,
3869    popupHideDelay = 150,
3870    showSpeed = 250,
3871    hideSpeed = 250,
3872    linkEl = null;
3873  this.el = el;
3874  this.position = function() {
3875    navSelected.css("left", _this.el.offset().left - 10 + "px");
3876    navSelected.css("top", (linkEl.offset().top + linkEl.outerHeight() - 1) + "px");
3877  };
3878  this.show = function(anchor, e) {
3879    var tallestDiv = 0;
3880    var firstDivClass = "navItemLeft";
3881    _this.canceltimer();
3882    _this.el.find("a.selected").attr("aria-expanded", "false"); //18.R4
3883    _this.el.find("a.selected").removeClass("selected");
3884    linkEl = anchor;
3885    navSelected = $("#" + linkEl.attr("data-navitem"));
3886    linkEl.addClass("selected");
3887    // 18.R1 ADA WFC-23
3888    //linkEl.attr("aria-selected", "true");
3889    linkEl.attr("aria-expanded", "true");
3890    $("div.navItem").addClass("hide");
3891    _this.position();
3892    navSelected.removeClass("hide");
3893    navSelected.attr("aria-hidden", "false");
3894    $("div.navItem").each(function() {
3895      if ($(this).hasClass("hide")) {
3896        $(this).css("display", "none");
3897      }
3898    });
3899    var delay;
3900    if (e.type == "mouseover") {
3901      delay = (isDisplaying) ? 0 : hoverShowDelay;
3902    } else {
3903      delay = clickShowDelay;
3904    }
3905    _this.settimer(function() {
3906      if (!navSelected) {
3907        navSelected = $("#" + linkEl.attr("data-navitem"));
3908      }
3909      if (e.type == "mouseover") {
3910        navSelected.filter(":not(:animated)").animate({
3911          height: "show",
3912          opacity: "show"
3913        }, showSpeed);
3914      } else {
3915        navSelected.filter(":not(:animated)").animate({
3916          height: "toggle",
3917          opacity: "toggle"
3918        }, showSpeed, function() {
3919          if (e.type == "keypress" && linkEl.next("div").css("display") == "block") {
3920            navSelected.find("span.beginmarker").focus();
3921          }
3922          if (linkEl.next("div").css("display") == "none") {
3923            linkEl.removeClass("selected");
3924            linkEl.removeAttr("aria-selected");
3925            $("div.navItem").attr("aria-hidden", "true");
3926            $("div.navItem").css("display", "none");
3927          }
3928        });
3929      }
3930      navSelected.children("div").each(function(idx) {
3931        if (idx == 0 && this.className) {
3932          firstDivClass = this.className;
3933        }
3934        if ($(this).innerHeight() > tallestDiv) {
3935          tallestDiv = $(this).innerHeight();
3936        }
3937      });
3938      navSelected.find("." + firstDivClass).first().css("height", tallestDiv + "px");
3939      isDisplaying = true;
3940      if (navSelected.find("a.iaRendered").length) {
3941        var favLink = navSelected.find("a.iaRendered"),
3942          slotId = favLink.data("slotId"),
3943          offerId = favLink.data("offerId");
3944        WF.Utils.trackTas({
3945          "RequestType": "ServeConfirm",
3946          "displayed": slotId + ":" + offerId
3947        });
3948      }
3949      $(_this.el).trigger("fatnavopen");
3950    }, delay);
3951  };
3952  this.hide = function() {
3953    // 18.R1 ADA WFC-23
3954    // _this.el.find("a.selected").removeAttr("aria-selected");
3955    _this.el.find("a.selected").attr("aria-expanded", "false");
3956    _this.el.find("a.navLevel1").removeClass("selected");
3957    if (navSelected != null) {
3958      navSelected.addClass("hide").attr("aria-hidden", "true");
3959      navSelected.animate({
3960        height: "hide",
3961        opacity: "hide"
3962      }, hideSpeed, function() {
3963        $(".navItem").css("display", "none");
3964        navSelected = null;
3965      });
3966    }
3967    isDisplaying = false;
3968    $(_this.el).trigger("fatnavclose");
3969  };
3970  this.settimer = function(todo, time) {
3971    timer = window.setTimeout(todo, time);
3972  };
3973  this.canceltimer = function() {
3974    if (timer) {
3975      window.clearTimeout(timer);
3976      timer = null;
3977    }
3978  };
3979  this.setup = function() {
3980    $("div.navItem").each(function() {
3981      $(this).find("a.iaRendered").click(function() {
3982        var $el = $(this),
3983          slotId = $el.data("slotId"),
3984          offerId = $el.data("offerId");
3985        WF.Utils.trackTas({
3986          "suppressAsync": true,
3987          "slotId": slotId,
3988          "COID": offerId
3989        });
3990      });
3991      var temp;
3992      temp = $(this).detach();
3993      _this.el.find("a.navLevel1").each(function() {
3994        if (temp.attr("id") == $(this).attr("data-navitem")) {
3995          temp.insertAfter($(this));
3996        }
3997      });
3998    });
3999    if (WF.Browser.supports.touch) {
4000      _this.el.find("a.navLevel1").click(function(e) {
4001        e.preventDefault();
4002      });
4003      _this.el.find("a.navLevel1").bind("touchstart", function(e) {
4004        _this.show($(this), e);
4005      });
4006      $(document).bind("touchstart", function(e) {
4007        if ($(e.target).is("#" + _this.el.attr("id") + " *")) {
4008          return true;
4009        } else {
4010          _this.hide();
4011        }
4012      });
4013    } else {
4014      _this.el.find("a.navLevel1").click(function(e) {
4015        _this.show($(this), e);
4016        e.preventDefault();
4017      });
4018      _this.el.find("a.navLevel1").bind("mouseover", function(e) {
4019        _this.show($(this), e);
4020      });
4021      _this.el.find("a.navLevel1").bind("mouseout", function(e) {
4022        _this.canceltimer();
4023        _this.settimer(_this.hide, triggerHideDelay);
4024      });
4025      _this.el.keypress(function(e) {
4026        var target = $(e.target);
4027        if (target.is("a.navLevel1") == true && e.keyCode == 13) {
4028          _this.show($(target), e);
4029          e.preventDefault();
4030        }
4031        if (e.keyCode == 27) {
4032          _this.el.find("a.selected").focus();
4033          _this.hide();
4034        }
4035      });
4036      _this.el.find("div.navItem").bind("mouseover", function(e) {
4037        _this.canceltimer();
4038      });
4039      _this.el.find("div.navItem").bind("mouseout", function(e) {
4040        _this.settimer(_this.hide, popupHideDelay);
4041      });
4042      _this.el.find("li a").first().bind("keypress", function(e) {
4043        if (e.shiftKey === true && e.keyCode == 9) {
4044          _this.hide();
4045        }
4046      });
4047      // 18.R1 ADA WFC-15 & 18.R4
4048      _this.el.find("a.endmarker").bind("keydown", function(e) {
4049        if (e.keyCode == 9) {
4050          _this.hide();
4051        }
4052      });
4053    }
4054  };
4055  $(window).resize(function() {
4056    if (navSelected != null) {
4057      _this.position();
4058    }
4059  });
4060  WF.Page.Components.FatNav = this;
4061  this.setup();
4062  return this;
4063};
4064WF.OnLoads.setupFatNav = function(root) {
4065  if (typeof root == "undefined") {
4066    root = $("body");
4067  }
4068  if (WF.Page.Components.FatNav) {
4069    return;
4070  }
4071  if ($(root).find("#fatnav").length > 0) {
4072    new WF.Component.FatNav($("#fatnav"));
4073  }
4074};
4075WF.Component.RibbonCarousel = function(el, options) {
4076  if (!el.id) {
4077    el.id = WF.Utils.generateUniqueId(el);
4078  }
4079  var self = this;
4080  var stdOptions = {
4081    "autostart": false,
4082    "autoloop": false,
4083    "frameRate": 8000,
4084    "loop": true,
4085    "paddles": "on",
4086    "speed": 500,
4087    "Tip": false
4088  };
4089  var curFrame, evtDesc = "DisplayRibbonCarouselItem",
4090    incomingFrame, incomingChevron, visibleChevron, wrapLength, onlySixFrames = false,
4091    autoFirstFrame = 0,
4092    specialFrameId = "fraud";
4093  this.elem = el;
4094  this.id = "RibbonCarousel_" + el.id;
4095  var ribbon = $(this.elem).find("ul.c63controls"),
4096    ribbonItems = ribbon.find("li"),
4097    bodies = $(el).find(".carouselFrame");
4098  if (!options) {
4099    options = {};
4100  }
4101  for (var o in stdOptions) {
4102    if (typeof options[o] == "undefined") {
4103      options[o] = stdOptions[o];
4104    }
4105  }
4106  this.buildMultiframeHtml = function() {
4107    incomingFrame = $('<div class="carouselFrame incomingFrame"/>');
4108    $(el).append(incomingFrame);
4109    chevron = $('<div class="chevron"/>');
4110    visibleChevron = $('<div class="visibleChevron"/>');
4111    chevron.append(visibleChevron);
4112    incomingChevron = $('<div class="incomingChevron"/>');
4113    chevron.append(incomingChevron);
4114    $(el).append(chevron);
4115    if (ribbonItems.length != bodies.length) {
4116      var only = (ribbonItems.length > bodies.length) ? "only " : "";
4117      alert("There are " + ribbonItems.length + " items in the top ribbon (ul.c63controls), but " + only + bodies.length + " carouselFrame divs!");
4118      return false;
4119    }
4120  };
4121  this.buildPaddles = function() {
4122    var leftImg = $('<img alt="' + WF.Strings.Shared.prev[WF.Page.lang] + '"/>');
4123    var rightImg = $('<img alt="' + WF.Strings.Shared.next[WF.Page.lang] + '"/>');
4124    var leftLink = $('<a href="#' + el.id + '_prevFrame" class="paddle prevPaddle"></a>');
4125    leftLink.append(leftImg);
4126    var rightLink = $('<a href="#' + el.id + '_nextFrame" class="paddle nextPaddle"></a>');
4127    rightLink.append(rightImg);
4128    leftLink.mouseover(function() {
4129      var img = $(this).find("img").get(0);
4130      img.src = img.src.replace(/grey/, "blue");
4131    }).mouseout(function() {
4132      var img = $(this).find("img").get(0);
4133      img.src = img.src.replace(/blue/, "grey");
4134    }).click(function(evt) {
4135      evt.preventDefault();
4136      self.prev();
4137    }).bind("click keypress", function(evt) {
4138      if (evt.type == "keypress" && evt.keyCode != 13) {
4139        return;
4140      }
4141      ribbon.find("li").removeAttr("tabindex").attr({
4142        "aria-expanded": false,
4143        "aria-selected": false
4144      });
4145      if (!WF.Browser.supports.IE7mode) {
4146        ribbon.find(".show" + curFrame).attr({
4147          "tabindex": 0,
4148          "aria-expanded": true,
4149          "aria-selected": true
4150        });
4151      }
4152      WF.Utils.trackVS({
4153        "event": "LinkActivated",
4154        "eventType": evt.type,
4155        "eventDescription": evtDesc,
4156        "clist": self.retrieveClist(),
4157        "elementActivated": "LeftPaddle"
4158      });
4159      if (evt.type == "keypress") {
4160        evt.preventDefault();
4161        self.prev();
4162      }
4163    });
4164    rightLink.mouseover(function() {
4165      var img = $(this).find("img").get(0);
4166      img.src = img.src.replace(/grey/, "blue");
4167    }).mouseout(function() {
4168      var img = $(this).find("img").get(0);
4169      img.src = img.src.replace(/blue/, "grey");
4170    }).click(function(evt) {
4171      evt.preventDefault();
4172      self.next();
4173    }).bind("click keypress", function(evt) {
4174      if (evt.type == "keypress" && evt.keyCode != 13) {
4175        return;
4176      }
4177      ribbon.find("li").removeAttr("tabindex").attr({
4178        "aria-expanded": false,
4179        "aria-selected": false
4180      });
4181      if (!WF.Browser.supports.IE7mode) {
4182        ribbon.find(".show" + curFrame).attr({
4183          "tabindex": 0,
4184          "aria-expanded": true,
4185          "aria-selected": true
4186        });
4187      }
4188      WF.Utils.trackVS({
4189        "event": "LinkActivated",
4190        "eventType": evt.type,
4191        "eventDescription": evtDesc,
4192        "clist": self.retrieveClist(),
4193        "elementActivated": "RightPaddle"
4194      });
4195      if (evt.type == "keypress") {
4196        evt.preventDefault();
4197        self.next();
4198      }
4199    });
4200    ribbon.before(leftLink);
4201    ribbon.after(rightLink);
4202    WF.Utils.setImageSrcFromBackground(leftImg, "18RibbonCarousel 152; leftImg");
4203    WF.Utils.setImageSrcFromBackground(rightImg, "18RibbonCarousel 153; rightImg");
4204  };
4205  this.copyFrame = function(from, to) {
4206    to.html(from.html());
4207    $.each(["cid", "ctid", "presentation"], function(i, val) {
4208      to.data(val, from.data(val));
4209    });
4210  };
4211  this.count = function() {
4212    return bodies.length;
4213  };
4214  this.frameIdToNumber = function(id) {
4215    var frame = $(ribbon).find('li[data-ia-code="' + id + '"]');
4216    if (!frame.length) {
4217      return null;
4218    }
4219    var num = frame.attr("class").match(/show(\d+)/)[1];
4220    return parseInt(num, 10);
4221  };
4222  this.getFrameByNumber = function(num) {
4223    return $(ribbon).find("li.show" + num);
4224  };
4225  this.handleAutoFirstFrame = function() {
4226    var specialTargetFrameNum = ribbonItems.length - 1;
4227    if (WF.Component.RibbonCarousel.autoFirstFrame) {
4228      if (typeof WF.Component.RibbonCarousel.autoFirstFrame == "string") {
4229        WF.Component.RibbonCarousel.autoFirstFrame = self.frameIdToNumber(WF.Component.RibbonCarousel.autoFirstFrame);
4230      }
4231      self.swapFrames(WF.Component.RibbonCarousel.autoFirstFrame, 1);
4232    }
4233    if (specialFrameId) {
4234      var specialFrameNum = self.frameIdToNumber(specialFrameId);
4235      if (specialFrameNum != specialTargetFrameNum) {
4236        self.swapFrames(self.frameIdToNumber(specialFrameId), specialTargetFrameNum);
4237      }
4238    }
4239  };
4240  this.next = function() {
4241    var showing = curFrame;
4242    if (showing >= wrapLength) {
4243      showing = 1;
4244    } else {
4245      showing++;
4246    }
4247    if (onlySixFrames) {
4248      ribbon.find("li:first").replaceWith(ribbon.find("li:nth-child(2)").clone(true));
4249    }
4250    ribbon.css("left", (parseInt(ribbon.css("left"), 10) + 162) + "px").find("li:first").appendTo(ribbon);
4251    this.showFrame(showing, "right");
4252  };
4253  this.numberBodies = function() {
4254    $.each(bodies, function(idx, body) {
4255      if (!body.id) {
4256        body.id = WF.Utils.generateUniqueId(body);
4257      }
4258      body = $(body);
4259      body.addClass("item" + (idx + 1)).attr("aria-hidden", true);
4260    });
4261  };
4262  this.prev = function() {
4263    var showing = curFrame;
4264    if (showing <= 1) {
4265      showing = wrapLength;
4266    } else {
4267      showing--;
4268    }
4269    if (onlySixFrames) {
4270      ribbon.find("li:last").replaceWith(ribbon.find("li:nth-child(6)").clone(true));
4271    }
4272    ribbon.css("left", (parseInt(ribbon.css("left"), 10) - 162) + "px").find("li:last").prependTo(ribbon);
4273    this.showFrame(showing, "left");
4274  };
4275  this.retrieveClist = function() {
4276    var visibleCarouselFrame = $(el).find(".item" + curFrame);
4277    return $(visibleCarouselFrame).data("cid") + "~" + $(visibleCarouselFrame).data("ctid");
4278  };
4279  this.setupBodyLinkTasCalls = function() {
4280    $.each(bodies, function(idx, body) {
4281      var $body = $(body),
4282        num = $body.attr("class").match(/item(\d+)/)[1],
4283        offerId;
4284      offerId = $(".c63controls").find("li.show" + num).data("iaCode");
4285      $(body).find("a").each(function() {
4286        var el = $(this);
4287        if (el.hasClass("iaRendered")) {
4288          return true;
4289        }
4290        if (el.hasClass("cmsDefault")) {
4291          return true;
4292        }
4293        el.click(function(evt) {
4294          WF.Utils.trackTas({
4295            "suppressAsync": true,
4296            "slotId": tasInfo.ribbonCarouselSlotId,
4297            "COID": offerId
4298          });
4299        });
4300      });
4301    });
4302  };
4303  this.setupBodyClassesAndHandlers = function() {
4304    for (var i = 1; i <= bodies.length; i++) {
4305      $(bodies[i - 1]).prepend($('<span class="hidden">' + WF.Strings.Shared.beginItemNo[WF.Page.lang] + i + "</span>"));
4306      $(bodies[i - 1]).append($('<span class="hidden">' + WF.Strings.Shared.endItemNo[WF.Page.lang] + i + "</span>"));
4307      $(bodies[i - 1]).hide();
4308      if ($.fn.touchwipe) {
4309        $(bodies[i - 1]).touchwipe({
4310          wipeLeft: function(evt) {
4311            evt.preventDefault();
4312            self.next(true);
4313          },
4314          wipeRight: function(evt) {
4315            evt.preventDefault();
4316            self.prev(true);
4317          }
4318        });
4319      }
4320    }
4321  };
4322  this.setupRibbonClassesAndHandlers = function() {
4323    for (var i = 1; i <= ribbonItems.length; i++) {
4324      if (!ribbonItems[i - 1].id) {
4325        ribbonItems[i - 1].id = WF.Utils.generateUniqueId(ribbonItems[i - 1]);
4326      }
4327      $(bodies[i - 1]).attr("aria-labelledby", ribbonItems[i - 1].id);
4328      $(ribbonItems[i - 1]).attr({
4329        "aria-expanded": false,
4330        "aria-selected": false
4331      }).addClass("show" + i).bind("click", function(evt) {
4332        var target = evt.target;
4333        if (target.tagName != "LI") {
4334          target = $(target).parent("li").get(0);
4335        }
4336        var x = target.className.match(/show(\d+)\b/)[1];
4337        var dir = null;
4338        var rItems = ribbon.find("li");
4339        if (rItems.index(target) == 0) {
4340          dir = "left";
4341        } else {
4342          if (rItems.index(target) == rItems.length - 1) {
4343            dir = "right";
4344          }
4345        }
4346        self.shiftTo(x, dir);
4347        ribbon.find("li").removeAttr("tabindex").attr({
4348          "aria-expanded": false,
4349          "aria-selected": false
4350        });
4351        if (!WF.Browser.supports.isIE) {
4352          $(this).attr({
4353            "tabindex": 0,
4354            "aria-expanded": true,
4355            "aria-selected": true
4356          }).focus();
4357        }
4358        WF.Utils.trackVS({
4359          "event": "LinkActivated",
4360          "eventType": evt.type,
4361          "eventDescription": evtDesc,
4362          "clist": self.retrieveClist(),
4363          "elementActivated": "RibbonItem"
4364        });
4365      }).bind("keydown", function(evt) {
4366        if (evt.keyCode == 39) {
4367          self.next();
4368          if (!WF.Browser.supports.IE7mode) {
4369            $(this).next().attr({
4370              "tabindex": 0,
4371              "aria-expanded": true,
4372              "aria-selected": true
4373            }).focus();
4374          }
4375          $(this).removeAttr("tabindex").attr({
4376            "aria-expanded": false,
4377            "aria-selected": false
4378          });
4379        } else {
4380          if (evt.keyCode == 37) {
4381            self.prev();
4382            if (!WF.Browser.supports.IE7mode) {
4383              $(this).prev().attr({
4384                "tabindex": 0,
4385                "aria-expanded": true,
4386                "aria-selected": true
4387              }).focus();
4388            }
4389            $(this).removeAttr("tabindex").attr({
4390              "aria-expanded": false,
4391              "aria-selected": false
4392            });
4393          }
4394        }
4395      }).bind("keypress", function(evt) {
4396        if ($.inArray(evt.keyCode, [13, 37, 39]) == -1) {
4397          return;
4398        }
4399        WF.Utils.trackVS({
4400          "event": "LinkActivated",
4401          "eventType": evt.type,
4402          "eventDescription": evtDesc,
4403          "clist": self.retrieveClist(),
4404          "elementActivated": "RibbonItem"
4405        });
4406      });
4407    }
4408  };
4409  this.shiftTo = function(num, dir) {
4410    var diff = num - curFrame;
4411    if (Math.abs(diff) > 3) {
4412      if (diff < 0) {
4413        diff += ribbonItems.length;
4414      } else {
4415        diff -= ribbonItems.length;
4416      }
4417    }
4418    if (!dir) {
4419      if (diff < 0) {
4420        dir = "left";
4421      } else {
4422        dir = "right";
4423      }
4424    }
4425    diff = Math.abs(diff);
4426    for (var i = 0; i < diff; i++) {
4427      if (dir == "right") {
4428        if (onlySixFrames) {
4429          ribbon.find("li:first").replaceWith(ribbon.find("li:nth-child(2)").clone(true));
4430        }
4431        ribbon.css("left", (parseInt(ribbon.css("left"), 10) + 162) + "px").find("li:first").appendTo(ribbon);
4432      } else {
4433        if (onlySixFrames) {
4434          ribbon.find("li:last").replaceWith(ribbon.find("li:nth-child(6)").clone(true));
4435        }
4436        ribbon.css("left", (parseInt(ribbon.css("left"), 10) - 162) + "px").find("li:last").prependTo(ribbon);
4437      }
4438    }
4439    this.showFrame(num, dir);
4440  };
4441  this.showFrame = function(num, dir) {
4442    if (num == curFrame) {
4443      return;
4444    }
4445    var incFrame = $(el).find(".carouselFrame.item" + num);
4446    self.copyFrame(incFrame, incomingFrame);
4447    self.copyFrame($("ul.c63controls li.show" + num), incomingChevron);
4448    var animOpts = {
4449      queue: false,
4450      left: 0
4451    };
4452    var plusWidth = options.width + "px";
4453    var minusWidth = "-" + options.width + "px";
4454    if (dir == "left") {
4455      incomingFrame.css("left", minusWidth);
4456    } else {
4457      if (dir == "right") {
4458        incomingFrame.css("left", plusWidth);
4459      } else {
4460        if (num > curFrame) {
4461          dir = "right";
4462          incomingFrame.css("left", plusWidth);
4463        } else {
4464          dir = "left";
4465          incomingFrame.css("left", minusWidth);
4466        }
4467      }
4468    }
4469    var chevronWidth = visibleChevron.width() + "px";
4470    if (dir == "left") {
4471      chevronWidth = "-" + chevronWidth;
4472    }
4473    incomingChevron.css("left", chevronWidth);
4474    incomingFrame.show();
4475    incomingFrame.animate(animOpts, options.speed, "swing", function() {
4476      incomingFrame.hide();
4477      $(el).find(".carouselFrame:visible").attr("aria-hidden", "true").hide();
4478      incFrame.attr("aria-hidden", "false").show();
4479    });
4480    incomingChevron.animate(animOpts, options.speed, "swing", function() {
4481      self.copyFrame(incomingChevron, visibleChevron);
4482      incomingChevron.hide();
4483    });
4484    curFrame = num;
4485    ribbon.animate({
4486      "left": "-100px"
4487    }, options.speed);
4488    if (num != 1) {
4489      if (ribbon.find(".show" + num).data("iaCode") == specialFrameId) {
4490        return;
4491      }
4492      var displayedItems = [];
4493      displayedItems.push(WF.Utils.getTasCallData(incomingFrame.find(".c63contentTop"), true).displayed);
4494      displayedItems.push(WF.Utils.getTasCallData(incomingFrame.find(".c63contentBottom"), true).displayed);
4495      displayedItems.push(tasInfo.ribbonCarouselSlotId + ":" + ribbon.find(".show" + num).data("iaCode"));
4496      displayedItems = $.grep(displayedItems, function(val) {
4497        return !!val;
4498      });
4499      if (displayedItems.length < 1) {
4500        return;
4501      }
4502      WF.Utils.trackTas({
4503        "displayed": displayedItems.join(","),
4504        "RequestType": "ServeConfirm"
4505      });
4506    }
4507  };
4508  this.swapFrames = function(arg1, arg2) {
4509    if (typeof arg1 != "number") {
4510      return;
4511    }
4512    if (arg1 == arg2) {
4513      return;
4514    }
4515    var idx1 = arg1 - 1,
4516      idx2 = arg2 - 1;
4517    if (arg2 > arg1) {
4518      idx2++;
4519    }
4520    if (arg2 == 1) {
4521      arg2 = arg1;
4522      arg1 = 1;
4523    }
4524    var ribbonItem1 = self.getFrameByNumber(arg1),
4525      ribbonItem2 = self.getFrameByNumber(arg2),
4526      body1 = $(this.elem).find(".carouselFrame.item" + arg1),
4527      body2 = $(this.elem).find(".carouselFrame.item" + arg2);
4528    var putRibbonAfter = ribbonItem2.prev();
4529    var putBodyAfter = body2.prev();
4530    if (putRibbonAfter.get(0) == ribbonItem1.get(0)) {
4531      putRibbonAfter = ribbonItem2;
4532      putBodyAfter = body2;
4533    }
4534    ribbonItem2.detach().removeClass("show" + arg2).addClass("show" + arg1).insertAfter(ribbonItem1);
4535    ribbonItem1.detach().removeClass("show" + arg1).addClass("show" + arg2).insertAfter(putRibbonAfter);
4536    body2.detach().removeClass("item" + arg2).addClass("item" + arg1).insertAfter(body1);
4537    body1.detach().removeClass("item" + arg1).addClass("item" + arg2).insertAfter(putBodyAfter);
4538  };
4539  this.init = function() {
4540    options.width = $(el).width();
4541    options.padding = $(el).css("padding-left");
4542    if (options && options.Tip) {
4543      evtDesc = "DisplayTip";
4544    }
4545    self.numberBodies();
4546    if (bodies.length > 1) {
4547      self.buildMultiframeHtml();
4548      if (bodies.length == 6) {
4549        onlySixFrames = true;
4550        wrapLength = 6;
4551        bodies.splice(3, 0, $(bodies[3]).clone(true).get(0));
4552      } else {
4553        wrapLength = bodies.length;
4554      }
4555      self.setupRibbonClassesAndHandlers();
4556      self.handleAutoFirstFrame();
4557      if (onlySixFrames) {
4558        ribbon.find(":nth-child(4)").before(ribbon.find(":nth-child(4)").clone(true));
4559      }
4560      if (!WF.Browser.supports.IE7mode) {
4561        $(ribbonItems[0]).attr({
4562          "tabindex": 0,
4563          "aria-expanded": true,
4564          "aria-selected": true
4565        });
4566      }
4567      self.setupBodyClassesAndHandlers();
4568      self.setupBodyLinkTasCalls();
4569      self.buildPaddles();
4570      for (var i = 0; i < 3; i++) {
4571        ribbon.find("li:last").prependTo(ribbon);
4572      }
4573      self.copyFrame(self.getFrameByNumber(1), visibleChevron);
4574      $(el).find(".carouselFrame.item1").show();
4575      incomingFrame.hide();
4576      curFrame = 1;
4577      if ($.fn.touchwipe) {
4578        ribbon.touchwipe({
4579          wipeLeft: function(evt) {
4580            evt.preventDefault();
4581            self.next();
4582          },
4583          wipeRight: function(evt) {
4584            evt.preventDefault();
4585            self.prev();
4586          }
4587        });
4588      }
4589    } else {
4590      $(bodies[0]).show();
4591    }
4592    WF.Utils.trackVS({
4593      "event": "PageLoad",
4594      "eventDescription": evtDesc,
4595      "clist": self.retrieveClist()
4596    });
4597  };
4598  self.init();
4599  if (options && options.Tip) {
4600    WF.Page.Components.Tips.push(this);
4601  }
4602  WF.Page.Components.RibbonCarousels.push(this);
4603  return this;
4604};
4605WF.OnLoads.setupRibbonCarousels = function(root) {
4606  if (typeof root == "undefined") {
4607    root = $("body");
4608  }
4609  $(root).find(".c63").each(function() {
4610    new WF.Component.RibbonCarousel(this);
4611  });
4612};
4613WF.Component.Tabs = function(tabList, tabContent, options) {
4614  if (!(this instanceof WF.Component.Tabs)) {
4615    return new WF.Component.Tabs(tabList, tabContent, options);
4616  }
4617  this.tabs = tabList;
4618  this.content = tabContent;
4619  this.hash = window.location.hash;
4620  this.eventType = "PageLoad";
4621  this.container = $(this.tabs).closest(".c65, .c66filterTabs, .c73filterTabs")[0];
4622  this.clist = WF.Utils.getClist(this.container);
4623  var self = this;
4624  var PREV = 0,
4625    NEXT = 1;
4626  var defaults = {
4627    "history": false,
4628    "tabType": "",
4629    "tracking": true
4630  };
4631  var settings = $.extend(defaults, options);
4632  var firstRun = false;
4633  var deselectTab = function() {
4634    self.tabs.children(".selected").children("a").attr("tabIndex", "-1");
4635    self.tabs.children(".selected").removeClass("selected").children("a").attr("aria-selected", "false");
4636    self.content.children(".selected").removeClass("selected").attr("aria-hidden", "true");
4637  };
4638  var selectTab = function(newTabLI) {
4639    var newTab = $(newTabLI);
4640    var newTabLink = newTabLI.children("a");
4641    newTab.addClass("selected");
4642    newTabLink.attr("aria-selected", "true").attr("tabIndex", "0");
4643    self.content.children("#" + newTabLink.attr("href").split("#")[1]).addClass("selected").attr("aria-hidden", "false");
4644    self.tabs.trigger("tabSelected", newTabLink.attr("id"));
4645    $.each(WF.Page.Components.getByType("BalloonHelp"), function(idx, bh) {
4646      $.each($(bh.elem).parents(".c65, .c73filterTabs"), function(idx, elem) {
4647        if (elem == self.container) {
4648          bh.hide(undefined, 0);
4649        }
4650      });
4651    });
4652  };
4653  var selectFirstTab = function() {
4654    deselectTab();
4655    newTab = self.tabs.children("li:first-child");
4656    selectTab(newTab);
4657  };
4658  var getSelectedTab = function(newHash) {
4659    var newHashIsValid = (typeof newHash !== "undefined");
4660    var theHash;
4661    var hashPanel;
4662    var tabID;
4663    var hashFromURL = false;
4664    if (newHashIsValid) {
4665      theHash = newHash.replace("tab_", "");
4666    } else {
4667      theHash = self.hash.replace("tab_", "");
4668      if (self.hash === window.location.hash && self.hash !== "") {
4669        hashFromURL = true;
4670      }
4671    }
4672    theHash = theHash.toLowerCase();
4673    if (theHash === "" || theHash === "#") {
4674      selectFirstTab();
4675    }
4676    hashPanel = self.content.children(theHash);
4677    if (hashPanel.length === 1 && theHash !== "") {
4678      deselectTab();
4679      tabID = "#tab-" + theHash.split("#")[1];
4680      selectTab(self.tabs.find(tabID).parent());
4681      self.hash = theHash;
4682    }
4683    if (self.content.children(".selected").length === 0) {
4684      selectFirstTab();
4685    }
4686    if ($("html").hasClass("lt-ie9")) {
4687      $("body").addClass("not_a_real_class").removeClass("not_a_real_class");
4688    }
4689    if ((newHash === window.location.hash) || (hashFromURL && firstRun)) {
4690      tabID = "#tab-" + theHash.split("#")[1];
4691      if ($(tabID).length) {
4692        var offset = $(tabID).offset();
4693        var tabsTop = offset.top <= 20 ? 0 : offset.top - 20;
4694        window.scrollTo(0, tabsTop);
4695      }
4696      firstRun = false;
4697    }
4698  };
4699  var updateLocation = function(newHash) {
4700    newHash = newHash.replace("tab_", "");
4701    var fullUrl = window.location.href,
4702      currHash = window.location.hash;
4703    var baseUrl = fullUrl.substr(0, fullUrl.length - currHash.length);
4704    var newUrl = baseUrl + newHash;
4705    if (settings.history) {
4706      window.location = newUrl;
4707    } else {
4708      window.location.replace(newUrl);
4709    }
4710    if (WF.Browser.supports.IE7mode) {
4711      $(window).trigger("hashchange");
4712    }
4713  };
4714  var fireTrackingEvent = function(evt, tabID) {
4715    var clist = self.clist,
4716      options = {
4717        "event": "LinkActivated",
4718        "eventDescription": "Display" + settings.tabType + "Tab",
4719        "tabID": tabID,
4720        "clist": clist
4721      };
4722    if (evt == "PageLoad") {
4723      options.event = evt;
4724    } else {
4725      options.eventType = evt;
4726    }
4727    WF.Utils.trackVS(options);
4728  };
4729  var adjustTabHeights = function() {
4730    var maxHeight = 0;
4731    $(self.tabs).find("li a").each(function() {
4732      var thisHeight = $(this).height();
4733      if (thisHeight > maxHeight) {
4734        maxHeight = thisHeight;
4735      }
4736    });
4737    $(self.tabs).find("li a").each(function() {
4738      $(this).css("height", maxHeight + "px");
4739    });
4740  };
4741  var init = function() {
4742    firstRun = true;
4743    self.tabs.on("tabSelected", function(e, linkID) {
4744      var event = self.eventType,
4745        tabID = $("#" + linkID).attr("id").split("tab-")[1];
4746      fireTrackingEvent(event, tabID);
4747    });
4748    if (!(tabList instanceof jQuery)) {
4749      self.tabs = $(tabList);
4750    }
4751    if (!(tabContent instanceof jQuery)) {
4752      self.content = $(tabContent);
4753    }
4754    self.tabs.addClass("wf-tabs").attr("role", "tablist");
4755    self.tabs.children("li").addClass("wf-tab");
4756    self.content.addClass("wf-tab-content");
4757    self.content.children("div").addClass("wf-panel").attr("role", "tabpanel").attr("aria-hidden", "true");
4758    self.tabs.css("visibility", "visible");
4759    self.content.css("visibility", "visible");
4760    self.tabs.find("li").each(function(index) {
4761      var theTab = $(this);
4762      var theLink = theTab.children("a");
4763      var theHash = "#" + theLink.attr("href").split("#")[1];
4764      var theLinkID = "tab-" + theHash.split("#")[1];
4765      theLink.attr("id", theLinkID).attr("role", "tab").attr("aria-selected", "false").attr("tabIndex", "-1");
4766      $(theHash).attr("rel", theLinkID).attr("aria-labelledby", theLinkID);
4767      theLink.click(function(event) {
4768        event.stopPropagation();
4769        event.preventDefault();
4770        var tabLink = $(this);
4771        var newHash = "#tab_" + tabLink.attr("href").split("#")[1];
4772        self.eventType = "click";
4773        getSelectedTab(newHash);
4774      });
4775    });
4776    getSelectedTab();
4777    if ($(self.container).hasClass("c73filterTabs")) {
4778      adjustTabHeights();
4779    }
4780    $(window).on("hashchange", function() {
4781      getSelectedTab(window.location.hash);
4782    });
4783    self.tabs.keydown(function(event) {
4784      var theKey = event.which;
4785      var currentTabLink = self.tabs.find("li.selected a");
4786      self.eventType = "keypress";
4787      var gotoTabLink = function(direction) {
4788        var newTab = currentTabLink.parent();
4789        if (direction) {
4790          newTab = newTab.next();
4791        } else {
4792          newTab = newTab.prev();
4793        }
4794        return newTab.find("a");
4795      };
4796      var nextTabLink = gotoTabLink(NEXT);
4797      var previousTabLink = gotoTabLink(PREV);
4798      var triggerTabLink = function(tabLink) {
4799        var newHash = "#tab_" + tabLink.attr("href").split("#")[1];
4800        getSelectedTab(newHash);
4801        tabLink.focus();
4802        return false;
4803      };
4804      if (theKey === 39 || theKey === 40) {
4805        triggerTabLink(nextTabLink);
4806        event.preventDefault();
4807      }
4808      if (theKey === 37 || theKey === 38) {
4809        triggerTabLink(previousTabLink);
4810        event.preventDefault();
4811      }
4812    });
4813  };
4814  init();
4815};
4816WF.OnLoads.setupTabs = function(root) {
4817  if (typeof root == "undefined") {
4818    root = $("body");
4819  }
4820  $(root).find(".c65").each(function() {
4821    new WF.Component.Tabs($(this).find(".tabs"), $(this).find(".tabContent"));
4822  });
4823  $(root).find(".c66filterTabs").each(function() {
4824    new WF.Component.Tabs($(this).find(".filterTabs"), $(this).find(".filterTabContent"), {
4825      tabType: "Filter"
4826    });
4827  });
4828  $(root).find(".c73filterTabs").each(function() {
4829    new WF.Component.Tabs($(this).find(".filterTabs"), $(this).find(".filterTabContent"), {
4830      tabType: "Subway"
4831    });
4832  });
4833  if (WF.Browser.supports.IE7mode) {
4834    $("a[href]").each(function() {
4835      if ($(this).parent().hasClass("wf-tab")) {
4836        return true;
4837      }
4838      var href = this.href;
4839      if (href.search(/#$/) != -1) {
4840        return true;
4841      }
4842      if (href.search("#") == -1) {
4843        return true;
4844      }
4845      href = href.substr(href.indexOf("#"));
4846      if (href.search(/tab_/) !== -1) {
4847        var thisPage = window.location.href;
4848        thisPage = thisPage.match(/#/) ? thisPage.split("#")[0] : thisPage;
4849        var linkPage = this.href.split("#")[0];
4850        if (thisPage === linkPage) {
4851          $(this).on("click", function(event) {
4852            event.stopPropagation();
4853            event.preventDefault();
4854            window.location.hash = href;
4855            $(window).trigger("hashchange");
4856          });
4857        }
4858        return true;
4859      }
4860      if (!$(this).parents("ul.tabs").length) {
4861        return true;
4862      }
4863      $(this).click(function(evt) {
4864        evt.preventDefault();
4865        var newHash = evt.target.href.substr(evt.target.href.indexOf("#"));
4866        var fullUrl = window.location.href,
4867          currHash = window.location.hash;
4868        var baseUrl = fullUrl.substr(0, fullUrl.length - currHash.length);
4869        var newUrl = baseUrl + newHash;
4870        window.location.replace(newUrl);
4871        $(window).trigger("hashchange");
4872      });
4873    });
4874  } else {
4875    $("a[href]").each(function() {
4876      if ($(this).parent().hasClass("wf-tab")) {
4877        return true;
4878      }
4879      var href = this.href;
4880      href = href.substr(href.indexOf("#"));
4881      if (href.search(/tab_/) !== -1) {
4882        var thisPage = window.location.href;
4883        thisPage = thisPage.match(/#/) ? thisPage.split("#")[0] : thisPage;
4884        var linkPage = this.href.split("#")[0];
4885        if (thisPage === linkPage) {
4886          $(this).on("click", function(event) {
4887            event.stopPropagation();
4888            event.preventDefault();
4889            window.location.hash = href;
4890            $(window).trigger("hashchange");
4891          });
4892        }
4893        return true;
4894      }
4895    });
4896  }
4897};
4898WF.Component.Overlay = function(trigger, options) {
4899  if (!trigger.id) {
4900    trigger.id = WF.Utils.generateUniqueId(trigger);
4901  }
4902  this.elem = trigger;
4903  this.id = "Overlay_" + trigger.id;
4904  var self = this;
4905  var cache = "",
4906    contentContainer = $("<div/>"),
4907    defaultHeight = 500,
4908    defaultWidth = 722,
4909    destPid = "",
4910    dimensions = {},
4911    dir = "",
4912    fadeTime = 300,
4913    helperDialog = $("<div/>"),
4914    keyMovePixels = 10,
4915    mainContainer = $("#c28overlay"),
4916    margin = 50,
4917    maxHeight = 500,
4918    maxWidth = 722,
4919    showHideSpeed = 600,
4920    stdHeightAjdust = 60,
4921    stdWidthAdjust = 0,
4922    timer, titleBar;
4923  var stdOptions = {
4924    title: "",
4925    inlineId: "",
4926    pleaseWaitDelay: 1500,
4927    timeout: 10000,
4928    onTimeout: false,
4929    postInit: false,
4930    disableCache: false,
4931    stateVariant: false,
4932    "offsetX": 0,
4933    "offsetY": 6,
4934    "paddingTop": 0,
4935    "paddingBottom": 0,
4936    "marginBottom": 10,
4937    showPrintIcon: false,
4938    url: "",
4939    method: "GET",
4940    parameters: {}
4941  };
4942  this.addDialogCloseButton = function() {
4943    helperDialog.append('<div class="closeButton"><a href="#" class="c7 utilitybtn" role="button">' + WF.Strings.Components.LightboxOverlay.closeDialog[WF.Page.lang] + "</a></div>");
4944    helperDialog.find(".c7").click(function(evt) {
4945      evt.preventDefault();
4946      helperDialog.fadeOut(fadeTime, function() {
4947        helperDialog.remove();
4948      });
4949    });
4950  };
4951  this.addOverlayEvents = function() {
4952    mainContainer.find("a.c28close, a.c28cancel").click(function(evt) {
4953      evt.preventDefault();
4954      self.hide();
4955    });
4956    mainContainer.keydown(function(evt) {
4957      if (evt.keyCode == 27) {
4958        self.hide();
4959      }
4960    });
4961    titleBar.keydown(function(evt) {
4962      var mainLeft = parseInt(mainContainer.css("left").replace(/px$/, ""), 10),
4963        mainTop = parseInt(mainContainer.css("top").replace(/px$/, ""), 10);
4964      switch (evt.keyCode) {
4965        case 13:
4966          evt.stopPropagation();
4967          evt.preventDefault();
4968          break;
4969        case 37:
4970          mainContainer.css("left", mainLeft - 10);
4971          evt.stopPropagation();
4972          evt.preventDefault();
4973          break;
4974        case 38:
4975          mainContainer.css("top", mainTop - 10);
4976          evt.stopPropagation();
4977          evt.preventDefault();
4978          break;
4979        case 39:
4980          mainContainer.css("left", mainLeft + 10);
4981          evt.stopPropagation();
4982          evt.preventDefault();
4983          break;
4984        case 40:
4985          mainContainer.css("top", mainTop + 10);
4986          evt.stopPropagation();
4987          evt.preventDefault();
4988          break;
4989        default:
4990          break;
4991      }
4992    }).click(function(evt) {
4993      evt.preventDefault();
4994    });
4995    $(window).resize(function() {
4996      self.setPosition();
4997    });
4998  };
4999  this.createLoadingDialogHtml = function() {
5000    helperDialog.html("").attr("class", "c28loading");
5001    helperDialog.append("<h2>" + WF.Strings.Components.LightboxOverlay.oneMomentPlease[WF.Page.lang] + "</h2>");
5002    var loadingImg = $('<img class="loadImg"/>');
5003    helperDialog.append(loadingImg);
5004    helperDialog.append(WF.Strings.Components.LightboxOverlay.plsWaitGettingInfo[WF.Page.lang]);
5005    $("body").append(helperDialog);
5006    WF.Utils.setImageSrcFromBackground(loadingImg, "21Overlay 115; loadingImg");
5007  };
5008  this.createOverlayHtml = function(content, title, evt) {
5009    mainContainer.unbind().empty();
5010    var closeButton = $("<img/>").attr({
5011      "alt": WF.Strings.Shared.close[WF.Page.lang],
5012      "role": "button"
5013    });
5014    var topContainer = $("<div/>").addClass("c28topContainer").html('<a class="c28close" id="c28bClose" href="#"></a>');
5015    topContainer.find("a").append(closeButton);
5016    topContainer.appendTo(mainContainer);
5017    WF.Utils.setImageSrcFromBackground(closeButton, "21Overlay 126; closeButton");
5018    var topFocus = $("<span/>").attr({
5019      "id": "c28bTopFocus",
5020      "class": "hidden",
5021      "tabindex": 0
5022    });
5023    topFocus.focus(function(evt) {
5024      if (dir == "back") {
5025        $("#c28bLastFocusable").focus();
5026      } else {
5027        $("#c28bClose").focus();
5028      }
5029    }).prependTo(mainContainer);
5030    $("#c28bClose").focus(function() {
5031      dir = "back";
5032    });
5033    contentContainer.addClass("c28contentContainer");
5034    contentContainer.html(content).appendTo(mainContainer);
5035    contentContainer.find("h1").remove();
5036    titleBar = $('<a href="#" class="c28titleBar"><h2>' + title + "</h2></a>");
5037    topContainer.append(titleBar);
5038    if (options.showPrintIcon) {
5039      topContainer.append($('<a href="javascript:window.print();" class="c28print">' + WF.Strings.Shared.print[WF.Page.lang] + "</a>"));
5040    }
5041    var btmFocus = mainContainer.find("a, input, select");
5042    if (btmFocus.length) {
5043      btmFocus = $(btmFocus[btmFocus.length - 1]);
5044    } else {
5045      btmFocus = topContainer.find("a.c28print");
5046    }
5047    btmFocus.attr("id", "c28bLastFocusable");
5048    var bottomFocus = $("<span/>").attr({
5049      "id": "c28bBottomFocus",
5050      "class": "hidden",
5051      "tabindex": 0
5052    });
5053    bottomFocus.focus(function(evt) {
5054      $("#c28bTopFocus").focus();
5055    }).appendTo(mainContainer);
5056    $("#c28bLastFocusable").focus(function() {
5057      dir = "forward";
5058    });
5059    self.setOverlaySizes();
5060    self.addOverlayEvents();
5061    cache = mainContainer.contents().clone(true);
5062    self.show(evt);
5063  };
5064  this.doTimeout = function() {
5065    helperDialog.html("<h2>" + WF.Strings.Components.LightboxOverlay.infoCurrUnavail[WF.Page.lang] + "</h2>").addClass("timeout");
5066    helperDialog.append("<p>" + WF.Strings.Components.LightboxOverlay.apologizeTryAgain[WF.Page.lang] + "</p>");
5067    self.addDialogCloseButton();
5068    helperDialog.fadeIn(fadeTime);
5069  };
5070  this.getContentRegion = function(data) {
5071    data = $.parseHTML(data, document, false); //2025-12; false = don't execute scripts
5072    data = "<div>" + data + "</div>";
5073    var content = options.inlineId === "" ? $(data).find("#content") : $("body").find(options.inlineId);
5074    if (content.length) {
5075      if (content.hasClass(".exitPageContent")) {
5076        options.isExit = true;
5077      }
5078    } else {
5079      content = $(data).find(".exitPageContent");
5080      if (content.length) {
5081        options.isExit = true;
5082      }
5083    }
5084    if (!content.length) {
5085      content = $(data).find(".mainContentCol:first");
5086    }
5087    return content;
5088  };
5089  this.getContentTrackingData = function(data) {
5090    data = "<div>" + data + "</div>";
5091    var pid = $(data).find("#shell").data("pid");
5092    var ptid = $(data).find("#shell").data("ptid");
5093    return pid + "~" + ptid;
5094  };
5095  this.getDimensions = function(html) {
5096    var ret = {
5097      width: 0,
5098      height: 0
5099    };
5100    var match;
5101    html = "<div>" + html + "</div>";
5102    var node = $(html).find("#shell");
5103    if (node.length) {
5104      if (node.data("lightboxWidth") && node.data("lightboxHeight")) {
5105        ret.width = node.data("lightboxWidth");
5106        ret.height = node.data("lightboxHeight");
5107      } else {
5108        match = node.attr("class").match(/\b(\d\d\d?\d?)x(\d\d\d?\d?)\b/);
5109        if (match) {
5110          ret.width = parseInt(match[1], 10);
5111          ret.height = parseInt(match[2], 10);
5112        }
5113      }
5114    }
5115    if (!ret.width) {
5116      $.each(["#content", ".exitPageContent", ".mainContentCol:first"], function(i, css) {
5117        node = $(html).find(css);
5118        if (node.length && node.attr("class")) {
5119          match = node.attr("class").match(/\b(\d\d\d?\d?)x(\d\d\d?\d?)\b/);
5120          if (match) {
5121            ret.width = parseInt(match[1], 10);
5122            ret.height = parseInt(match[2], 10);
5123            return false;
5124          }
5125        }
5126      });
5127    }
5128    if (!ret.width) {
5129      ret = {
5130        width: defaultWidth,
5131        height: defaultHeight
5132      };
5133    }
5134    if (ret.width > maxWidth) {
5135      ret.width = maxWidth;
5136    }
5137    if (ret.height > maxHeight) {
5138      ret.height = maxHeight;
5139    }
5140    return ret;
5141  };
5142  this.getExitPageUrl = function(html) {
5143    html = "<div>" + html + "</div>";
5144    var link = $(html).find(".t7buttons a.c7");
5145    if (link.length) {
5146      return link.attr("href");
5147    }
5148    link = $(html).find('a.c7:contains("' + WF.Strings.Shared["continue"][WF.Page.lang] + '")');
5149    if (link.length) {
5150      return link.attr("href");
5151    }
5152    return "";
5153  };
5154  this.getOptionsFromLink = function() {
5155    if (trigger.href.indexOf("?") != -1 && options.inlineId === "") {
5156      options.url = trigger.href.substr(0, trigger.href.indexOf("?"));
5157      var params = trigger.href.substr(trigger.href.indexOf("?") + 1);
5158      params = params.split(/&(?:amp;)?/);
5159      $.each(params, function(idx, param) {
5160        var p = param.split("=");
5161        options.parameters[p[0]] = p[1];
5162      });
5163      options.method = "GET";
5164    } else {
5165      options.url = trigger.href;
5166    }
5167    if ($(trigger).data("overlayOptions")) {
5168      var dataOpts = $(trigger).data("overlayOptions");
5169      $.extend(true, options, $(trigger).data("overlayOptions"));
5170    }
5171  };
5172  this.setStateVariant = function() {
5173    var zipCode = $("h1:first span#c3location");
5174    if (zipCode.length === 1) {
5175      options.stateVariant = true;
5176    }
5177  };
5178  this.getQuadrant = function(pos, size) {
5179    var scroll = {
5180      "top": $(window).scrollTop(),
5181      "left": $(window).scrollLeft()
5182    };
5183    var bounds = WF.Utils.getViewportSize();
5184    var vert = "b",
5185      horz = "l";
5186    if ((pos.top - scroll.top) < bounds.height / 2) {
5187      vert = "t";
5188    }
5189    if ((pos.left - scroll.left) > bounds.width / 2) {
5190      horz = "r";
5191    }
5192    return vert + horz;
5193  };
5194  this.getTitleText = function(data) {
5195    if (options.title !== "") {
5196      return options.title;
5197    }
5198    data = "<div>" + data + "</div>";
5199    var title = $(data).find("h1");
5200    if (title.length === 1) {
5201      title.find("span").remove();
5202      title.html(title.html().replace(/\s*-\s*$/, ""));
5203      return title.text();
5204    }
5205    title = $(data).find("h2");
5206    if (title.length === 1) {
5207      return title.text();
5208    }
5209    return "";
5210  };
5211  this.handleAjaxResponse = function(data, evt) {
5212    data = $.parseHTML(data, document, false); //2025-12; false = don't execute scripts
5213    var content = self.getContentRegion(data);
5214    destPid = self.getContentTrackingData(data);
5215    var title = self.getTitleText(data);
5216    dimensions = self.getDimensions(data);
5217    if (options.isExit) {
5218      options.exitUrl = self.getExitPageUrl(data);
5219    } else {
5220      if (self.hasContentPrintOption(data)) {
5221        options.showPrintIcon = true;
5222      }
5223    }
5224    self.createOverlayHtml(content, title, evt);
5225  };
5226  this.hasContentPrintOption = function(data) {
5227    data = "<div>" + data + "</div>";
5228    var shell = $(data).find("#shell");
5229    if (shell.data("lightboxPrint")) {
5230      return new Boolean(shell.data("lightboxPrint").toString());
5231    }
5232    return false;
5233  };
5234  this.hide = function() {
5235    $("body").removeClass("overlayOpen");
5236    mainContainer.draggable("destroy");
5237    mainContainer.find(".c28topContainer").find("a.c28close").hide();
5238    mainContainer.attr("aria-hidden", "true").fadeOut(showHideSpeed, function() {
5239      trigger.focus();
5240    });
5241  };
5242  this.init = function(evt) {
5243    if (cache) {
5244      self.show(evt);
5245    } else {
5246      self.requestContent(evt);
5247    }
5248  };
5249  this.positionLoadingDialog = function() {
5250    var screenWidth = $(window).width();
5251    var screenHeight = $(window).height();
5252    var dlgWidth = helperDialog.width();
5253    var dlgHeight = helperDialog.height();
5254    var left = Math.floor((screenWidth / 2) - (dlgWidth / 2));
5255    var top = Math.floor((screenHeight / 2) - (dlgHeight / 2));
5256    helperDialog.css({
5257      "top": top + "px",
5258      "left": left + "px"
5259    });
5260  };
5261  this.requestContent = function(evt) {
5262    self.createLoadingDialogHtml();
5263    timer = setTimeout(function() {
5264      self.positionLoadingDialog();
5265      helperDialog.fadeIn(fadeTime);
5266    }, options.pleaseWaitDelay);
5267    if (options.disableCache || options.stateVariant) {
5268      options.parameters.cb = new Date().valueOf();
5269    }
5270    $.ajax({
5271      url: options.url,
5272      type: options.method,
5273      data: options.parameters,
5274      timeout: options.timeout,
5275      error: function(XMLHttpRequest, textStatus, errorThrown) {
5276        if (textStatus == "timeout") {
5277          self.doTimeout();
5278          if (options.onTimeout) {
5279            options.onTimeout.call(this, XMLHttpRequest, textStatus, errorThrown);
5280          }
5281        } else {
5282          self.showErrorDialog(XMLHttpRequest, textStatus, errorThrown);
5283        }
5284      },
5285      success: function(data) {
5286        clearTimeout(timer);
5287        self.handleAjaxResponse(data, evt);
5288      }
5289    });
5290  };
5291  this.setOverlaySizes = function() {
5292    var heightAdjust = stdHeightAjdust,
5293      widthAdjust = stdWidthAdjust;
5294    var screenWidth = $(window).width();
5295    var screenHeight = $(window).height();
5296    contentContainer.css({
5297      "width": dimensions.width + "px",
5298      "height": dimensions.height + "px"
5299    });
5300    mainContainer.css({
5301      "width": (dimensions.width + widthAdjust) + "px",
5302      "height": (dimensions.height + heightAdjust) + "px"
5303    });
5304  };
5305  this.setPosition = function() {
5306    var trigger_pos = trigger.offset();
5307    var trigger_size = WF.Utils.getDimensions(trigger);
5308    var dir = self.getQuadrant(trigger_pos);
5309    mainContainer.css({
5310      top: "",
5311      left: ""
5312    });
5313    switch (dir) {
5314      case "tl":
5315        mainContainer.css({
5316          "top": (trigger_pos.top + trigger_size.height + options.marginBottom) + "px",
5317          "left": (trigger_pos.left + options.offsetX) + "px"
5318        });
5319        break;
5320      case "tr":
5321        mainContainer.css({
5322          "top": (trigger_pos.top + trigger_size.height + options.marginBottom) + "px",
5323          "right": ($("body").width() - (trigger_pos.left + trigger_size.width) - options.offsetX) + "px"
5324        });
5325        break;
5326      case "bl":
5327        var blTop = trigger_pos.top - mainContainer.height() - options.offsetY - options.paddingBottom - options.paddingTop - options.marginBottom;
5328        if (blTop < 10) {
5329          blTop = 10;
5330        }
5331        mainContainer.css({
5332          "top": blTop + "px",
5333          "left": (trigger_pos.left + options.offsetX) + "px"
5334        });
5335        break;
5336      case "br":
5337        var brTop = trigger_pos.top - mainContainer.height() - options.offsetY - options.paddingBottom - options.paddingTop - options.marginBottom;
5338        if (brTop < 10) {
5339          brTop = 10;
5340        }
5341        mainContainer.css({
5342          "top": brTop + "px",
5343          "right": ($("body").width() - (trigger_pos.left + trigger_size.width) - options.offsetX) + "px"
5344        });
5345        break;
5346    }
5347    mainContainer.removeClass("tl").removeClass("tr").removeClass("bl").removeClass("br").addClass(dir);
5348  };
5349  this.show = function(evt) {
5350    helperDialog.fadeOut(showHideSpeed);
5351    mainContainer.empty();
5352    mainContainer.append(cache.clone(true));
5353    self.setOverlaySizes();
5354    self.setPosition();
5355    $("body").addClass("overlayOpen");
5356    mainContainer.draggable({
5357      handle: ".c28titleBar"
5358    });
5359    mainContainer.fadeIn(showHideSpeed, function() {
5360      $(this).attr({
5361        "aria-labelledby": trigger.attr("id"),
5362        "aria-hidden": "false"
5363      }).find("a.c28close").show().focus();
5364      var h1 = contentContainer.find("h1, h2, h3")[0];
5365    });
5366    WF.OnLoads.doAll(mainContainer);
5367    if (options.disableCache) {
5368      cache = "";
5369    }
5370    WF.Utils.trackVS({
5371      "event": "LinkActivated",
5372      "eventType": evt.type,
5373      "eventDescription": "overlayOpen",
5374      "linkText": trigger.text(),
5375      "destinationUrl": trigger.get(0).href,
5376      "destinationPid": destPid,
5377      "clist": clist
5378    });
5379  };
5380  this.showErrorDialog = function(XMLHttpRequest, textStatus, errorThrown) {
5381    helperDialog.html("<h2>" + WF.Strings.Components.LightboxOverlay.errorEncountered[WF.Page.lang] + "</h2>").attr("class", "c28error");
5382    helperDialog.append("<div>" + XMLHttpRequest.status + "</div>");
5383    helperDialog.append("<div>" + errorThrown + "</div>");
5384    self.addDialogCloseButton();
5385    $("body").append(helperDialog);
5386    self.positionLoadingDialog();
5387    helperDialog.fadeIn(fadeTime);
5388  };
5389  if (!options) {
5390    options = {
5391      parameters: {}
5392    };
5393  }
5394  if (trigger.href != "") {
5395    self.getOptionsFromLink();
5396    self.setStateVariant();
5397  }
5398  for (var o in stdOptions) {
5399    if (typeof options[o] == "undefined") {
5400      options[o] = stdOptions[o];
5401    }
5402  }
5403  var clist = WF.Utils.getClist(trigger);
5404  trigger = $(trigger);
5405  trigger.attr("aria-haspopup", "true").bind("click keypress", function(evt) {
5406    if (evt.type == "keypress" && evt.keyCode != 13) {
5407      return;
5408    }
5409    evt.preventDefault();
5410    self.init(evt);
5411  });
5412  WF.Page.Components.Overlays.push(this);
5413  return this;
5414};
5415WF.OnLoads.setupOverlays = function(root) {
5416  if (typeof root == "undefined") {
5417    root = $("body");
5418  }
5419  if (!$("#c28overlay").length) {
5420    $('<div id="c28overlay" class="c28mainContainer" role="region" aria-hidden="true" />').appendTo($("body"));
5421  }
5422  $(root).find(".c28bLink").each(function() {
5423    new WF.Component.Overlay(this);
5424  });
5425};
5426$(document).ready(function() {
5427  $("body").on("click", "#zipStateForm #zipCode", function() {
5428    $(this).val("");
5429  });
5430  $("body").on("submit", "#zipStateForm", function(evt) {
5431    evt.preventDefault();
5432    clearErrorMarkers();
5433    var formData = $("#zipCode, #zipStateCode").serialize();
5434    var lang = WF.Utils.getLanguage();
5435    var zipCodeVal = $("#zipCode").val();
5436    var zipCodePlaceHolder = $("#zipCode").attr("placeHolder");
5437    if (zipCodeVal === zipCodePlaceHolder) {
5438      zipCodeVal = "";
5439    }
5440    var url = "/as/zipandstate/" + zipCodeVal + "?lang=" + lang;
5441    $("#zipStateForm p.busy").removeClass("invisible");
5442    $.ajax({
5443      "type": "GET",
5444      "url": url,
5445      "dataType": "text",
5446      "success": function(data) {
5447        $("#zipStateForm p.busy").addClass("invisible");
5448        try {
5449          data = untaintAndParse(data);
5450          if (data.errorMessage) {
5451            showMessageBox("error", data.errorMessage);
5452            $("#zipStateForm").addClass("hasError");
5453            return;
5454          } else {
5455            if (data.warningMessage) {
5456              showMessageBox("warning", data.warningMessage);
5457            } else {
5458              window.location.reload(true);
5459            }
5460          }
5461        } catch (err) {
5462          WF.Utils.ajaxLog(err);
5463        }
5464      },
5465      "timeout": 10000,
5466      onTimeout: function() {
5467        showMessageBox("error", "This information is currently unavailable. Please try again later.");
5468      },
5469      "error": function() {
5470        WF.Utils.ajaxLog({
5471          "message": "AJAX request failed."
5472        });
5473      }
5474    });
5475
5476    function populateStates(obj, target_id) {
5477      $("#stateSelect").addClass("showLine");
5478      $("#stateSelect").removeClass("hideLine");
5479      var dropdown = $("#" + target_id);
5480      for (var i = 0; i < obj.length; i++) {
5481        dropdown.append('<option value="' + obj[i].shortName + '">' + obj[i].longName + "</option>");
5482      }
5483    }
5484
5485    function clearErrorMarkers() {
5486      $("#zipStateForm").removeClass("hasError");
5487      if ($("#messageBox").hasClass("error")) {
5488        $("#messageBox").empty();
5489        $("#messageBox").removeClass("error");
5490        $("#messageBox").addClass("hidden");
5491      }
5492    }
5493
5494    function showMessageBox(mbType, mbMessage) {
5495      var mbox = $("#messageBox");
5496      var mbState = mbox.data("type");
5497      var theLightbox = $("#c28lightbox");
5498      if (typeof mbState !== "undefined" && mbState !== "") {
5499        clearMessageBox();
5500      }
5501      mbox.addClass(mbType);
5502      mbox.data("type", mbType);
5503      mbox.html(mbMessage);
5504      mbox.removeClass("hidden");
5505      if ($("#c28lightbox").find("form[name='zipStateForm']").length > 0) {
5506        theLightbox.css("height", "225px");
5507        theLightbox.find(".c28contentContainer").css("height", "225px");
5508      } else {
5509        theLightbox.css("height", "530px");
5510        theLightbox.find(".c28contentContainer").css("height", "480px");
5511      }
5512    }
5513
5514    function clearMessageBox() {
5515      var mbox = $("#messageBox");
5516      var theLightbox = $("#c28lightbox");
5517      mbox.addClass("hidden");
5518      mbox.removeClass("busy info warning error");
5519      mbox.html("");
5520      theLightbox.css("height", "480px");
5521      theLightbox.find(".c28contentContainer").css("height", "420px");
5522    }
5523
5524    function untaintAndParse(str) {
5525      if (str.substr(0, 100).search(/for *\(;;/) == -1) {
5526        WF.Utils.ajaxLog({
5527          "message": "Expected JSON result but got: " + str.substr(0, 100) + "..."
5528        });
5529        return str;
5530      }
5531      try {
5532        str = str.replace(/^\s*for *\(;;\) *;?\s*/, "");
5533        str = str.replace(/^\s*\/\*\s*\w+%\s+\{/, "{").replace(/\}\s+%\w+\s*\*\/\s*$/, "}");
5534        return jQuery.parseJSON(str);
5535      } catch (err) {
5536        WF.Utils.ajaxLog(err);
5537      }
5538    }
5539    $("#lbcontent a.closeLink").click(function(evt) {
5540      clearErrorMarkers();
5541    });
5542  });
5543  if ($(".zipCodeDialog").length > 0) {
5544    $("#zipCodeSelector").find(".c28aLink").each(function() {
5545      var s = new WF.Component.LightBox(this);
5546      s.init();
5547    });
5548  }
5549});
5550window.suggestmeyes_loaded = true;
5551
5552function GSA_getSearchRootPathPrefix() {
5553  return "/search";
5554}
5555
5556function GSA_getResourceRootPathPrefix() {
5557  return "";
5558}
5559
5560function GSA_isEmbeddedMode() {
5561  return false;
5562}
5563var ss_form_element = "frmSearch";
5564var ss_popup_element = "search_suggest";
5565var ss_seq = ["g"];
5566var ss_g_one_name_to_display = "Suggestion";
5567var ss_g_more_names_to_display = "";
5568var ss_g_max_to_display = 5;
5569var ss_max_to_display = 5;
5570var ss_wait_millisec = 300;
5571var ss_delay_millisec = 30;
5572var ss_gsa_host = null;
5573var SS_OUTPUT_FORMAT_LEGACY = "legacy";
5574var SS_OUTPUT_FORMAT_OPEN_SEARCH = "os";
5575var SS_OUTPUT_FORMAT_RICH = "rich";
5576var ss_protocol = SS_OUTPUT_FORMAT_RICH;
5577var ss_allow_non_query = true;
5578var ss_non_query_empty_title = "No Title";
5579var ss_allow_debug = false;
5580var ss_form_element = "frmSearch";
5581var ss_popup_element = "search_suggest";
5582var ss_seq = ["g"];
5583var ss_g_one_name_to_display = "Suggestion";
5584var ss_g_more_names_to_display = "";
5585var ss_g_max_to_display = 5;
5586var ss_r_max_to_display = 5;
5587var ss_max_to_display = 5;
5588var ss_wait_millisec = 300;
5589var ss_delay_millisec = 30;
5590var ss_gsa_host = null;
5591var SS_OUTPUT_FORMAT_LEGACY = "legacy";
5592var SS_OUTPUT_FORMAT_OPEN_SEARCH = "os";
5593var SS_OUTPUT_FORMAT_RICH = "rich";
5594var ss_protocol = SS_OUTPUT_FORMAT_RICH;
5595var ss_allow_non_query = true;
5596var ss_non_query_empty_title = "No Title";
5597var ss_allow_debug = false;
5598
5599function BR_AgentContains_(str) {
5600  if (str in BR_AgentContains_cache_) {
5601    return BR_AgentContains_cache_[str];
5602  }
5603  return BR_AgentContains_cache_[str] = (navigator.userAgent.toLowerCase().indexOf(str) != -1);
5604}
5605var BR_AgentContains_cache_ = {};
5606
5607function BR_IsIE() {
5608  return BR_AgentContains_("msie") && !window.opera;
5609}
5610
5611function BR_IsKonqueror() {
5612  return BR_AgentContains_("konqueror");
5613}
5614
5615function BR_IsSafari() {
5616  return BR_AgentContains_("safari") || BR_IsKonqueror();
5617}
5618
5619function BR_IsNav() {
5620  return !BR_IsIE() && !BR_IsSafari() && BR_AgentContains_("mozilla");
5621}
5622
5623function BR_IsWin() {
5624  return BR_AgentContains_("win");
5625}
5626
5627function BR_IsMac() {
5628  return BR_AgentContains_("macintosh") || BR_AgentContains_("mac_powerpc");
5629}
5630
5631function BR_IsLinux() {
5632  return BR_AgentContains_("linux");
5633}
5634var BACKSPACE_KEYCODE = 8;
5635var COMMA_KEYCODE = 188;
5636var DEBUG_KEYCODE = 68;
5637var DELETE_KEYCODE = 46;
5638var DOWN_KEYCODE = 40;
5639var ENTER_KEYCODE = 13;
5640var ESC_KEYCODE = 27;
5641var LEFT_KEYCODE = 37;
5642var RIGHT_KEYCODE = 39;
5643var SPACE_KEYCODE = 32;
5644var TAB_KEYCODE = 9;
5645var UP_KEYCODE = 38;
5646var SHIFT_KEYCODE = 16;
5647var PAGE_DOWN_KEYCODE = 34;
5648var PAGE_UP_KEYCODE = 33;
5649
5650function GetSemicolonKeyCode() {
5651  return BR_IsIE() ? 186 : 59;
5652}
5653var MAX_EMAIL_ADDRESS_LENGTH = 320;
5654var MAX_SIGNATURE_LENGTH = 1000;
5655
5656function raise(msg) {
5657  if (typeof Error != "undefined") {
5658    throw new Error(msg || "Assertion Failed");
5659  } else {
5660    throw (msg);
5661  }
5662}
5663
5664function Fail(opt_msg) {
5665  opt_msg = opt_msg || "Assertion failed";
5666  if (IsDefined(DumpError)) {
5667    DumpError(opt_msg + "\n");
5668  }
5669  raise(opt_msg);
5670}
5671
5672function AssertTrue(expression, opt_msg) {
5673  if (!expression) {
5674    opt_msg = opt_msg || "Assertion failed";
5675    Fail(opt_msg);
5676  }
5677}
5678
5679function AssertEquals(val1, val2, opt_msg) {
5680  if (val1 != val2) {
5681    opt_msg = opt_msg || "AssertEquals failed: <" + val1 + "> != <" + val2 + ">";
5682    Fail(opt_msg);
5683  }
5684}
5685
5686function AssertType(value, type, opt_msg) {
5687  if (typeof value == type) {
5688    return;
5689  }
5690  if (value || value == "") {
5691    try {
5692      if (type == AssertTypeMap[typeof value] || value instanceof type) {
5693        return;
5694      }
5695    } catch (e) {}
5696  }
5697  var makeMsg = opt_msg === undefined;
5698  if (makeMsg) {
5699    if (typeof type == "function") {
5700      var match = type.toString().match(/^\s*function\s+([^\s\{]+)/);
5701      if (match) {
5702        type = match[1];
5703      }
5704    }
5705    opt_msg = "AssertType failed: <" + value + "> not typeof " + type;
5706  }
5707  Fail(opt_msg);
5708}
5709var AssertTypeMap = {
5710  "string": String,
5711  "number": Number,
5712  "boolean": Boolean
5713};
5714
5715function AssertNumArgs(num, opt_msg) {
5716  var caller = AssertNumArgs.caller;
5717  if (caller && caller.arguments.length != num) {
5718    opt_msg = opt_msg || caller.name + " expected " + num + " arguments " + " but received " + caller.arguments.length;
5719    Fail(opt_msg);
5720  }
5721}
5722var ILLEGAL_COOKIE_CHARS_RE = /[\s;]/;
5723
5724function SetCookie(name, value, opt_max_age, opt_path, opt_domain) {
5725  value = "" + value;
5726  AssertTrue((typeof name == "string" && typeof value == "string" && !name.match(ILLEGAL_COOKIE_CHARS_RE) && !value.match(ILLEGAL_COOKIE_CHARS_RE)), "trying to set an invalid cookie");
5727  if (!IsDefined(opt_max_age)) {
5728    opt_max_age = -1;
5729  }
5730  if (!IsDefined(opt_path)) {
5731    opt_path = "/";
5732  }
5733  if (!IsDefined(opt_domain)) {
5734    opt_domain = null;
5735  }
5736  var domain_str = (opt_domain == null) ? "" : ";domain=" + opt_domain;
5737  var path_str = (opt_path == null) ? "" : ";path=" + opt_path;
5738  var expires_str;
5739  if (opt_max_age < 0) {
5740    expires_str = "";
5741  } else {
5742    if (opt_max_age == 0) {
5743      var pastDate = new Date(1970, 1, 1);
5744      expires_str = ";expires=" + pastDate.toUTCString();
5745    } else {
5746      var futureDate = new Date(Now() + opt_max_age * 1000);
5747      expires_str = ";expires=" + futureDate.toUTCString();
5748    }
5749  }
5750  document.cookie = name + "=" + value + domain_str + path_str + expires_str;
5751}
5752var EXPIRED_COOKIE_VALUE = "EXPIRED";
5753
5754function ExpireCookie(name, opt_path, opt_domain) {
5755  SetCookie(name, EXPIRED_COOKIE_VALUE, 0, opt_path, opt_domain);
5756}
5757
5758function GetCookie(name) {
5759  var nameeq = name + "=";
5760  var cookie = String(document.cookie);
5761  for (var pos = -1;
5762    (pos = cookie.indexOf(nameeq, pos + 1)) >= 0;) {
5763    var i = pos;
5764    while (--i >= 0) {
5765      var ch = cookie.charAt(i);
5766      if (ch == ";") {
5767        i = -1;
5768        break;
5769      } else {
5770        if (" \t".indexOf(ch) < 0) {
5771          break;
5772        }
5773      }
5774    }
5775    if (-1 === i) {
5776      var end = cookie.indexOf(";", pos);
5777      if (end < 0) {
5778        end = cookie.length;
5779      }
5780      return cookie.substring(pos + nameeq.length, end);
5781    }
5782  }
5783  return "";
5784}
5785
5786function Now() {
5787  return (new Date()).getTime();
5788}
5789
5790function MaybeGetElement(win, id) {
5791  return win.document.getElementById(id);
5792}
5793
5794function GetElement(win, id) {
5795  var el = win.document.getElementById(id);
5796  if (!el) {
5797    DumpError("Element " + id + " not found.");
5798  }
5799  return el;
5800}
5801
5802function GetElements(win, id) {
5803  return win.document.getElementsByName(id);
5804}
5805
5806function GetParentNode(n) {
5807  try {
5808    return n.parentNode;
5809  } catch (e) {
5810    return n;
5811  }
5812}
5813
5814function IsDescendant(parent, child) {
5815  do {
5816    if (parent === child) {
5817      return true;
5818    }
5819    child = GetParentNode(child);
5820  } while (child && child !== document.body);
5821  return false;
5822}
5823
5824function GetAttribute(node, attribute) {
5825  if (!node.getAttribute) {
5826    return null;
5827  }
5828  var attr = node.getAttribute(attribute);
5829  if (BR_IsIE() && attribute == "style") {
5830    return attr.value;
5831  } else {
5832    return attr;
5833  }
5834}
5835
5836function SetInnerHTML(win, id, html) {
5837  try {
5838    GetElement(win, id).innerHTML = html;
5839  } catch (ex) {
5840    DumpException(ex);
5841  }
5842}
5843
5844function GetInnerHTML(win, id) {
5845  try {
5846    return GetElement(win, id).innerHTML;
5847  } catch (ex) {
5848    DumpException(ex);
5849    return "";
5850  }
5851}
5852
5853function ClearInnerHTML(win, id) {
5854  try {
5855    GetElement(win, id).innerHTML = "";
5856  } catch (ex) {
5857    DumpException(ex);
5858  }
5859}
5860
5861function SetCssStyle(win, id, name, value) {
5862  try {
5863    var elem = GetElement(win, id);
5864    elem.style[name] = value;
5865  } catch (ex) {
5866    DumpException(ex);
5867  }
5868}
5869
5870function GetStyleProperty(style, name) {
5871  var i = style.indexOf(name);
5872  if (i != -1) {
5873    var j = style.indexOf(";", i);
5874    if (j == -1) {
5875      j = style.length;
5876    }
5877    return CollapseWhitespace(style.substring(i + name.length + 1, j));
5878  }
5879  return null;
5880}
5881
5882function GetCellIndex(cell) {
5883  if (cell.cellIndex) {
5884    return cell.cellIndex;
5885  } else {
5886    if (cell.parentNode) {
5887      return FindInArray(cell.parentNode.cells, cell);
5888    } else {
5889      return null;
5890    }
5891  }
5892}
5893
5894function ShowElement(el, show) {
5895  el.style.display = show ? "" : "none";
5896}
5897
5898function ShowBlockElement(el, show) {
5899  el.style.display = show ? "block" : "none";
5900}
5901
5902function ShowInlineElement(el, show) {
5903  el.style.display = show ? "inline" : "none";
5904}
5905
5906function SetButtonText(button, text) {
5907  button.childNodes[0].nodeValue = text;
5908}
5909
5910function AppendNewElement(win, parent, tag) {
5911  var e = win.document.createElement(tag);
5912  parent.appendChild(e);
5913  return e;
5914}
5915
5916function FindChildWithID(parent, id) {
5917  var el;
5918  for (el = parent.firstChild; el && el.id != id; el = el.nextSibling) {}
5919  return el;
5920}
5921
5922function AddMenuDisabledOption(win, menu, html) {
5923  var op = AppendNewElement(win, menu, "OPTION");
5924  op.disabled = true;
5925  op.innerHTML = html;
5926  return op;
5927}
5928
5929function AddMenuOption(win, menu, value, html) {
5930  var op = AppendNewElement(win, menu, "OPTION");
5931  op.value = value;
5932  op.innerHTML = html;
5933  return op;
5934}
5935
5936function CreateDIV(win, id) {
5937  var div = MaybeGetElement(win, id);
5938  if (!div) {
5939    div = AppendNewElement(win, win.document.body, "div");
5940    div.id = id;
5941  }
5942  return div;
5943}
5944
5945function CreateIFRAME(win, id, url) {
5946  var iframe = MaybeGetElement(win, id);
5947  if (!iframe) {
5948    var div = AppendNewElement(win, win.document.body, "div");
5949    div.innerHTML = "<iframe id=" + id + " name=" + id + " src=" + url + "></iframe>";
5950    iframe = GetElement(win, id);
5951  }
5952  return iframe;
5953}
5954
5955function Tr(win, tds) {
5956  var tr = win.document.createElement("TR");
5957  for (var i = 0; i < tds.length; i++) {
5958    tr.appendChild(tds[i]);
5959  }
5960  return tr;
5961}
5962
5963function Td(win, opt_colspan) {
5964  var td = win.document.createElement("TD");
5965  if (opt_colspan) {
5966    td.colSpan = opt_colspan;
5967  }
5968  return td;
5969}
5970
5971function HasClass(el, cl) {
5972  if (el == null || el.className == null) {
5973    return false;
5974  }
5975  if (el.className == cl) {
5976    return true;
5977  }
5978  var classes = el.className.split(" ");
5979  for (var i = 0; i < classes.length; i++) {
5980    if (classes[i] == cl) {
5981      return true;
5982    }
5983  }
5984  return false;
5985}
5986
5987function AddClass(el, cl) {
5988  if (HasClass(el, cl)) {
5989    return;
5990  }
5991  el.className += " " + cl;
5992}
5993
5994function RemoveClass(el, cl) {
5995  if (el.className == null) {
5996    return;
5997  }
5998  if (el.className == cl) {
5999    el.className = "";
6000    return;
6001  }
6002  var classes = el.className.split(" ");
6003  var result = [];
6004  var changed = false;
6005  for (var i = 0; i < classes.length; i++) {
6006    if (classes[i] != cl) {
6007      if (classes[i]) {
6008        result.push(classes[i]);
6009      }
6010    } else {
6011      changed = true;
6012    }
6013  }
6014  if (changed) {
6015    el.className = result.join(" ");
6016  }
6017}
6018
6019function GetElementsBySelector(root, selector) {
6020  var nodes = [];
6021  for (var child = root.firstChild; child; child = child.nextSibling) {
6022    AddElementBySelector_(child, selector, nodes);
6023  }
6024  return nodes;
6025}
6026
6027function AddElementBySelector_(root, selector, nodes) {
6028  if (selector.select(root)) {
6029    nodes.push(root);
6030  }
6031  for (var child = root.firstChild; child; child = child.nextSibling) {
6032    AddElementBySelector_(child, selector, nodes);
6033  }
6034}
6035
6036function GetPageOffsetLeft(el) {
6037  var x = el.offsetLeft;
6038  if (el.offsetParent != null) {
6039    x += GetPageOffsetLeft(el.offsetParent);
6040  }
6041  return x;
6042}
6043
6044function GetPageOffsetTop(el) {
6045  var y = el.offsetTop;
6046  if (el.offsetParent != null) {
6047    y += GetPageOffsetTop(el.offsetParent);
6048  }
6049  return y;
6050}
6051
6052function GetPageOffset(el) {
6053  var x = el.offsetLeft;
6054  var y = el.offsetTop;
6055  if (el.offsetParent != null) {
6056    var pos = GetPageOffset(el.offsetParent);
6057    x += pos.x;
6058    y += pos.y;
6059  }
6060  return {
6061    x: x,
6062    y: y
6063  };
6064}
6065
6066function GetPageOffsetRight(el) {
6067  return GetPageOffsetLeft(el) + el.offsetWidth;
6068}
6069
6070function GetPageOffsetBottom(el) {
6071  return GetPageOffsetTop(el) + el.offsetHeight;
6072}
6073
6074function GetScrollTop(win) {
6075  return GetWindowPropertyByBrowser_(win, getScrollTopGetters_);
6076}
6077var getScrollTopGetters_ = {
6078  ieQuirks_: function(win) {
6079    return win.document.body.scrollTop;
6080  },
6081  ieStandards_: function(win) {
6082    return win.document.documentElement.scrollTop;
6083  },
6084  dom_: function(win) {
6085    return win.pageYOffset;
6086  }
6087};
6088
6089function GetScrollLeft(win) {
6090  return GetWindowPropertyByBrowser_(win, getScrollLeftGetters_);
6091}
6092var getScrollLeftGetters_ = {
6093  ieQuirks_: function(win) {
6094    return win.document.body.scrollLeft;
6095  },
6096  ieStandards_: function(win) {
6097    return win.document.documentElement.scrollLeft;
6098  },
6099  dom_: function(win) {
6100    return win.pageXOffset;
6101  }
6102};
6103
6104function IsScrollAtEnd(win, opt_isHoriz) {
6105  var total = (opt_isHoriz) ? document.body.offsetWidth : document.body.offsetHeight;
6106  var inner = (opt_isHoriz) ? GetWindowWidth(win) : GetWindowHeight(win);
6107  var offset = (opt_isHoriz) ? GetScrollLeft(win) : GetScrollTop(win);
6108  return (inner + offset >= total || total < inner);
6109}
6110
6111function ScrollTo(win, el, position) {
6112  var y = GetPageOffsetTop(el);
6113  y -= GetWindowHeight(win) * position;
6114  win.scrollTo(0, y);
6115}
6116var ALIGN_BOTTOM = "b";
6117var ALIGN_MIDDLE = "m";
6118var ALIGN_TOP = "t";
6119
6120function ScrollIntoView(win, el, alignment) {
6121  var el_top = GetPageOffsetTop(el);
6122  var el_bottom = el_top + el.offsetHeight;
6123  var win_top = GetScrollTop(win);
6124  var win_height = GetWindowHeight(win);
6125  var win_bottom = win_top + win_height;
6126  if (el_top < win_top || el_bottom > win_bottom) {
6127    var scrollto_y;
6128    if (alignment == ALIGN_BOTTOM) {
6129      scrollto_y = el_bottom - win_height + 5;
6130    } else {
6131      if (alignment == ALIGN_MIDDLE) {
6132        scrollto_y = (el_top + el_bottom) / 2 - win_height / 2;
6133      } else {
6134        scrollto_y = el_top - 5;
6135      }
6136    }
6137    win.scrollTo(0, scrollto_y);
6138  }
6139}
6140
6141function IsElementVisible(win, id) {
6142  var el = MaybeGetElement(win, id);
6143  if (el == null) {
6144    return false;
6145  }
6146  var el_top = GetPageOffsetTop(el);
6147  var el_bottom = el_top + el.offsetHeight;
6148  var win_top = GetScrollTop(win);
6149  var win_bottom = win_top + GetWindowHeight(win);
6150  if (el_top >= win_top && el_bottom <= win_bottom) {
6151    return true;
6152  }
6153  return false;
6154}
6155
6156function GetWindowWidth(win) {
6157  return GetWindowPropertyByBrowser_(win, getWindowWidthGetters_);
6158}
6159var getWindowWidthGetters_ = {
6160  ieQuirks_: function(win) {
6161    return win.document.body.clientWidth;
6162  },
6163  ieStandards_: function(win) {
6164    return win.document.documentElement.clientWidth;
6165  },
6166  dom_: function(win) {
6167    return win.innerWidth;
6168  }
6169};
6170
6171function GetWindowHeight(win) {
6172  return GetWindowPropertyByBrowser_(win, getWindowHeightGetters_);
6173}
6174var getWindowHeightGetters_ = {
6175  ieQuirks_: function(win) {
6176    return win.document.body.clientHeight;
6177  },
6178  ieStandards_: function(win) {
6179    return win.document.documentElement.clientHeight;
6180  },
6181  dom_: function(win) {
6182    return win.innerHeight;
6183  }
6184};
6185
6186function GetWindowPropertyByBrowser_(win, getters) {
6187  try {
6188    if (BR_IsSafari()) {
6189      return getters.dom_(win);
6190    } else {
6191      if (!window.opera && "compatMode" in win.document && win.document.compatMode == "CSS1Compat") {
6192        return getters.ieStandards_(win);
6193      } else {
6194        if (BR_IsIE()) {
6195          return getters.ieQuirks_(win);
6196        }
6197      }
6198    }
6199  } catch (e) {}
6200  return getters.dom_(win);
6201}
6202
6203function GetAvailScreenWidth(win) {
6204  return win.screen.availWidth;
6205}
6206
6207function GetAvailScreenHeight(win) {
6208  return win.screen.availHeight;
6209}
6210
6211function GetNiceWindowHeight(win) {
6212  return Math.floor(0.8 * GetAvailScreenHeight(win));
6213}
6214
6215function GetCenteringLeft(win, width) {
6216  return (win.screen.availWidth - width) >> 1;
6217}
6218
6219function GetCenteringTop(win, height) {
6220  return (win.screen.availHeight - height) >> 1;
6221}
6222
6223function Popup(url, opt_name, opt_width, opt_height, opt_center, opt_hide_scrollbars, opt_noresize, opt_blocked_msg) {
6224  if (!opt_height) {
6225    opt_height = Math.floor(GetWindowHeight(window.top) * 0.8);
6226  }
6227  if (!opt_width) {
6228    opt_width = Math.min(GetAvailScreenWidth(window), opt_height);
6229  }
6230  var features = "resizable=" + (opt_noresize ? "no" : "yes") + "," + "scrollbars=" + (opt_hide_scrollbars ? "no" : "yes") + "," + "width=" + opt_width + ",height=" + opt_height;
6231  if (opt_center) {
6232    features += ",left=" + GetCenteringLeft(window, opt_width) + "," + "top=" + GetCenteringTop(window, opt_height);
6233  }
6234  return OpenWindow(window, url, opt_name, features, opt_blocked_msg);
6235}
6236
6237function OpenWindow(win, url, opt_name, opt_features, opt_blocked_msg) {
6238  var newwin = OpenWindowHelper(top, url, opt_name, opt_features);
6239  if (!newwin || newwin.closed || !newwin.focus) {
6240    newwin = OpenWindowHelper(win, url, opt_name, opt_features);
6241  }
6242  if (!newwin || newwin.closed || !newwin.focus) {
6243    if (opt_blocked_msg) {
6244      alert(opt_blocked_msg);
6245    }
6246  } else {
6247    newwin.focus();
6248  }
6249  return newwin;
6250}
6251
6252function OpenWindowHelper(win, url, name, features) {
6253  var newwin;
6254  if (features) {
6255    newwin = win.open(url, name, features);
6256  } else {
6257    if (name) {
6258      newwin = win.open(url, name);
6259    } else {
6260      newwin = win.open(url);
6261    }
6262  }
6263  return newwin;
6264}
6265
6266function MaybeEscape(str, escape) {
6267  return escape ? HtmlEscape(str) : str;
6268}
6269var windata = [];
6270
6271function GetWindowData(win) {
6272  var data = windata[win.name];
6273  if (!data) {
6274    windata[win.name] = data = [];
6275  }
6276  return data;
6277}
6278
6279function ClearWindowData(win_name) {
6280  if (windata[win_name]) {
6281    windata[win_name] = null;
6282  }
6283}
6284var amp_re_ = /&/g;
6285var lt_re_ = /</g;
6286var gt_re_ = />/g;
6287
6288function HtmlEscape(str) {
6289  if (!str) {
6290    return "";
6291  }
6292  return str.replace(amp_re_, "&amp;").replace(lt_re_, "&lt;").replace(gt_re_, "&gt;").replace(quote_re_, "&quot;");
6293}
6294
6295function HtmlUnescape(str) {
6296  if (!str) {
6297    return "";
6298  }
6299  return str.replace(/&#(\d+);/g, function(_, n) {
6300    return String.fromCharCode(parseInt(n, 10));
6301  }).replace(/&#x([a-f0-9]+);/gi, function(_, n) {
6302    return String.fromCharCode(parseInt(n, 16));
6303  }).replace(/&(\w+);/g, function(_, entity) {
6304    entity = entity.toLowerCase();
6305    return entity in HtmlUnescape_unesc_ ? HtmlUnescape_unesc_[entity] : "?";
6306  });
6307}
6308var HtmlUnescape_unesc_ = {
6309  lt: "<",
6310  gt: ">",
6311  quot: '"',
6312  nbsp: " ",
6313  amp: "&",
6314  apos: "'"
6315};
6316var dbsp_re_ = /  /g;
6317var ret_re_ = /\r/g;
6318var nl_re_ = /\n/g;
6319
6320function HtmlWhitespaceEscape(str) {
6321  str = HtmlEscape(str);
6322  str = str.replace(dbsp_re_, "&nbsp;&nbsp;");
6323  str = str.replace(ret_re_, "");
6324  str = str.replace(nl_re_, "<br>");
6325  return str;
6326}
6327var quote_re_ = /\"/g;
6328
6329function QuoteEscape(str) {
6330  return HtmlEscape(str).replace(quote_re_, "&quot;");
6331}
6332var JS_SPECIAL_RE_ = /[\'\\\r\n\b\"<>&\u0085\u2028\u2029]/g;
6333
6334function JSEscOne_(s) {
6335  return JSEscOne_.js_escs_[s];
6336}
6337
6338function ToJSString(s) {
6339  if (!JSEscOne_.js_escs_) {
6340    var escapes = {};
6341    escapes["\\"] = "\\\\";
6342    escapes["'"] = "\\047";
6343    escapes["\b"] = "\\b";
6344    escapes['"'] = "\\042";
6345    escapes["<"] = "\\074";
6346    escapes[">"] = "\\076";
6347    escapes["&"] = "\\046";
6348    escapes["\n"] = "\\n";
6349    escapes["\r"] = "\\r";
6350    escapes["\u0085"] = "\\205";
6351    escapes["\u2028"] = "\\u2028";
6352    escapes["\u2029"] = "\\u2029";
6353    JSEscOne_.js_escs_ = escapes;
6354  }
6355  return "'" + s.toString().replace(JS_SPECIAL_RE_, JSEscOne_) + "'";
6356}
6357var spc_re_ = /\s+/g;
6358var beg_spc_re_ = /^ /;
6359var end_spc_re_ = / $/;
6360
6361function CollapseWhitespace(str) {
6362  if (!str) {
6363    return "";
6364  }
6365  return str.replace(spc_re_, " ").replace(beg_spc_re_, "").replace(end_spc_re_, "");
6366}
6367var newline_re_ = /\r?\n/g;
6368var spctab_re_ = /[ \t]+/g;
6369var nbsp_re_ = /\xa0/g;
6370
6371function StripNewlines(str) {
6372  if (!str) {
6373    return "";
6374  }
6375  return str.replace(newline_re_, " ");
6376}
6377
6378function CanonicalizeNewlines(str) {
6379  if (!str) {
6380    return "";
6381  }
6382  return str.replace(newline_re_, "\n");
6383}
6384
6385function HtmlifyNewlines(str) {
6386  if (!str) {
6387    return "";
6388  }
6389  return str.replace(newline_re_, "<br>");
6390}
6391
6392function NormalizeSpaces(str) {
6393  if (!str) {
6394    return "";
6395  }
6396  return str.replace(spctab_re_, " ").replace(nbsp_re_, " ");
6397}
6398
6399function UrlEncode(str) {
6400  return encodeURIComponent(str);
6401}
6402var plus_re_ = /\+/g;
6403
6404function UrlDecode(str) {
6405  return decodeURIComponent(str.replace(plus_re_, " "));
6406}
6407
6408function Trim(str) {
6409  if (!str) {
6410    return "";
6411  }
6412  return str.replace(/^\s+/, "").replace(/\s+$/, "");
6413}
6414
6415function EndsWith(str, suffix) {
6416  if (!str) {
6417    return !suffix;
6418  }
6419  return (str.lastIndexOf(suffix) == (str.length - suffix.length));
6420}
6421
6422function IsEmpty(str) {
6423  return CollapseWhitespace(str) == "";
6424}
6425
6426function IsLetterOrDigit(ch) {
6427  return ((ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z") || (ch >= "0" && ch <= "9"));
6428}
6429
6430function IsSpace(ch) {
6431  return (" \t\r\n".indexOf(ch) >= 0);
6432}
6433var eol_re_ = /\r\n?/g;
6434var trailingspc_re_ = /[\n\t ]+$/;
6435
6436function NormalizeText(str) {
6437  return str.replace(eol_re_, "\n").replace(trailingspc_re_, "");
6438}
6439
6440function HtmlEscapeInsertWbrs(str, n, chars_to_break_after, chars_to_break_before) {
6441  AssertNumArgs(4);
6442  var out = "";
6443  var strpos = 0;
6444  var spc = 0;
6445  for (var i = 1; i < str.length; ++i) {
6446    var prev_char = str.charAt(i - 1);
6447    var next_char = str.charAt(i);
6448    if (IsSpace(next_char)) {
6449      spc = i;
6450    } else {
6451      if (i - spc == n || chars_to_break_after.indexOf(prev_char) != -1 || chars_to_break_before.indexOf(next_char) != -1) {
6452        out += HtmlEscape(str.substring(strpos, i)) + "<wbr>";
6453        strpos = i;
6454        spc = i;
6455      }
6456    }
6457  }
6458  out += HtmlEscape(str.substr(strpos));
6459  return out;
6460}
6461var illegal_chars_re_ = /[ \/(){}&|\\\"\000]/g;
6462
6463function CanonicalizeLabel(str, lowercase) {
6464  var uppercase = str.replace(illegal_chars_re_, "-");
6465  return lowercase ? uppercase.toLowerCase() : uppercase;
6466}
6467
6468function CompareStringsIgnoreCase(s1, s2) {
6469  s1 = s1.toLowerCase();
6470  s2 = s2.toLowerCase();
6471  if (s1 < s2) {
6472    return -1;
6473  } else {
6474    if (s1 == s2) {
6475      return 0;
6476    } else {
6477      return 1;
6478    }
6479  }
6480}
6481
6482function GetCursorPos(win, textfield) {
6483  try {
6484    if (IsDefined(textfield.selectionEnd)) {
6485      return textfield.selectionEnd;
6486    } else {
6487      if (win.document.selection && win.document.selection.createRange) {
6488        var tr = win.document.selection.createRange();
6489        if (tr.parentElement() != textfield) {
6490          return -1;
6491        }
6492        var tr2 = tr.duplicate();
6493        tr2.moveToElementText(textfield);
6494        tr2.setEndPoint("EndToStart", tr);
6495        var cursor = tr2.text.length;
6496        if (cursor > textfield.value.length) {
6497          return -1;
6498        }
6499        return cursor;
6500      } else {
6501        Debug("Unable to get cursor position for: " + navigator.userAgent);
6502        return textfield.value.length;
6503      }
6504    }
6505  } catch (e) {
6506    DumpException(e, "Cannot get cursor pos");
6507  }
6508  return -1;
6509}
6510
6511function SetCursorPos(win, textfield, pos) {
6512  if (IsDefined(textfield.selectionEnd) && IsDefined(textfield.selectionStart)) {
6513    textfield.selectionStart = pos;
6514    textfield.selectionEnd = pos;
6515  } else {
6516    if (win.document.selection && textfield.createTextRange) {
6517      var sel = textfield.createTextRange();
6518      sel.collapse(true);
6519      sel.move("character", pos);
6520      sel.select();
6521    }
6522  }
6523}
6524
6525function FindInArray(array, x) {
6526  for (var i = 0; i < array.length; i++) {
6527    if (array[i] == x) {
6528      return i;
6529    }
6530  }
6531  return -1;
6532}
6533
6534function InsertArray(array, x) {
6535  if (FindInArray(array, x) == -1) {
6536    array[array.length] = x;
6537  }
6538}
6539
6540function DeleteArrayElement(array, x) {
6541  var i = 0;
6542  while (i < array.length && array[i] != x) {
6543    i++;
6544  }
6545  array.splice(i, 1);
6546}
6547
6548function CopyArray(array) {
6549  var copy = [];
6550  for (var i = 0; i < array.length; i++) {
6551    copy[i] = array[i];
6552  }
6553  return copy;
6554}
6555
6556function CloneObject(x) {
6557  if ((typeof x) == "object") {
6558    var y = [];
6559    for (var i in x) {
6560      y[i] = CloneObject(x[i]);
6561    }
6562    return y;
6563  }
6564  return x;
6565}
6566
6567function CloneEvent(ev) {
6568  var clone = {};
6569  clone.clientX = ev.clientX;
6570  clone.clientY = ev.clientY;
6571  clone.pageX = ev.pageX;
6572  clone.pageY = ev.pageY;
6573  clone.type = ev.type;
6574  clone.srcElement = ev.srcElement;
6575  clone.target = ev.target;
6576  clone.cancelBubble = ev.cancelBubble;
6577  clone.explicitOriginalTarget = ev.explicitOriginalTarget;
6578  clone.button = ev.button;
6579  clone.shiftKey = ev.shiftKey;
6580  clone.ctrlKey = ev.ctrlKey;
6581  return clone;
6582}
6583
6584function GetEventTarget(ev) {
6585  return ev.srcElement || ev.target;
6586}
6587
6588function CancelEvent(ev) {
6589  if (BR_IsIE()) {
6590    ev.cancelBubble = true;
6591  } else {
6592    if (ev.stopPropagation) {
6593      ev.stopPropagation();
6594    }
6595  }
6596}
6597
6598function CancelDefaultAction(ev) {
6599  if (BR_IsIE()) {
6600    ev.returnValue = false;
6601  } else {
6602    ev.preventDefault();
6603  }
6604}
6605
6606function PrintArray(array, data) {
6607  AssertEquals(array.length, data.length * 2 + 1);
6608  for (var i = 0, idx = 1; i < data.length; i++, idx += 2) {
6609    array[idx] = data[i];
6610  }
6611  return array.join("");
6612}
6613
6614function ImageHtml(url, attributes) {
6615  return "<img " + attributes + " src=" + url + ">";
6616}
6617
6618function MakeId3(idprefix, m, n) {
6619  return idprefix + m + "_" + n;
6620}
6621
6622function ParseAddress(addr) {
6623  var name = "";
6624  var address = "";
6625  for (var i = 0; i < addr.length;) {
6626    var token = GetEmailToken(addr, i);
6627    if (token.charAt(0) == "<") {
6628      var end = token.indexOf(">");
6629      address = token.substring(1, (end != -1) ? end : token.length);
6630    } else {
6631      if (address == "") {
6632        name += token;
6633      }
6634    }
6635    i += token.length;
6636  }
6637  if (address == "" && name.indexOf("@") != -1) {
6638    address = name;
6639    name = "";
6640  }
6641  name = CollapseWhitespace(name);
6642  name = StripQuotes(name, "'");
6643  name = StripQuotes(name, '"');
6644  address = CollapseWhitespace(address);
6645  return [name, address];
6646}
6647
6648function GetAddress(address) {
6649  return ParseAddress(address)[1];
6650}
6651
6652function GetAddressUsername(address) {
6653  address = GetAddress(address);
6654  var at = address.indexOf("@");
6655  return (at == -1) ? address : address.substr(0, at);
6656}
6657
6658function GetPersonal(address) {
6659  return ParseAddress(address)[0];
6660}
6661
6662function GetPersonalElseUsername(address) {
6663  var personal = GetPersonal(address);
6664  if (personal != "") {
6665    return personal;
6666  } else {
6667    return GetAddressUsername(address);
6668  }
6669}
6670
6671function StripQuotes(str, quotechar) {
6672  var len = str.length;
6673  if (str.charAt(0) == quotechar && str.charAt(len - 1) == quotechar) {
6674    return str.substring(1, len - 1);
6675  }
6676  return str;
6677}
6678
6679function EmailsToArray(str) {
6680  var result = [];
6681  var email = "";
6682  var token;
6683  for (var i = 0; i < str.length;) {
6684    token = GetEmailToken(str, i);
6685    if (token == ",") {
6686      AddEmailAddress(result, email);
6687      email = "";
6688      i++;
6689      continue;
6690    }
6691    email += token;
6692    i += token.length;
6693  }
6694  if (email != "" || token == ",") {
6695    AddEmailAddress(result, email);
6696  }
6697  return result;
6698}
6699var openers_ = '"<([';
6700var closers_ = '">)]';
6701
6702function GetEmailToken(str, pos) {
6703  var ch = str.charAt(pos);
6704  var p = openers_.indexOf(ch);
6705  if (p == -1) {
6706    return ch;
6707  }
6708  var end_pos = str.indexOf(closers_.charAt(p), pos + 1);
6709  var token = (end_pos >= 0) ? str.substring(pos, end_pos + 1) : str.substr(pos);
6710  return token;
6711}
6712
6713function AddEmailAddress(result, email) {
6714  email = CleanEmailAddress(email);
6715  result[result.length] = email;
6716}
6717var specialchars_re_ = /[()<>@,;:\\\".\[\]]/;
6718
6719function CleanEmailAddress(str) {
6720  var name_address = ParseAddress(str);
6721  var name = name_address[0];
6722  var address = name_address[1];
6723  if (name.indexOf('"') == -1) {
6724    var quote_needed = specialchars_re_.test(name);
6725    if (quote_needed) {
6726      name = '"' + name + '"';
6727    }
6728  }
6729  if (name == "") {
6730    return address;
6731  } else {
6732    if (address == "") {
6733      return name;
6734    } else {
6735      return name + " <" + address + ">";
6736    }
6737  }
6738}
6739
6740function SafeTimeout(win, fn, ms) {
6741  if (!win) {
6742    win = window;
6743  }
6744  if (!win._tm) {
6745    win._tm = [];
6746  }
6747  var timeoutfn = SafeTimeoutFunction_(win, fn);
6748  var id = win.setTimeout(timeoutfn, ms);
6749  timeoutfn.id = id;
6750  win._tm[id] = 1;
6751  return id;
6752}
6753
6754function SafeTimeoutFunction_(win, fn) {
6755  var timeoutfn = function() {
6756    try {
6757      fn(win);
6758      var t = win._tm;
6759      if (t) {
6760        delete t[timeoutfn.id];
6761      }
6762    } catch (e) {
6763      DumpException(e);
6764    }
6765  };
6766  return timeoutfn;
6767}
6768
6769function CancelTimeout(win, id) {
6770  if (!win) {
6771    win = window;
6772  }
6773  win.clearTimeout(id);
6774  if (win._tm) {
6775    delete win._tm[id];
6776  }
6777}
6778
6779function CancelAllTimeouts(win) {
6780  if (win && win._tm) {
6781    try {
6782      for (var i in win._tm) {
6783        win.clearTimeout(i);
6784      }
6785      win._tm = [];
6786    } catch (e) {
6787      DumpException(e);
6788    }
6789  }
6790}
6791
6792function CompareID(a, b) {
6793  if (a.length != b.length) {
6794    return (a.length - b.length);
6795  } else {
6796    return (a < b) ? -1 : (a > b) ? 1 : 0;
6797  }
6798}
6799
6800function IsDefined(value) {
6801  return (typeof value) != "undefined";
6802}
6803
6804function GetKeyCode(event) {
6805  var code;
6806  if (event.keyCode) {
6807    code = event.keyCode;
6808  } else {
6809    if (event.which) {
6810      code = event.which;
6811    }
6812  }
6813  return code;
6814}
6815
6816function forid_1(id) {
6817  return document.getElementById(id);
6818}
6819
6820function forid_2(id) {
6821  return document.all[id];
6822}
6823var forid = document.getElementById ? forid_1 : forid_2;
6824
6825function GetFnName(func) {
6826  AssertTrue(func, "func passed to GetFnName() is undefined");
6827  var name;
6828  if (!("name" in func)) {
6829    var match = /\W*function\s+([\w\$]+)\(/.exec(func);
6830    if (!match) {
6831      throw new Error("Cannot extract name from function: " + func);
6832    }
6833    name = match[1];
6834    func.name = name;
6835  } else {
6836    name = func.name;
6837  }
6838  if (!name || name == "anonymous") {
6839    throw new Error("Anonymous function has no name: " + func);
6840  }
6841  return func.name;
6842}
6843
6844function log(msg) {
6845  try {
6846    if (window.parent != window && window.parent.log) {
6847      window.parent.log(window.name + "::" + msg);
6848      return;
6849    }
6850  } catch (e) {}
6851  var logPane = forid("log");
6852  if (logPane) {
6853    var logText = "<p class=logentry><span class=logdate>" + new Date() + "</span><span class=logmsg>" + msg + "</span></p>";
6854    logPane.innerHTML = logText + logPane.innerHTML;
6855  } else {
6856    window.status = msg;
6857  }
6858}
6859var XH_ieProgId_;
6860var XML_READY_STATE_UNINITIALIZED = 0;
6861var XML_READY_STATE_LOADING = 1;
6862var XML_READY_STATE_LOADED = 2;
6863var XML_READY_STATE_INTERACTIVE = 3;
6864var XML_READY_STATE_COMPLETED = 4;
6865
6866function XH_XmlHttpInit_() {
6867  var XH_ACTIVE_X_IDENTS = ["MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
6868  if (typeof XMLHttpRequest == "undefined" && typeof ActiveXObject != "undefined") {
6869    for (var i = 0; i < XH_ACTIVE_X_IDENTS.length; i++) {
6870      var candidate = XH_ACTIVE_X_IDENTS[i];
6871      try {
6872        new ActiveXObject(candidate);
6873        XH_ieProgId_ = candidate;
6874        break;
6875      } catch (e) {}
6876    }
6877    if (!XH_ieProgId_) {
6878      throw Error("Could not create ActiveXObject. ActiveX might be disabled," + " or MSXML might not be installed.");
6879    }
6880  }
6881}
6882XH_XmlHttpInit_();
6883
6884function XH_XmlHttpCreate() {
6885  if (XH_ieProgId_) {
6886    return new ActiveXObject(XH_ieProgId_);
6887  } else {
6888    return new XMLHttpRequest();
6889  }
6890}
6891
6892function XH_XmlHttpGET(xmlHttp, url, handler) {
6893  xmlHttp.open("GET", url, true);
6894  xmlHttp.onreadystatechange = handler;
6895  XH_XmlHttpSend(xmlHttp, null);
6896}
6897
6898function XH_XmlHttpPOST(xmlHttp, url, data, handler) {
6899  xmlHttp.open("POST", url, true);
6900  xmlHttp.onreadystatechange = handler;
6901  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
6902  XH_XmlHttpSend(xmlHttp, data);
6903}
6904
6905function XH_XmlHttpOpen(xmlHttp, verb, url, handler) {
6906  xmlHttp.open(verb, url, true);
6907  xmlHttp.onreadystatechange = handler;
6908}
6909
6910function XH_XmlHttpSetRequestHeader(xmlHttp, name, value) {
6911  xmlHttp.setRequestHeader(name, value);
6912}
6913
6914function XH_XmlHttpSend(xmlHttp, data) {
6915  try {
6916    xmlHttp.send(data);
6917  } catch (e) {
6918    log("XMLHttpSend failed " + e.toString() + "<br>" + e.stack);
6919    throw e;
6920  }
6921}
6922
6923function XH_XmlHttpAbort(xmlHttp) {
6924  SafeTimeout(window, function() {
6925    xmlHttp.onreadystatechange = function() {};
6926  }, 0);
6927  if (xmlHttp.readyState < XML_READY_STATE_COMPLETED) {
6928    xmlHttp.abort();
6929  }
6930}
6931
6932function uri_parse(uriStr) {
6933  var m = uriStr.match(URI_RE_);
6934  if (!m) {
6935    return null;
6936  }
6937  return new URI(uri_nullIfAbsent_(m[1]), uri_nullIfAbsent_(m[2]), uri_nullIfAbsent_(m[3]), uri_nullIfAbsent_(m[4]), uri_nullIfAbsent_(m[5]), uri_nullIfAbsent_(m[6]), uri_nullIfAbsent_(m[7]));
6938}
6939
6940function uri_create(scheme, credentials, domain, port, path, cgiParamList, fragment) {
6941  var uri = new URI(uri_encodeIfExists2_(scheme, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_), uri_encodeIfExists2_(credentials, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_), uri_encodeIfExists_(domain), port > 0 ? port.toString() : null, uri_encodeIfExists2_(path, URI_DISALLOWED_IN_PATH_), null, uri_encodeIfExists_(fragment));
6942  if (cgiParamList) {
6943    uri.SetAllCgiParameters(cgiParamList);
6944  }
6945  return uri;
6946}
6947
6948function uri_encodeIfExists_(unescapedPart) {
6949  if ("string" == typeof unescapedPart) {
6950    return encodeURIComponent(unescapedPart);
6951  }
6952  return null;
6953}
6954
6955function uri_encodeIfExists2_(unescapedPart, extra) {
6956  if ("string" == typeof unescapedPart) {
6957    return encodeURI(unescapedPart).replace(extra, uri_encodeOne_);
6958  }
6959  return null;
6960}
6961
6962function uri_encodeOne_(ch) {
6963  var n = ch.charCodeAt(0);
6964  return "%" + "0123456789ABCDEF".charAt((n >> 4) & 15) + "0123456789ABCDEF".charAt(n & 15);
6965}
6966
6967function uri_resolve(baseUri, relativeUri) {
6968  var absoluteUri = baseUri.Clone();
6969  var overridden = relativeUri.HasScheme();
6970  if (overridden) {
6971    absoluteUri.SetRawScheme(relativeUri.GetRawScheme());
6972  } else {
6973    overridden = relativeUri.HasCredentials();
6974  }
6975  if (overridden) {
6976    absoluteUri.SetRawCredentials(relativeUri.GetRawCredentials());
6977  } else {
6978    overridden = relativeUri.HasDomain();
6979  }
6980  if (overridden) {
6981    absoluteUri.SetRawDomain(relativeUri.GetRawDomain());
6982  } else {
6983    overridden = relativeUri.HasPort();
6984  }
6985  var rawPath = relativeUri.GetRawPath();
6986  if (overridden) {
6987    absoluteUri.SetPort(relativeUri.GetPort());
6988  } else {
6989    overridden = relativeUri.HasPath();
6990    if (overridden) {
6991      if (!new RegExp("^/").test(rawPath)) {
6992        rawPath = absoluteUri.GetRawPath().replace(new RegExp("/?[^/]*$"), "/" + rawPath);
6993      }
6994    }
6995  }
6996  if (overridden) {
6997    absoluteUri.SetRawPath(rawPath);
6998  } else {
6999    overridden = relativeUri.HasQuery();
7000  }
7001  if (overridden) {
7002    absoluteUri.SetRawQuery(relativeUri.GetRawQuery());
7003  } else {
7004    overridden = relativeUri.HasFragment();
7005  }
7006  if (overridden) {
7007    absoluteUri.SetRawFragment(relativeUri.GetRawFragment());
7008  }
7009  return absoluteUri;
7010}
7011
7012function URI(rawScheme, rawCredentials, rawDomain, port, rawPath, rawQuery, rawFragment) {
7013  this.scheme_ = rawScheme;
7014  this.credentials_ = rawCredentials;
7015  this.domain_ = rawDomain;
7016  this.port_ = port;
7017  this.path_ = rawPath;
7018  this.query_ = rawQuery;
7019  this.fragment_ = rawFragment;
7020  this.paramCache_ = null;
7021}
7022URI.prototype.toString = function() {
7023  var out = [];
7024  if (null !== this.scheme_) {
7025    out.push(this.scheme_, ":");
7026  }
7027  if (null !== this.domain_) {
7028    out.push("//");
7029    if (null !== this.credentials_) {
7030      out.push(this.credentials_, "@");
7031    }
7032    out.push(this.domain_);
7033    if (null !== this.port_) {
7034      out.push(":", this.port_.toString());
7035    }
7036  }
7037  if (null !== this.path_) {
7038    out.push(this.path_);
7039  }
7040  if (null !== this.query_) {
7041    out.push("?", this.query_);
7042  }
7043  if (null !== this.fragment_) {
7044    out.push("#", this.fragment_);
7045  }
7046  return out.join("");
7047};
7048URI.prototype.Clone = function() {
7049  return new URI(this.scheme_, this.credentials_, this.domain_, this.port_, this.path_, this.query_, this.fragment_);
7050};
7051URI.prototype.GetScheme = function() {
7052  return this.scheme_ && uri_decodeThatWorks_(this.scheme_);
7053};
7054URI.prototype.GetRawScheme = function() {
7055  return this.scheme_;
7056};
7057URI.prototype.SetScheme = function(newScheme) {
7058  this.scheme_ = uri_encodeIfExists2_(newScheme, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_);
7059  return this;
7060};
7061URI.prototype.SetRawScheme = function(newScheme) {
7062  this.scheme_ = newScheme ? newScheme : null;
7063  return this;
7064};
7065URI.prototype.HasScheme = function() {
7066  return null !== this.scheme_;
7067};
7068URI.prototype.GetCredentials = function() {
7069  return this.credentials_ && uri_decodeThatWorks_(this.credentials_);
7070};
7071URI.prototype.GetRawCredentials = function() {
7072  return this.credentials_;
7073};
7074URI.prototype.SetCredentials = function(newCredentials) {
7075  this.credentials_ = uri_encodeIfExists2_(newCredentials, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_);
7076  return this;
7077};
7078URI.prototype.SetRawCredentials = function(newCredentials) {
7079  this.credentials_ = newCredentials ? newCredentials : null;
7080  return this;
7081};
7082URI.prototype.HasCredentials = function() {
7083  return null !== this.credentials_;
7084};
7085URI.prototype.GetDomain = function() {
7086  return this.domain_ && uri_decodeThatWorks_(this.domain_);
7087};
7088URI.prototype.GetRawDomain = function() {
7089  return this.domain_;
7090};
7091URI.prototype.SetDomain = function(newDomain) {
7092  this.domain_ = newDomain ? encodeURIComponent(newDomain) : null;
7093  return this;
7094};
7095URI.prototype.SetRawDomain = function(newDomain) {
7096  this.domain_ = newDomain ? newDomain : null;
7097  return this;
7098};
7099URI.prototype.HasDomain = function() {
7100  return null !== this.domain_;
7101};
7102URI.prototype.GetPort = function() {
7103  return this.port_ && uri_decodeThatWorks_(this.port_);
7104};
7105URI.prototype.SetPort = function(newPort) {
7106  if (newPort) {
7107    if ("number" !== typeof newPort) {
7108      newPort = parseInt(newPort, 10);
7109      if (newPort < 0 || isNaN(newPort)) {
7110        throw new Error("Bad port number " + newPort);
7111      }
7112    }
7113    this.port_ = newPort.toString();
7114  } else {
7115    this.port_ = null;
7116  }
7117  return this;
7118};
7119URI.prototype.HasPort = function() {
7120  return null !== this.port_;
7121};
7122URI.prototype.GetPath = function() {
7123  return this.path_ && uri_decodeThatWorks_(this.path_);
7124};
7125URI.prototype.GetRawPath = function() {
7126  return this.path_;
7127};
7128URI.prototype.SetPath = function(newPath) {
7129  this.path_ = uri_encodeIfExists2_(newPath, URI_DISALLOWED_IN_PATH_);
7130  return this;
7131};
7132URI.prototype.SetRawPath = function(newPath) {
7133  this.path_ = newPath ? newPath : null;
7134  return this;
7135};
7136URI.prototype.HasPath = function() {
7137  return null !== this.path_;
7138};
7139URI.prototype.GetQuery = function() {
7140  return this.query_ && uri_decodeThatWorks_(this.query_);
7141};
7142URI.prototype.GetRawQuery = function() {
7143  return this.query_;
7144};
7145URI.prototype.SetQuery = function(newQuery) {
7146  this.paramCache_ = null;
7147  this.query_ = uri_encodeIfExists_(newQuery);
7148  return this;
7149};
7150URI.prototype.SetRawQuery = function(newQuery) {
7151  this.paramCache_ = null;
7152  this.query_ = newQuery ? newQuery : null;
7153  return this;
7154};
7155URI.prototype.HasQuery = function() {
7156  return null !== this.query_;
7157};
7158URI.prototype.SetAllCgiParameters = function(unescapedCgiParameters) {
7159  this.paramCache_ = null;
7160  var queryBuf = [];
7161  var separator = "";
7162  for (var i = 0; i < unescapedCgiParameters.length;) {
7163    var k = unescapedCgiParameters[i++];
7164    var v = unescapedCgiParameters[i++];
7165    queryBuf.push(separator, encodeURIComponent(k.toString()));
7166    separator = "&";
7167    if (v) {
7168      queryBuf.push("=", encodeURIComponent(v.toString()));
7169    }
7170  }
7171  this.query_ = queryBuf.join("");
7172  return this;
7173};
7174URI.prototype.CheckParameterCache_ = function() {
7175  if (!this.paramCache_) {
7176    if (!this.query_) {
7177      this.paramCache_ = [];
7178    } else {
7179      var cgiParams = this.query_.split(/[&\?]/);
7180      var out = [];
7181      for (var i = 0; i < cgiParams.length; ++i) {
7182        var m = cgiParams[i].match(/^([^=]*)(?:=(.*))?$/);
7183        out.push(uri_decodeThatWorks_(m[1]), uri_decodeThatWorks_(m[2] || ""));
7184      }
7185      this.paramCache_ = out;
7186    }
7187  }
7188};
7189URI.prototype.SetCgiParameterValues = function(key, values) {
7190  if (typeof values === "string") {
7191    values = [values];
7192  }
7193  this.CheckParameterCache_();
7194  var newValueIndex = 0;
7195  var pc = this.paramCache_;
7196  var params = [];
7197  for (var i = 0, k = 0; i < pc.length; i += 2) {
7198    if (key === pc[i]) {
7199      if (newValueIndex < values.length) {
7200        params.push(key, values[newValueIndex++]);
7201      }
7202    } else {
7203      params.push(pc[i], pc[i + 1]);
7204    }
7205  }
7206  while (newValueIndex < values.length) {
7207    params.push(key, values[newValueIndex++]);
7208  }
7209  this.SetAllCgiParameters(params);
7210  return this;
7211};
7212URI.prototype.GetAllCgiParameters = function() {
7213  this.CheckParameterCache_();
7214  return this.paramCache_.slice(0, this.paramCache_.length);
7215};
7216URI.prototype.GetCgiParameterValues = function(paramNameUnescaped) {
7217  this.CheckParameterCache_();
7218  var values = [];
7219  for (var i = 0; i < this.paramCache_.length; i += 2) {
7220    if (paramNameUnescaped === this.paramCache_[i]) {
7221      values.push(this.paramCache_[i + 1]);
7222    }
7223  }
7224  return values;
7225};
7226URI.prototype.GetCgiParameterMap = function(paramNameUnescaped) {
7227  this.CheckParameterCache_();
7228  var paramMap = {};
7229  for (var i = 0; i < this.paramCache_.length; i += 2) {
7230    var key = this.paramCache_[i++],
7231      value = this.paramCache_[i++];
7232    if (!(key in paramMap)) {
7233      paramMap[key] = [value];
7234    } else {
7235      paramMap[key].push(value);
7236    }
7237  }
7238  return paramMap;
7239};
7240URI.prototype.GetCgiParameterValue = function(paramNameUnescaped) {
7241  this.CheckParameterCache_();
7242  for (var i = 0; i < this.paramCache_.length; i += 2) {
7243    if (paramNameUnescaped === this.paramCache_[i]) {
7244      return this.paramCache_[i + 1];
7245    }
7246  }
7247  return null;
7248};
7249URI.prototype.GetFragment = function() {
7250  return this.fragment_ && uri_decodeThatWorks_(this.fragment_);
7251};
7252URI.prototype.GetRawFragment = function() {
7253  return this.fragment_;
7254};
7255URI.prototype.SetFragment = function(newFragment) {
7256  this.fragment_ = newFragment ? encodeURIComponent(newFragment) : null;
7257  return this;
7258};
7259URI.prototype.SetRawFragment = function(newFragment) {
7260  this.fragment_ = newFragment ? newFragment : null;
7261  return this;
7262};
7263URI.prototype.HasFragment = function() {
7264  return null !== this.fragment_;
7265};
7266
7267function uri_decodeThatWorks_(s) {
7268  return decodeURIComponent(s).replace(/\+/g, " ");
7269}
7270
7271function uri_nullIfAbsent_(matchPart) {
7272  return ("string" == typeof matchPart) && (matchPart.length > 0) ? matchPart : null;
7273}
7274var URI_RE_ = new RegExp("^" + "(?:" + "([^:/?#]+)" + ":)?" + "(?://" + "(?:([^/?#]*)@)?" + "([^/?#:@]*)" + "(?::([0-9]+))?" + ")?" + "([^?#]+)?" + "(?:\\?([^#]*))?" + "(?:#(.*))?" + "$");
7275var URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_ = /[#\/\?@]/g;
7276var URI_DISALLOWED_IN_PATH_ = /[\#\?]/g;
7277var ss_cached = [];
7278var ss_qbackup = null;
7279var ss_qshown = null;
7280var ss_loc = -1;
7281var ss_waiting = 0;
7282var ss_painting = false;
7283var ss_key_handling_queue = null;
7284var ss_painting_queue = null;
7285var ss_dismissed = false;
7286var ss_panic = false;
7287var SS_ROW_CLASS = "ss-gac-a";
7288var SS_ROW_SELECTED_CLASS = "ss-gac-b";
7289if (!Array.prototype.indexOf) {
7290  Array.prototype.indexOf = function(searchElement) {
7291    if (this == null) {
7292      throw new TypeError();
7293    }
7294    var t = Object(this);
7295    var len = t.length >>> 0;
7296    if (len === 0) {
7297      return -1;
7298    }
7299    var n = 0;
7300    if (arguments.length > 0) {
7301      n = Number(arguments[1]);
7302      if (n != n) {
7303        n = 0;
7304      } else {
7305        if (n != 0 && n != Infinity && n != -Infinity) {
7306          n = (n > 0 || -1) * Math.floor(Math.abs(n));
7307        }
7308      }
7309    }
7310    if (n >= len) {
7311      return -1;
7312    }
7313    var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
7314    for (; k < len; k++) {
7315      if (k in t && t[k] === searchElement) {
7316        return k;
7317      }
7318    }
7319    return -1;
7320  };
7321}
7322var ss_debug = new ss_Debugger();
7323
7324function ss_composeSuggestUri(qVal, suggestForm) {
7325  if (!qVal) {
7326    return null;
7327  }
7328  var accessVal = (suggestForm.access && suggestForm.access.value) ? suggestForm.access.value : "p";
7329  var uri = "/search/as/suggest";
7330  if (SS_OUTPUT_FORMAT_LEGACY == ss_protocol) {
7331    uri = uri + "?token=" + encodeURIComponent(qVal) + "&max_matches=" + ss_g_max_to_display;
7332  } else {
7333    uri = uri + "?q=" + encodeURIComponent(qVal) + "&max=" + ss_g_max_to_display;
7334  }
7335  uri = uri + "&access=" + encodeURIComponent(accessVal) + "&format=" + encodeURIComponent(ss_protocol);
7336  if (ss_isEmbeddedMode_()) {
7337    uri = window["GSA_getResourceRootPathPrefix"]() + encodeURIComponent(uri);
7338  }
7339  return uri;
7340}
7341
7342function ss_suggest(qVal) {
7343  var startTimeMs = new Date().getTime();
7344  if (!ss_cached[qVal]) {
7345    ss_cached[qVal] = {};
7346  }
7347  var suggestForm = document.getElementById(ss_form_element);
7348  var uri = ss_composeSuggestUri(qVal, suggestForm);
7349  var url = uri;
7350  if (ss_panic) {
7351    alert("ss_suggest() AJAX: " + url);
7352  }
7353  var xmlhttp = XH_XmlHttpCreate();
7354  var handler = function() {
7355    if (xmlhttp.readyState == XML_READY_STATE_COMPLETED) {
7356      if (ss_panic) {
7357        alert("ss_suggest() AJAX: " + xmlhttp.responseText);
7358      }
7359      var suggested;
7360      try {
7361        suggested = JSON.parse(xmlhttp.responseText);
7362      } catch (e) {
7363        ss_cached[qVal].g = null;
7364        ss_show(qVal);
7365        return;
7366      }
7367      if (ss_use.g) {
7368        try {
7369          switch (ss_protocol) {
7370            case SS_OUTPUT_FORMAT_LEGACY:
7371            default:
7372              var suggestions = suggested;
7373              if (suggestions && suggestions.length > 0) {
7374                var found = false;
7375                ss_cached[qVal].g = [];
7376                var max = (ss_g_max_to_display <= 0) ? suggestions.length : Math.min(ss_g_max_to_display, suggestions.length);
7377                for (var si = 0; si < max; si++) {
7378                  ss_cached[qVal].g[si] = {
7379                    "q": suggestions[si]
7380                  };
7381                  found = true;
7382                }
7383                if (!found) {
7384                  ss_cached[qVal].g = null;
7385                }
7386              } else {
7387                ss_cached[qVal].g = null;
7388              }
7389              break;
7390            case SS_OUTPUT_FORMAT_OPEN_SEARCH:
7391              if (suggested.length > 1) {
7392                var suggestions = suggested[1];
7393                if (suggestions && suggestions.length > 0) {
7394                  var found = false;
7395                  ss_cached[qVal].g = [];
7396                  var max = (ss_g_max_to_display <= 0) ? suggestions.length : Math.min(ss_g_max_to_display, suggestions.length);
7397                  for (var si = 0; si < max; si++) {
7398                    if (suggestions[si] && suggestions[si] != suggested[0]) {
7399                      ss_cached[qVal].g[si] = {
7400                        "q": suggestions[si]
7401                      };
7402                      found = true;
7403                    } else {
7404                      if ((suggested.length > 3) && ss_allow_non_query) {
7405                        var title = (suggested[2].length > si) ? null : suggested[2][si];
7406                        var url = (suggested[3].length > si) ? null : suggested[3][si];
7407                        if (url) {
7408                          title = !title ? ss_non_query_empty_title : title;
7409                          ss_cached[qVal].g[si] = {
7410                            "t": title,
7411                            "u": url
7412                          };
7413                          found = true;
7414                        }
7415                      }
7416                    }
7417                  }
7418                  if (!found) {
7419                    ss_cached[qVal].g = null;
7420                  }
7421                } else {
7422                  ss_cached[qVal].g = null;
7423                }
7424              } else {
7425                ss_cached[qVal].g = null;
7426              }
7427              break;
7428            case SS_OUTPUT_FORMAT_RICH:
7429              var suggestions = suggested.results;
7430              var relatedSuggestion = suggested.relatedSuggestion;
7431              if (suggestions && suggestions.length > 0) {
7432                var found = false;
7433                ss_cached[qVal].g = [];
7434                var max = (ss_g_max_to_display <= 0) ? suggestions.length : Math.min(ss_g_max_to_display, suggestions.length);
7435                for (var si = 0; si < max; si++) {
7436                  if (suggestions[si].name && suggestions[si].name != suggested.query) {
7437                    ss_cached[qVal].g[si] = {
7438                      "q": suggestions[si].name
7439                    };
7440                    found = true;
7441                  } else {
7442                    if (ss_allow_non_query) {
7443                      var title = suggestions[si].content;
7444                      var url = suggestions[si].moreDetailsUrl;
7445                      if (url) {
7446                        title = !title ? ss_non_query_empty_title : title;
7447                        ss_cached[qVal].g[si] = {
7448                          "t": title,
7449                          "u": url
7450                        };
7451                        found = true;
7452                      }
7453                    }
7454                  }
7455                }
7456                if (!found) {
7457                  ss_cached[qVal].g = null;
7458                }
7459              } else {
7460                ss_cached[qVal].g = null;
7461              }
7462              if (relatedSuggestion && relatedSuggestion.length > 0) {
7463                var found = false;
7464                ss_cached[qVal].r = [];
7465                var max = (ss_r_max_to_display <= 0) ? relatedSuggestion.length : Math.min(ss_r_max_to_display, relatedSuggestion.length);
7466                for (var si = 0; si < max; si++) {
7467                  if (relatedSuggestion[si].message && relatedSuggestion[si].message != suggested.query) {
7468                    ss_cached[qVal].r[si] = {
7469                      "q": relatedSuggestion[si].message,
7470                      "u": relatedSuggestion[si].url
7471                    };
7472                    found = true;
7473                  } else {
7474                    if (ss_allow_non_query) {
7475                      var title = suggestions[si].content;
7476                      var url = suggestions[si].moreDetailsUrl;
7477                      if (url) {
7478                        title = !title ? ss_non_query_empty_title : title;
7479                        ss_cached[qVal].g[si] = {
7480                          "t": title,
7481                          "u": url
7482                        };
7483                        found = true;
7484                      }
7485                    }
7486                  }
7487                }
7488                if (!found) {
7489                  ss_cached[qVal].g = null;
7490                }
7491              }
7492              break;
7493          }
7494        } catch (e) {
7495          ss_cached[qVal].g = null;
7496        }
7497      }
7498      if (ss_allow_debug && ss_debug && ss_debug.getDebugMode()) {
7499        var stopTimeMs = new Date().getTime();
7500        ss_debug.addRequestDebugLine(qVal, "suggest", stopTimeMs - startTimeMs, ss_cached[qVal]);
7501      }
7502      ss_show(qVal);
7503    }
7504  };
7505  XH_XmlHttpPOST(xmlhttp, url, "", handler);
7506}
7507
7508function ss_processed(qVal) {
7509  if (!ss_cached[qVal] && ss_use.g) {
7510    return false;
7511  }
7512  return true;
7513}
7514
7515function ss_handleAllKey(e) {
7516  var kid = (window.event) ? window.event.keyCode : e.keyCode;
7517  switch (kid) {
7518    case 40:
7519    case 38:
7520      break;
7521    case 9:
7522      ss_qbackup = null;
7523      ss_dismissed = true;
7524      ss_clear(true);
7525    case 16:
7526      ss_qbackup = null;
7527      ss_dismissed = true;
7528      var qry = document.getElementById(ss_form_element).q.value;
7529      if (!ss_processed(qry)) {
7530        if (ss_panic) {
7531          alert("run ajax when key off");
7532        }
7533        ss_suggest(qry);
7534      }
7535      break;
7536    case 113:
7537      if (!ss_allow_debug) {
7538        break;
7539      }
7540      if (ss_debug && ss_debug.getDebugMode()) {
7541        ss_debug.deactivateConsole();
7542      } else {
7543        ss_debug.activateConsole();
7544      }
7545      break;
7546    default:
7547      break;
7548  }
7549}
7550
7551function ss_handleKey(e, opt_inputEle) {
7552  ss_initEmbedMode_(opt_inputEle);
7553  var kid = (window.event) ? window.event.keyCode : e.keyCode;
7554  var fo = document.getElementById(ss_form_element);
7555  if (ss_isEmbeddedMode_()) {
7556    document.getElementById(ss_form_element).q.value = opt_inputEle.value;
7557  }
7558  var qnow = (!ss_qbackup) ? fo.q.value : ss_qbackup;
7559  var sum = 0;
7560  var tbl = document.getElementById(ss_popup_element);
7561  switch (kid) {
7562    case 40:
7563      ss_dismissed = false;
7564      if (ss_processed(qnow)) {
7565        sum = ss_countSuggestions(qnow);
7566        if (sum > 0) {
7567          if (tbl.style.visibility == "hidden") {
7568            ss_show(qnow);
7569            break;
7570          }
7571          if (ss_qbackup) {
7572            ss_loc++;
7573          } else {
7574            ss_qbackup = qnow;
7575            ss_loc = 0;
7576          }
7577          while (ss_loc >= sum) {
7578            ss_loc -= sum;
7579          }
7580          var rows = tbl.getElementsByTagName("tr");
7581          for (var ri = 0; ri < rows.length - 1; ri++) {
7582            if (ri == ss_loc) {
7583              rows[ri].className = SS_ROW_SELECTED_CLASS;
7584            } else {
7585              rows[ri].className = SS_ROW_CLASS;
7586            }
7587          }
7588          var suggestion = ss_locateSuggestion(qnow, ss_loc);
7589          if (suggestion.q) {
7590            fo.q.value = suggestion.q;
7591            if (ss_isEmbeddedMode_() && opt_inputEle) {
7592              opt_inputEle.value = suggestion.q;
7593            }
7594          } else {
7595            fo.q.value = ss_qbackup;
7596            if (ss_isEmbeddedMode_() && opt_inputEle) {
7597              opt_inputEle.value = ss_qbackup;
7598            }
7599          }
7600        }
7601      } else {
7602        if (ss_panic) {
7603          alert("run ajax when key down");
7604        }
7605        ss_suggest(qnow);
7606      }
7607      break;
7608    case 38:
7609      ss_dismissed = false;
7610      if (ss_processed(qnow)) {
7611        sum = ss_countSuggestions(qnow);
7612        if (sum > 0) {
7613          if (tbl.style.visibility == "hidden") {
7614            ss_show(qnow);
7615            break;
7616          }
7617          if (ss_qbackup) {
7618            ss_loc--;
7619          } else {
7620            ss_qbackup = qnow;
7621            ss_loc = -1;
7622          }
7623          while (ss_loc < 0) {
7624            ss_loc += sum;
7625          }
7626          var rows = tbl.getElementsByTagName("tr");
7627          for (var ri = 0; ri < rows.length - 1; ri++) {
7628            if (ri == ss_loc) {
7629              rows[ri].className = SS_ROW_SELECTED_CLASS;
7630            } else {
7631              rows[ri].className = SS_ROW_CLASS;
7632            }
7633          }
7634          var suggestion = ss_locateSuggestion(qnow, ss_loc);
7635          if (suggestion.q) {
7636            fo.q.value = suggestion.q;
7637          } else {
7638            fo.q.value = ss_qbackup;
7639          }
7640        }
7641      } else {
7642        if (ss_panic) {
7643          alert("run ajax when key up");
7644        }
7645        ss_suggest(qnow);
7646      }
7647      break;
7648    case 13:
7649    case 9:
7650      if (ss_isEmbeddedMode_()) {
7651        return;
7652      }
7653      var url = null;
7654      if (ss_processed(qnow) && ss_qbackup && ss_loc > -1) {
7655        var suggestion = ss_locateSuggestion(ss_qbackup, ss_loc);
7656        if (suggestion.u) {
7657          url = suggestion.u;
7658        }
7659      }
7660      ss_qbackup = null;
7661      ss_dismissed = true;
7662      ss_clear();
7663      if (url) {
7664        window.location.href = url;
7665      }
7666      break;
7667    case 27:
7668      if (ss_qbackup) {
7669        fo.q.value = ss_qbackup;
7670        ss_qbackup = null;
7671      }
7672      ss_dismissed = true;
7673      ss_clear();
7674      break;
7675    case 37:
7676    case 39:
7677    case 16:
7678      break;
7679    default:
7680      ss_dismissed = false;
7681      if (fo.q.value == ss_qshown) {} else {
7682        if (ss_key_handling_queue) {
7683          clearTimeout(ss_key_handling_queue);
7684        }
7685        ss_qbackup = null;
7686        ss_loc = -1;
7687        ss_waiting++;
7688        if (ss_allow_debug && ss_debug && ss_debug.getDebugMode()) {
7689          ss_debug.addWaitDebugLine(fo.q.value, "queue", ss_wait_millisec);
7690        }
7691        ss_key_handling_queue = setTimeout('ss_handleQuery("' + ss_escape(fo.q.value) + '", ' + ss_waiting + ")", ss_wait_millisec);
7692      }
7693      break;
7694  }
7695}
7696
7697function ss_isEmbeddedMode_() {
7698  return window["GSA_isEmbeddedMode"] && window.GSA_isEmbeddedMode();
7699}
7700
7701function ss_handleQuery(query, waiting1) {
7702  if (waiting1 != ss_waiting) {
7703    return;
7704  }
7705  ss_waiting = 0;
7706  if (query == "") {
7707    ss_clear();
7708  } else {
7709    if (!ss_processed(query)) {
7710      if (ss_panic) {
7711        alert("run ajax when key change");
7712      }
7713      ss_suggest(query);
7714    } else {
7715      ss_show(query);
7716    }
7717  }
7718}
7719
7720function ss_removeNode_(node) {
7721  return node && node.parentNode ? node.parentNode.removeChild(node) : null;
7722}
7723
7724function ss_replaceNode_(newNode, oldNode) {
7725  var parentNode = oldNode.parentNode;
7726  if (parentNode) {
7727    parentNode.replaceChild(newNode, oldNode);
7728  }
7729}
7730
7731function ss_initEmbedMode_(inputEle) {
7732  var suggestFormEle = document.getElementById(ss_form_element);
7733  if (!suggestFormEle && ss_isEmbeddedMode_()) {
7734    var embedModeFormEle = document.createElement("form");
7735    embedModeFormEle.id = "suggestform" + new Date().getTime();
7736    var formParamsEle = document.getElementById("gsaembedmodeformparams");
7737    var inputEles = formParamsEle.getElementsByTagName("INPUT");
7738    for (var i = 0; i < inputEles.length; i++) {
7739      embedModeFormEle.appendChild(inputEles[i].cloneNode(true));
7740    }
7741    ss_replaceNode_(embedModeFormEle, formParamsEle);
7742    var bodyEle = document.getElementsByTagName("BODY")[0];
7743    bodyEle.appendChild(embedModeFormEle);
7744    ss_form_element = embedModeFormEle.id;
7745    var suggestPopupTableEle = document.createElement("table");
7746    suggestPopupTableEle.border = "0";
7747    suggestPopupTableEle.cellPadding = "0";
7748    suggestPopupTableEle.
7748cellSpacing = "0";
7749    suggestPopupTableEle.className = "ss-gac-m ss-embed-mode";
7750    suggestPopupTableEle.id = "sspop" + new Date().getTime();
7751    suggestPopupTableEle.style.visibility = "hidden";
7752    ss_popup_element = suggestPopupTableEle.id;
7753    inputEle.parentNode.insertBefore(suggestPopupTableEle, inputEle);
7754  }
7755}
7756
7757function ss_sf() {
7758  if (!ss_isEmbeddedMode_()) {
7759    document.getElementById(ss_form_element).q.focus();
7760  }
7761  ss_dismissed = false;
7762}
7763
7764function ss_clear(nofocus) {
7765  ss_qshown = null;
7766  var fo = document.getElementById(ss_form_element);
7767  var qnow = (!ss_qbackup) ? fo.q.value : ss_qbackup;
7768  ss_hide(qnow);
7769  if (!nofocus) {
7770    ss_sf();
7771  }
7772}
7773
7774function ss_hide(qry) {
7775  var tbl = document.getElementById(ss_popup_element);
7776  if (tbl.style.visibility == "visible") {
7777    if (ss_panic) {
7778      alert("close suggestion box");
7779    }
7780    if (ss_allow_debug && ss_debug && ss_debug.getDebugMode()) {
7781      ss_debug.addHideDebugLine(qry, "hide");
7782    }
7783    tbl.style.visibility = "hidden";
7784    tbl.setAttribute("aria-hidden", "true");
7785  }
7786}
7787
7788function ss_show(qry) {
7789  var currentQry = document.getElementById(ss_form_element).q.value;
7790  if (currentQry != qry) {
7791    if (ss_allow_debug && ss_debug && ss_debug.getDebugMode()) {
7792      ss_debug.addHideDebugLine(qry, "skip");
7793    }
7794    return;
7795  }
7796  var startTimeMs = new Date().getTime();
7797  if (ss_dismissed) {
7798    ss_qshown = null;
7799    ss_hide(qry);
7800    return;
7801  }
7802  if (!ss_processed(qry)) {
7803    return;
7804  }
7805  if (qry == "") {
7806    ss_hide(qry);
7807    return;
7808  }
7809  var g = ss_cached[qry] ? ss_cached[qry].g : null;
7810  var r = ss_cached[qry] ? ss_cached[qry].r : null;
7811  var disp = false;
7812  if (ss_use.g && g) {
7813    disp = true;
7814  }
7815  if (!disp) {
7816    ss_qshown = null;
7817    ss_hide(qry);
7818    return;
7819  }
7820  if (ss_painting) {
7821    if (ss_painting_queue) {
7822      clearTimeout(ss_painting_queue);
7823    }
7824    if (ss_allow_debug && ss_debug && ss_debug.getDebugMode()) {
7825      ss_debug.addWaitDebugLine(qry, "delay", ss_delay_millisec);
7826    }
7827    ss_painting_queue = setTimeout('ss_show("' + ss_escape(qry) + '")', ss_delay_millisec);
7828    return;
7829  } else {
7830    ss_painting = true;
7831  }
7832  var tbl = document.getElementById(ss_popup_element);
7833  for (var ri = tbl.rows.length - 1; ri > -1; ri--) {
7834    tbl.deleteRow(ri);
7835  }
7836  var cnt = 0;
7837  var rCount = 0;
7838  for (var z = 0; z < ss_seq.length; z++) {
7839    switch (ss_seq[z]) {
7840      case "g":
7841        cnt += ss_showSuggestion(g, cnt, tbl, qry);
7842        rCount += ss_showRelatedSuggestion(r, rCount, tbl, qry);
7843        break;
7844    }
7845    if (ss_max_to_display > 0 && cnt >= ss_max_to_display) {
7846      break;
7847    }
7848  }
7849  if (cnt > 0) {
7850    var row = tbl.insertRow(-1);
7851    row.className = "ss-gac-e";
7852    var cls = document.createElement("td");
7853    cls.colSpan = 2;
7854    var clsTxt = document.createElement("span");
7855    clsTxt.onclick = function() {
7856      ss_qbackup = null;
7857      ss_clear();
7858      var query = document.getElementById(ss_form_element).q.value;
7859      if (!ss_processed(query)) {
7860        ss_dismissed = true;
7861        if (ss_panic) {
7862          alert("run ajax when mouse close");
7863        }
7864        ss_suggest(query);
7865      }
7866    };
7867    cls.appendChild(clsTxt);
7868    row.appendChild(cls);
7869    tbl.style.visibility = "visible";
7870    tbl.setAttribute("aria-hidden", "false");
7871    ss_qshown = qry;
7872    if (ss_panic) {
7873      alert("open suggestion box for " + qry);
7874    }
7875    if (ss_allow_debug && ss_debug && ss_debug.getDebugMode()) {
7876      var stopTimeMs = new Date().getTime();
7877      ss_debug.addShowDebugLine(qry, stopTimeMs - startTimeMs, ss_cached[qry], cnt);
7878    }
7879  } else {
7880    ss_hide(qry);
7881  }
7882  ss_painting = false;
7883}
7884
7885function ss_showSuggestion(g, cnt, tbl, qry) {
7886  if (ss_max_to_display > 0 && cnt >= ss_max_to_display) {
7887    return 0;
7888  }
7889  if (g && g.length > 0) {
7890    lqry = qry.toLowerCase().replace(/\"/g, "");
7891    for (var i = 0; i < g.length; i++) {
7892      var row = tbl.insertRow(-1);
7893      row.onclick = ss_handleMouseC;
7894      row.onmousemove = ss_handleMouseM;
7895      row.className = SS_ROW_CLASS;
7896      var alt = document.createElement("td");
7897      if (g[i].q) {
7898        var txtNode = "<b>" + g[i].q.substr(0, lqry.length) + "</b>";
7899        if (g[i].q.length > lqry.length) {
7900          txtNode += g[i].q.substring(lqry.length);
7901        }
7902        alt.innerHTML = txtNode;
7903      } else {
7904        alt.innerHTML = "<i>" + g[i].t + "</i>";
7905      }
7906      alt.className = "ss-gac-c";
7907      row.appendChild(alt);
7908      var clue = "";
7909      if (i == 0 && g.length == 1) {
7910        clue = ss_g_one_name_to_display;
7911      } else {
7912        if (i == 0) {
7913          clue = ss_g_more_names_to_display;
7914        }
7915      }
7916      if (ss_max_to_display > 0 && cnt + i + 1 >= ss_max_to_display) {
7917        return i + 1;
7918      }
7919    }
7920    return g.length;
7921  }
7922  return 0;
7923}
7924
7925function ss_showRelatedSuggestion(g, cnt, tbl, qry) {
7926  if (ss_max_to_display > 0 && cnt >= ss_max_to_display) {
7927    return 0;
7928  }
7929  if (g && g.length > 0) {
7930    var headRow = tbl.insertRow(-1);
7931    headRow.onclick = ss_handleMouseC;
7932    headRow.onmousemove = ss_handleMouseM;
7933    headRow.className = SS_ROW_CLASS;
7934    var headAlt = document.createElement("td");
7935    headAlt.innerHTML = '<div id="ss-gac-line"></div><div id="ss-gac-related">Related Suggestions</div>';
7936    headRow.appendChild(headAlt);
7937    lqry = qry.toLowerCase().replace(/\"/g, "");
7938    for (var i = 0; i < g.length; i++) {
7939      var row = tbl.insertRow(-1);
7940      row.onclick = ss_handleMouseC;
7941      row.onmousemove = ss_handleMouseM;
7942      row.className = SS_ROW_CLASS;
7943      var alt = document.createElement("td");
7944      if (g[i].q) {
7945        var txtNode = "<a href=" + g[i].u + ">" + g[i].q + "</a>";
7946        alt.innerHTML = txtNode;
7947      } else {
7948        alt.innerHTML = "<i>" + g[i].t + "</i>";
7949      }
7950      alt.className = "ss-gac-c";
7951      row.appendChild(alt);
7952      var clue = "";
7953      if (i == 0 && g.length == 1) {
7954        clue = ss_g_one_name_to_display;
7955      } else {
7956        if (i == 0) {
7957          clue = ss_g_more_names_to_display;
7958        }
7959      }
7960      if (ss_max_to_display > 0 && cnt + i + 1 >= ss_max_to_display) {
7961        return i + 1;
7962      }
7963    }
7964    return g.length;
7965  }
7966  return 0;
7967}
7968
7969function ss_handleMouseM() {
7970  var fo = document.getElementById(ss_form_element);
7971  var tbl = document.getElementById(ss_popup_element);
7972  var rows = tbl.getElementsByTagName("tr");
7973  for (var ri = 0; ri < rows.length - 1; ri++) {
7974    if (rows[ri] == this && rows[ri].className != SS_ROW_SELECTED_CLASS) {
7975      rows[ri].className = SS_ROW_SELECTED_CLASS;
7976      if (!ss_qbackup) {
7977        ss_qbackup = fo.q.value;
7978      }
7979      ss_loc = ri;
7980      var suggestion = ss_locateSuggestion(ss_qbackup, ss_loc);
7981      if (suggestion.q) {
7982        fo.q.value = suggestion.q;
7983      } else {
7984        fo.q.value = ss_qbackup;
7985      }
7986    } else {
7987      if (rows[ri] != this) {
7988        rows[ri].className = SS_ROW_CLASS;
7989      }
7990    }
7991  }
7992  ss_sf();
7993  return true;
7994}
7995
7996function ss_handleMouseC() {
7997  var fo = document.getElementById(ss_form_element);
7998  var tbl = document.getElementById(ss_popup_element);
7999  var rows = tbl.getElementsByTagName("tr");
8000  for (var ri = 0; ri < rows.length - 1; ri++) {
8001    if (rows[ri] == this) {
8002      if (!ss_qbackup) {
8003        ss_qbackup = fo.q.value;
8004      }
8005      ss_loc = ri;
8006      var suggestion = ss_locateSuggestion(ss_qbackup, ss_loc);
8007      if (suggestion.q) {
8008        fo.q.value = suggestion.q;
8009        fo.submit();
8010      } else {
8011        fo.q.value = ss_qbackup;
8012        if (suggestion.u) {
8013          window.location.href = suggestion.u;
8014        }
8015      }
8016      break;
8017    }
8018  }
8019}
8020
8021function ss_countSuggestions(query) {
8022  var cnt = 0;
8023  for (var i = 0; i < ss_seq.length; i++) {
8024    switch (ss_seq[i]) {
8025      case "g":
8026        cnt += ss_cached[query].g ? ss_cached[query].g.length : 0;
8027        break;
8028    }
8029    if (ss_max_to_display > 0 && cnt >= ss_max_to_display) {
8030      return ss_max_to_display;
8031    }
8032  }
8033  return cnt;
8034}
8035
8036function ss_locateSuggestion(query, loc) {
8037  var cnt1 = 0;
8038  var cnt2 = 0;
8039  var type = null;
8040  for (var z = 0; z < ss_seq.length; z++) {
8041    switch (ss_seq[z]) {
8042      case "g":
8043        cnt2 += ss_cached[query].g ? ss_cached[query].g.length : 0;
8044        break;
8045    }
8046    if (loc >= cnt1 && loc < cnt2) {
8047      switch (ss_seq[z]) {
8048        case "g":
8049          var qV = ss_cached[query].g[loc - cnt1].q;
8050          if (qV) {
8051            return {
8052              "q": qV
8053            };
8054          } else {
8055            return {
8056              "u": ss_cached[query].g[loc - cnt1].u
8057            };
8058          }
8059      }
8060      break;
8061    }
8062    cnt1 = cnt2;
8063  }
8064  return null;
8065}
8066
8067function ss_escape(query) {
8068  return query.replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
8069}
8070
8071function ss_escapeDbg(query) {
8072  var escapedQuery = "";
8073  var ch = query.split("");
8074  for (var i = 0; i < ch.length; i++) {
8075    switch (ch[i]) {
8076      case "&":
8077        escapedQuery += "&amp;";
8078        break;
8079      case "<":
8080        escapedQuery += "&lt;";
8081        break;
8082      case ">":
8083        escapedQuery += "&gt;";
8084        break;
8085      default:
8086        escapedQuery += ch[i];
8087        break;
8088    }
8089  }
8090  return escapedQuery;
8091}
8092
8093function ss_Debugger() {
8094  this.debugMode = false;
8095}
8096ss_Debugger.DEBUG_CONSOLE_ID = "ss_debug_console";
8097ss_Debugger.DEBUG_CONTENT_ID = "ss_debug_content";
8098ss_Debugger.DEBUG_TOGGLE_ID = "ss_debug_toggle";
8099ss_Debugger.prototype.getDebugMode = function() {
8100  return this.debugMode;
8101};
8102ss_Debugger.prototype.activateConsole = function() {
8103  var console = document.getElementById(ss_Debugger.DEBUG_CONSOLE_ID);
8104  if (console) {
8105    console.style.display = "block";
8106  } else {
8107    var dc = document.createElement("div");
8108    dc.id = ss_Debugger.DEBUG_CONSOLE_ID;
8109    dc.zIndex = 100;
8110    dc.className = "expanded";
8111    var title = document.createElement("h1");
8112    title.appendChild(document.createTextNode("GSA Suggest Debug Console"));
8113    title.style.display = "inline";
8114    dc.appendChild(title);
8115    var actn = document.createElement("div");
8116    actn.style.styleFloat = "right";
8117    actn.style.cssFloat = "right";
8118    var btn = document.createElement("button");
8119    btn.onclick = function(event) {
8120      var debugContent = document.getElementById(ss_Debugger.DEBUG_CONTENT_ID);
8121      if (debugContent) {
8122        for (var ri = debugContent.rows.length - 1; ri > 0; ri--) {
8123          debugContent.deleteRow(ri);
8124        }
8125      }
8126    };
8127    btn.appendChild(document.createTextNode("Clear console"));
8128    actn.appendChild(btn);
8129    btn = document.createElement("button");
8130    btn.onclick = function(event) {
8131      ss_cached = [];
8132    };
8133    btn.appendChild(document.createTextNode("Clear cache"));
8134    actn.appendChild(btn);
8135    btn = document.createElement("button");
8136    btn.id = ss_Debugger.DEBUG_TOGGLE_ID;
8137    btn.onclick = function(event) {
8138      var debugConsole = document.getElementById(ss_Debugger.DEBUG_CONSOLE_ID);
8139      if (debugConsole) {
8140        var b = document.getElementById(ss_Debugger.DEBUG_TOGGLE_ID);
8141        if (debugConsole.className.indexOf("expanded") != -1) {
8142          debugConsole.className = debugConsole.className.replace(/expanded/, "contracted");
8143          b.innerHTML = "Maximize";
8144        } else {
8145          debugConsole.className = debugConsole.className.replace(/contracted/, "expanded");
8146          b.innerHTML = "Minimize";
8147        }
8148      }
8149    };
8150    btn.appendChild(document.createTextNode("Minimize"));
8151    actn.appendChild(btn);
8152    actn.style.display = "inline";
8153    dc.appendChild(actn);
8154    dc.appendChild(document.createElement("br"));
8155    var pane = document.createElement("table");
8156    pane.id = ss_Debugger.DEBUG_CONTENT_ID;
8157    var dhr = pane.insertRow(-1);
8158    var dhc = document.createElement("th");
8159    dhc.innerHTML = "Query";
8160    dhr.appendChild(dhc);
8161    dhc = document.createElement("th");
8162    dhc.innerHTML = "Type";
8163    dhr.appendChild(dhc);
8164    dhc = document.createElement("th");
8165    dhc.innerHTML = "Time";
8166    dhr.appendChild(dhc);
8167    dhc = document.createElement("th");
8168    dhc.innerHTML = "g";
8169    dhr.appendChild(dhc);
8170    dhc = document.createElement("th");
8171    dhc.innerHTML = "Total";
8172    dhr.appendChild(dhc);
8173    dc.appendChild(pane);
8174    document.body.appendChild(dc);
8175  }
8176  this.debugMode = true;
8177};
8178ss_Debugger.prototype.deactivateConsole = function() {
8179  var console = document.getElementById(ss_Debugger.DEBUG_CONSOLE_ID);
8180  if (console) {
8181    console.style.display = "none";
8182  }
8183  this.debugMode = false;
8184};
8185ss_Debugger.prototype.addRequestDebugLine = function(query, type, time, obj) {
8186  var debugContent = document.getElementById(ss_Debugger.DEBUG_CONTENT_ID);
8187  if (debugContent) {
8188    var currentRow = debugContent.insertRow(1);
8189    var currentCell = document.createElement("td");
8190    currentCell.innerHTML = "&lt;" + ss_escapeDbg(query) + "&gt;";
8191    currentRow.appendChild(currentCell);
8192    currentCell = document.createElement("td");
8193    currentCell.innerHTML = type;
8194    currentRow.appendChild(currentCell);
8195    currentCell = document.createElement("td");
8196    currentCell.className = "no";
8197    currentCell.innerHTML = time + " ms";
8198    currentRow.appendChild(currentCell);
8199    switch (type) {
8200      case "suggest":
8201        currentCell = document.createElement("td");
8202        currentCell.className = "no";
8203        currentCell.innerHTML = (obj.g ? obj.g.length : 0);
8204        currentRow.appendChild(currentCell);
8205        currentCell = document.createElement("td");
8206        currentRow.appendChild(currentCell);
8207        break;
8208      default:
8209        currentCell = document.createElement("td");
8210        currentRow.appendChild(currentCell);
8211        currentCell = document.createElement("td");
8212        currentRow.appendChild(currentCell);
8213        break;
8214    }
8215  }
8216};
8217ss_Debugger.prototype.addShowDebugLine = function(query, time, o, total) {
8218  var debugContent = document.getElementById(ss_Debugger.DEBUG_CONTENT_ID);
8219  if (debugContent) {
8220    var currentRow = debugContent.insertRow(1);
8221    var currentCell = document.createElement("td");
8222    currentCell.innerHTML = "&lt;" + ss_escapeDbg(query) + "&gt;";
8223    currentRow.appendChild(currentCell);
8224    currentCell = document.createElement("td");
8225    currentCell.innerHTML = "<i>show</i>";
8226    currentRow.appendChild(currentCell);
8227    currentCell = document.createElement("td");
8228    currentCell.className = "no";
8229    currentCell.innerHTML = time + " ms";
8230    currentRow.appendChild(currentCell);
8231    currentCell = document.createElement("td");
8232    currentCell.className = "no";
8233    currentCell.innerHTML = (o ? (o.g ? o.g.length : 0) : 0);
8234    currentRow.appendChild(currentCell);
8235    currentCell = document.createElement("td");
8236    currentCell.className = "no";
8237    currentCell.innerHTML = total;
8238    currentRow.appendChild(currentCell);
8239  }
8240};
8241ss_Debugger.prototype.addHideDebugLine = function(query, type) {
8242  var debugContent = document.getElementById(ss_Debugger.DEBUG_CONTENT_ID);
8243  if (debugContent) {
8244    var currentRow = debugContent.insertRow(1);
8245    var currentCell = document.createElement("td");
8246    currentCell.innerHTML = "&lt;" + ss_escapeDbg(query) + "&gt;";
8247    currentRow.appendChild(currentCell);
8248    currentCell = document.createElement("td");
8249    currentCell.innerHTML = "<i>" + type + "</i>";
8250    currentRow.appendChild(currentCell);
8251    currentCell = document.createElement("td");
8252    currentCell.className = "no";
8253    currentCell.innerHTML = "0 ms";
8254    currentRow.appendChild(currentCell);
8255    currentCell = document.createElement("td");
8256    currentRow.appendChild(currentCell);
8257    currentCell = document.createElement("td");
8258    currentRow.appendChild(currentCell);
8259  }
8260};
8261ss_Debugger.prototype.addWaitDebugLine = function(query, type, time) {
8262  var debugContent = document.getElementById(ss_Debugger.DEBUG_CONTENT_ID);
8263  if (debugContent) {
8264    var currentRow = debugContent.insertRow(1);
8265    var currentCell = document.createElement("td");
8266    currentCell.innerHTML = "&lt;" + ss_escapeDbg(query) + "&gt;";
8267    currentRow.appendChild(currentCell);
8268    currentCell = document.createElement("td");
8269    currentCell.innerHTML = "<i>" + type + "</i>";
8270    currentRow.appendChild(currentCell);
8271    currentCell = document.createElement("td");
8272    currentCell.className = "no";
8273    currentCell.innerHTML = time + " ms";
8274    currentRow.appendChild(currentCell);
8275    currentCell = document.createElement("td");
8276    currentRow.appendChild(currentCell);
8277    currentCell = document.createElement("td");
8278    currentRow.appendChild(currentCell);
8279  }
8280};
8281var ss_use = {};
8282ss_use.g = ss_seq.indexOf("g") >= 0 ? true : false;
8283$(window).on('load', function() {
8284  var $inputField = $("#inputTopSearchField"),
8285    $searchButton = $(".register");
8286  $searchButton.attr("disabled", true);
8287  $inputField.keyup(function() {
8288    var trigger = false;
8289    $inputField.each(function() {
8290      if (!$(this).val()) {
8291        trigger = true;
8292      }
8293    });
8294    trigger ? $searchButton.attr("disabled", true) : $searchButton.removeAttr("disabled");
8295  });
8296});
8297WF.Component.BannerLightbox = function() {
8298  var link = "";
8299  var newId = "";
8300  var offset = 0;
8301  var fadeSpeed = 500;
8302  var obj = {};
8303  $(".bannerThumb-item").each(function() {
8304    link = $("a", this).attr("id");
8305    newId = link.replace("link", "content");
8306    obj = $(this);
8307    var clist = WF.Utils.getClist(this);
8308    $(this).clone().appendTo($(this)).attr("id", newId).attr("class", "bannerThumb-content").find(".bannerThumb-details").removeClass("bannerThumb-details");
8309    $(this).attr("aria-haspopup", "true");
8310    $(this).find("h2 > a").data("newId", newId).data("obj", obj).bind("click keypress", function(e) {
8311      if (e.type == "keypress" && e.keyCode != 13) {
8312        return;
8313      }
8314      var popObj = "#" + $(this).data("newId");
8315      var object = $(this).data("obj");
8316      offset = $(object).offset();
8317      $(popObj).css({
8318        "top": offset.top + 10,
8319        "left": offset.left + 10
8320      });
8321      $(".bannerThumb-content").fadeOut(fadeSpeed).attr("aria-hidden", "true");
8322      $(popObj).fadeIn(fadeSpeed, function() {
8323        $(popObj).find(".c28aLink").each(function() {
8324          new WF.Component.LightBox(this);
8325        });
8326        $(popObj).find("h2").attr("tabindex", 0).focus();
8327      }).attr("aria-hidden", "false");
8328      $("body").data("lastClickedAbout", $(this));
8329      WF.Utils.trackVS({
8330        "event": "LinkActivated",
8331        "eventType": e.type,
8332        "eventDescription": "aboutPageTopicOpen",
8333        "custom-topic-title": $.trim($(this).text()),
8334        "clist": clist
8335      });
8336      return false;
8337    });
8338    $("#" + newId).attr({
8339      "role": "dialog",
8340      "aria-labelledby": newId
8341    }).prepend($('<span class="bannerThumb-close"><a href="#"><img src="/assets/images/global/btn-close-x.png" alt="Close"/></a></span>'));
8342    var triggerLink = $("#" + newId).find(".bannerThumb-link");
8343    $(triggerLink).replaceWith($(triggerLink).html());
8344    $(".bannerThumb-content ul li a").click(function() {
8345      return true;
8346    });
8347    $(".bannerThumb-close, .c28close").bind("click", function() {
8348      $(".bannerThumb-content").fadeOut(fadeSpeed).attr("aria-hidden", "true");
8349      return false;
8350    });
8351    $(document).keyup(function(e) {
8352      if (e.keyCode === 27) {
8353        $(".bannerThumb-content").fadeOut(fadeSpeed).attr("aria-hidden", "true");
8354        $("body").data("lastClickedAbout").focus();
8355      }
8356    });
8357  });
8358  var offsetFix = ($("html").hasClass("ie7")) ? 0 : -102;
8359  $(window).resize(function() {
8360    var popObj = $(".bannerThumb-content:visible");
8361    if ($("body").data("lastClickedAbout")) {
8362      var offset = $("body").data("lastClickedAbout").offset();
8363      $(popObj).css({
8364        "top": (offset.top + offsetFix) + 10,
8365        "left": offset.left + 10
8366      });
8367    }
8368  });
8369};
8370WF.OnLoads.setupBannerLightbox = function() {
8371  WF.Component.BannerLightbox();
8372};
8373WF.Component.SocialShare = {};
8374WF.Component.SocialShare.Options = {
8375  "VisibleWidgetItems": ["Facebook", "Twitter"],
8376  "PopupItems": ["LinkedIn", "GooglePlus", "email"],
8377  "ParameterSharingStyle": "listed",
8378  "ParametersToShare": ["hmc", ],
8379  "ParametersToNeverShare": ["utm_source", ],
8380  "Shares": {
8381    "email": {
8382      "Name": {
8383        "en": "Email",
8384        "es": "Correo electr&oacute;nico"
8385      },
8386      "ShareUrl": "mailto:?body=EMAIL_BODY&subject=EMAIL_SUBJECT",
8387      "ImageClass": "email",
8388      "OldStyleImageClass": "c52email"
8389    },
8390    "Facebook": {
8391      "Name": {
8392        "en": "Facebook",
8393        "es": "Facebook"
8394      },
8395      "ShareUrl": "http://www.facebook.com/sharer.php?u=(THIS_URL?ss=fb)&t=THIS_HEADER",
8396      "ImageClass": "facebook",
8397      "OldStyleImageClass": "c52fb",
8398      "TrackingCodeShort": "fb",
8399      "TrackingCodeLong": "facebook",
8400      "OpenInLightbox": true,
8401      "LightboxUrl": "/exit/social?site=facebook"
8402    },
8403    "GooglePlus": {
8404      "Name": {
8405        "en": "Google+",
8406        "es": "Google+"
8407      },
8408      "ShareUrl": "https://plus.google.com/share?url=(THIS_URL?ss=gp)",
8409      "ImageClass": "gplus",
8410      "OldStyleImageClass": "c52googleplus",
8411      "TrackingCodeShort": "gp",
8412      "TrackingCodeLong": "googleplus"
8413    },
8414    "Instagram": {
8415      "Name": {
8416        "en": "Instagram",
8417        "es": "Instagram"
8418      },
8419      "ShareUrl": "/exit/social?site=INSTAGRAM_MAYBE",
8420      "ImageClass": "instagram"
8421    },
8422    "LinkedIn": {
8423      "Name": {
8424        "en": "LinkedIn",
8425        "es": "LinkedIn"
8426      },
8427      "ShareUrl": "http://www.linkedin.com/shareArticle?mini=true&ro=false&url=(THIS_URL?ss=ln)&summary=THIS_TITLE&title=THIS_TITLE&source=",
8428      "ImageClass": "linkedin",
8429      "OldStyleImageClass": "c52linkedin",
8430      "TrackingCodeShort": "ln",
8431      "TrackingCodeLong": "linkedin"
8432    },
8433    "Pinterest": {
8434      "Name": {
8435        "en": "Pinterest",
8436        "es": "Pinterest"
8437      },
8438      "ShareUrl": "/exit/social?site=PINTEREST_MAYBE",
8439      "ImageClass": "pinterest"
8440    },
8441    "Twitter": {
8442      "Name": {
8443        "en": "Twitter",
8444        "es": "Twitter"
8445      },
8446      "ShareUrl": "http://twitter.com/share?url=(THIS_URL?ss=tw)&text=Discover THIS_HEADER from Wells Fargo - ",
8447      "ImageClass": "twitter",
8448      "OldStyleImageClass": "c52twitter",
8449      "TrackingCodeShort": "tw",
8450      "TrackingCodeLong": "twitter",
8451      "OpenInLightbox": true,
8452      "LightboxUrl": "/exit/social?site=twitter"
8453    }
8454  },
8455  "Strings": {
8456    "BeginningOfPopup": {
8457      "en": "Beginning of popup",
8458      "es": "Comienzo de ventana emergente"
8459    },
8460    "EndOfPopup": {
8461      "en": "End of popup",
8462      "es": "Fin de ventana emergente"
8463    },
8464    "Share": {
8465      "en": "Share",
8466      "es": "Comparta"
8467    },
8468    "DisclosureHeader": {
8469      "en": "Share this page",
8470      "es": "Comparta esta p&aacute;gina"
8471    },
8472    "DisclosureText": {
8473      "en": "Choose a link above. We provide these links to external websites for your convenience. Wells Fargo does not endorse and is not responsible for their content, links, privacy policies, or security policies.",
8474      "es": "Seleccione uno de los enlaces electr&oacute;nicos arriba. Para su conveniencia, le proporcionamos estos enlaces electr&oacute;nicos a sitios de Internet externos. Wells Fargo no avala ni se hace responsable por el contenido, los enlaces electr&oacute;nicos, las pol&iacute;ticas de privacidad o las pol&iacute;ticas de seguridad de esos sitios de Internet."
8475    },
8476    "EmailIntro": {
8477      "en": "Hi,\n\nI thought you'd be interested in this page I found on wellsfargo.com: \n\n",
8478      "es": "Pens&eacute; que podr&iacute;a interesarle esta p&aacute;gina que encontr&eacute; en wellsfargo.com/spanish:\n\n"
8479    }
8480  }
8481};
8482WF.Component.SocialShare.Widget = function(el) {
8483  el = $(el).get(0);
8484  if (el.id) {
8485    return;
8486  } else {
8487    el.id = WF.Utils.generateUniqueId(el);
8488  }
8489  var self = this,
8490    $el = $(el),
8491    $visibleWidget, $popupContainer, $popupOpener, $pageHeader = $("h1"),
8492    $pageTitle = $("title"),
8493    useOldStyle = $el.hasClass("c52noLink");
8494  this.createVisibleWidget = function() {
8495    $visibleWidget = $('<div class="VisibleWidget"/>');
8496    $el.append($visibleWidget);
8497    $visibleWidget.append('<div class="labelText">' + WF.Component.SocialShare.Options.Strings.Share[WF.Page.lang] + "</div>");
8498    $.each(WF.Component.SocialShare.Options.VisibleWidgetItems, function(i, item) {
8499      self.createVisibleLink(item);
8500    });
8501    $popupOpener = $('<a href="#" class="PopupOpener" aria-haspopup="true"> </a>').click(function(evt) {
8502      if ($(this).hasClass("active")) {
8503        self.hide(evt);
8504      } else {
8505        $(".PopupOpener").removeClass("active");
8506        $(".Popup").hide();
8507        self.show(evt);
8508      }
8509    });
8510    $visibleWidget.append($popupOpener);
8511  };
8512  this.createOldStyleVisibleWidget = function() {
8513    $visibleWidget = $el;
8514    $visibleWidget.html(WF.Component.SocialShare.Options.Strings.Share[WF.Page.lang]);
8515    $visibleWidget = $visibleWidget.parent();
8516    $.each(WF.Component.SocialShare.Options.VisibleWidgetItems, function(i, item) {
8517      self.createVisibleLink(item);
8518    });
8519    $popupOpener = $('<a href="#" class="c52Link PopupOpener" aria-haspopup="true"> </a>').click(function(evt) {
8520      if ($(this).hasClass("active")) {
8521        self.hide(evt);
8522      } else {
8523        $(".c52Link").removeClass("active");
8524        $(".c52").hide();
8525        self.show(evt);
8526      }
8527    });
8528    $visibleWidget.append($popupOpener);
8529  };
8530  this.createVisibleLink = function(item) {
8531    var $link = $("<a/>"),
8532      opts = WF.Component.SocialShare.Options.Shares[item],
8533      linkClass = (useOldStyle) ? opts.OldStyleImageClass : "ShareLink";
8534    hiddenSpanClass = (useOldStyle) ? "jaws_hidden" : "hide_from_sight";
8535    $link.append($('<span class="' + hiddenSpanClass + '">' + opts.Name[WF.Page.lang] + "</span>")).attr({
8536      "class": linkClass,
8537      "href": self.fixUpUrl(opts.ShareUrl),
8538      "target": "_blank",
8539      "aria-haspopup": "true"
8540    }).addClass(opts.ImageClass).bind("click keypress", function(evt) {
8541      if (evt.type == "keypress" && evt.keyCode != 13) {
8542        return;
8543      }
8544      WF.Utils.trackVS({
8545        "url": WF.Utils.addUrlParam(window.location.href, "ss", opts.TrackingCodeShort),
8546        "event": "LinkActivated",
8547        "eventType": evt.type,
8548        "eventDescription": opts.TrackingCodeLong + "Continue"
8549      });
8550    });
8551    if (opts.OpenInLightbox) {
8552      $link.addClass("c28aLink").data("lightboxOptions", '{"exitPageDestination": "' + self.fixUpUrl(opts.ShareUrl) + '"}').attr("href", self.fixUpUrl(opts.LightboxUrl));
8553    }
8554    if ($link.attr("href").search(/^\//) > -1 && window.location.pathname.search(/^\/es\//) > -1) {
8555      $link.attr("href", "/es" + $link.attr("href"));
8556    }
8557    $visibleWidget.append($link);
8558  };
8559  this.createPopup = function() {
8560    var $ul;
8561    $popupContainer = $('<div class="Popup"/>');
8562    $popupContainer.attr({
8563      "aria-label": "popup",
8564      "aria-hidden": "true"
8565    });
8566    $popupContainer.append($('<span class="hide_from_sight" tabindex="0"/>').append(WF.Component.SocialShare.Options.Strings.BeginningOfPopup[WF.Page.lang]));
8567    $popupContainer.append($('<h2 class="DisclosureHeader" />').append(WF.Component.SocialShare.Options.Strings.DisclosureHeader[WF.Page.lang]));
8568    $popupContainer.bind("keypress", function(evt) {
8569      if (evt.keyCode == 27) {
8570        self.hide(evt);
8571      }
8572    });
8573    $ul = $('<ul class=""/>');
8574    $.each(WF.Component.SocialShare.Options.PopupItems, function(i, item) {
8575      var opts = WF.Component.SocialShare.Options.Shares[item];
8576      $ul.append($("<li/>").append($("<a/>").addClass("ShareLink").addClass(opts.ImageClass).attr("href", self.fixUpUrl(opts.ShareUrl)).attr("target", "_blank").html(opts.Name[WF.Page.lang]).bind("click keypress", function(evt) {
8577        if (evt.type == "keypress" && evt.keyCode != 13) {
8578          return;
8579        }
8580        WF.Utils.trackVS({
8581          "url": WF.Utils.addUrlParam(window.location.href, "ss", opts.TrackingCodeShort),
8582          "event": "LinkActivated",
8583          "eventType": evt.type,
8584          "eventDescription": opts.TrackingCodeLong + "Continue"
8585        });
8586      })));
8587    });
8588    $popupContainer.append($ul);
8589    $popupContainer.append($('<p class="Disclosure" />').html(WF.Component.SocialShare.Options.Strings.DisclosureText[WF.Page.lang]));
8590    $popupContainer.append($('<span class="hide_from_sight" tabindex="0"/>').append(WF.Component.SocialShare.Options.Strings.EndOfPopup[WF.Page.lang]));
8591    $visibleWidget.after($popupContainer);
8592  };
8593  this.createOldStylePopup = function() {
8594    var $ul;
8595    $popupContainer = $el.parents(".sideUtility").find(".c52");
8596    $popupContainer.append($('<span class="hide" tabindex="0"/>').append(WF.Component.SocialShare.Options.Strings.BeginningOfPopup[WF.Page.lang]));
8597    $popupContainer.append($('<h2 class="DisclosureHeader" />').append(WF.Component.SocialShare.Options.Strings.DisclosureHeader[WF.Page.lang]));
8598    $popupContainer.bind("keypress", function(evt) {
8599      if (evt.keyCode == 27) {
8600        self.hide(evt);
8601      }
8602    });
8603    $ul = $('<ul class="SocialShareList"/>');
8604    $.each(WF.Component.SocialShare.Options.PopupItems, function(i, item) {
8605      var opts = WF.Component.SocialShare.Options.Shares[item];
8606      $ul.append($("<li/>").append($("<a/>").addClass("ShareLink").addClass(opts.OldStyleImageClass).attr("href", self.fixUpUrl(opts.ShareUrl)).attr("target", "_blank").html(opts.Name[WF.Page.lang]).bind("click keypress", function(evt) {
8607        if (evt.type == "keypress" && evt.keyCode != 13) {
8608          return;
8609        }
8610        WF.Utils.trackVS({
8611          "url": WF.Utils.addUrlParam(window.location.href, "ss", opts.TrackingCodeShort),
8612          "event": "LinkActivated",
8613          "eventType": evt.type,
8614          "eventDescription": opts.TrackingCodeLong + "Continue"
8615        });
8616      })));
8617    });
8618    $popupContainer.append($ul);
8619    $popupContainer.append($('<p class="Disclosure" />').html(WF.Component.SocialShare.Options.Strings.DisclosureText[WF.Page.lang]));
8620    $popupContainer.append($('<span class="hide" tabindex="0"/>').append(WF.Component.SocialShare.Options.Strings.EndOfPopup[WF.Page.lang]));
8621  };
8622  this.fixUpUrl = function(url) {
8623    var pageHeader = $("h1:first").clone();
8624    pageHeader.find("span").remove();
8625    pageHeader = WF.Utils.removeHtmlTags(pageHeader.html()).replace(/[^\x20-\x7f-]/g, "").replace(/\s*-\s*$/, "");
8626    url = url.replace(/EMAIL_BODY/g, function() {
8627      var metaDesc = "";
8628      if (navigator.userAgent.indexOf("MSIE") == -1) {
8629        metaDesc = "\n" + $("meta[name=description]").attr("content");
8630      }
8631      return encodeURIComponent(WF.Component.SocialShare.Options.Strings.EmailIntro[WF.Page.lang] + pageHeader + metaDesc + "\n\n") + "(THIS_URL?ss=email)";
8632    });
8633    pageHeader = pageHeader.replace(/&amp;/g, "&");
8634    url = url.replace(/THIS_HEADER/g, encodeURIComponent(pageHeader));
8635    url = url.replace(/EMAIL_SUBJECT/g, "Wellsfargo.com: " + encodeURIComponent(pageHeader));
8636    url = url.replace(/THIS_TITLE/g, encodeURIComponent(document.title));
8637    url = url.replace(/\(THIS_URL(\?[a-z0-9=&\+_]+)?\)/g, function(all, params) {
8638      var pageUrl = window.location.href;
8639      if (params) {
8640        params = params.substr(1);
8641        $.each(params.split(/&/), function(i, pair) {
8642          var x = pair.split("=");
8643          pageUrl = WF.Utils.addUrlParam(pageUrl, x[0], x[1]);
8644        });
8645      }
8646      var parsedUrl = self.parseUrl(pageUrl);
8647      if (WF.Component.SocialShare.Options.ParameterSharingStyle == "listed") {
8648        $.each(parsedUrl.parameters, function(k, v) {
8649          if ($.inArray(k, WF.Component.SocialShare.Options.ParametersToShare) == -1) {
8650            delete parsedUrl.parameters[k];
8651          }
8652        });
8653      } else {
8654        if (WF.Component.SocialShare.Options.ParameterSharingStyle == "all") {
8655          $.grep(parsedUrl.parameters, function(v, k) {
8656            if ($.inArray(k, WF.Component.SocialShare.Options.ParametersToNeverShare) != -1) {
8657              delete parsedUrl.parameters[k];
8658            }
8659          });
8660        }
8661      }
8662      return encodeURIComponent(self.constructUrl(parsedUrl));
8663    });
8664    return url;
8665  };
8666  this.show = function(evt) {
8667    evt.preventDefault();
8668    self.positionPopup();
8669    $visibleWidget.find(".PopupOpener").addClass("active");
8670    $popupContainer.show().removeClass("hide");
8671    WF.Utils.trackVS({
8672      "event": "LinkActivated",
8673      "eventType": evt.type,
8674      "eventDescription": "socialShareOpen"
8675    });
8676  };
8677  this.hide = function(evt) {
8678    evt.preventDefault();
8679    $visibleWidget.find(".PopupOpener").removeClass("active");
8680    $popupContainer.hide();
8681    WF.Utils.trackVS({
8682      "event": "LinkActivated",
8683      "eventType": evt.type,
8684      "eventDescription": "socialShareClosed"
8685    });
8686  };
8687  this.positionPopup = function() {
8688    var opener_pos = $popupOpener.offset(),
8689      opener_size = WF.Utils.getDimensions($popupOpener),
8690      dir, marginBottom = parseFloat($popupOpener.css("marginBottom").replace(/[^0-9.-]/g, ""), 10),
8691      paddingBottom = parseFloat($popupOpener.css("paddingBottom").replace(/[^0-9.-]/g, ""), 10),
8692      paddingTop = parseFloat($popupOpener.css("paddingTop").replace(/[^0-9.-]/g, ""), 10),
8693      offsetX = 0,
8694      offsetY = 15;
8695    if ($popupOpener.hasClass("c52Link")) {
8696      if ($popupOpener.parents(".sideUtility").hasClass("top")) {
8697        dir = "tr";
8698        offsetX = -43;
8699        offsetY = 15;
8700      } else {
8701        dir = "bl";
8702        offsetX = 0;
8703        offsetY = 13;
8704      }
8705    } else {
8706      dir = self.getViewportQuadrant(opener_pos);
8707    }
8708    if (dir.substr(0, 1) == "b") {
8709      offsetY -= 12;
8710    }
8711    if (dir.substr(1, 1) == "r") {
8712      offsetX += 12;
8713    }
8714    switch (dir) {
8715      case "tl":
8716        $popupContainer.css({
8717          "top": (opener_pos.top + opener_size.height + marginBottom + offsetY) + "px",
8718          "left": (opener_pos.left + offsetX) + "px"
8719        });
8720        break;
8721      case "tr":
8722        $popupContainer.css({
8723          "top": (opener_pos.top + opener_size.height + marginBottom + offsetY) + "px",
8724          "right": ($("body").width() - (opener_pos.left + opener_size.width) + offsetX) + "px"
8725        });
8726        break;
8727      case "bl":
8728        $popupContainer.css({
8729          "top": (opener_pos.top - $popupContainer.height() - offsetY - paddingBottom - paddingTop - marginBottom) + "px",
8730          "left": (opener_pos.left + offsetX) + "px"
8731        });
8732        break;
8733      case "br":
8734        $popupContainer.css({
8735          "top": (opener_pos.top - $popupContainer.height() - offsetY - paddingBottom - paddingTop - marginBottom) + "px",
8736          "right": ($("body").width() - (opener_pos.left + opener_size.width) + offsetX) + "px"
8737        });
8738        break;
8739    }
8740    $popupContainer.removeClass("tl").removeClass("tr").removeClass("bl").removeClass("br").addClass(dir);
8741  };
8742  this.getViewportQuadrant = function(pos) {
8743    var scroll = {
8744      "top": $(window).scrollTop(),
8745      "left": $(window).scrollLeft()
8746    };
8747    var bounds = WF.Utils.getViewportSize();
8748    var vert = "b",
8749      horz = "l";
8750    if ((pos.top - scroll.top) < bounds.height / 2) {
8751      vert = "t";
8752    }
8753    if ((pos.left - scroll.left) > bounds.width / 2) {
8754      horz = "r";
8755    }
8756    return vert + horz;
8757  };
8758  this.constructUrl = function(urlObj) {
8759    var ret = urlObj.protocol + "://" + urlObj.hostname + urlObj.port + urlObj.pathname;
8760    if (urlObj.protocol == "file") {
8761      ret = ret.replace("://", ":///");
8762    }
8763    if (!$.isEmptyObject(urlObj.parameters)) {
8764      ret += "?" + $.map(urlObj.parameters, function(v, k) {
8765        return encodeURIComponent(k) + "=" + encodeURIComponent(v);
8766      }).join("&");
8767    }
8768    if (urlObj.anchor.length > 1) {
8769      ret += urlObj.anchor;
8770    }
8771    return ret;
8772  };
8773  this.parseUrl = function(url) {
8774    var ret = {
8775      "protocol": "",
8776      "hostname": "",
8777      "port": "",
8778      "pathname": "/",
8779      "parameters": {},
8780      "anchor": "#"
8781    };
8782    var match;
8783    if (match = url.match(/^(https?):/)) {
8784      ret.protocol = match[1];
8785    } else {
8786      return false;
8787    }
8788    if (match = url.match(/:\/\/(([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,10})[\/:$]/i)) {
8789      ret.hostname = match[1].toLowerCase();
8790    } else {
8791      return false;
8792    }
8793    if (match = url.match(/:(\d{1,5})[\/$]/)) {
8794      ret.port = match[1];
8795    }
8796    if (match = url.match(/.{9}[0-9a-z:]\/([-a-z0-9_\/\.% ]+)/i)) {
8797      ret.pathname += match[1];
8798    }
8799    if (match = url.match(/#(\w+)/)) {
8800      ret.anchor += match[1];
8801    }
8802    if (match = url.match(/\?([-\w\.!~\*'\(\)%+&=\.]+)/)) {
8803      $.each(match[1].split("&"), function(i, pair) {
8804        var temp = decodeURIComponent(pair).replace(/\+/g, " ").split("=");
8805        if (temp[1].match(/^-?[\d\.]+$/)) {
8806          if (temp[1].match(/\./)) {
8807            temp[1] = parseFloat(temp[1], 10);
8808          } else {
8809            temp[1] = parseInt(temp[1], 10);
8810          }
8811        } else {
8812          if (temp[1].match(/^(true|false)$/i)) {
8813            temp[1] = (temp[1].search(/^true$/i) != -1);
8814          }
8815        }
8816        ret.parameters[temp[0]] = temp[1];
8817      });
8818    }
8819    return ret;
8820  };
8821  this.init = function() {
8822    if (useOldStyle) {
8823      self.createOldStyleVisibleWidget();
8824      self.createOldStylePopup();
8825    } else {
8826      self.createVisibleWidget();
8827      self.createPopup();
8828    }
8829    WF.OnLoads.setupLightboxes($el.parent());
8830  };
8831  self.init();
8832};
8833WF.OnLoads.setupSocialShare = function(root) {
8834  if (WF.Component.SocialShare.hasRunSetup) {
8835    return;
8836  } else {
8837    WF.Component.SocialShare.hasRunSetup = true;
8838  }
8839  if (typeof root == "undefined") {
8840    root = $("body");
8841  }
8842  $(root).find(".SocialShare").each(function() {
8843    new WF.Component.SocialShare.Widget(this);
8844  });
8845  $(root).find(".sideUtility ul li a.printLink").parent().each(function() {
8846    $(this).after('<li><span>&nbsp;</span><div class="c52noLink"></div>');
8847    var elem = $(this).parent().find(".c52noLink").get(0);
8848    new WF.Component.SocialShare.Widget($(this).parent().find(".c52noLink"));
8849  });
8850};
8851WF.Component.FinEdShowMore = function(elem) {
8852  var $link = $(elem);
8853  var self = this;
8854  var dataAttributes = ["primaryTopic", "secondaryTopic", "tertiaryTopic", "publicationId", "pageId", "primaryId1", "primaryId2", "primaryId3", "startArticle", "endArticle", "templateId"];
8855  this.buildPostQueryMap = function($link) {
8856    var ret = {};
8857    $.each(dataAttributes, function(idx, val) {
8858      ret[val] = $link.data(val);
8859    });
8860    return ret;
8861  };
8862  this.findOutermostNode = function($link) {
8863    var $node = $link.parent();
8864    if ($node.parent().get(0).tagName == "ASIDE") {
8865      $node = $node.parent();
8866    }
8867    return $node;
8868  };
8869  this.getClist = function() {
8870    var clist = [];
8871    var $item = self.findOutermostNode($link).prev();
8872    while ($item.get(0).tagName == "ARTICLE") {
8873      clist.push($item);
8874      $item = $item.prev();
8875    }
8876    clist = $.map(clist, function($article) {
8877      var cid = $article.data("cid");
8878      var ctid = $article.data("ctid");
8879      return WF.Utils.stripTcm(cid + "~" + ctid);
8880    }).reverse().join("|");
8881    return clist;
8882  };
8883  this.updateLinkDataAttributes = function(data) {
8884    if (data.response.startArticleIndex) {
8885      $link.data("startArticle", data.response.startArticleIndex);
8886    }
8887    if (data.response.endArticleIndex) {
8888      $link.data("endArticle", data.response.endArticleIndex);
8889    }
8890  };
8891  WF.Utils.trackVS({
8892    "event": "PageLoad",
8893    "eventDescription": "DisplaySecondaryArticleList",
8894    "clist": self.getClist()
8895  });
8896  $link.bind("click keypress", function(evt) {
8897    if (evt.type == "keypress" && evt.keyCode != 13) {
8898      return;
8899    }
8900    var url = $(this).data("requestUrl") || "/as/SecondaryArticles";
8901    var clist = $.map($(".mainContentCol").find(".c48").parent(), function(jq) {
8902      jq = $(jq);
8903      var cid = jq.data("cid");
8904      var ctid = jq.data("ctid");
8905      return WF.Utils.stripTcm(cid + "~" + ctid);
8906    }).join("|");
8907    $.post(url, self.buildPostQueryMap($link), function(data, txtStatus) {
8908      if (!data.response) {
8909        $link.fadeOut(500);
8910        return;
8911      }
8912      self.updateLinkDataAttributes(data);
8913      var clist = [];
8914      for (var i = 0; i < data.response.secondaryArticles.length; i++) {
8915        var $node = $(data.response.secondaryArticles[i].articleContent);
8916        $node.css("display", "none").insertBefore(self.findOutermostNode($link)).slideDown(500);
8917        var cid = data.response.secondaryArticles[i].articleComponentId;
8918        var ctid = data.response.secondaryArticles[i].articleComponentTemplateId;
8919        clist.push(WF.Utils.stripTcm(cid + "~" + ctid));
8920      }
8921      if (data.response && !data.response.showMoreLink) {
8922        $link.parent().html(WF.Strings.Components.ShowMore.noMoreArticles[WF.Page.lang]);
8923      }
8924      WF.Utils.trackVS({
8925        "event": "LinkActivated",
8926        "eventType": evt.type,
8927        "eventDescription": "DisplaySecondaryArticleList",
8928        "clist": clist.join("|")
8929      });
8930    }, "json");
8931    evt.preventDefault();
8932  });
8933};
8934WF.OnLoads.setupFinEdShowMores = function(root) {
8935  if ($(root).get(0).tagName != "BODY") {
8936    return;
8937  }
8938  if (!$(".c48").length && !WF.Browser.isMobile) {
8939    return;
8940  }
8941  WF.Page.FinEdShowMore = [];
8942  $(root).find(".c48showMore a").each(function() {
8943    WF.Component.FinEdShowMore(this);
8944  });
8945};
8946WF.Utils.convertVarsToNamespaces();
8947$(document).ready(function() {
8948  if (typeof window.WFonDocReady == "function") {
8949    window.WFonDocReady();
8950  }
8951  if ($("html").hasClass("lt-ie9")) {
8952    $("body").addClass("not_a_real_class").removeClass("not_a_real_class");
8953  }
8954  if (WF.Browser.supports.IE7mode) {
8955    $("a[href$=#]:not(.c16header a, .c58question a, .c65 li.wf-tab a, .c66filterTabs li.wf-tab a)").click(function() {
8956      window.location.href = this.href;
8957    });
8958  }
8959  if (window.location.hash && window.location.hash.length > 1) {
8960    WF.Utils.setDelayedScrollTo(window.location.hash);
8961  }
8962});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.