(function($) { if (typeof($.bell) !== "object") { $.bell = {}; } $.bell.page = { isHomePage: false, isShop: true, init: function () { var $body = $("body"), languageResourceEnabled = false, disableLinkHTML = "", $homePage = $("#homePageShop"), // variables for supports section pageH1Array, pageH1ArrayLength, $pageH1, pageH1Word, pageH1Modified = "", pageH1Wrapped = false; $body.removeClass("noJs"); if ($.isFunction($.getText)) { languageResourceEnabled = true; // Add accessibility warning message disableLinkHTML = ""+$.getText("accessibilityLink")+""; $body.prepend("

"+$.getText("accessibilityMsg")+disableLinkHTML+"

"); // disable accessibility fn (functions)? /*global window */ if (window.location.search.indexOf("disableFn=1") !== -1) { $.bell.disableFn(); } } if ($homePage.length) { this.isHomePage = true; this.runHomePage(); } else { this.runHomePage(); // *** exception routines for support sections *** this.isShop = $body.find(".shopSection:first").length > 0? true: false; if (!this.isShop) { $body.find("h1").each(function() { $pageH1 = $(this); pageH1Array = $pageH1.text().split(" : "); pageH1ArrayLength = pageH1Array.length; if (pageH1ArrayLength > 1) { for (pageH1Word=0;pageH1Word 0 && !pageH1Wrapped) { pageH1Modified += ' : '; pageH1Wrapped = true; } pageH1Modified += pageH1Array[pageH1Word]; if ((pageH1Word == pageH1ArrayLength-1) && pageH1Wrapped) { pageH1Modified += '<\/span>'; } } $pageH1.html(pageH1Modified); } }); } // list of routines to render the page that can be re-called (in Ajax for instance) this.render(); // Scrollers //roman $(".hScrollBarJs").scroller({fillSpace:false, toggle: true}); // Content Displayer //roman $(".cTabs").contentDisplayer(); //roman $(".pkgToggle.tglBoxJs").contentDisplayer(); // Flyouts $(".flyOutInputsJs").flyOut({inputs:true}); $(".flyOutAjaxHelpLinksJs").flyOut({ajax:true, className:"helpPanel"}); // lightBoxes //roman $(".decisionLightBoxJs,.lightBoxInPageJs").lightBox(); //roman $(".emailFriendJs").lightBox({colClassName:"col8"}); //roman $(".lightBoxImageJs").lightBox({image:true}); //roman $(".channelLightBoxJs").lightBox({ajax:true, minWidth: 224, colClassName:'col5'}); //roman $(".extDecisionLightBoxJs, .lightBoxAjaxJs").lightBox({ajax:true}); //roman $(".inPageGreyMarketToolJs").lightBox({colClassName:"col10"}); //roman $(".extGreyMarketToolJs").lightBox({ajax:true, colClassName:"col10"}); // text Breaker (this needs to be placed before tabbings declaration) //roman $(".secNav").textBreaker(); //roman $(".hTabs").textBreaker({maxWidth:130}); // tabs //roman $(".tabsJs").tabbing(); $(".tabTrigSet li a").append(""); // Compare Table $("td:first",".compareTbl tr").each(function() { $(this).width($(this).width()); }); // outLineKiller //roman $(".buttonize, .ttTrigger, .tabTrigSet ul li a, .secNav ul li a, .bt_addCompare, .pageCounter ul li a, .pkgToggle ul li a").outLineKiller(); // Remove Table Column //roman $(".tableColumnRemoverJs").tableColumnRemover(); // collaspe/uncollaspe in compare table //roman $(".pkgToggle").collapser(); // Open link in new browser window //roman $(".newSbWinJs").live("click", function() { //roman $.popup.open(this, { //roman width: 698, //roman height: $(window).height()-$(window).height()/3, //roman toolBar: false, //roman location: true, //roman status: true, //roman menuBar: false, //roman scrollBars: true, //roman resizable: true //roman }); //roman return false; //roman }); // Compare Tool //roman $(".bt_addCompare").live("click",function() { //roman $.compareTool.show(this); //roman return false; //roman }); //roman // To Remove //roman $(".bt_remove").live("click",function() { //roman $.toRemove.remove($(this)); //roman return false; //roman }); } }, render: function(context, useCase) { if (typeof(context) === "undefined") { context = "body"; } $.bell.renderSelector = context; // Optimisation only: everything can go in default switch(useCase) { case "lightBox": this.frontEnd.fonts(context); this.frontEnd.boxes(context); this.frontEnd.buttons(context); this.frontEnd.datePicker(context); $(".lbTitle a", context).outLineKiller(); $(".hScrollBarJs", context).scroller({fillSpace:true, toggle: false}); this.frontEnd.misc(context); break; case "scroller": this.frontEnd.fonts(context); this.frontEnd.buttons(context); this.frontEnd.itemGroup(context); this.frontEnd.quickViews(context); this.frontEnd.pricingFormats(context); break; case "summaryBox": this.frontEnd.boxes(context); this.frontEnd.buttons(context); break; case "sBuilderStepTV": this.frontEnd.buttons(context); this.frontEnd.capsules(context); this.frontEnd.itemGroup(context); break; case "sBuilderStepHome": case "sBuilderStepInternet": this.frontEnd.buttons(context); this.frontEnd.capsules(context); $(context).find(".vSpacer:last").remove(); break; case "sBuilderStepMobility": this.frontEnd.buttons(context); this.frontEnd.capsules(context); this.frontEnd.carousel(context); this.frontEnd.fonts(context); this.frontEnd.itemGroup(context); this.frontEnd.pricingFormats(context); this.frontEnd.toggleShowHide(context); break; case "sBuilderStepTitle": this.frontEnd.fonts(context); break; case "quickview": this.frontEnd.fonts(context); this.frontEnd.buttons(context); this.frontEnd.carousel(context); this.frontEnd.pricingFormats(context); this.frontEnd.itemGroup(context); break; default: this.frontEnd.fonts(context); this.frontEnd.boxes(context); this.frontEnd.tables(context); this.frontEnd.buttons(context); this.frontEnd.capsules(context); this.frontEnd.misc(context); } // execute any callBacks if ($.isFunction($.runCallBack)) { $.runCallBack(arguments); } }, ready : function() { $.bell.navigation.primary.init(); if (!this.isHomePage) { // Arrange Margins // Note Arrange margins MUST BE PLACE BEFORE EQUALIZE //roman $.itemGroupLayouting(); // Equalizing: we put the equalize process in page.ready e.g when everything // is loaded in the page because some browsers cannot access image dimension // when the image is not fully loaded // $(".cBox").equalize({similarItem:"unit"}); // $(".stepList").equalize({similarItem:"eqJs"}); // $(".eqJs").parents(".refLine").equalize({similarItem: "eqJs"}); if ($(".capsule:first").length) { $(".refLine .refLine").equalize({similarItem:"eqJs"}); $(".refLine").equalize({similarItem:"unit"}); } } }, elementFinder: function(selector) { var context = $.bell.renderSelector; switch(typeof(context)) { case "object": selector = $(context).find(selector); break; case "string": if (context.indexOf("#") !== -1 || context.indexOf(".") !== -1) { selector = context+" "+selector; } else { selector = "body "+selector; } break; } return selector; }, frontEnd: { boxes: function(context) { var $cBox, $shell, $actHighlight; // Create extra markup to display cBox structure $(".cBox", context).each(function() { $cBox = $(this); if ($cBox.find(".cBoxExtra1:first").length === 0) { $cBox.append('
'); } }); // Create extra markup to display shell structure $(".shell", context).each(function() { $shell = $(this); if ($shell.find(".shellExtra1:first").length === 0) { $shell.append(''); } }); // Create extra markup to display shell structure $(".actHighlight", context).each(function() { $actHighlight = $(this); if ($actHighlight.find(".liExtra1:first").length === 0) { $actHighlight.append(''); } }); }, buttons : function(context) { var $child; // Create extra markup to display button structure //roman $(".buttonize", context).each(function() { //roman $child = $(this).children(); //roman if ($child.length) { //roman if ($($child[0]).hasClass("accessAlt")) { //roman $(this).wrapInner("").find("span:not('.accessAlt')").append(''); //roman } //roman } else { //roman $(this).wrapInner("").find("span:not('.accessAlt')").append(''); //roman } //roman }).outLineKiller(); }, capsules: function(context) { var $capsules, $capsule; $capsules = $(".capsule", context); // Create extra markup to display capsules structure if ($capsules.length) { $capsules.each(function() { $capsule = $(this); if ($capsule.find(".capsuleExtra1:first").length === 0) { $capsule.append(''); } }); $(".refLine .refLine", context).equalize({similarItem:"eqJs"}); $(".refLine", context).equalize({similarItem:"unit"}); } }, carousel: function(context) { $(".carousel", context).carousel(); }, compareWidget: function(context) { $(".bt_addCompare", context).compareTool(); }, datePicker: function(context) { var $inputs, imgPath = "/web/common/all_languages/all_regions/skin/ic_cal.gif", initDatePicker, lang = ""; if ($.isFunction($.getPageLang)) { lang = $.getPageLang(); lang = lang==="en"?"":lang; } $.datepicker.setDefaults($.datepicker.regional[lang]); initDatePicker = function($inputs) { $inputs.each(function() { if (!$.data(this,"datePickerInitialized")) { $(this).datepicker({showOn: 'both', showAnim: 'fadeIn', buttonImage: imgPath, buttonImageOnly: true}); $.data(this,"datePickerInitialized", true); } }); }; $inputs = $(".datepicker", context); if ($inputs.length) { initDatePicker($inputs); } }, fonts : function(context) { // Replace page's title with Cufon text-replacement method /*global Cufon */ if (typeof(Cufon) === "function" && typeof($.cookies.get("bell-cufon")) !== "string") { // Text replacement exceptions // put temporary away var $noTextTransform = $(".noTextTransform"), $element, $parent; $noTextTransform.each(function() { $element = $(this); $parent = $element.parent(); if ($parent.attr("id") === "") { $parent.attr("id","txtReplacement-"+Math.floor(Math.random()*100)); } // Set element ID $element.attr("id","element-"+$parent.attr("id")); // Put text outside $("body").append($element); }); // Do text replacement Cufon.replace($.bell.page.elementFinder("h1")); Cufon.replace($.bell.page.elementFinder(".txtRep")); // Reverse text replacement exceptions $noTextTransform.each(function() { $element = $(this); $parent = $("#"+$element.attr("id").replace("element-","")); // Put back content $parent.append($element); }); } }, itemGroup: function(context) { $.itemGroupLayouting(context); }, misc: function(context) { var pageHTML; if (typeof(context) !== "undefined") { pageHTML = $(context).html(); } else { /*global document */ pageHTML = document.body.innerHTML; } // Carousel if (/carousel/.test(pageHTML)) { this.carousel(context); } // Accordion if (/hAccordion/.test(pageHTML)) { $(".hAccordion", context).accordion(); } // Toggle ShowHide if (/tglJs/.test(pageHTML)) { this.toggleShowHide(context); } // Max character counter if (/charCountDownJs/.test(pageHTML)) { $(".charCountDownJs", context).maxChar(); } // CompareTool if (/bt_addCompare/.test(pageHTML)) { this.compareWidget(context); } // Build pricing markup if (/pricingInfo/.test(pageHTML)) { this.pricingFormats(context); } // QuickView if (/quickViewJs/.test(pageHTML)) { this.quickViews(context); } // DatePicker if (/datepicker/.test(pageHTML)) { this.datePicker(context); } // ToolTip if (/ttTrigger/.test(pageHTML)) { $(".ttTrigger", context).toolTip(); } // outline Killer //roman if (/tgl||bt_remove/.test(pageHTML)) { //roman $(".tgl, .bt_remove", context).outLineKiller(); //roman } // full Scroll Detector if (/fTerms/.test(pageHTML)) { $(".fTerms", context).fullScrollDetector(); } // ItemGroup margins layouting if (/itemGroup/.test(pageHTML)) { this.itemGroup(context); } }, pricingFormats: function(context) { $(".pricingInfo .priceTag", context).formatPrice(); }, tables: function(context) { // Styles added to data tables $("table tr:odd", context).addClass("odd"); $("table tr:even", context).addClass("even"); }, toggleShowHide: function(context) { // Toggle ShowHide $(".tglJs", context).toggleShowHide(); }, quickViews: function(context) { // QuickViews $(".quickViewJs", context).quickView(); } }, runHomePage: function() { // put here homepage exclusive routines // note: these routines will also be executed on normal pages // Put a label over its associated text input $('label.labelOver').labelOver(); // Flyouts $(".flyOutLinksJs").flyOut(); // Carousel $(".pgFeature .carousel").carousel({navInside:true, autoPlay:true}); // Open link in new browser window //roman $(".newWinJs").live("click", function() { //roman $.popup.open(this, { //roman width: $(window).width(), //roman height: $(window).height() //roman }); //roman return false; //roman }); //roman $(".popupWinJs").live("click", function() { //roman $.popup.open(this, { //roman width: 640, //roman height: 480, //roman scrollBars: true, //roman toolBar: false, //roman location: false, //roman status: false, //roman menuBar: false, //roman resizable: false //roman }); //roman return false; //roman }); // outLineKiller //roman $(".flyOutTrig, .primNav ul li a, .pgFeature a").outLineKiller(); } }; $.bell.navigation = { primary: { languageResourceEnabled: false, shopButtonObj: null, supportButtonObj: null, init: function() { var shopOpen = $.bell.page.isShop, supportOpen = shopOpen === true ? false: true, duration = 600, $primNavShopButton = $("#primNavShopButton"), $primNavSupportButton = $("#primNavSupportButton"), $primNavSupportList = $("#primNavSupportList"); if ($primNavShopButton.length && $primNavSupportButton.length) { this.shopButtonObj = $primNavShopButton; this.supportButtonObj = $primNavSupportButton; if ($.isFunction($.getText)) { this.languageResourceEnabled = true; } $.bell.navigation.primary.setTitle(shopOpen); $primNavShopButton.click(function(){ if (supportOpen){ $primNavSupportList.animate({left: "864px"}, {duration: duration}); shopOpen = true; supportOpen = false; $.bell.navigation.primary.setTitle(shopOpen); return false; } $.bell.navigation.primary.setTitle(shopOpen); }); $primNavSupportButton.click(function(){ if (shopOpen){ $primNavSupportList.animate({left: "222px"}, {duration: duration}); shopOpen = false; supportOpen = true; $.bell.navigation.primary.setTitle(shopOpen); return false; } $.bell.navigation.primary.setTitle(shopOpen); }); } }, setTitle: function(shopOpen) { if (this.languageResourceEnabled) { if (shopOpen) { this.shopButtonObj.attr("title", $.getText("goToShopHomePage")); this.supportButtonObj.attr("title", $.getText("openSupportMenu")); } else { this.shopButtonObj.attr("title", $.getText("openShopMenu")); this.supportButtonObj.attr("title", $.getText("goToSupportHomePage")); } } } } }; // used to add third-party interface $.bell.external = { // params structure looks like: // params.appName // params.actionName // params.data tracker: function(params) { if (typeof(params) === "object") { switch(params.appName) { case "lp": // live person if (params.actionName === "solutionBuilder") { /*global lpSendData */ if (typeof(lpSendData) === "function") { if (typeof(params.data) === "object") { $.each(params.data, function(name, value) { lpSendData("page",name,value); }); } } } break; } } } }; // used to disable functions that may reduce accessibility $.bell.disableFn = function() { // disable cufon if (typeof($.cookies)==="object") { $.cookies.set("bell-cufon",false,365); } }; // Dom ready $(function() { $.bell.page.init(); }); // Page ready $(window).load(function(){ $.bell.page.ready(); }); /*global jQuery */ })(jQuery); function OpenAliantPopup(){ var region = $('meta[name=province]').attr("content"); var lang = $('meta[name=language]').attr("content"); var url = "/shopping/jsp/pageblock_styles/popup/redirectAliant.jsp"; var myWindow = window.open(url,"_blank","width=400,height=350,menubar=no,scrollbars=no,toolbar=no,location=no,status=no,resizable=no"); } /* depreacated */ function popper(thisUrl, thisWindow, thisWidth, thisHeight, thisTop, thisLeft) { optionString = ('width=' + thisWidth + ',height=' + thisHeight + ',top=' + thisTop + ',left=' + thisLeft + ',status=no,menubar=no,resizable=yes,scrollbars=yes'); mainWin = window.open(thisUrl, thisWindow, optionString); } /* depreacated */ function popperNoScroll(thisUrl, thisWindow, thisWidth, thisHeight, thisTop, thisLeft) { optionString = ('width=' + thisWidth + ',height=' + thisHeight + ',top=' + thisTop + ',left=' + thisLeft + ',status=no,menubar=no,resizable=yes,scrollbars=no'); mainWin = window.open(thisUrl, thisWindow, optionString); } /* depreacated */ function popperRedirector(thisUrl, newWindow) { var w = 285; var h = 285; var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; popperNoScroll('/home/popups/redirector.jsp?newWindow=' + newWindow + '&url=' + thisUrl, '', w,h,wint,winl); } /* depreacated */ function popperNewWindow(thisUrl, thisWindow) { mainWin = window.open(thisUrl, thisWindow, 'status=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes'); }