Anda di halaman 1dari 79

if(typeof M_VZW == 'undefined') M_VZW = {}; M_VZW.Log = function () { if (typeof console != "undefined") { console.log(arguments); } }; var log = M_VZW.

Log; (function ($) { /*** Begin Component Includes ***/ M_VZW.Modal = { showModal: function (modalname, pagename) { var pn = '#' + pagename; var modal = jQuery(pn + ' #modal_' + modalname); if (modal != undefined && modal != null) { if (modal.css('display') != "block") { modal.css('display', 'block'); jQuery(pn + ' #modal_' + modalname + ' .modalblack').live('click ', function () { M_VZW.Modal.hideModal(modalname, pagename); }); } } }, hideModal: function (modalname, pagename) { var pn = '#' + pagename; var modal = jQuery(pn + ' #modal_' + modalname); if (modal != undefined && modal != null) { if (modal.css('display') != "none") { modal.css('display', 'none'); jQuery(pn + ' #modal_' + modalname + ' .modalblack').die('click' ); } } }, showSection: function (sectionname, pagename) { var pn = '#' + pagename; var section = jQuery(pn + ' #section_' + sectionname); if (section != undefined && section != null) { if (section.css('display') != "block") { section.css('display', 'block'); } } }, hideSection: function (sectionname, pagename) { var pn = '#' + pagename; var section = jQuery(pn + ' #section_' + sectionname); if (section != undefined && section != null) { if (section.css('display') != "none") { section.css('display', 'none'); } } },

navLoginShow: false, navLoginHide: true, toggleLogin: function (pagename) { var pn = '#' + pagename; if (M_VZW.Modal.navLoginHide) { M_VZW.Modal.navLoginShow = true; M_VZW.Modal.navLoginHide = false; jQuery(pn + " #navtoggleInd").css('display', 'block'); jQuery(pn + " #gn_navLoginPanel").css('display', 'block'); } else if (M_VZW.Modal.navLoginShow) { M_VZW.Modal.navLoginShow = false; M_VZW.Modal.navLoginHide = true; jQuery(pn + " #navtoggleInd").css('display', 'none'); jQuery(pn + " #gn_navLoginPanel").css('display', 'none'); } jQuery(document).trigger("updatelayout"); }, navStatic: true, navFixed: false, toggleNav: function (pagename) { var pn = '#' + pagename; if (M_VZW.Modal.navFixed) { jQuery(pn + ' #gn_header').css('position', 'static'); jQuery(pn + ' #content').css('padding-top', '0'); M_VZW.Modal.navStatic = true; M_VZW.Modal.navFixed = false; M_VZW.Global.ClearCookie('mvzw_navbehaviour'); M_VZW.Global.CreateCookie("mvzw_navbehaviour", "static", 30); } else if (M_VZW.Modal.navStatic) { jQuery(pn + ' #gn_header').css('position', 'fixed'); jQuery(pn + ' #content').css('padding-top', '3.214em'); M_VZW.Modal.navStatic = false; M_VZW.Modal.navFixed = true; M_VZW.Global.ClearCookie('mvzw_navbehaviour'); M_VZW.Global.CreateCookie("mvzw_navbehaviour", "fixed", 30); } jQuery(document).trigger("updatelayout"); }, setNavBehaviour: function (pagename) { var navbehaviour = M_VZW.Global.readCookie("mvzw_navbehaviour"); if (navbehaviour != null && navbehaviour != false && navbehaviour != und efined) { if (navbehaviour == "static") { jQuery(pagename + ' #gn_header').css('position', 'static'); jQuery(pagename + ' #content').css('padding-top', '0'); M_VZW.Modal.navStatic = true; M_VZW.Modal.navFixed = false; } else if (navbehaviour == "fixed") { jQuery(pagename + ' #gn_header').css('position', 'fixed'); jQuery(pagename + ' #content').css('padding-top', '3.214em'); M_VZW.Modal.navStatic = false; M_VZW.Modal.navFixed = true; }

} jQuery(pagename).trigger("updatelayout"); } } M_VZW.Home = { CreateBindings: function () { M_VZW.Global.CurrentPage.find("#home-links li").unbind("vclick", M_VZW.H ome.LinkSelected); M_VZW.Global.CurrentPage.find("#home-links li").bind("vclick", M_VZW.Hom e.LinkSelected); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#home-links li").unbind("vclick", M_VZW.H ome.LinkSelected); }, LinkSelected: function (btn) { var btn = $(btn.currentTarget); btn = M_VZW.Global.ModifyUrlWithDetection(btn); var url = btn.attr("details-url"); if (url.indexOf("http") != -1) { M_VZW.Global.goto(url, true); } else { M_VZW.Global.goto(url, false); } //$.mobile.changePage(url); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) try { M_VZW.Global.CurrentJS.RemoveBindings(); } catch (e) { //meh - the function doesnt exist } M_VZW.Global.CurrentJS = M_VZW.Home; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Home.CreateBindings(); M_VZW.Modal.setNavBehaviour("#" + PageName); } }; M_VZW.MyVerizon = { devices: { android: "android", ios: "(iphone|ipad|ipod)", iphone: "iphone", blackberry: "blackberry", blackberryCurve2: "blackberry8530", blackberryStorm2: "blackberry9550", blackberryTour: "blackberry9630", blackberryStorm: "blackberry9530", blackberry8130: "blackberry8130", blackberry8330: "blackberry8330", blackberry8830: "blackberry8830", galaxynexus: "galaxy nexus",

windows: "windows ce; (iemobile|ppc|smartphone)", windows7: "windows phone OS" }, isDevice: function (device) { if (M_VZW.MyVerizon.devices[device] != null) { var uaString = navigator.userAgent.toLowerCase(); var regex = new RegExp(M_VZW.MyVerizon.devices[device], "gi"); return regex.test(uaString); } else { console.log("Unknown device " + device); } }, init: function () { if (M_VZW.MyVerizon.isDevice("blackberry")) { if (M_VZW.MyVerizon.isDevice('blackberryCurve2')) { $('#blackberry a').attr('href', '/myverizon/howto/BlackBerry-Cur ve2'); $('#blackberry').css('display', 'block'); } else if (M_VZW.MyVerizon.isDevice('blackberryStorm2')) { $('#blackberry a').attr('href', '/myverizon/howto/BlackBerry-Sto rm2'); $('#blackberry').css('display', 'block'); } else if (M_VZW.MyVerizon.isDevice('blackberryTour')) { $('#blackberry a').attr('href', '/myverizon/howto/BlackBerry-Tou r'); $('#blackberry').css('display', 'block'); } else if (M_VZW.MyVerizon.isDevice('blackberryStorm')) { $('#blackberry a').attr('href', '/myverizon/howto/BlackBerry-Sto rm'); $('#blackberry').css('display', 'block'); } else if (M_VZW.MyVerizon.isDevice('blackberry8130') || M_VZW.MyVer izon.isDevice('blackberry8330') || M_VZW.MyVerizon.isDevice('blackberry8830')) { $('#blackberry a').attr('href', '/myverizon/howto/BlackBerry-Pea rl-Curve-WorldEdition'); $('#blackberry').css('display', 'block'); } else { $('#blackberry a').attr('href', '/myverizon/howto/'); $('#blackberry').css('display', 'block'); } } else if (M_VZW.MyVerizon.isDevice("iphone")) { $('#signin').css('display', 'block'); $('#iphone').css('display', 'block'); } else if (M_VZW.MyVerizon.isDevice("android")) { $('#signin').css('display', 'block'); if (M_VZW.MyVerizon.isDevice("galaxynexus")) { $('#galaxynexus').css('display', 'block'); } else { $('#android').css('display', 'block'); } } else if (M_VZW.MyVerizon.isDevice("windows7") || M_VZW.MyVerizon.isDev ice("windows")) { $('#otherpda').css('display', 'block'); } else { $('#signin').css('display', 'block'); $('#android').css('display', 'block'); $('#blackberry').css('display', 'block'); $('#iphone').css('display', 'block'); $('#otherpda').css('display', 'block');

$('#wap').css('display', 'block'); } } };M_VZW.MarqueeScroller = { scrollInterval: 5000, offerItems: null, currentOffer: null, currentItem: 0, interval: null, running: false, init: function () { var scroller = M_VZW.MarqueeScroller; if (!scroller.running) { scroller.offerItems = $(".single-offer"); if ($(scroller.offerItems[0]).hasClass('after-load-banner')) { if (M_VZW.Global.IsiOS()) { $(scroller.offerItems[2]).remove(); } else { $(scroller.offerItems[1]).remove(); } scroller.offerItems.removeClass('after-load-banner'); M_VZW.MarqueeScroller.init(); return; } if (scroller.offerItems.length > 0) { scroller.currentItem = 0; scroller.currentOffer = scroller.offerItems.first(); scroller.hideInactiveItems(); scroller.interval = setInterval(scroller.nextItem, scroller.scro llInterval); scroller.running = true; } } else { clearInterval(scroller.interval); scroller.interval = setInterval(scroller.nextItem, scroller.scrollIn terval); } }, nextItem: function () { var scroller = M_VZW.MarqueeScroller; scroller.currentOffer.hide(); scroller.currentItem++; if (scroller.currentItem >= scroller.offerItems.length) scroller.current Item = 0; scroller.currentOffer = $(scroller.offerItems[scroller.currentItem]); scroller.currentOffer.show(); }, hideInactiveItems: function () { var scroller = M_VZW.MarqueeScroller; scroller.offerItems.each(function (count, item) { var offer = $(item); if (offer[0] != scroller.currentOffer[0]) { offer.hide();

} }); } }; M_VZW.StoreLocator = { GPS: "", ZIP_URL: "", CITY_STATE_URL: "", GPS_URL: "", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#searchCurLoc").unbind("vclick", M_VZW.St oreLocator.SearchByGPS); M_VZW.Global.CurrentPage.find("#searchCurLoc").bind("vclick", M_VZW.Stor eLocator.SearchByGPS); M_VZW.Global.CurrentPage.find("#zipgo").unbind("vclick", M_VZW.StoreLoca tor.SearchByZip); M_VZW.Global.CurrentPage.find("#zipgo").bind("vclick", M_VZW.StoreLocato r.SearchByZip); M_VZW.Global.CurrentPage.find("#statecitygo").unbind("vclick", M_VZW.Sto reLocator.SearchByCityState); M_VZW.Global.CurrentPage.find("#statecitygo").bind("vclick", M_VZW.Store Locator.SearchByCityState); M_VZW.Global.CurrentPage.find("#searchCurLoc").bind("vclick", function ( ) { M_VZW.SiteCatalyst.TrackClick(this, 'o', 'SLR Current Loc'); }); M_VZW.Global.CurrentPage.find("#zipgo").bind("vclick", function () { M_VZW.SiteCatalyst.TrackClick(this, 'o', 'SLR Zip'); }); M_VZW.Global.CurrentPage.find("#statecitygo").bind("vclick", function () { M_VZW.SiteCatalyst.TrackClick(this, 'o', 'SLR CityState'); }); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#searchCurLoc").unbind("vclick", M_VZW.St oreLocator.SearchByGPS); M_VZW.Global.CurrentPage.find("#zipgo").unbind("vclick", M_VZW.StoreLoca tor.SearchByZip); M_VZW.Global.CurrentPage.find("#statecitygo").unbind("vclick", M_VZW.Sto reLocator.SearchByCityState); }, getLocation: function () { M_VZW.StoreLocator.GPS = navigator.geolocation; if (M_VZW.StoreLocator.GPS) { M_VZW.StoreLocator.GPS.getCurrentPosition(M_VZW.StoreLocator.GPS_Sup ported, M_VZW.StoreLocator.GPS_NoSupport); } }, GPS_Supported: function (position) {

M_VZW.StoreLocator.GPS.latitude = position.coords.latitude; M_VZW.StoreLocator.GPS.longitude = position.coords.longitude; M_VZW.Global.CurrentPage.find("#search-gps").removeClass("hidedetails"). addClass("showdetails"); }, GPS_NoSupport: function () { M_VZW.Global.CurrentPage.find("#search-gps").removeClass("showdetails"). addClass("hidedetails"); }, SearchByGPS: function () { if (M_VZW.StoreLocator.GPS) { var lat = M_VZW.StoreLocator.GPS.latitude; var long = M_VZW.StoreLocator.GPS.longitude; M_VZW.Global.goto(M_VZW.StoreLocator.GPS_URL + "/" + lat + "/" + lon g, false); //$.mobile.changePage(M_VZW.StoreLocator.GPS_URL + "/" + lat + "/" + long); } }, SearchByZip: function () { M_VZW.StoreLocator.HideAllErrorMsgs(); var zip = M_VZW.Global.CurrentPage.find("#zip").val(); if (zip != "") { M_VZW.Global.goto(M_VZW.StoreLocator.ZIP_URL + "/" + zip, false); } else { M_VZW.Global.CurrentPage.find("#zipErrorMsg").css("display", "block" ).html("Please enter a zip code"); } //$.mobile.changePage(M_VZW.StoreLocator.ZIP_URL + "/" + zip); }, SearchByCityState: function () { M_VZW.StoreLocator.HideAllErrorMsgs(); var city = M_VZW.Global.CurrentPage.find("#city").val(); var state = M_VZW.Global.CurrentPage.find("#state").val(); if (city != "") { if (state != "") { M_VZW.Global.goto(M_VZW.StoreLocator.CITY_STATE_URL + "/" + city + "/" + state, false); } else { M_VZW.Global.CurrentPage.find("#csErrorMsg").css("display", "blo ck").html("Please choose a state"); } } else { M_VZW.Global.CurrentPage.find("#csErrorMsg").css("display", "block") .html("Please enter in a city name"); } //$.mobile.changePage(M_VZW.StoreLocator.CITY_STATE_URL + "/" + city + " /" + state); }, HideAllErrorMsgs: function () { M_VZW.Global.CurrentPage.find("#zipErrorMsg").css("display", "none"); M_VZW.Global.CurrentPage.find("#csErrorMsg").css("display", "none"); },

init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.StoreLocator; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.StoreLocator.getLocation(); M_VZW.StoreLocator.CreateBindings(); } }; M_VZW.Support = { CreateBindings: function () { M_VZW.Global.CurrentPage.find("#SupportLinks li").unbind("vclick", M_VZW .Support.SupportClick); M_VZW.Global.CurrentPage.find("#SupportLinks li").bind("vclick", M_VZW.S upport.SupportClick); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#SupportLinks li").unbind("vclick", M_VZW .Support.SupportClick); }, SupportClick: function (btn) { btn = $(btn.currentTarget); var url = btn.attr("data-url"); if (M_VZW.Global.CurrentDevice.VZWPhoneID != 0) { url = url.replace("{PHONE_ID}", M_VZW.Global.CurrentDevice.VZWPhoneI D); } else { url = url.replace("&p={PHONE_ID}", ""); } var trackingValue = btn.attr("data-tracking"); var trackingStatus = btn.attr("data-tracking-status"); if (trackingValue != undefined && trackingValue != "" && trackingStatus != undefined && trackingStatus != "") { M_VZW.SiteCatalyst.TrackClick(btn, trackingStatus, trackingValue); } M_VZW.Global.goto(url, true); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Support; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Support.CreateBindings(); M_VZW.Global.GetClientDevice(navigator.userAgent); } } M_VZW.EmailOptin = { DisplayMsg: false, ID: "", SourceID: "",

NextPage: "", TrackingVars: new Array(), Optin_URL: "https://email.vzwshop.com/servlet/campaignrespondent", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#chkEC").unbind("change", M_VZW.EmailOpti n.ECCheck); M_VZW.Global.CurrentPage.find("#chkEC").bind("change", M_VZW.EmailOptin. ECCheck); M_VZW.Global.CurrentPage.find("#ecoptin").unbind("focus", M_VZW.EmailOpt in.ClearIt); M_VZW.Global.CurrentPage.find("#ecoptin").bind("focus", M_VZW.EmailOptin .ClearIt); M_VZW.Global.CurrentPage.find("#ecoptin").unbind("blur", M_VZW.EmailOpti n.CheckIt); M_VZW.Global.CurrentPage.find("#ecoptin").bind("blur", M_VZW.EmailOptin. CheckIt); M_VZW.Global.CurrentPage.find("#ecmtn").die("focus", M_VZW.EmailOptin.Se tMasks); M_VZW.Global.CurrentPage.find("#ecmtn").live("focus", M_VZW.EmailOptin.S etMasks); M_VZW.Global.CurrentPage.find("#ecmtn").die("blur", M_VZW.EmailOptin.Rem oveMasks); M_VZW.Global.CurrentPage.find("#ecmtn").live("blur", M_VZW.EmailOptin.Re moveMasks); M_VZW.Global.CurrentPage.find("#ecsignup").unbind("vclick", M_VZW.EmailO ptin.ECOptIn); M_VZW.Global.CurrentPage.find("#ecsignup").bind("vclick", M_VZW.EmailOpt in.ECOptIn); M_VZW.Global.CurrentPage.find("#ncsignup").unbind("vclick", M_VZW.EmailO ptin.NCOptIn); M_VZW.Global.CurrentPage.find("#ncsignup").bind("vclick", M_VZW.EmailOpt in.NCOptIn); M_VZW.Global.CurrentPage.find("#ncsignup").bind("vclick", function () { M_VZW.SiteCatalyst.TrackClick(this, 'o', 'mobile/home/email sign up' ); }); M_VZW.Global.CurrentPage.find("#email").unbind("keyup"); M_VZW.Global.CurrentPage.find("#email").bind("keyup", function () { M_VZ W.EmailOptin.ClearTipMSG('#email') }); M_VZW.Global.CurrentPage.find("#confirm_email").unbind("keyup"); M_VZW.Global.CurrentPage.find("#confirm_email").bind("keyup", function ( ) { M_VZW.EmailOptin.ClearTipMSG('#confirm_email') }); M_VZW.Global.CurrentPage.find("#shopping_question_myself").unbind("chang e", M_VZW.EmailOptin.ClearShoppingQuestionError); M_VZW.Global.CurrentPage.find("#shopping_question_myself").bind("change" , M_VZW.EmailOptin.ClearShoppingQuestionError); M_VZW.Global.CurrentPage.find("#shopping_question_business").unbind("cha nge", M_VZW.EmailOptin.ClearShoppingQuestionError); M_VZW.Global.CurrentPage.find("#shopping_question_business").bind("chang e", M_VZW.EmailOptin.ClearShoppingQuestionError); M_VZW.Global.CurrentPage.find("#customer_question_yes").unbind("change",

M_VZW.EmailOptin.RequireMTN); M_VZW.Global.CurrentPage.find("#customer_question_yes").bind("change", M _VZW.EmailOptin.RequireMTN); M_VZW.Global.CurrentPage.find("#customer_question_no").unbind("change", M_VZW.EmailOptin.RequireMTN); M_VZW.Global.CurrentPage.find("#customer_question_no").bind("change", M_ VZW.EmailOptin.RequireMTN); M_VZW.Global.CurrentPage.find("#mobile_number").unbind("keyup", M_VZW.Em ailOptin.UpdateMTN); M_VZW.Global.CurrentPage.find("#mobile_number").bind("keyup", M_VZW.Emai lOptin.UpdateMTN); M_VZW.Global.CurrentPage.find("#signupfull").unbind("vclick", M_VZW.Emai lOptin.SubmitFullInfo); M_VZW.Global.CurrentPage.find("#signupfull").bind("vclick", M_VZW.EmailO ptin.SubmitFullInfo); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#ecoptin").unbind("focus", M_VZW.EmailOpt in.ClearIt); M_VZW.Global.CurrentPage.find("#ecoptin").unbind("blur", M_VZW.EmailOpti n.CheckIt); M_VZW.Global.CurrentPage.find("#ecmtn").die("focus", M_VZW.EmailOptin.Se tMasks); M_VZW.Global.CurrentPage.find("#ecmtn").die("blur", M_VZW.EmailOptin.Rem oveMasks); M_VZW.Global.CurrentPage.find("#chkEC").unbind("change", M_VZW.EmailOpti n.ECCheck); M_VZW.Global.CurrentPage.find("#ecsignup").unbind("vclick", M_VZW.EmailO ptin.ECOptIn); M_VZW.Global.CurrentPage.find("#ncsignup").unbind("vclick", M_VZW.EmailO ptin.NCOptIn); M_VZW.Global.CurrentPage.find("#email").unbind("keyup"); M_VZW.Global.CurrentPage.find("#confirm_email").unbind("keyup"); M_VZW.Global.CurrentPage.find("#shopping_question_myself").unbind("chang e", M_VZW.EmailOptin.ClearShoppingQuestionError); M_VZW.Global.CurrentPage.find("#shopping_question_business").unbind("cha nge", M_VZW.EmailOptin.ClearShoppingQuestionError); M_VZW.Global.CurrentPage.find("#customer_question_yes").unbind("change", M_VZW.EmailOptin.RequireMTN); M_VZW.Global.CurrentPage.find("#customer_question_no").unbind("change", M_VZW.EmailOptin.RequireMTN); M_VZW.Global.CurrentPage.find("#mobile_number").unbind("keyup", M_VZW.Em ailOptin.UpdateMTN); M_VZW.Global.CurrentPage.find("#signupfull").unbind("vclick", M_VZW.Emai lOptin.SubmitFullInfo); }, ECCheck: function () { M_VZW.Global.CurrentPage.find("#ncsignup").toggle();

M_VZW.Global.CurrentPage.find("#mtn").toggle(); }, ECOptIn: function () { if (M_VZW.EmailOptin.DisplayMsg) { M_VZW.EmailOptin.DisplayMsg = false; M_VZW.Global.CurrentPage.find("#optin_msg").css("display", "none"); } //Grab email and remove trailing spaces form email using jQuery trim var email = jQuery.trim(M_VZW.Global.CurrentPage.find("#ecoptin").val()) ; var mtn = M_VZW.Global.CurrentPage.find("#ecmtn").val(); var e = M_VZW.EmailOptin.CheckEmail(email); var mn = M_VZW.EmailOptin.CheckMTN(mtn); if (e && mn) { M_VZW.EmailOptin.SendECSignUp(email, mtn); } else { if (!e && !mn) { M_VZW.EmailOptin.ShowMsg('error', 'Please enter in a valid email address and mobile number.'); } else if (!e) { if (email == "ENTER EMAIL") { M_VZW.EmailOptin.ShowMsg('error', 'Please enter a valid emai l address.'); } else { M_VZW.EmailOptin.ShowMsg('error', 'Please enter a valid emai l address.'); } } else if (!mn) { M_VZW.EmailOptin.ShowMsg('error', 'Please enter a valid mobile n umber.'); } } }, NCOptIn: function () { //Grab email and remove trailing spaces form email using jQuery trim var email = jQuery.trim(M_VZW.Global.CurrentPage.find("#ecoptin").val()) ; var e = M_VZW.EmailOptin.CheckEmail(email); if (e) { if (M_VZW.EmailOptin.TrackingVars != null && M_VZW.EmailOptin.Tracki ngVars.length > 0) { var trackObj = new Object(M_VZW.EmailOptin.TrackingVars); var rsid = "" + trackObj[0].rsid; var linktype = "" + trackObj[0].linktype; var trackurl = "" + trackObj[0].trackurl; var s = s_gi(rsid); s.tl(this, linktype, trackurl); M_VZW.EmailOptin.SendNCSignUp(email); } else { M_VZW.EmailOptin.SendNCSignUp(email); } } else { if (!e) { if (email == "ENTER EMAIL" || email == "ENTER EMAIL FOR NEWS AND DEALS") {

M_VZW.EmailOptin.ShowMsg('error', 'Please enter a valid emai l address.'); } else { M_VZW.EmailOptin.ShowMsg('error', 'Please enter a valid emai l address.'); } } } }, ClearIt: function () { var txt = M_VZW.Global.CurrentPage.find("#ecoptin").val(); if (txt == "ENTER EMAIL" || txt == "ENTER EMAIL FOR NEWS AND DEALS") { M_VZW.Global.CurrentPage.find("#ecoptin").val(""); } }, CheckIt: function () { var txt = M_VZW.Global.CurrentPage.find("#ecoptin").val(); if (txt == " " || txt == "") { M_VZW.Global.CurrentPage.find("#ecoptin").val("ENTER EMAIL FOR NEWS AND DEALS"); } }, CheckEmail: function (e) { var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; return emailPattern.test(e); }, CheckMTN: function (mtn) { var dashPattern = /-/ig; var mtnstripped = mtn.replace(dashPattern, ''); var mtnPattern = /[0-9]/ig; var strLength = mtnstripped.length; if (strLength < 10 && strLength > 0) { return "lessthan10"; } return (strLength == 10 && mtnPattern.test(mtnstripped)) ? true : false; }, CheckName: function (name) { return (name == "" || name == " " || name == undefined || name == null) ? false : true; }, ClearShoppingQuestionError: function () { M_VZW.Global.CurrentPage.find('#sfsb .tip').css("display", "none"); }, RequireMTN: function () { M_VZW.Global.CurrentPage.find('#auq .tip').css("display", "none"); var c = M_VZW.Global.CurrentPage.find('#customer_question_yes').attr("ch ecked"); var nc = M_VZW.Global.CurrentPage.find('#customer_question_no').attr("ch ecked"); if (c == "checked") { jQuery(document).find('#mobile_number_required').css('display', 'inl ine-block'); return true;

} if (nc == "checked") { jQuery(document).find('#mobile_number_required').css('display', 'non e'); return false; } }, UpdateMTN: function () { M_VZW.Global.CurrentPage.find('#mobile_number').parent().find('.tip').cs s("display", "none"); var mtn = jQuery(this).val() var dashPattern = /-/ig; var mtnstripped = mtn.replace(dashPattern, ''); var mtnPattern = /\D/ig; var noCharsMTN = mtnstripped.replace(mtnPattern, ''); var nomorethan10 = noCharsMTN.slice(0, 10); jQuery(this).val(nomorethan10); M_VZW.Global.CurrentPage.find('#datarates').css("display", "block"); }, CheckIsCustomer: function (isCustomer, notCustomer) { if (isCustomer == "checked") { return true; } if (notCustomer == "checked") { return false; } return false; }, /*Full form email checks/binding*/ SubmitFullInfo: function () { //Hide all error messages M_VZW.Global.CurrentPage.find('.tip').css("display", "none"); //Vars we send over //Grab email and remove trailing spaces form email using jQuery trim var email = jQuery.trim(M_VZW.Global.CurrentPage.find('#email').val()); var confirmEmail = jQuery.trim(M_VZW.Global.CurrentPage.find('#confirm_e mail').val()); var firstName = M_VZW.Global.CurrentPage.find('#first_name').val(); firstName = (firstName == null || firstName == "" || firstName == undefi ned) ? "" : firstName; var lastName = M_VZW.Global.CurrentPage.find('#last_name').val(); lastName = (lastName == null || lastName == "" || lastName == undefined) ? "" : lastName; var shoppingForWhom = ""; //Set after its been answered var dashPattern = /-/ig; var mtn = M_VZW.Global.CurrentPage.find('#mobile_number').val(); var mtnstripped = mtn.replace(dashPattern, ''); var mobilealertoptin = (M_VZW.Global.CurrentPage.find('#more_updates').a ttr('checked') == "checked") ? 'Y' : 'N'; //Validate values var validEmail = M_VZW.EmailOptin.CheckEmail(email); var validConfirmEmail = M_VZW.EmailOptin.CheckEmail(confirmEmail); var validFirstName = M_VZW.EmailOptin.CheckName(firstName); var validLastName = M_VZW.EmailOptin.CheckName(lastName); var isCustomer = M_VZW.EmailOptin.CheckIsCustomer(M_VZW.Global.CurrentPa

ge.find('#customer_question_yes').attr('checked'), M_VZW.Global.CurrentPage.find ('#customer_question_no').attr('checked')); var validMobileNumber = M_VZW.EmailOptin.CheckMTN(mtn); var allFieldsValid = false; //Check Emails first if (validEmail) { if (validConfirmEmail) { var e = M_VZW.Global.CurrentPage.find('#email').val(); var ec = M_VZW.Global.CurrentPage.find('#confirm_email').val(); if (e == ec) { allFieldsValid = true; } else { allFieldsValid = false; M_VZW.Global.CurrentPage.find('#confirm_email').parent().fin d('.tip').css("display", "block").text('Emails do not match. Please reconfirm.') ; M_VZW.Global.CurrentPage.find('#confirm_email').focus(); } } else { allFieldsValid = false; M_VZW.Global.CurrentPage.find('#confirm_email').parent().find('. tip').css("display", "block").text('Please confirm.'); M_VZW.Global.CurrentPage.find('#confirm_email').focus(); } } else { allFieldsValid = false; M_VZW.Global.CurrentPage.find('#email').parent().find('.tip').css("d isplay", "block"); M_VZW.Global.CurrentPage.find('#email').focus(); } //Check Name Fields //Name fields ARE NOT required //Did they answer the question about whether or not they're a VZW custom er? var c = M_VZW.Global.CurrentPage.find('#customer_question_yes').attr('ch ecked'); var nc = M_VZW.Global.CurrentPage.find('#customer_question_no').attr('ch ecked'); if (c != "checked" && nc != "checked" && allFieldsValid) { allFieldsValid = false; M_VZW.Global.CurrentPage.find('#auq').find('.tip').css("display", "b lock"); jQuery('html, body').animate({ scrollTop: $("#auq").offset().top }, 500); //M_VZW.Global.CurrentPage.find('#customer_question_yes').triggerHan dler("focus"); } else if (allFieldsValid) { allFieldsValid = true; } //Check if we need to verify the mtn field only if they are a VZW custom er if (isCustomer && allFieldsValid) { if (validMobileNumber == true) { allFieldsValid = true; } else {

allFieldsValid = false; var msg = ""; switch (validMobileNumber) { case "lessthan10": msg = "Phone number must be 10 digits"; break; default: msg = "Phone number must be 10 digits"; break; } M_VZW.Global.CurrentPage.find('#mobile_number').parent().find('. tip').text(msg); M_VZW.Global.CurrentPage.find('#mobile_number').parent().find('. tip').css("display", "block"); M_VZW.Global.CurrentPage.find('#mobile_number').focus(); } } //Did they answer the question about whether or not they're shopping for themselves or business? var s = M_VZW.Global.CurrentPage.find('#shopping_question_myself').attr( 'checked'); var b = M_VZW.Global.CurrentPage.find('#shopping_question_business').att r('checked'); if (s != "checked" && b != "checked" && allFieldsValid) { allFieldsValid = false; M_VZW.Global.CurrentPage.find('#sfsb').find('.tip').css("display", " block"); //M_VZW.Global.CurrentPage.find('#shopping_question_myself').focus() ; jQuery('html, body').animate({ scrollTop: $("#sfsb").offset().top }, 100); } else if (allFieldsValid) { shoppingForWhom = (s == "checked") ? 'PERSONAL' : 'BUSINESS'; allFieldsValid = true; } if (allFieldsValid) { if (M_VZW.EmailOptin.TrackingVars != null && M_VZW.EmailOptin.Tracki ngVars.length > 0) { var trackObj = new Object(M_VZW.EmailOptin.TrackingVars); var rsid = "" + trackObj[0].rsid; var linktype = "" + trackObj[0].linktype; var trackurl = "" + trackObj[0].trackurl; var s = s_gi(rsid); s.tl(this, linktype, trackurl); if (nc == "checked") { M_VZW.EmailOptin.FullFormSendNCSignUp(email, lastName, first Name, shoppingForWhom, mobilealertoptin); } else if (c == "checked") { M_VZW.EmailOptin.FullFormSendCSignUp(email, lastName, firstN ame, mtnstripped, shoppingForWhom, mobilealertoptin); } } else { if (nc == "checked") { M_VZW.EmailOptin.FullFormSendNCSignUp(email, lastName, first Name, shoppingForWhom, mobilealertoptin); } else if (c == "checked") { M_VZW.EmailOptin.FullFormSendCSignUp(email, lastName, firstN ame, mtnstripped, shoppingForWhom, mobilealertoptin);

} } } }, /*End Full form email checks/bindings*/ FullFormSendNCSignUp: function (email, lastname, firstname, purchasetype, mo bilealertoptin) { $.ajax({ type: 'POST', url: M_VZW.EmailOptin.Optin_URL, data: { _ID_: M_VZW.EmailOptin.ID, LANGCODE: 'EN', SOURCEID: M_VZW.EmailOptin.SourceID, CHANNEL: 'M', EMAIL: email, LASTNAME: lastname, FIRSTNAME: firstname, CUSTOMERSTATUS: 'NonCustomer', PURCHASETYPE: purchasetype, MOBILEALERTOPTIN: mobilealertoptin, TRIGGERED: 'true' }, statusCode: { 200: function (data) { M_VZW.Global.goto('/shop/thankyou'); }, 302: function () { console.log('error'); M_VZW.Global.goto('/shop/emailerror'); } }, ajaxError: function (e) { console.log(e); M_VZW.Global.goto('/shop/emailerror'); }, success: function () { M_VZW.Global.goto('/shop/thankyou'); }, complete: function (data) { M_VZW.Global.goto('/shop/thankyou'); } }); }, FullFormSendCSignUp: function (email, lastname, firstname, mtn, purchasetype , mobilealertoptin) { $.ajax({ type: 'POST', url: M_VZW.EmailOptin.Optin_URL, data: { _ID_: M_VZW.EmailOptin.ID, LANGCODE: 'EN', SOURCEID: M_VZW.EmailOptin.SourceID, CHANNEL: 'M', EMAIL: email, LASTNAME: lastname, FIRSTNAME: firstname, CUSTOMERSTATUS: 'Customer',

MOBILENUMBER: mtn, PURCHASETYPE: purchasetype, MOBILEALERTOPTIN: mobilealertoptin, TRIGGERED: 'true' }, statusCode: { 200: function (data) { M_VZW.Global.goto('/shop/thankyou'); }, 302: function () { M_VZW.Global.goto('/shop/emailerror'); } }, ajaxError: function (e) { M_VZW.Global.goto('/shop/emailerror'); }, success: function () { M_VZW.Global.goto('/shop/thankyou'); }, complete: function (data) { M_VZW.Global.goto('/shop/thankyou'); } }); }, SendNCSignUp: function (email) { $.ajax({ type: 'POST', url: M_VZW.EmailOptin.Optin_URL, data: { _ID_: M_VZW.EmailOptin.ID, LANGCODE: 'EN', SOURCEID: M_VZW.EmailOptin.SourceID, CHANNEL: 'M', EMAIL: email, CUSTOMERSTATUS: 'NonCustomer', TRIGGERED: 'false' }, statusCode: { 200: function (data) { switch (M_VZW.EmailOptin.NextPage) { case "thankyou": M_VZW.Global.goto('/shop/thankyou'); break; case "fullform": M_VZW.Global.goto('/shop/emailoptin/?email=' + email ); break; default: M_VZW.Global.goto('/shop/thankyou'); } }, 302: function () { M_VZW.EmailOptin.ShowMsg('error', 'The server is busy at the moment. Try again.'); } }, success: function () { switch (M_VZW.EmailOptin.NextPage) { case "thankyou":

M_VZW.Global.goto('/shop/thankyou'); break; case "fullform": M_VZW.Global.goto('/shop/emailoptin/?email=' + email); break; default: M_VZW.Global.goto('/shop/thankyou'); } }, complete: function (data) { switch (M_VZW.EmailOptin.NextPage) { case "thankyou": M_VZW.Global.goto('/shop/thankyou'); break; case "fullform": M_VZW.Global.goto('/shop/emailoptin/?email=' + email); break; default: M_VZW.Global.goto('/shop/thankyou'); } } }); }, SendECSignUp: function (email, mtn) { var dashPattern = /-/ig; var mtnstripped = mtn.replace(dashPattern, ''); $.ajax({ type: 'POST', url: M_VZW.EmailOptin.Optin_URL, data: { _ID_: M_VZW.EmailOptin.ID, LANGCODE: 'EN', SOURCEID: M_VZW.EmailOptin.SourceID, CHANNEL: 'M', EMAIL: email, CUSTOMERSTATUS: 'Customer', MOBILENUMBER: mtnstripped, TRIGGERED: 'false' }, statusCode: { 200: function (data) { switch (M_VZW.EmailOptin.NextPage) { case "thankyou": M_VZW.Global.goto('/shop/thankyou'); break; case "fullform": M_VZW.Global.goto('/shop/emailoptin/?email=' + email ); break; default: M_VZW.Global.goto('/shop/thankyou'); } }, 302: function () { M_VZW.EmailOptin.ShowMsg('error', 'The server is busy at the moment. Try again.'); } },

success: function () { switch (M_VZW.EmailOptin.NextPage) { case "thankyou": M_VZW.Global.goto('/shop/thankyou'); break; case "fullform": M_VZW.Global.goto('/shop/emailoptin/?email=' + email); break; default: M_VZW.Global.goto('/shop/thankyou'); } }, complete: function (data) { switch (M_VZW.EmailOptin.NextPage) { case "thankyou": M_VZW.Global.goto('/shop/thankyou'); break; case "fullform": M_VZW.Global.goto('/shop/emailoptin/?email=' + email); break; default: M_VZW.Global.goto('/shop/thankyou'); } } }); }, ShowMsg: function (t, msg) { M_VZW.EmailOptin.DisplayMsg = true; if (t == "success") { M_VZW.Global.CurrentPage.find("#cust_optin").toggle(); } M_VZW.Global.CurrentPage.find("#optin_msg").css("display", "block"); M_VZW.Global.CurrentPage.find("#optin_msg").text(msg); }, ClearTipMSG: function (obj) { jQuery(obj).parent().find('.tip').css('display', 'none'); }, SetMasks: function () { //M_VZW.Global.CurrentPage.find("#ecmtn").mask("999-999-9999", { placeho lder: " " }); var txt = M_VZW.Global.CurrentPage.find("#ecmtn").val(); if (txt == "ENTER MOBILE NUMBER") { M_VZW.Global.CurrentPage.find("#ecmtn").val(""); } }, RemoveMasks: function () { //M_VZW.Global.CurrentPage.find("#ecmtn").unmask(); var mtn = M_VZW.Global.CurrentPage.find("#ecmtn").val(); if (mtn == "" || mtn == " " || mtn == " - ") { M_VZW.Global.CurrentPage.find("#ecmtn").val("ENTER MOBILE NUMBER"); } }, init: function (PageName) { if (M_VZW.Global.CurrentEmailJS != null) { M_VZW.Global.CurrentEmailJS.RemoveBindings();

} M_VZW.Global.CurrentEmailJS = M_VZW.EmailOptin; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.EmailOptin.CreateBindings(); } }; M_VZW.Shop = { GetMoreReviews_URL: "", CurrentReviewsPage: 1, CreateBindings: function () { M_VZW.Shop.ShopLinksListItem = M_VZW.Global.CurrentPage.find("#ShopLinks li"); M_VZW.Shop.ShopLinksListItem.unbind("vclick", M_VZW.Shop.SelectLink); M_VZW.Shop.ShopLinksListItem.bind("vclick", { "class": $(this).attr("cla ss") }, M_VZW.Shop.SelectLink); }, RemoveBindings: function () { M_VZW.Shop.ShopLinksListItem.unbind("vclick", M_VZW.Shop.ChangeTab); }, SelectLink: function (lnk) { var lnk = $(lnk.currentTarget); var tracking = lnk.attr("data-tracking"); var trackingStatus = lnk.attr("data-tracking-status"); var url = lnk.attr("data-url"); var altURL = lnk.attr("data-alt-url"); if (tracking != 'false') { M_VZW.SiteCatalyst.TrackClick(lnk, trackingStatus, tracking); } if (M_VZW.Global.IsAndroid() == false && M_VZW.Global.IsiOS() == false) { M_VZW.Global.goto(altURL, true); } else { M_VZW.Global.goto(url, true); } }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Shop; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Shop.CreateBindings(); } }; M_VZW.Deals = { CreateBindings: function () { M_VZW.Global.CurrentPage.find("#ShopLinks li").unbind("vclick", M_VZW.Sh op.SelectLink); M_VZW.Global.CurrentPage.find("#ShopLinks li").bind("vclick", M_VZW.Shop .SelectLink); },

RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#ShopLinks li").unbind("vclick", M_VZW.Sh op.ChangeTab); }, SelectLink: function (lnk) { var lnk = $(lnk.currentTarget); var tracking = lnk.attr("data-tracking"); var trackingStatus = lnk.attr("data-tracking-status"); var url = lnk.attr("data-url"); var altURL = lnk.attr("data-alt-url"); M_VZW.SiteCatalyst.TrackClick(lnk, trackingStatus, tracking); if (M_VZW.Global.IsAndroid() == false && M_VZW.Global.IsiOS() == false) { M_VZW.Global.goto(altURL, true); } else { M_VZW.Global.goto(url, true); } }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Deals; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Deals.CreateBindings(); }, CheckDealsCookie: function () { return M_VZW.Global.readCookie("mvzw_specialdeals"); } }; M_VZW.ProductCatalog = { CreateBindings: function () { M_VZW.Global.CurrentPage.find("#device-listings li").unbind("vclick", M_ VZW.ProductCatalog.DeviceSelected); M_VZW.Global.CurrentPage.find("#device-listings li").bind("vclick", M_VZ W.ProductCatalog.DeviceSelected); M_VZW.Global.CurrentPage.find("#accessory-listings li").unbind("vclick", M_VZW.ProductCatalog.DeviceSelected); M_VZW.Global.CurrentPage.find("#accessory-listings li").bind("vclick", M _VZW.ProductCatalog.DeviceSelected); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#device-listings li").unbind("vclick", M_ VZW.ProductCatalog.DeviceSelected); M_VZW.Global.CurrentPage.find("#accessory-listings li").unbind("vclick", M_VZW.ProductCatalog.DeviceSelected); }, DeviceSelected: function (btn) { var btn = $(btn.currentTarget); var url = btn.attr("details-url"); M_VZW.Global.goto(url, false); //$.mobile.changePage(url);

}, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.ProductCatalog; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.ProductCatalog.CreateBindings(); M_VZW.Modal.setNavBehaviour("#" + PageName); } }; M_VZW.ProductDetails = { GetMoreReviews_URL: "", CurrentReviewsPage: 1, Quantity: 1, AddCart_URL: "", CheckPhoneUserAgent: 'false', CreateBindings: function () { M_VZW.Global.CurrentPage.find("#device-sections li").off("vclick", M_VZW .ProductDetails.ChangeTab); M_VZW.Global.CurrentPage.find("#device-sections li").on("vclick", M_VZW. ProductDetails.ChangeTab); M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").off("vclick", M_VZW .ProductDetails.RetrieveMoreReviews); M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").on("vclick", M_VZW. ProductDetails.RetrieveMoreReviews); M_VZW.Global.CurrentPage.find("#lnkReadReviews").off("vclick", M_VZW.Pro ductDetails.GotoReviews); M_VZW.Global.CurrentPage.find("#lnkReadReviews").on("vclick", M_VZW.Prod uctDetails.GotoReviews); M_VZW.Global.CurrentPage.find("#device-pic-vid").off("vclick", M_VZW.Pro ductDetails.PlayVideo); M_VZW.Global.CurrentPage.find("#device-pic-vid").on("vclick", M_VZW.Prod uctDetails.PlayVideo); M_VZW.Global.CurrentPage.find("#btnAddCartAccessory").off("vclick", M_VZ W.ProductDetails.AddAccessoryToCart); M_VZW.Global.CurrentPage.find("#btnAddCartAccessory").on("vclick", M_VZW .ProductDetails.AddAccessoryToCart); //Device Add To Cart Buttons M_VZW.Global.CurrentPage.find("#device-cta").off("vclick", M_VZW.Product Details.AddDeviceToCart); M_VZW.Global.CurrentPage.find("#device-cta").on("vclick", M_VZW.ProductD etails.AddDeviceToCart); M_VZW.Global.CurrentPage.find("#device-accessories-cta").off("vclick", M _VZW.ProductDetails.AddDeviceBundleToCart); M_VZW.Global.CurrentPage.find("#device-accessories-cta").on("vclick", M_ VZW.ProductDetails.AddDeviceBundleToCart); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#lnkReadReviews").off("vclick", M_VZW.Pro

ductDetails.GotoReviews); M_VZW.Global.CurrentPage.find("#device-sections li").off("vclick", M_VZW .ProductDetails.ChangeTab); M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").off("vclick", M_VZW .ProductDetails.RetrieveMoreReviews); M_VZW.Global.CurrentPage.find("#device-pic-vid").off("vclick", M_VZW.Pro ductDetails.PlayVideo); M_VZW.Global.CurrentPage.find("#btnAddCartAccessory").off("vclick", M_VZ W.ProductDetails.AddAccessoryToCart); }, GotoReviews: function (lnk) { var btn = M_VZW.Global.CurrentPage.find("#device-sections li").filter(fu nction (index) { return $(this).attr("tabname") == "device-reviews" }); btn.click(); var lnk = $(lnk.currentTarget); var tracking = lnk.attr("data-tracking"); M_VZW.SiteCatalyst.TrackClick(lnk, 'o', tracking); //$(window).scrollTo(0,200); }, PlayVideo: function (btn) { var btn = $(btn.currentTarget); if (btn.attr("video-URL") != "#") { M_VZW.SiteCatalyst.TrackClick(btn, 'd', "play-video"); window.location = btn.attr("video-URL"); } }, ChangeTab: function (btn) { M_VZW.Global.CurrentPage.find('#device-sections li').filter(".current"). removeClass("current") M_VZW.Global.CurrentPage.find('#device-details div').filter(".showdetail s").removeClass("showdetails").addClass("hidedetails"); var btn = $(btn.currentTarget); var TabName = "#" + btn.attr("tabname"); var tab = M_VZW.Global.CurrentPage.find(TabName); btn.addClass("current"); tab.removeClass("hidedetails").addClass("showdetails"); var tracking = btn.attr("data-tracking"); M_VZW.SiteCatalyst.TrackClick(btn, 'o', tracking); }, RetrieveMoreReviews: function () { var parsedTotalReviews = parseInt(M_VZW.Global.CurrentPage.find("#number OfTotalReviews").val()); var totalReviews = 0; var endOfReviews = false; if (!isNaN(parsedTotalReviews)) { totalReviews = parsedTotalReviews; } if (totalReviews <= 5) { endOfReviews = true; M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").off("vclick", M _VZW.ProductDetails.RetrieveMoreReviews); M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").addClass("apply

DisabledBtnAttrib"); } else { M_VZW.SiteCatalyst.TrackClick(M_VZW.Global.CurrentPage.find("#btnLoa dMoreReviews"), 'o', 'more reviews'); M_VZW.ProductDetails.CurrentReviewsPage = M_VZW.ProductDetails.Curre ntReviewsPage + 1; // Check to see if the total number of reviews have been retrieved. if so, then disable the load // reviews button on the page. try { if (M_VZW.ProductDetails.CurrentReviewsPage * 5 > totalReviews) { endOfReviews = true; } } catch (err) { } var url = M_VZW.ProductDetails.GetMoreReviews_URL + "/" + M_VZW.Prod uctDetails.CurrentReviewsPage; $.get(url, {}, function (data) { var ReviewContainer = $(M_VZW.Global.CurrentPage.find("#custom er-reviews")); ReviewContainer.append(data); if (endOfReviews) { M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").off(" vclick", M_VZW.ProductDetails.RetrieveMoreReviews); M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").addCl ass("applyDisabledBtnAttrib"); } }); } }, getCustInfoCookie: function () { var i, x, y, ARRcookies = document.cookie.split(";"); var c_name = "CustType"; for (i = 0; i < ARRcookies.length; i++) { x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")); y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1); x = x.replace(/^\s+|\s+$/g, ""); if (x == c_name) { return unescape(y); } } }, checkCartQty: function () { if ($('#gn_cartbtn').length) { return parseFloat($('#gn_cartbtn').attr('data-cart-qty')); } else { return 0; } },

AddDeviceToCart: function () { var custCookie = M_VZW.ProductDetails.getCustInfoCookie(); //possible va lues that this should return are NewCustomer or ExistingCustomer var cartQty = M_VZW.Global.readCookie('vzw_cart_qty'); if (typeof custCookie == "undefined") custCookie = ""; if (custCookie != "ExistingCustomer" && cartQty < 5) { M_VZW.ProductDetails.Track_AddDeviceToCart(M_VZW.ProductDetails.Devi ceName); $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.ProductDetails.AddCart_Url, success: M_VZW.ProductDetails.AddCart_Success, data: { OrderType: M_VZW.ProductDetails.OrderType, PhoneID: M_VZW.ProductDetails.PhoneID, PhoneQuantity: 1, FilterType: M_VZW.ProductDetails.FilterType, IncludeFeatAccessories: false } }); } else if (custCookie == "ExistingCustomer" && cartQty < 5) { M_VZW.ProductDetails.Track_AddDeviceToCart(M_VZW.ProductDetails.Devi ceName); $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.ProductDetails.AddCart_Url, success: M_VZW.ProductDetails.AddCart_Success, data: { OrderType: "Upgrade", PhoneID: M_VZW.ProductDetails.PhoneID, PhoneQuantity: 1, FilterType: M_VZW.ProductDetails.FilterType, IncludeFeatAccessories: false } }); } else { try { var NewPageURL = "/Cart/Contents" window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } } }, AddDeviceBundleToCart: function () { var custCookie = M_VZW.ProductDetails.getCustInfoCookie(); //possible va lues that this should return are NewCustomer or ExistingCustomer var cartQty = M_VZW.Global.readCookie('vzw_cart_qty'); if (typeof custCookie == "undefined") custCookie = ""; if (custCookie != "ExistingCustomer" && cartQty < 5) { M_VZW.ProductDetails.Track_AddDeviceAndAccessoriesToCart(M_VZW.Produ ctDetails.DeviceName, M_VZW.ProductDetails.FeaturedAccessories); $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST',

url: M_VZW.ProductDetails.AddCart_Url, success: M_VZW.ProductDetails.AddCart_Success, data: { OrderType: M_VZW.ProductDetails.OrderType, PhoneID: M_VZW.ProductDetails.PhoneID, PhoneQuantity: 1, FilterType: M_VZW.ProductDetails.FilterType, IncludeFeatAccessories: true } }); } else if (custCookie == "ExistingCustomer" && cartQty < 5) { M_VZW.ProductDetails.Track_AddDeviceAndAccessoriesToCart(M_VZW.Produ ctDetails.DeviceName, M_VZW.ProductDetails.FeaturedAccessories); $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.ProductDetails.AddCart_Url, success: M_VZW.ProductDetails.AddCart_Success, data: { OrderType: "Upgrade", PhoneID: M_VZW.ProductDetails.PhoneID, PhoneQuantity: 1, FilterType: M_VZW.ProductDetails.FilterType, IncludeFeatAccessories: true } }); } else { try { var NewPageURL = "/Cart/Contents" window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } } }, AddAccessoryToCart: function () { $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.ProductDetails.AddCart_URL, success: M_VZW.ProductDetails.AddCartAccessory_Success, data: { PhonePK: M_VZW.ProductDetails.PhonePK, AccessoryPK: M_VZW.ProductDetails.AccessoryPK, Quantity: M_VZW.ProductDetails.Quantity } }); }, AddCart_Success: function (result) { var cartQty = M_VZW.CartContents.getDeviceQtyTotal(); if (!cartQty) { M_VZW.Global.CreateHourCookie('vzw_cart_qty', 1, 1); } else { M_VZW.Global.CreateHourCookie('vzw_cart_qty', parseFloat(cartQty) + 1, 1); } cartQty = parseFloat(M_VZW.Global.readCookie('vzw_cart_qty')); try {

var NewPageURL = jQuery.parseJSON(result).ResponseData; window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } }, AddCartAccessory_Success: function (result) { M_VZW.Global.ClearCookie('vzw_cart_qty'); try { var NewPageURL = jQuery.parseJSON(result).ResponseData; window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } }, Track_AddDeviceToCart: function (devicename) { s.linkTrackVars = "eVar2,eVar3,list1"; s.eVar2 = "blank"; //Clear Any Previous Device s.eVar3 = "blank"; //Clear Any Previous Accessory SKUs s.list1 = "blank"; //Clear Any Previous Accessory SKUs M_VZW.SiteCatalyst.TrackClick(this, "o", "device add to cart"); }, Track_AddDeviceAndAccessoriesToCart: function (devicename, accSku) { s.linkTrackVars = "eVar2,eVar3,list1"; var skulist = accSku; s.eVar2 = "mobile/shop/phones-devices/device details/" + devicename; s.eVar3 = skulist; //Accessories SKUs, comma delimited s.list1 = skulist; //Accessories SKUs, comma delimited M_VZW.SiteCatalyst.TrackClick(this, "o", "tab/accessories/device bundle add to cart"); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) { try { M_VZW.Global.CurrentJS.RemoveBindings(); } catch (err) { } } M_VZW.Global.CurrentJS = M_VZW.ProductDetails; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.ProductDetails.CreateBindings(); M_VZW.Modal.setNavBehaviour("#" + PageName); if (M_VZW.ProductDetails.CheckPhoneUserAgent == "true") { M_VZW.MAS_ChoosePhones.GetDeviceFromUA_Compatibility(navigator.userA gent); } var parsedTotalReviews = parseInt(M_VZW.Global.CurrentPage.find("#number OfTotalReviews").val()); var totalReviews = 0; var endOfReviews = false; if (!isNaN(parsedTotalReviews)) {

totalReviews = parsedTotalReviews; } if (totalReviews <= 5) { endOfReviews = true; M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").off("vclick", M _VZW.ProductDetails.RetrieveMoreReviews); M_VZW.Global.CurrentPage.find("#btnLoadMoreReviews").addClass("apply DisabledBtnAttrib"); } } }; M_VZW.NewDevice = { DisplayMsg: false, CreateBindings: function () { M_VZW.Global.CurrentPage.find("#chkEC").unbind("change", M_VZW.NewDevice .ECCheck); M_VZW.Global.CurrentPage.find("#chkEC").bind("change", M_VZW.NewDevice.E CCheck); M_VZW.Global.CurrentPage.find("#ecoptin").unbind("focus", M_VZW.NewDevic e.ClearIt); M_VZW.Global.CurrentPage.find("#ecoptin").bind("focus", M_VZW.NewDevice. ClearIt); M_VZW.Global.CurrentPage.find("#ecoptin").unbind("blur", M_VZW.NewDevice .CheckIt); M_VZW.Global.CurrentPage.find("#ecoptin").bind("blur", M_VZW.NewDevice.C heckIt); M_VZW.Global.CurrentPage.find("#ecmtn").die("focus", M_VZW.NewDevice.Set Masks); M_VZW.Global.CurrentPage.find("#ecmtn").live("focus", M_VZW.NewDevice.Se tMasks); M_VZW.Global.CurrentPage.find("#ecmtn").die("blur", M_VZW.NewDevice.Remo veMasks); M_VZW.Global.CurrentPage.find("#ecmtn").live("blur", M_VZW.NewDevice.Rem oveMasks); M_VZW.Global.CurrentPage.find("#ecsignup").unbind("vclick", M_VZW.NewDev ice.ECOptIn); M_VZW.Global.CurrentPage.find("#ecsignup").bind("vclick", M_VZW.NewDevic e.ECOptIn); M_VZW.Global.CurrentPage.find("#ncsignup").unbind("vclick", M_VZW.NewDev ice.NCOptIn); M_VZW.Global.CurrentPage.find("#ncsignup").bind("vclick", M_VZW.NewDevic e.NCOptIn); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#ecoptin").unbind("focus", M_VZW.NewDevic e.ClearIt); M_VZW.Global.CurrentPage.find("#ecoptin").unbind("blur", M_VZW.NewDevice .CheckIt); M_VZW.Global.CurrentPage.find("#ecmtn").die("focus", M_VZW.NewDevice.Set Masks); M_VZW.Global.CurrentPage.find("#ecmtn").die("blur", M_VZW.NewDevice.Remo veMasks);

M_VZW.Global.CurrentPage.find("#chkEC").unbind("change", M_VZW.NewDevice .ECCheck); M_VZW.Global.CurrentPage.find("#ecsignup").unbind("vclick", M_VZW.NewDev ice.ECOptIn); M_VZW.Global.CurrentPage.find("#ncsignup").unbind("vclick", M_VZW.NewDev ice.NCOptIn); }, ECCheck: function () { M_VZW.Global.CurrentPage.find("#ncsignup").toggle(); M_VZW.Global.CurrentPage.find("#mtn").toggle(); }, ECOptIn: function () { if (M_VZW.NewDevice.DisplayMsg) { M_VZW.NewDevice.DisplayMsg = false; M_VZW.Global.CurrentPage.find("#optin_msg").css("display", "none"); } var email = M_VZW.Global.CurrentPage.find("#ecoptin").val(); var mtn = M_VZW.Global.CurrentPage.find("#ecmtn").val(); var e = M_VZW.NewDevice.CheckEmail(email); var mn = M_VZW.NewDevice.CheckMTN(mtn); if (e && mn) { M_VZW.NewDevice.SendECSignUp(email, mtn); } else { if (!e && !mn) { M_VZW.NewDevice.ShowMsg('error', 'Please enter in a valid email address and mobile number.'); } else if (!e) { if (email == "ENTER EMAIL") { M_VZW.NewDevice.ShowMsg('error', 'Please enter a valid email address.'); } else { M_VZW.NewDevice.ShowMsg('error', 'Please enter a valid email address.'); } } else if (!mn) { M_VZW.NewDevice.ShowMsg('error', 'Please enter a valid mobile nu mber.'); } } }, NCOptIn: function () { var email = M_VZW.Global.CurrentPage.find("#ecoptin").val(); var e = M_VZW.NewDevice.CheckEmail(email); if (e) { M_VZW.NewDevice.SendNCSignUp(email); } else { if (!e) { if (email == "ENTER EMAIL") { M_VZW.NewDevice.ShowMsg('error', 'Please enter a valid email address.'); } else { M_VZW.NewDevice.ShowMsg('error', 'Please enter a valid email address.');

} } } }, ClearIt: function () { var txt = M_VZW.Global.CurrentPage.find("#ecoptin").val(); if (txt == "ENTER EMAIL") { M_VZW.Global.CurrentPage.find("#ecoptin").val(""); } }, CheckIt: function () { var txt = M_VZW.Global.CurrentPage.find("#ecoptin").val(); if (txt == " " || txt == "") { M_VZW.Global.CurrentPage.find("#ecoptin").val("ENTER EMAIL"); } }, CheckEmail: function (e) { var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; return emailPattern.test(e); }, CheckMTN: function (mtn) { var dashPattern = /-/ig; var mtnstripped = mtn.replace(dashPattern, ''); var mtnPattern = /\d{7}/; return mtnPattern.test(mtnstripped); }, SendNCSignUp: function (email) { $.ajax({ type: 'POST', url: M_VZW.NewDevice.Optin_URL, data: { _ID_: 'vzw.9019', LANGCODE: 'EN', SOURCEID: '12_03_ACME3_Optin_Mobile', CHANNEL: 'M', EMAIL: email, CUSTOMERSTATUS: 'NonCustomer' }, statusCode: { 200: function (data) { M_VZW.Global.goto('/shop/thankyou'); }, 302: function () { M_VZW.NewDevice.ShowMsg('error', 'The server is busy at the moment. Try again.'); } }, success: function () { M_VZW.Global.goto('/shop/thankyou'); }, complete: function (data) { M_VZW.Global.goto('/shop/thankyou'); } }); },

SendECSignUp: function (email, mtn) { var dashPattern = /-/ig; var mtnstripped = mtn.replace(dashPattern, ''); $.ajax({ type: 'POST', url: M_VZW.NewDevice.Optin_URL, data: { _ID_: 'vzw.9019', LANGCODE: 'EN', SOURCEID: '12_03_ACME3_Optin_Mobile', CHANNEL: 'M', EMAIL: email, CUSTOMERSTATUS: 'Customer', MOBILENUMBER: mtnstripped }, statusCode: { 200: function (data) { M_VZW.Global.goto('/shop/thankyou'); }, 302: function () { M_VZW.NewDevice.ShowMsg('error', 'The server is busy at the moment. Try again.'); } }, success: function () { M_VZW.Global.goto('/shop/thankyou'); }, complete: function (data) { M_VZW.Global.goto('/shop/thankyou'); } }); }, ShowMsg: function (t, msg) { M_VZW.NewDevice.DisplayMsg = true; if (t == "success") { M_VZW.Global.CurrentPage.find("#cust_optin").toggle(); } M_VZW.Global.CurrentPage.find("#optin_msg").css("display", "block"); M_VZW.Global.CurrentPage.find("#optin_msg").text(msg); }, SetMasks: function () { //M_VZW.Global.CurrentPage.find("#ecmtn").mask("999-999-9999", { placeho lder: " " }); var txt = M_VZW.Global.CurrentPage.find("#ecmtn").val(); if (txt == "ENTER MOBILE NUMBER") { M_VZW.Global.CurrentPage.find("#ecmtn").val(""); } }, RemoveMasks: function () { //M_VZW.Global.CurrentPage.find("#ecmtn").unmask(); var mtn = M_VZW.Global.CurrentPage.find("#ecmtn").val(); if (mtn == "" || mtn == " " || mtn == " - ") { M_VZW.Global.CurrentPage.find("#ecmtn").val("ENTER MOBILE NUMBER"); } },

init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.NewDevice; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.NewDevice.CreateBindings(); } }; M_VZW.Cart = { LogIn_URL: "", SelectLine_URL: "", Cancel_URL: "", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#btnLogIn").unbind("vclick", M_VZW.Cart.L ogIn); M_VZW.Global.CurrentPage.find("#btnLogIn").bind("vclick", M_VZW.Cart.Log In); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnLogIn").unbind("vclick", M_VZW.Cart.L ogIn); }, LogIn: function () { $.mobile.showPageLoadingMsg(); var doughValue = M_VZW.Global.readCookie("mox_dough"); if (doughValue != false && doughValue != "undefined") { M_VZW.Global.goto(M_VZW.Cart.SelectLine_URL, true); } else M_VZW.Global.goto(M_VZW.Cart.LogIn_URL); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Cart; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Cart.CreateBindings(); M_VZW.TradeIns.GetDeviceFromUA(); }, BuildCartSubtotal: function () { var subtotal = 0; var multiplier; $('.finalDevicePrice').each(function () { if ($(this).text().indexOf('FREE') > -1) { subtotal = subtotal; } else { multiplier = $(this).parent().parent().find('.PhoneQuantity').va l(); subtotal += parseFloat($(this).text().replace('$', '')) * multip lier;

} }); subtotal = subtotal.toFixed(2); $('#subtotalContainer').text('$' + subtotal); }, UpdateDeviceQtyInCart: function (PhoneID, PhoneQty, OrderType, HasAccessorie s, LineID) { $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: '/Cart/Shop/Devices/UpdateQty', success: M_VZW.Cart.UpdateCart_Success, data: { OrderType: OrderType, SelectedDeviceID: PhoneID, PhoneQuantity: PhoneQty, IncludeFeatAccessories: HasAccessories, LineID: parseFloat(LineID) } }); }, UpdateCart_Success: function (result) { $.mobile.hidePageLoadingMsg(); window.location = '/Cart/Contents'; }, ShowDeviceTradeInOption: function (device) { var copy = $("#tradein_label").text(); copy = copy.replace("[PRICE]", device.price).replace("[DEVICE]", device. name); $("#tradein_label").text(copy); $("#tradein_msg").css("display", "block"); $("#tradein_device").change(function () { if (this.checked) M_VZW.TradeIns.TradeInDeviceSelected(); else M_VZW.TradeIns.TradeInDeviceDeSelected(); }); if (M_VZW.TradeIns.CheckForTradeInSelected()) { $("#tradein_device").attr("checked", true); } }, ClearSessionAndCart: function (NewURL) { /*var PhonePK = -1; var removeUrl = "/Cart/Contents/Remove/-1"; $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: removeUrl, success: function () { //Clear the order cookie M_VZW.Global.ClearCookie('CustType'); window.location = NewURL; }, data: { PhonePK: PhonePK,

HasAccessories: false } });*/ $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.Cart.Cancel_URL, success: function (result) { try { var NewPageURL = jQuery.parseJSON(result).ResponseData; //Clear the order cookie M_VZW.Global.ClearCookie('CustType'); window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } } }); } }; M_VZW.CartContents = { InitialCartQty: "", CreateBindings: function () { $(document).find('#btnLogIn').on('tap', function () { $(".OrderType").val("Upgrade"); $(".PhoneQuantity-Dropdown").css("display", "none"); $(".device-name div").css("display", "none"); $(".offer").css("display", "none"); $(".qty").css("display", "block"); M_VZW.CartContents.setCustInfoCookie("ExistingCustomer"); M_VZW.CartContents.hideBtns(); }); $(document).find('#btnNewCustomer').on('vmouseup', function () { $(".OrderType").val("NSE"); $(".PhoneQuantity-Dropdown").css("display", "block"); $(".device-name div").css("display", "block"); $(".offer").css("display", "block"); $(".qty").css("display", "none"); M_VZW.CartContents.setCustInfoCookie("NewCustomer"); M_VZW.CartContents.hideBtns(); if (M_VZW.CartContents.InitialCartQty < 5) $('.continue-btn').show() ; }); M_VZW.Global.CurrentPage.find('.PhoneQuantity').on('change', function () { M_VZW.CartContents.updateCartQty($(this)); }); $(document).find(".device-remove").off("tap"); $(document).find(".device-remove").on("tap", function () { M_VZW.CartContents.RemoveDeviceFromCart(this); //clearInterval(interval); }); $(document).find('#blackBKG').off('vclick'); $(document).find('#blackBKG').on('vclick', function () { //M_VZW.CartContents.hideBtns(); });

M_VZW.Global.CurrentPage.find('#btnCheckOut .redCartBtn').on('vclick', f unction () { $(".cartcontents").submit(); }); M_VZW.Global.CurrentPage.find('#btnContinue').on('vclick', function () { var NewPageURL = "/Shop/Categories" window.location = NewPageURL; }); //Hide/Show Continue Shopping button $('.continue-btn').hide(); var custCookie = M_VZW.CartContents.getCustInfoCookie(); if (custCookie == "NewCustomer" && M_VZW.CartContents.InitialCartQty < 5 ) { $('.continue-btn').show(); $('#qtyTotalReminder').hide(); } else if (M_VZW.CartContents.InitialCartQty >= 5) { //Show Error message if there already 5 items in the cart $('#qtyTotalReminder').show(); } }, RemoveBindings: function () { $(document).find(".device-remove").off("tap"); $(document).find('#blackBKG').off('vclick'); $(document).find('#btnLogIn').off('tap'); $(document).find('#btnNewCustomer').off('tap'); }, showBtns: function () { var custCookie = M_VZW.CartContents.getCustInfoCookie(); if (custCookie == null || custCookie == "") { $(document).find('#blackBKG').css('display', 'block'); $(document).find('#customerBtns').css('display', 'block'); } else { if (custCookie == "NewCustomer" && M_VZW.CartContents.InitialCartQty < 5) $('.continue-btn').show(); M_VZW.CartContents.checkCustInfoCookie(custCookie); M_VZW.CartContents.hideBtns(); } }, hideBtns: function () { $(document).find('#customerBtns').css('display', 'none'); $(document).find('#blackBKG').css('display', 'none'); /*var interval = setInterval(function () { $(".device-remove").off("tap"); $(".device-remove").on("tap", function () { M_VZW.CartContents.RemoveDeviceFromCart(this); clearInterval(interval); }); }, 1000);*/ }, setCustInfoCookie: function (value) { M_VZW.Global.CreateHourCookie("CustType", escape(value), 1); },

getCustInfoCookie: function () { var i, x, y, ARRcookies = document.cookie.split(";"); var c_name = "CustType"; for (i = 0; i < ARRcookies.length; i++) { x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")); y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1); x = x.replace(/^\s+|\s+$/g, ""); if (x == c_name) { return unescape(y); } } }, checkCustInfoCookie: function (cookieValue) { if (cookieValue == "ExistingCustomer") { $(".OrderType").val("Upgrade"); $(".PhoneQuantity-Dropdown").css("display", "none"); $(".qty").css("display", "block"); } else { $(".OrderType").val("NSE"); } }, RemoveDeviceFromCart: function (obj) { var lineID = jQuery(obj).attr("lineid"); var phonePK = jQuery(obj).attr("data-phone-pk"); var hasAcc = jQuery(obj).attr("data-has-accessories"); var removeUrl = "/Cart/Contents/Remove/" + phonePK; var cartQty = parseFloat(M_VZW.Global.readCookie('vzw_cart_qty')); var currentQtyByPK = $('#Qty-' + phonePK).attr('value'); var newQty = cartQty - currentQtyByPK; if (newQty > 0) { M_VZW.Global.CreateHourCookie('vzw_cart_qty', newQty, 1); } else { M_VZW.Global.ClearCookie('vzw_cart_qty'); } $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: removeUrl, success: M_VZW.CartContents.RemoveCart_Success, data: { PhonePK: phonePK, HasAccessories: hasAcc } }); }, RemoveCart_Success: function (result) { try { var NewPageURL = jQuery.parseJSON(result).ResponseData; window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } }, getDeviceQtyTotal: function () {

var devQty = 0; var cookieQty = M_VZW.Global.readCookie('vzw_cart_qty'); if (cookieQty) { devQty = parseFloat(M_VZW.Global.readCookie('vzw_cart_qty')); } /*M_VZW.Global.CurrentPage.find('.PhoneQuantity').each(function () { devQty += parseFloat($(this).attr('value')); });*/ return devQty; }, updateCartQty: function (changedEl) { var el = changedEl; var cartQty = M_VZW.CartContents.getDeviceQtyTotal(); var deviceID = el.attr('id').replace('Qty-', ''); var prevQty = el.attr('data-chosen-qty'); var deviceQty = parseFloat(el.val()); var orderType = $('.OrderType').first().val(); var LineID = $('#device-info-' + deviceID).find('.device-remove').attr(' lineid'); var hasAccessories = el.attr('data-has-accessories'); $('.cartMsg').hide(); $('.cartMsg').text(""); if (cartQty > 1) { M_VZW.Global.CurrentPage.find('.share_more').css("display", "none"); M_VZW.Global.CurrentPage.find('.share_more_bundle').css("display", " none"); } else { M_VZW.Global.CurrentPage.find('.share_more').css("display", "block") ; M_VZW.Global.CurrentPage.find('.share_more_bundle').css("display", " block"); } if (cartQty >= 5 && deviceQty > prevQty) { M_VZW.Global.CurrentPage.find('.continue-btn').css("display", "none" ); $('#qtyTotalReminder').show(); $('#device-info-' + deviceID).show(); el.parents('#device-info-' + deviceID).find("#device-" + deviceID + "-msg").text("We're sorry, you may only add up to 5 devices at a time."); $(".cartMsg").show(); el.val(prevQty); el.selectmenu("refresh", true); //have to refresh the jQ mobile ui t o see the change } else if (el.val() != prevQty) { el.parents('#device-info-' + deviceID).find("#device-" + deviceID + "-msg").text(""); $(".cartMsg").hide(); var cookieQty = (cartQty - prevQty) + deviceQty; if(cookieQty <= 5){ M_VZW.Global.CreateHourCookie('vzw_cart_qty', cookieQty, 1); } M_VZW.Cart.UpdateDeviceQtyInCart(deviceID, deviceQty, orderType, has Accessories, LineID); } //M_VZW.CartContents.toggleContinueButton(); }, toggleContinueButton: function () {

var cartQty = M_VZW.CartContents.getDeviceQtyTotal(); if (cartQty >= 5) { $('.continue-btn').hide(); $('#qtyTotalReminder').show(); } else { $('.continue-btn').show(); $('#qtyTotalReminder').hide(); } }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Home; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.CartContents.RemoveBindings(); M_VZW.CartContents.CreateBindings(); M_VZW.TradeIns.GetDeviceFromUA(); var bgHeight = $(document).height(); $(document).find('#blackBKG').height(bgHeight); } };M_VZW.SharedDataPlans = { GOTO_FEAURES_URL: "", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#cart-sections li").off("vclick", M_VZW.S haredDataPlans.ChangeTab); M_VZW.Global.CurrentPage.find("#cart-sections li").on("vclick", M_VZW.Sh aredDataPlans.ChangeTab); M_VZW.Global.CurrentPage.find('#shared-data-plan-choices-tabs li').not(" .spacer").off("vclick", M_VZW.SharedDataPlans.ChangeDataPlanTab); M_VZW.Global.CurrentPage.find('#shared-data-plan-choices-tabs li').not(" .spacer").on("vclick", M_VZW.SharedDataPlans.ChangeDataPlanTab); M_VZW.Global.CurrentPage.find("#btnAddCart").off("vclick", M_VZW.SharedD ataPlans.AddToCart); M_VZW.Global.CurrentPage.find("#btnAddCart").on("vclick", M_VZW.SharedDa taPlans.AddToCart); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#cart-sections li").off("vclick", M_VZW.S haredDataPlans.ChangeTab); M_VZW.Global.CurrentPage.find('#shared-data-plan-choices-tabs li').not(" .spacer").off("vclick", M_VZW.SharedDataPlans.ChangeDataPlanTab); M_VZW.Global.CurrentPage.find("#btnAddCart").off("vclick", M_VZW.SharedD ataPlans.AddToCart); }, ChangeTab: function (btn) { var btn = $(btn.currentTarget); var TabName = "#" + btn.attr("tabname"); var CatID = "#shared_data_plans"; var catDiv = M_VZW.Global.CurrentPage.find(CatID);

catDiv.find('#cart-sections li').filter(".current").removeClass("current "); catDiv.find('#options-and-information div').filter(".showdetails").remov eClass("showdetails").addClass("hidedetails"); var tab = catDiv.find(TabName); btn.addClass("current"); tab.removeClass("hidedetails").addClass("showdetails"); }, ChangeDataPlanTab: function (btn) { var btn = $(btn.currentTarget); var TabName = "#" + btn.attr("tabname"); var tabs = M_VZW.Global.CurrentPage.tabs; var pages = M_VZW.Global.CurrentPage.pages; btn.addClass("current").addClass("currenttab"); tabs.not(btn).removeClass("current").removeClass("currenttab"); pages.filter(".current").removeClass("current"); pages.filter(TabName).addClass("current"); M_VZW.SharedDataPlans.UpdateForm(); }, UpdateForm: function () { var Minutes = M_VZW.Global.CurrentPage.find("#SelectedMinutesPK"); var CurrentTab = M_VZW.Global.CurrentPage.find(".currenttab").attr("data -minutes-pk"); Minutes.val(CurrentTab); }, MinutesSelected: function (btn) { }, AddToCart: function () { M_VZW.Global.CurrentPage.find("#DataSelectionForm").submit(); }, AddCart_Success: function (result) { }, GetSelected: function () { }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.SharedDataPlans; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.SharedDataPlans.CreateBindings(); M_VZW.SharedDataPlans.UpdateForm(); M_VZW.Global.CurrentPage.tabs = $("#shared-data-plan-choices-tabs ul li" ).not(".spacer"); M_VZW.Global.CurrentPage.pages = $("#shared-data-plan-choices-panels>div "); M_VZW.Global.CurrentPage.find('#shared-data-plan-choices-tabs li').not("

.spacer").filter(".current").trigger("vclick"); }, tabs: "", pages: "" }; M_VZW.Features = { TotalFeatures: 0, selectedPKs: "", AddCart_URL: "", PhonePK: "", IncludeFeaturedAccessories: false, PlanMinPK: "", PlanCatPK: "", OrdType: "NSE", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#cart-sections li").unbind("vclick", M_VZ W.Features.ChangeTab); M_VZW.Global.CurrentPage.find("#cart-sections li").bind("vclick", M_VZW. Features.ChangeTab); M_VZW.Global.CurrentPage.find("#cart-choices li").unbind("vclick", M_VZW .Features.FeatureChanged); M_VZW.Global.CurrentPage.find("#cart-choices li").bind("vclick", M_VZW.F eatures.FeatureChanged); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnAddCart").unbind("vclick", M_VZW.Feat ures.AddToCart); M_VZW.Global.CurrentPage.find("#cart-choices li").unbind("vclick", M_VZW .Features.FeatureChanged); M_VZW.Global.CurrentPage.find("#cart-sections li").unbind("vclick", M_VZ W.Features.ChangeTab); }, DisableAllButtons: function () { M_VZW.Global.CurrentPage.find("#btnAddCart").unbind("vclick", M_VZW.Feat ures.AddToCart); M_VZW.Global.CurrentPage.find("#btnAddCart").removeClass("h-red-gradient -bg").addClass("h-grey-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnAddCart span").removeClass("redCartBt n").addClass("disabledBtn"); }, EnableCartBtns: function () { if (M_VZW.Features.GetSelectedItems() == M_VZW.Features.TotalFeatures) { M_VZW.Global.CurrentPage.find("#btnAddCart").removeClass("h-grey-gra dient-bg").addClass("h-red-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnAddCart span").removeClass("disab ledBtn").addClass("redCartBtn"); M_VZW.Global.CurrentPage.find("#btnAddCart").bind("vclick", M_VZW.Fe atures.AddToCart); } }, GetSelectedItems: function () { M_VZW.Features.selectedPKs = new Array();

var count = 0; M_VZW.Global.CurrentPage.find(".currentChoice").each(function (k, item) { var i = $(item); if (i.attr("class") == "currentChoice") { M_VZW.Features.selectedPKs[count] = i.attr("pk"); count += 1; } }); return count; }, ChangeTab: function (btn) { var btn = $(btn.currentTarget); var currentSection = M_VZW.Global.CurrentPage.find("#feature-" + btn.att r("data-type")); currentSection.find('#cart-sections li').filter(".current").removeClass( "current") currentSection.find('#options-and-information div').filter(".showdetails ").removeClass("showdetails").addClass("hidedetails"); var TabName = "#" + btn.attr("tabname"); var tab = currentSection.find(TabName); tab.removeClass("hidedetails").addClass("showdetails"); btn.addClass("current"); }, FeatureChanged: function (btn) { var btn = $(btn.currentTarget); var currentSection = M_VZW.Global.CurrentPage.find("#feature-" + btn.att r("data-type")); currentSection.find('#cart-choices li').filter(".currentChoice").removeC lass("currentChoice").addClass("notChosen"); btn.removeClass("notChosen").addClass("currentChoice"); //Enabling Continue Button M_VZW.Features.EnableCartBtns(); }, AddToCart: function () { $.mobile.showPageLoadingMsg(); var selectedPKs = new Array(); selectedPKs = M_VZW.Features.selectedPKs.join(","); $.ajax({ type: 'POST', url: M_VZW.Features.AddCart_URL, success: M_VZW.Features.AddCart_Success, data: { PhonePK: M_VZW.Features.PhonePK, PlanCatPK: M_VZW.Features.PlanCatPK, PlanMinPK: M_VZW.Features.PlanMinPK, FeaturePKs: selectedPKs, IncludeFeaturedAccessories: M_VZW.Features.IncludeFeaturedAccess ories, OrdType: M_VZW.Features.OrdType }

}); }, AddCart_Success: function (result) { try { var NewPageURL = jQuery.parseJSON(result).ResponseData; window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Features; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Features.DisableAllButtons(); //M_VZW.Features.ShowNextCategory(); M_VZW.Features.CreateBindings(); } } M_VZW.CartPreview = { Cancel_URL: "", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#btnCancel a").unbind("vclick", M_VZW.Car tPreview.GotoCancel); M_VZW.Global.CurrentPage.find("#btnCancel a").bind("vclick", M_VZW.CartP review.GotoCancel); M_VZW.Global.CurrentPage.find("#required_plan_changes .excerpt").bind("v click", M_VZW.CartPreview.ToggleFeatures); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnCancel a").unbind("vclick", M_VZW.Car tPreview.GotoCancel); }, GotoCancel: function () { $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.CartPreview.Cancel_URL, success: function (result) { try { var NewPageURL = jQuery.parseJSON(result).ResponseData; //Clear the order cookie M_VZW.Global.ClearCookie('CustType'); M_VZW.Global.ClearCookie('vzw_cart_qty'); window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } } }); },

ToggleFeatures: function () { $('#options_removed').toggle(); $('#required_plan_changes').toggleClass('collapsed'); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.CartPreview; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.CartPreview.CreateBindings(); } }; M_VZW.CartConfirm = { Confirm_URL: "", Cancel_URL: "", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#btnConfirm").unbind("vclick", M_VZW.Cart Confirm.ConfirmOrder); M_VZW.Global.CurrentPage.find("#btnConfirm").bind("vclick", M_VZW.CartCo nfirm.ConfirmOrder); M_VZW.Global.CurrentPage.find("#btnCancel a").unbind("vclick", M_VZW.Car tConfirm.CancelOrder); M_VZW.Global.CurrentPage.find("#btnCancel a").bind("vclick", M_VZW.CartC onfirm.CancelOrder); M_VZW.Global.CurrentPage.find("#required_plan_changes .excerpt").bind("v click", M_VZW.CartPreview.ToggleFeatures); ; }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnConfirm").unbind("vclick", M_VZW.Cart Confirm.ConfirmOrder); M_VZW.Global.CurrentPage.find("#btnCancel a").unbind("vclick", M_VZW.Car tConfirm.CancelOrder); }, ConfirmOrder: function() { $.mobile.showPageLoadingMsg(); window.location = M_VZW.CartConfirm.Confirm_URL; }, CancelOrder: function () { $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.CartConfirm.Cancel_URL, success: function (result) { try { var NewPageURL = jQuery.parseJSON(result).ResponseData; //Clear the order cookie M_VZW.Global.ClearCookie('CustType'); window.location = NewPageURL;

} catch (e) { $.mobile.hidePageLoadingMsg(); } } }); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.CartConfirm; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.CartConfirm.CreateBindings(); } }; M_VZW.CartComplete = { BackToPhones_URL: "", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#btnBackToPhones").unbind("vclick", M_VZW .CartComplete.BackToPhones); M_VZW.Global.CurrentPage.find("#btnBackToPhones").bind("vclick", M_VZW.C artComplete.BackToPhones); M_VZW.Global.CurrentPage.find("#required_plan_changes .excerpt").bind("v click", M_VZW.CartPreview.ToggleFeatures); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnBackToPhones").unbind("vclick", M_VZW .CartComplete.BackToPhones); }, BackToPhones: function () { $.mobile.showPageLoadingMsg(); window.location = M_VZW.CartConfirm.Confirm_URL; }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.CartComplete; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.CartComplete.CreateBindings(); M_VZW.Millennial.FireTracking(); //Clear the order cookies M_VZW.Global.ClearCookie('CustType'); M_VZW.Global.ClearCookie('vzw_cart_qty'); if (M_VZW.TradeIns.CheckForTradeInSelected()) { $("#optin_tradein_btn").show(); $("#optout_tradein_btn").hide(); } } }; M_VZW.CSA = { ContinueURL: "",

Cancel_URL: "", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#chkTanCAgree").unbind("change", M_VZW.CS A.IAgree); M_VZW.Global.CurrentPage.find("#chkTanCAgree").bind("change", M_VZW.CSA. IAgree); M_VZW.Global.CurrentPage.find("#btnCancel a").unbind("vclick", M_VZW.CSA .GotoCancel); M_VZW.Global.CurrentPage.find("#btnCancel a").bind("vclick", M_VZW.CSA.G otoCancel); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnCancel a").unbind("vclick", M_VZW.CSA .GotoCancel); M_VZW.Global.CurrentPage.find("#chkTanCAgree").unbind("change", M_VZW.CS A.IAgree); M_VZW.CSA.DisableButton(); }, IAgree: function (event) { if (event.target.checked) M_VZW.CSA.EnableButton(); else M_VZW.CSA.DisableButton(); }, EnableButton: function () { M_VZW.Global.CurrentPage.find("#btnContinue").bind("vclick", M_VZW.CSA.C ontinue); M_VZW.Global.CurrentPage.find("#btnContinue").removeClass("h-grey-gradie nt-bg").addClass("h-red-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnContinue span").removeClass("disabled Btn").addClass("redCartBtn"); }, DisableButton: function () { M_VZW.Global.CurrentPage.find("#btnContinue").unbind("vclick", M_VZW.CSA .Continue); M_VZW.Global.CurrentPage.find("#btnContinue").removeClass("h-red-gradien t-bg").addClass("h-grey-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnContinue span").removeClass("redCartB tn").addClass("disabledBtn"); }, GotoCancel: function () { $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.CSA.Cancel_URL, success: function (result) { try { var NewPageURL = jQuery.parseJSON(result).ResponseData; //Clear the order cookie M_VZW.Global.ClearCookie('CustType'); window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg();

} } }); }, Continue: function () { $.mobile.showPageLoadingMsg(); window.location = M_VZW.CSA.ContinueURL; }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.CSA; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.CSA.CreateBindings(); M_VZW.CSA.DisableButton(); } };M_VZW.DGF = { // CurrentPanelSelection: "", // SelectedPanelIndex: 0, // AvailablePanels: "", // CreateBindings: function () { // //Wire up buttons Buttons // M_VZW.Global.CurrentPage.find("#btnCustomerInfoComplete").unbind("vcli ck", M_VZW.DGF.ShowNextPanel); // M_VZW.Global.CurrentPage.find("#btnCustomerInfoComplete").bind("vclick ", M_VZW.DGF.ShowNextPanel); // M_VZW.Global.CurrentPage.find("#btnPhoneNumberSelectionComplete").unbi nd("vclick", M_VZW.DGF.ShowNextPanel); // M_VZW.Global.CurrentPage.find("#btnPhoneNumberSelectionComplete").bind ("vclick", M_VZW.DGF.ShowNextPanel); // M_VZW.Global.CurrentPage.find("#btnCreditApprovalComplete").unbind("vc lick", M_VZW.DGF.SubmitForm); // M_VZW.Global.CurrentPage.find("#btnCreditApprovalComplete").bind("vcli ck", M_VZW.DGF.SubmitForm); // M_VZW.Global.CurrentPage.find("#shipping-choices li").unbind("vclick", M_VZW.DGF.ShippingOptionsChange); // M_VZW.Global.CurrentPage.find("#shipping-choices li").bind("vclick", M _VZW.DGF.ShippingOptionsChange); // M_VZW.Global.CurrentPage.find("#phonenumber-choices li").unbind("vclic k", M_VZW.DGF.PhoneNumberOptionsChange); // M_VZW.Global.CurrentPage.find("#phonenumber-choices li").bind("vclick" , M_VZW.DGF.PhoneNumberOptionsChange); // },

// RemoveBindings: function () { // M_VZW.Global.CurrentPage.find("#btnCustomerInfoComplete").unbind("vcli ck", M_VZW.DGF.ShowNextPanel); // M_VZW.Global.CurrentPage.find("#btnPhoneNumberSelectionComplete").unbi nd("vclick", M_VZW.DGF.ShowNextPanel);

// M_VZW.Global.CurrentPage.find("#btnCreditApprovalComplete").unbind("vc lick", M_VZW.DGF.SubmitForm); // }, // // // // // // // // // // SubmitForm: function () { if (!M_VZW.Global.CurrentPage.find("form:first").valid()) { } else { M_VZW.Global.CurrentPage.find("form:first").submit(); } }, ChangeTab: function (btn) { },

// ShowNextPanel: function () { // if (M_VZW.DGF.SelectedPanelIndex == 0) { // var divType = M_VZW.DGF.AvailablePanels[M_VZW.DGF.SelectedPanelInd ex]; // M_VZW.DGF.CurrentPanelSelection = M_VZW.Global.CurrentPage.find("# panel-" + divType); // } // var ContinueToNextForm = true; // M_VZW.DGF.CurrentPanelSelection.find('select,input[type!=radio],textar ea,input[type=radio]:checked').each(function (i, item) { // if (!$(item).valid()) { // // alert($(item).attr("id") + " is not valid."); // ContinueToNextForm = false; // } // }); // if (ContinueToNextForm) { // M_VZW.DGF.CurrentPanelSelection.addClass("hidedetails"); // M_VZW.DGF.SelectedPanelIndex += 1; // if (M_VZW.DGF.SelectedPanelIndex < M_VZW.DGF.AvailablePanels.lengt h) { // M_VZW.DGF.CurrentPanelSelection = M_VZW.Global.CurrentPage.fin d("#panel-" + M_VZW.DGF.AvailablePanels[M_VZW.DGF.SelectedPanelIndex]); // M_VZW.DGF.CurrentPanelSelection.removeClass("hidedetails").add Class("showdetails"); // } // M_VZW.DGF.CurrentPanelSelection.find("#shipping-choices li").unbin d("vclick", M_VZW.DGF.ShippingOptionsChange); // M_VZW.DGF.CurrentPanelSelection.find("#shipping-choices li").bind( "vclick", M_VZW.DGF.ShippingOptionsChange); // } // },

// ShippingOptionsChange: function (btn) { // M_VZW.Global.CurrentPage.find('#shipping-choices li').filter(".current Choice").removeClass("currentChoice").addClass("notChosen"); // $(btn.currentTarget).removeClass("notChosen").addClass("currentChoice" ); // M_VZW.Global.CurrentPage.find('#SelectedShippingTypePk').val($(btn.cur rentTarget).attr("id").replace("pk_", "")); // M_VZW.Global.CurrentPage.find('#CardBillingZip').val(M_VZW.Global.Curr entPage.find('#Zip').val()); // }, // PhoneNumberOptionsChange: function (btn) {

// M_VZW.Global.CurrentPage.find('#phonenumber-choices li').filter(".curr entChoice").removeClass("currentChoice").addClass("notChosen"); // $(btn.currentTarget).removeClass("notChosen").addClass("currentChoice" ); // // hide phonenumber-newdetails and phonenumber-existingdetails // M_VZW.Global.CurrentPage.find('#phonenumber-newdetails').addClass("hid edetails").removeClass("showdetails"); // M_VZW.Global.CurrentPage.find('#phonenumber-existingdetails').addClass ("hidedetails").removeClass("showdetails"); // if ($(btn.currentTarget).attr("id") == "phonenumber-existing") { // M_VZW.Global.CurrentPage.find('#phonenumber-existingdetails').addC lass("showdetails").removeClass("hidedetails"); // } // else { // M_VZW.Global.CurrentPage.find('#phonenumber-newdetails').addClass( "showdetails").removeClass("hidedetails"); // } // }, // init: function (PageName) { // if (M_VZW.Global.CurrentJS != null) // M_VZW.Global.CurrentJS.RemoveBindings(); // // // // }; M_VZW.Global.CurrentJS = M_VZW.DGF; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.DGF.CreateBindings(); }

M_VZW.DGF.CustomerInfo = { IsOptingIn: false, CreateBindings: function () { M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.DGF.C ustomerInfo.ValidateSuccess); M_VZW.Global.CurrentPage.find("#btnSubmit").bind("vclick", M_VZW.DGF.Cus tomerInfo.ValidateSuccess); M_VZW.Global.CurrentPage.find(".OptIn").unbind("vclick", M_VZW.DGF.Custo merInfo.Expand); M_VZW.Global.CurrentPage.find(".OptIn").bind("vclick", M_VZW.DGF.Custome rInfo.Expand); M_VZW.Global.CurrentPage.find("#chkOptIn").unbind("change", M_VZW.DGF.Cu stomerInfo.OptInChange); M_VZW.Global.CurrentPage.find("#chkOptIn").bind("change", M_VZW.DGF.Cust omerInfo.OptInChange); M_VZW.Global.CurrentPage.find("#shipping-choices li").unbind("vclick", M _VZW.DGF.CustomerInfo.ShippingOptionsChange); M_VZW.Global.CurrentPage.find("#shipping-choices li").bind("vclick", M_V ZW.DGF.CustomerInfo.ShippingOptionsChange); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.DGF.C ustomerInfo.ValidateSuccess); M_VZW.Global.CurrentPage.find("#OptIn").unbind("vclick", M_VZW.DGF.Custo merInfo.Expand); M_VZW.Global.CurrentPage.find("#chkOptIn").unbind("change", M_VZW.DGF.Cu stomerInfo.OptInChange);

M_VZW.Global.CurrentPage.find("#shipping-choices li").unbind("vclick", M _VZW.DGF.CustomerInfo.ShippingOptionsChange); }, ValidateSuccess: function () { M_VZW.Global.CurrentPage.find("form").submit(); var formValidate = M_VZW.Global.CurrentPage.find("form").validate(); if (formValidate.errorList.length == 0 && M_VZW.DGF.CustomerInfo.IsOptin gIn) { M_VZW.DGF.CustomerInfo.OptIn(); } }, OptInChange: function (event) { M_VZW.DGF.CustomerInfo.IsOptingIn = event.target.checked; }, Expand: function (btn) { btn = $(btn.currentTarget); var fullDesc = M_VZW.Global.CurrentPage.find("#OptIn .fulldesc"); fullDesc.toggle(); btn.find("span").toggleClass('arrowdown').toggleClass('arrowright'); }, GotoNextPage: function (result) { M_VZW.Global.goto(result, true); //$.mobile.changePage(result); }, OptIn: function () { var email = $('#Email').val(); var zipcode = $('#Zip').val(); $.ajax({ type: 'POST', url: M_VZW.DGF.CustomerInfo.Optin_URL, data: { _ID_: 'vzw.7765', EMAIL: email, SOURCEID: 'WEB_DGF_MOBILE_SHOP_PATH', MOBILEALERTOPTIN: 'N', PURCHASETYPE: 'PERSONAL', LANGCODE: 'EN', CUSTOMERSTATUS: M_VZW.DGF.CustomerInfo.CustomerStatus, ZIPCODE: zipcode, PHONEID: M_VZW.DGF.CustomerInfo.PhoneID } }); }, ShippingOptionsChange: function (btn) { M_VZW.Global.CurrentPage.find('#shipping-choices li').filter(".currentCh oice").removeClass("currentChoice").addClass("notChosen"); M_VZW.Global.CurrentPage.find('#shipping-choices li .currentChoice').rem oveClass("currentChoice").addClass("notChosen"); $(btn.currentTarget).removeClass("notChosen").addClass("currentChoice"); M_VZW.Global.CurrentPage.find('#SelectedShippingTypePk').val($(btn.curre ntTarget).attr("id").replace("pk_", "")); },

init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.DGF.CustomerInfo; M_VZW.Global.CurrentPage = $(".ui-page-active"); M_VZW.DGF.CustomerInfo.CreateBindings(); } }; M_VZW.DGF.LNP = { //Which field are we focused on for empty field validation CurrentFieldFocus: "", CreateBindings: function () { /*M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.DGF .LNP.ValidateSuccess); M_VZW.Global.CurrentPage.find("#btnSubmit").bind("vclick", M_VZW.DGF.LNP .ValidateSuccess);*/ M_VZW.DGF.LNP.DisableBtn(); M_VZW.Global.CurrentPage.find("#phonenumber-choices li").unbind("vclick" , M_VZW.DGF.LNP.PhoneNumberOptionsChange); M_VZW.Global.CurrentPage.find("#phonenumber-choices li").bind("vclick", M_VZW.DGF.LNP.PhoneNumberOptionsChange); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.DGF.L NP.ValidateSuccess); M_VZW.Global.CurrentPage.find("#phonenumber-choices li").unbind("vclick" , M_VZW.DGF.LNP.PhoneNumberOptionsChange); }, DisableBtn: function () { M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.DGF.L NP.ValidateSuccess); M_VZW.Global.CurrentPage.find("#btnSubmit").removeClass("h-red-gradientbg").addClass("h-grey-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnSubmit span").removeClass("redCartBtn ").addClass("disabledBtn"); }, EnableBtn: function () { M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.DGF.L NP.ValidateSuccess); M_VZW.Global.CurrentPage.find("#btnSubmit").bind("vclick", M_VZW.DGF.LNP .ValidateSuccess); M_VZW.Global.CurrentPage.find("#btnSubmit").removeClass("h-grey-gradient -bg").addClass("h-red-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnSubmit span").removeClass("disabledBt n").addClass("redCartBtn"); }, ValidateSuccess: function () { var selectedOption = M_VZW.Global.CurrentPage.find("#SelectNumberOption" ).val();

var AllFieldsValidated = false; switch (selectedOption) { case "1": AllFieldsValidated = true; break; case "2": M_VZW.Global.CurrentPage.find(".field-validation-error-msg").css ('display', 'none'); M_VZW.DGF.LNP.CurrentFieldFocus = ""; //Check to make sure all fields are filled in var chkExistingNumber = M_VZW.DGF.LNP.CheckField("#ExistingPhone Number"); var chkAccountNumber = M_VZW.DGF.LNP.CheckField("#AccountNumber" ); //var chkAccountPin = M_VZW.DGF.LNP.CheckField("#AccountPIN"); var chkSigner = M_VZW.DGF.LNP.CheckField("#AccountSignatory"); var chkContactPhone = M_VZW.DGF.LNP.CheckField("#ContactPhone"); var chkBilladdress1 = M_VZW.DGF.LNP.CheckField("#Address1"); var chkCity = M_VZW.DGF.LNP.CheckField("#City"); var chkState = M_VZW.DGF.LNP.CheckField("#State"); var chkZip = M_VZW.DGF.LNP.CheckField("#Zip"); if (chkExistingNumber && chkAccountNumber && chkSigner && chkCon tactPhone && chkBilladdress1 && chkCity && chkState && chkZip) { AllFieldsValidated = true; } else { AllFieldsValidated = false; } break; } if (AllFieldsValidated) { M_VZW.Global.CurrentPage.find("form").submit() } //if (M_VZW.Global.CurrentPage.find("#SelectNumberOption").val() == 1 || M_VZW.Global.CurrentPage.find("#SelectNumberOption").val() == 2) // M_VZW.Global.CurrentPage.find("form").submit() }, CheckField: function (f) { var notEmpty = false; var field = M_VZW.Global.CurrentPage.find(f).val(); var trimmed = jQuery.trim(field); notEmpty = (trimmed.length > 0) ? true : false; var fieldMsg = M_VZW.DGF.LNP.GetFieldMsg(f); if (!notEmpty) { if (M_VZW.DGF.LNP.CurrentFieldFocus == "") { M_VZW.Global.CurrentPage.find(f).focus(); M_VZW.DGF.LNP.CurrentFieldFocus = f; } M_VZW.Global.CurrentPage.find(f).bind('keyup', function () { jQuery(this).parent().find(".field-validation-error-msg").css('d isplay', 'none') M_VZW.DGF.LNP.CurrentFieldFocus = ""; }); M_VZW.Global.CurrentPage.find(f).parent().find(".field-validation-er ror-msg .error_msg").text(fieldMsg); M_VZW.Global.CurrentPage.find(f).parent().find(".field-validation-er ror-msg").css('display', 'block'); }

return notEmpty; }, GetFieldMsg: function (f) { var msg = ""; switch (f) { case "#ExistingPhoneNumber": msg = "Please enter a valid number to port in."; break; case "#AccountNumber": msg = "Your old service provider Account Number is required. Ple ase enter your account number."; break; case "#AccountPIN": msg = "Please provide your account PIN."; break; case "#AccountSignatory": msg = "Please enter the name of the authorized signer as it appe ars on the account."; break; case "#ContactPhone": msg = "A contact number is required. Please enter your telephone number."; break; case "#Address1": msg = "Please provide account billing address."; case "#City": msg = "Please enter a valid city."; case "#State": msg = "Please enter a valid state."; case "#Zip": msg = "Please provide a valid zip code."; break; default: msg = "Please fill in the field above."; break; } return msg; }, GotoNextPage: function (result) { M_VZW.Global.goto(result, true); //$.mobile.changePage(result); }, PhoneNumberOptionsChange: function (btn) { M_VZW.Global.CurrentPage.find('#phonenumber-choices li').filter(".curren tChoice").removeClass("currentChoice").addClass("notChosen"); $(btn.currentTarget).removeClass("notChosen").addClass("currentChoice"); // hide phonenumber-newdetails and phonenumber-existingdetails M_VZW.Global.CurrentPage.find('#phonenumber-newdetails').addClass("hided etails").removeClass("showdetails"); M_VZW.Global.CurrentPage.find('#phonenumber-existingdetails').addClass(" hidedetails").removeClass("showdetails"); if ($(btn.currentTarget).attr("id") == "phonenumber-existing") { M_VZW.Global.CurrentPage.find("#SelectNumberOption").val(2); M_VZW.Global.CurrentPage.find('#phonenumber-existingdetails').addCla ss("showdetails").removeClass("hidedetails"); M_VZW.DGF.LNP.EnableBtn(); }

else { M_VZW.Global.CurrentPage.find("#SelectNumberOption").val(1); M_VZW.Global.CurrentPage.find('#phonenumber-newdetails').addClass("s howdetails").removeClass("hidedetails"); //M_VZW.Global.CurrentPage.find('#phonenumber-newdetails select').bi nd("change", M_VZW.DGF.LNP.EnableBtn); M_VZW.DGF.LNP.EnableBtn(); } }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.DGF.LNP; M_VZW.Global.CurrentPage = $(".ui-page-active"); M_VZW.DGF.LNP.CreateBindings(); M_VZW.Global.CurrentPage.find("form").attr("data-ajax", "false"); } }; M_VZW.DGF.CreditInfo = { CreateBindings: function () { M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.DGF.C reditInfo.ValidateSuccess); M_VZW.Global.CurrentPage.find("#btnSubmit").removeClass("h-red-gradientbg").addClass("h-grey-gradient-bg"); M_VZW.DGF.CreditInfo.BindFormListeners(); //M_VZW.Global.CurrentPage.find("#btnSubmit").bind("vclick", M_VZW.DGF.C reditInfo.ValidateSuccess); M_VZW.Global.CurrentPage.find("#CardNumber").bind("keyup", M_VZW.DGF.Cre ditInfo.PopulateCardType); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.DGF.C reditInfo.ValidateSuccess); //M_VZW.Global.CurrentPage.find('form input').unbind('blur', M_VZW.DGF.C reditInfo.CheckAllFields); //M_VZW.Global.CurrentPage.find('form select').unbind('change', M_VZW.DG F.CreditInfo.CheckAllFields); //Commenting these out for now to see if that was causing the dropdowns to not function on the credit/billing page. M_VZW.Global.CurrentPage.find('form input').unbind('keyup', M_VZW.DGF.Cr editInfo.CheckAllFields); }, ValidateSuccess: function () { M_VZW.Global.CurrentPage.find("form").submit(); }, GotoNextPage: function (result) { M_VZW.Global.goto(result, true); //$.mobile.changePage(result);

}, BindFormListeners: function () { /*M_VZW.Global.CurrentPage.find('form input').unbind('blur', M_VZW.DGF.C reditInfo.CheckAllFields); M_VZW.Global.CurrentPage.find('form input').bind('blur', M_VZW.DGF.Credi tInfo.CheckAllFields);*/ /*M_VZW.Global.CurrentPage.find('form select').unbind('change', M_VZW.DG F.CreditInfo.CheckAllFields); M_VZW.Global.CurrentPage.find('form select').bind('change', M_VZW.DGF.Cr editInfo.CheckAllFields);*/ //Commenting these out for now to see if that was causing the dropdowns to not function on the credit/billing page. M_VZW.Global.CurrentPage.find('form input').unbind('keyup', M_VZW.DGF.Cr editInfo.CheckAllFields); M_VZW.Global.CurrentPage.find('form input').bind('keyup', M_VZW.DGF.Cred itInfo.CheckAllFields); }, CheckAllFields: function () { var values = {}; var allSelectionsSelected = false; var allInputFilled = false; $.each(M_VZW.Global.CurrentPage.find('form input').serializeArray(), fun ction (i, field) { if (field.value == "" && field.name != "Address2") { allInputFilled = false; return false; }; allInputFilled = true; }); $.each(M_VZW.Global.CurrentPage.find('form select').serializeArray(), fu nction (i, field) { if (field.value == "") { allSelectionsSelected = false; return false; }; allSelectionsSelected = true; }); if (allInputFilled && allSelectionsSelected) { M_VZW.Global.CurrentPage.find("#btnSubmit").removeClass("h-grey-grad ient-bg").addClass("h-red-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnSubmit").unbind("vclick", M_VZW.D GF.CreditInfo.ValidateSuccess); M_VZW.Global.CurrentPage.find("#btnSubmit").bind("vclick", M_VZW.DGF .CreditInfo.ValidateSuccess); }; }, SetMasks: function () { M_VZW.Global.CurrentPage.find("#DOB").mask("99/99/9999", { placeholder: " " }); },

PopulateCardType: function () { var ccNumberInput = M_VZW.Global.CurrentPage.find("#CardNumber"); var inputValue = ccNumberInput.val(); var ccTypeInput = M_VZW.Global.CurrentPage.find("#SelectedCardType, #Hol derCCType"); var CARDS = { VISA: "^4[0-9]{12}(?:[0-9]{3})?", //4111111111111111 MASTERCARD: "^5[1-5][0-9]{14}$", //5111111111111111 AMEX: "^3[47][0-9]{13}$", //341111111111111 DISCOVER: "^6(?:011|5[0-9]{2})[0-9]{12}$" //6511111111111111 }; var currentCard = ""; if (inputValue.length == 0) return false; if (inputValue.match(CARDS.VISA) && (inputValue.length == 13 || inputVal ue.length == 16)) { ccTypeInput.val("VISA"); } else if (inputValue.match(CARDS.MASTERCARD) && inputValue.length == 16 ) { ccTypeInput.val("MASTERCARD"); return true; } else if (inputValue.match(CARDS.AMEX) && inputValue.length == 15) { ccTypeInput.val("AMEX"); return true; } else if (inputValue.match(CARDS.DISCOVER) && inputValue.length == 16) { ccTypeInput.val("DISCOVER"); return true; } else { ccTypeInput.val(""); } return false; }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.DGF.CreditInfo; M_VZW.Global.CurrentPage = $(".ui-page-active"); M_VZW.DGF.CreditInfo.CreateBindings(); M_VZW.DGF.CreditInfo.SetMasks(); M_VZW.Global.CurrentPage.find("form").attr("data-ajax", "false"); } };M_VZW.Account = {};M_VZW.Account.LogIn = { Redirect_URL: "", LogIn_URL: "", CookieLogIn_URL: "", CreateBindings: function () { M_VZW.Global.CurrentPage.find("#btnLogIn").unbind("vclick", M_VZW.Accoun t.LogIn.AttemptLogIn); M_VZW.Global.CurrentPage.find("#btnLogIn").bind("vclick", M_VZW.Account. LogIn.AttemptLogIn); },

RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#btnLogIn").unbind("vclick", M_VZW.Accoun t.LogIn.AttemptLogIn); }, //Deprecated to Cart.js, for better user experience DoughFinder: function () { var dough = M_VZW.Global.readCookie("mox_dough"); if (dough != false) { M_VZW.Account.LogIn.AttemptCookieLogIn(); } }, AttemptCookieLogIn: function () { $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.Account.LogIn.CookieLogIn_URL, success: M_VZW.Account.LogIn.CookieLogIn_Success, error: M_VZW.Account.LogIn.LogIn_Error, data: { RedirectURL: M_VZW.Account.LogIn.Redirect_URL } }); }, AttemptLogIn: function () { $('#error').addClass('field-validation-valid').removeClass('field-valida tion-error'); var userID = M_VZW.Global.CurrentPage.find("#userid").val(); var pw = M_VZW.Global.CurrentPage.find("#pw").val(); if (userID != "" && pw != "") { $.mobile.showPageLoadingMsg(); $.ajax({ type: 'POST', url: M_VZW.Account.LogIn.LogIn_URL, success: M_VZW.Account.LogIn.LogIn_Success, error: M_VZW.Account.LogIn.LogIn_Error, data: { Username: userID, Password: pw, RedirectURL: M_VZW.Account.LogIn.Redirect_URL } }); } else { $('#error').html('Please enter a username and password.'); $('#error').addClass('field-validation-error').removeClass('field-va lidation-valid'); } }, LogIn_Success: function (result) { result = jQuery.parseJSON(result); if (result.StatusCode == 0) { M_VZW.Global.goto(result.ResponseData, true); } else if (result.StatusCode == 13) { M_VZW.Global.goto(result.ResponseData, true);

} else { $.mobile.hidePageLoadingMsg(); //alert("LOG IN FAILED"); $('#error').html('The information you have entered does not match th e information we have on file. Please try again.'); $('#error').addClass('field-validation-error').removeClass('field-va lidation-valid'); } }, CookieLogIn_Success: function (result) { result = jQuery.parseJSON(result); if (result.StatusCode == 0) { M_VZW.Global.goto(result.ResponseData, true); } else { $.mobile.hidePageLoadingMsg(); //alert("LOG IN FAILED"); //$('#error').html('The information you have entered does not match the information we have on file. Please try again.'); //$('#error').addClass('field-validation-error').removeClass('fieldvalidation-valid'); } }, LogIn_Error: function (result) { //alert("FAIL LOGIN"); $('#error').html('The information you have entered does not match the in formation we have on file. Please try again.'); $('#error').addClass('field-validation-error').removeClass('field-valida tion-valid'); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Account.LogIn; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Account.LogIn.CreateBindings(); //M_VZW.Account.LogIn.DoughFinder(); } }; M_VZW.Account.SelectLine = { AddCart_URL: "", Continue_URL: "", AAL_Continue_URL: "", AAL_Continue_Enabled: "True", IncludeFeaturedAccessories: false, MDN: "", IsMBD: false, MarketPK: "", PhonePK: "", CreateBindings: function () { //M_VZW.Global.CurrentPage.find("#btnContinue").unbind("vclick", M_VZW.A ccount.SelectLine.Continue); //M_VZW.Global.CurrentPage.find("#btnContinue").bind("vclick", M_VZW.Acc ount.SelectLine.Continue);

M_VZW.Global.CurrentPage.find("#aal-choice").unbind("click", M_VZW.Accou nt.SelectLine.ChooseAAL); M_VZW.Global.CurrentPage.find("#aal-choice").bind("click", M_VZW.Account .SelectLine.ChooseAAL); M_VZW.Global.CurrentPage.find("#cart-choices li").unbind("vclick", M_VZW .Account.SelectLine.ChangeLine); M_VZW.Global.CurrentPage.find("#cart-choices li").bind("vclick", M_VZW.A ccount.SelectLine.ChangeLine); }, RemoveBindings: function () { M_VZW.Account.SelectLine.DisableContinueBtn(); M_VZW.Account.SelectLine.DisableAALContinueBtn(); M_VZW.Global.CurrentPage.find("#cart-choices li").unbind("vclick", M_VZW .Account.SelectLine.ChangeLine); M_VZW.Global.CurrentPage.find("#aal-choice").unbind("click", M_VZW.Accou nt.SelectLine.ChooseAAL); }, AALContinue: function () { $.mobile.showPageLoadingMsg(); M_VZW.Global.CurrentPage.find("#OrderType").val("aal"); M_VZW.Global.CurrentPage.find("#MDN").val("0"); M_VZW.Global.CurrentPage.find("#UpgradeForm").submit(); }, Continue: function () { $.mobile.showPageLoadingMsg(); M_VZW.Global.CurrentPage.find("#UpgradeForm").submit(); }, ChangeLine: function (btn) { var btn = $(btn.currentTarget); M_VZW.Account.SelectLine.MDN = btn.attr("acct-mdn"); M_VZW.Global.CurrentPage.find("#MDN").val(btn.attr("acct-mdn")); M_VZW.Global.CurrentPage.find("#cart-choices li").removeClass("currentCh oice").addClass("notChosen"); M_VZW.Global.CurrentPage.find("#aal-choice div.aal_device").removeClass( "currentChoice").addClass("notChosen"); btn.removeClass("notChosen").addClass("currentChoice"); M_VZW.Account.SelectLine.EnableContinueBtn(); M_VZW.Account.SelectLine.DisableAALContinueBtn(); }, ChooseAAL: function () { M_VZW.Global.CurrentPage.find("#cart-choices li").removeClass("currentCh oice").addClass("notChosen"); M_VZW.Global.CurrentPage.find("#aal-choice div.aal_device").removeClass( "notChosen").addClass("currentChoice"); M_VZW.Account.SelectLine.DisableContinueBtn(); M_VZW.Account.SelectLine.EnableAALContinueBtn(); }, DisableAALContinueBtn: function () {

//Disable AAL M_VZW.Global.CurrentPage.find("#btnAALContinue").unbind("vclick", M_VZW. Account.SelectLine.Continue); M_VZW.Global.CurrentPage.find("#btnAALContinue").removeClass("h-red-grad ient-bg").addClass("h-grey-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnAALContinue span").removeClass("redCa rtBtn").addClass("disabledBtn"); }, EnableAALContinueBtn: function () { //Enable AAL M_VZW.Global.CurrentPage.find("#btnAALContinue").removeClass("h-grey-gra dient-bg").addClass("h-red-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnAALContinue span").removeClass("disab ledBtn").addClass("redCartBtn"); if (M_VZW.Account.SelectLine.AAL_Continue_Enabled == "True") { M_VZW.Global.CurrentPage.find("#btnAALContinue").unbind("vclick", M_ VZW.Account.SelectLine.AALContinue); M_VZW.Global.CurrentPage.find("#btnAALContinue").bind("vclick", M_VZ W.Account.SelectLine.AALContinue); } }, DisableContinueBtn: function () { M_VZW.Global.CurrentPage.find("#btnContinue").unbind("vclick", M_VZW.Acc ount.SelectLine.Continue); M_VZW.Global.CurrentPage.find("#btnContinue").removeClass("h-red-gradien t-bg").addClass("h-grey-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnContinue span").removeClass("redCartB tn").addClass("disabledBtn"); }, EnableContinueBtn: function () { M_VZW.Global.CurrentPage.find("#btnContinue").removeClass("h-grey-gradie nt-bg").addClass("h-red-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnContinue span").removeClass("disabled Btn").addClass("redCartBtn"); M_VZW.Global.CurrentPage.find("#btnContinue").unbind("vclick", M_VZW.Acc ount.SelectLine.Continue); M_VZW.Global.CurrentPage.find("#btnContinue").bind("vclick", M_VZW.Accou nt.SelectLine.Continue); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Account.SelectLine; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Account.SelectLine.CreateBindings(); M_VZW.Account.SelectLine.DisableContinueBtn(); M_VZW.Account.SelectLine.DisableAALContinueBtn(); } } M_VZW.Account.FeatureOnly = { ConfirmURL: "",

CreateBindings: function () { M_VZW.Global.CurrentPage.find("#device-sections li").unbind("vclick", M_ VZW.Account.FeatureOnly.ChangeTab); M_VZW.Global.CurrentPage.find("#device-sections li").bind("vclick", M_VZ W.Account.FeatureOnly.ChangeTab); M_VZW.Global.CurrentPage.find("#chkTECconfirm").unbind("change", M_VZW.A ccount.FeatureOnly.IAgree); M_VZW.Global.CurrentPage.find("#chkTECconfirm").bind("change", M_VZW.Acc ount.FeatureOnly.IAgree); M_VZW.Global.CurrentPage.find("#btnConfirm").unbind("vclick", M_VZW.Acco unt.FeatureOnly.Confirm); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#cart-sections li").unbind("vclick", M_VZ W.Account.FeatureOnly.ChangeTab); M_VZW.Global.CurrentPage.find("#chkTECconfirm").unbind("change", M_VZW.A ccount.FeatureOnly.IAgree); M_VZW.Global.CurrentPage.find("#btnConfirm").unbind("vclick", M_VZW.Acco unt.FeatureOnly.Confirm); }, IAgree: function (event) { if (event.target.checked) M_VZW.Account.FeatureOnly.EnableButton(); else M_VZW.Account.FeatureOnly.DisableButton(); }, EnableButton: function () { M_VZW.Global.CurrentPage.find("#btnConfirm").bind("vclick", M_VZW.Accoun t.FeatureOnly.Confirm); M_VZW.Global.CurrentPage.find("#btnConfirm").removeClass("h-grey-gradien t-bg").addClass("h-red-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnConfirm span").removeClass("disabledB tn").addClass("redCartBtn"); }, DisableButton: function () { M_VZW.Global.CurrentPage.find("#btnConfirm").unbind("vclick", M_VZW.Acco unt.FeatureOnly.Confirm); M_VZW.Global.CurrentPage.find("#btnConfirm").removeClass("h-red-gradient -bg").addClass("h-grey-gradient-bg"); M_VZW.Global.CurrentPage.find("#btnConfirm span").removeClass("redCartBt n").addClass("disabledBtn"); }, ChangeTab: function (btn) { M_VZW.Global.CurrentPage.find('#device-sections li').filter(".current"). removeClass("current") M_VZW.Global.CurrentPage.find('#device-details div').filter(".showdetail s").removeClass("showdetails").addClass("hidedetails"); var btn = $(btn.currentTarget); var TabName = "#" + btn.attr("tabname"); var tab = M_VZW.Global.CurrentPage.find(TabName); btn.addClass("current"); tab.removeClass("hidedetails").addClass("showdetails");

var tracking = btn.attr("data-tracking"); M_VZW.SiteCatalyst.TrackClick(btn, 'o', tracking); }, Confirm: function(btn) { $.mobile.showPageLoadingMsg(); $.ajax({ type: 'GET', url: M_VZW.Account.FeatureOnly.ConfirmURL, success: M_VZW.Account.FeatureOnly.AddCart_Success }); }, AddCart_Success: function (result) { try { var NewPageURL = jQuery.parseJSON(result).ResponseData; window.location = NewPageURL; } catch (e) { $.mobile.hidePageLoadingMsg(); } }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Account.FeatureOnly; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Account.FeatureOnly.DisableButton(); M_VZW.Account.FeatureOnly.CreateBindings(); } } M_VZW.MAS_ChoosePhones = { SelectedPhonePK: 0, CurrentMakeSelect: null, CurrentDevicePK: null, CampaignID: "", PageName: "", CategoriesURL: "", CampaignURL: "", Timeout: null, PhoneName: null, CreateBindings: function () { M_VZW.Global.CurrentPage.find("#select-device-make").unbind("change", M_ VZW.MAS_ChoosePhones.ShowMake); M_VZW.Global.CurrentPage.find("#select-device-make").bind("change", M_VZ W.MAS_ChoosePhones.ShowMake); M_VZW.Global.CurrentPage.find("#searchSelPhone").unbind("vclick", M_VZW. MAS_ChoosePhones.DeviceSelected); M_VZW.Global.CurrentPage.find("#searchSelPhone").bind("vclick", M_VZW.MA S_ChoosePhones.DeviceSelected); M_VZW.Global.CurrentPage.find("#searchCurPhone").unbind("vclick", M_VZW. MAS_ChoosePhones.DeviceSelected); M_VZW.Global.CurrentPage.find("#searchCurPhone").bind("vclick", M_VZW.MA S_ChoosePhones.DeviceSelected);

}, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#select-device-make").unbind("change", M_ VZW.MAS_ChoosePhones.ShowMake); M_VZW.Global.CurrentPage.find("#searchSelPhone").unbind("vclick", M_VZW. MAS_ChoosePhones.DeviceSelected); M_VZW.Global.CurrentPage.find("#searchCurPhone").unbind("vclick", M_VZW. MAS_ChoosePhones.DeviceSelected); }, GetDeviceFromUA_Compatibility: function (ua) { var serviceURL = "https://services.vzwshop.com/mobile/v4/services/GetDev iceInfo?ua=" + navigator.userAgent + "&apikey=bda11d91-7ade-4da1-855d-24adfe39d1 74&callback=?"; //As much as I like the getJSON method sometimes we just need to use the AJAX call instead /*$.getJSON(serviceURL, function (json) { M_VZW.MAS_ChoosePhones.SelectCurrentPhone(json) });*/ $.ajax({ url: serviceURL, dataType: 'json', timeout: 3000, //3 second timeout success: function (data) { M_VZW.MAS_ChoosePhones.UpdateTopBox(data); }, error: function (jqXHR, status, errorThrown) { M_VZW.MAS_ChoosePhones.UpdateTopBox(""); } }); M_VZW.MAS_ChoosePhones.Timeout = setTimeout(function () { M_VZW.MAS_ChoosePhones.UpdateTopBox(""); clearTimeout(M_VZW.MAS_ChoosePhones.Timeout); }, 3000); }, UpdateTopBox: function (response) { if (response.ResponseData != null && response.ResponseData != "" && resp onse.ResponseData != undefined) { if (response.ResponseData.WLSPhonePK != 0) { var phMake = response.ResponseData.VZWMakeName; var phModel = response.ResponseData.VZWModelName; var phPK = response.ResponseData.WLSPhonePK; var phImg = null; var CompatibleDevices = jQuery.parseJSON(M_VZW.ProductDetails.Co mpatiblePhones); var NonCompatibleDevices = jQuery.parseJSON(M_VZW.ProductDetails .NonCompatibleDevices); var Compatible = false; for (var i = 0; i < CompatibleDevices.length; i++) { if (phPK == CompatibleDevices[i].pk) { phImg = CompatibleDevices[i].img; M_VZW.Global.CurrentPage.find("#device-pic-vid").find("i mg").attr("src", phImg); M_VZW.ProductDetails.PhonePK = phPK; Compatible = true; break;

} Compatible = false; } if (!Compatible) { //If not compatible then find the phone image in the incompa tible device list for (var i = 0; i < NonCompatibleDevices.length; i++) { if (phPK == NonCompatibleDevices[i].pk) { phImg = NonCompatibleDevices[i].img; M_VZW.Global.CurrentPage.find("#device-pic-vid").fin d("img").attr("src", phImg); break; } } } if (Compatible) { M_VZW.Global.CurrentPage.find("#device-billboard").find("#de vice-title").html("The Accessory of the Month is compatible with the " + phMake + " " + phModel + "."); } else { M_VZW.Global.CurrentPage.find("#device-billboard").find("#de vice-title").html("The Accessory of the Month is not compatible with the " + phM ake + " " + phModel + "."); } M_VZW.Global.CurrentPage.find("#device-billboard").css("display" , "block"); M_VZW.MAS_ChoosePhones.PhoneName = phMake + " " + phModel; } } }, GetDeviceFromUA: function (ua) { M_VZW.Global.CurrentPage.find("#CurrPhone").removeClass("showdetails").a ddClass("hidedetails"); var serviceURL = "https://services.vzwshop.com/mobile/v4/services/GetDev iceInfo?ua=" + navigator.userAgent + "&apikey=bda11d91-7ade-4da1-855d-24adfe39d1 74&callback=?"; //As much as I like the getJSON method sometimes we just need to use the AJAX call instead /*$.getJSON(serviceURL, function (json) { M_VZW.MAS_ChoosePhones.SelectCurrentPhone(json) });*/ $.ajax({ url: serviceURL, dataType: 'json', timeout: 3000, //3 second timeout success: function (data) { M_VZW.MAS_ChoosePhones.SelectCurrentPhone(data); }, error: function (jqXHR, status, errorThrown) { M_VZW.MAS_ChoosePhones.SelectCurrentPhone(""); } }); M_VZW.MAS_ChoosePhones.Timeout = setTimeout(function () { M_VZW.MAS_ChoosePhones.SelectCurrentPhone(""); clearTimeout(M_VZW.MAS_ChoosePhones.Timeout); }, 3000); },

SelectCurrentPhone: function (response) { clearTimeout(M_VZW.MAS_ChoosePhones.Timeout); M_VZW.MAS_ChoosePhones.PhoneName = null; if (response != null && response != "" && response != undefined) { M_VZW.MAS_ChoosePhones.SelectedPhonePK = response.ResponseData.WLSPh onePK; } else { M_VZW.MAS_ChoosePhones.SelectedPhonePK = 0; } //M_VZW.Global.CurrentPage.find("#accessories_searchingfordevice").css(' display', 'none'); $.mobile.hidePageLoadingMsg(); //Set Querystring var var isCurrentDevicePKSet = (M_VZW.MAS_ChoosePhones.CurrentDevicePK != nu ll && M_VZW.MAS_ChoosePhones.CurrentDevicePK != undefined && M_VZW.MAS_ChoosePho nes.CurrentDevicePK != "") ? true : false; var isCampaignIDSet = (M_VZW.MAS_ChoosePhones.CampaignID != null && M_VZ W.MAS_ChoosePhones.CampaignID != undefined && M_VZW.MAS_ChoosePhones.CampaignID != "") ? true : false; var isCampaignIDDevicePKSame = (M_VZW.MAS_ChoosePhones.CurrentDevicePK = = M_VZW.MAS_ChoosePhones.CampaignID) ? true : false; try { if (isCurrentDevicePKSet && !isCampaignIDDevicePKSame) { //Showing Select Options M_VZW.Global.CurrentPage.find("#accessories_select_device").css( 'display', 'block'); //Set the image, Device Name and Model var imgAndName = new Object(M_VZW.MAS_ChoosePhones.GetImageAndNa meByPK(M_VZW.MAS_ChoosePhones.CurrentDevicePK)); M_VZW.Global.CurrentPage.find("#device-pic-vid img").attr("src", imgAndName.img); if (M_VZW.MAS_ChoosePhones.CurrentDevicePK != 0) { M_VZW.Global.CurrentPage.find("#device-title").html("Current selected device is the " + imgAndName.make + " " + imgAndName.model + "."); M_VZW.MAS_ChoosePhones.PhoneName = imgAndName.make + " " + i mgAndName.model; } else { M_VZW.Global.CurrentPage.find("#accessories_select_device #u nrecognized_device_msg").css('display', 'block'); M_VZW.MAS_ChoosePhones.PhoneName = null; } } else if (M_VZW.MAS_ChoosePhones.SelectedPhonePK != 0 && !isCurrent DevicePKSet && !isCampaignIDSet) { var phMake = response.ResponseData.VZWMakeName; var phModel = response.ResponseData.VZWModelName; var phPK = response.ResponseData.WLSPhonePK; //Verify if the PK is in the list //If so then allow user to use current device //If not then make them select on from the lists var PhoneAvailable = M_VZW.MAS_ChoosePhones.CheckForPK(phMake, p hPK); if (PhoneAvailable) { //M_VZW.Global.CurrentPage.find("#CurrPhone").removeClass("h idedetails").addClass("showdetails"); //Update current device image and name M_VZW.Global.CurrentPage.find("#device-pic-vid img").attr("s rc", M_VZW.MAS_ChoosePhones.GetImage(phMake, phModel, phPK)); M_VZW.Global.CurrentPage.find("#device-title").html("You hav

e selected the " + phMake + " " + phModel); M_VZW.MAS_ChoosePhones.SelectedPhonePK = phPK; M_VZW.MAS_ChoosePhones.DeviceSelected(); M_VZW.MAS_ChoosePhones.PhoneName = phMake + " " + phModel; } } else if (M_VZW.MAS_ChoosePhones.SelectedPhonePK != 0 && isCurrentD evicePKSet && isCampaignIDSet && isCampaignIDDevicePKSame) { var phMake = response.ResponseData.VZWMakeName; var phModel = response.ResponseData.VZWModelName; var phPK = response.ResponseData.WLSPhonePK; //Verify if the PK is in the list //If so then allow user to use current device //If not then make them select on from the lists var PhoneAvailable = M_VZW.MAS_ChoosePhones.CheckForPK(phMake, p hPK); if (PhoneAvailable) { //M_VZW.Global.CurrentPage.find("#CurrPhone").removeClass("h idedetails").addClass("showdetails"); //Update current device image and name M_VZW.Global.CurrentPage.find("#device-pic-vid img").attr("s rc", M_VZW.MAS_ChoosePhones.GetImage(phMake, phModel, phPK)); M_VZW.Global.CurrentPage.find("#device-title").html("You hav e selected the " + phMake + " " + phModel); M_VZW.MAS_ChoosePhones.SelectedPhonePK = phPK; M_VZW.MAS_ChoosePhones.DeviceSelected(); M_VZW.MAS_ChoosePhones.PhoneName = phMake + " " + phModel; } } else { M_VZW.Global.CurrentPage.find("#accessories_select_device").css( 'display', 'block'); M_VZW.Global.CurrentPage.find("#accessories_select_device #unrec ognized_device_msg").css('display', 'block'); M_VZW.MAS_ChoosePhones.PhoneName = null; //M_VZW.Global.CurrentPage.find("#CurrPhone").removeClass("showd etails").addClass("hidedetails"); } } catch (e) { } }, CheckForPK: function (make, pk) { var cleanMake = make.replace(/[&;]/gi, ''); var id = "#select-device-models-" + cleanMake; var deviceExists = false; M_VZW.Global.CurrentPage.find(id).find("#select-device-models > option") .each(function () { var curDevice = $(this).val(); if (curDevice == pk) { deviceExists = true; } }); return deviceExists; }, GetImage: function (make, model, pk) { var id = "#select-device-models-" + make; //Strip any unwanted html elements; id = id.replace(";", ""); id = id.replace("&", ""); var imgUrl = "/content/imgs/unknowndevice.png";

M_VZW.Global.CurrentPage.find(id).find("#select-device-models > option") .each(function () { var curModel = $(this).text(); var curModelPK = $(this).val(); if (curModelPK == pk) { imgUrl = $(this).attr("imgsrc"); } }); return imgUrl; }, GetImageAndNameByPK: function (pk) { var imgUrl = "/content/imgs/unknowndevice.png"; var devicemodel = ""; var devicemake = ""; M_VZW.Global.CurrentPage.find("#select-device-models > option").each(fun ction () { var curModelPK = $(this).val(); if (curModelPK == pk) { imgUrl = $(this).attr("imgsrc"); devicemake = $(this).parent().parent().parent().parent().attr("i d"); devicemake = devicemake.replace("select-device-models-", ""); devicemake = devicemake.replace("reg", "&reg;"); devicemake = devicemake.replace("&Trade", "&trade;"); devicemodel = $(this).text(); } }); var imageAndName = { img: imgUrl, model: devicemodel, make: devicemake } ; return imageAndName; }, ShowMake: function (btn) { M_VZW.Global.CurrentPage.find("#accessories_select_device #unrecognized_ device_msg").css('display', 'none'); btn = $(btn.currentTarget); var id = "#select-device-models-" + btn.val(); M_VZW.Global.CurrentPage.find("#modelContainer").find('div[data-role="fi eldcontain"]').removeClass("showdetails").addClass("hidedetails"); if (M_VZW.MAS_ChoosePhones.CurrentMakeSelect != null) { M_VZW.MAS_ChoosePhones.CurrentMakeSelect.unbind("change", M_VZW.MAS_ ChoosePhones.SelectModel); } M_VZW.MAS_ChoosePhones.CurrentMakeSelect = M_VZW.Global.CurrentPage.find (id).find("#select-device-models"); M_VZW.Global.CurrentPage.find(id).removeClass("hidedetails").addClass("s howdetails"); M_VZW.MAS_ChoosePhones.CurrentMakeSelect.bind("change", M_VZW.MAS_Choose Phones.SelectModel); M_VZW.Global.CurrentPage.find("#searchSelPhone").removeClass("showdetail s").addClass("hidedetails"); M_VZW.Global.CurrentPage.find("#accessories_select_device #unrecognized_ device_msg").css('display', 'none'); if (btn.val() == 0) { M_VZW.Global.CurrentPage.find("#device-pic-vid img").attr("src", "/c

ontent/imgs/unknowndevice.png"); M_VZW.Global.CurrentPage.find("#device-title").html(""); } }, SelectModel: function (btn) { M_VZW.Global.CurrentPage.find("#accessories_select_device #unrecognized_ device_msg").css('display', 'none') btn = $(btn.currentTarget); M_VZW.MAS_ChoosePhones.SelectedPhonePK = btn.val(); //Update top current device image and text var imgUrl = $('option:selected', btn).attr("imgsrc"); M_VZW.Global.CurrentPage.find("#device-pic-vid img").attr("src", imgUrl) ; M_VZW.Global.CurrentPage.find("#device-title").html("You have selected t he " + M_VZW.Global.CurrentPage.find('#select-device-make option:selected').text () + " " + $('option:selected', btn).text() + "."); //Show CTA M_VZW.Global.CurrentPage.find("#searchSelPhone").removeClass("hidedetail s").addClass("showdetails"); }, DeviceSelected: function (btn) { if (M_VZW.MAS_ChoosePhones.SelectedPhonePK != 0) { if (M_VZW.MAS_ChoosePhones.CampaignID != "") { var url = M_VZW.MAS_ChoosePhones.CampaignURL + "/all/" + M_VZW.M AS_ChoosePhones.SelectedPhonePK M_VZW.Global.goto(url); } else { M_VZW.Global.goto(M_VZW.MAS_ChoosePhones.CategoriesURL + "/" + M _VZW.MAS_ChoosePhones.SelectedPhonePK); } } else { alert("Please select a device..."); } }, ResetDropDowns: function () { M_VZW.Global.CurrentPage.find("#select-device-make").val('0'); M_VZW.Global.CurrentPage.find("#select-device-models").val('0'); M_VZW.Global.CurrentPage.find("#modelContainer").find('div[data-role="fi eldcontain"]').removeClass("showdetails").addClass("hidedetails"); M_VZW.Global.CurrentPage.find("#searchSelPhone").removeClass("showdetail s").addClass("hidedetails"); var isCurrentDevicePKSet = (M_VZW.MAS_ChoosePhones.CurrentDevicePK != nu ll && M_VZW.MAS_ChoosePhones.CurrentDevicePK != undefined && M_VZW.MAS_ChoosePho nes.CurrentDevicePK != "") ? true : false; var isCampaignIDSet = (M_VZW.MAS_ChoosePhones.CampaignID != null && M_VZ W.MAS_ChoosePhones.CampaignID != undefined && M_VZW.MAS_ChoosePhones.CampaignID != "") ? true : false; var isCampaignIDDevicePKSame = (M_VZW.MAS_ChoosePhones.CurrentDevicePK = = M_VZW.MAS_ChoosePhones.CampaignID) ? true : false; if (isCampaignIDDevicePKSame) { M_VZW.Global.CurrentPage.find("#device-pic-vid img").attr("src", "/c ontent/imgs/unknowndevice.png"); M_VZW.Global.CurrentPage.find("#device-title").html(""); }

$('select').selectmenu('refresh', true); }, init: function (PageName) { $.mobile.showPageLoadingMsg(); if (M_VZW.Global.CurrentJS != null) { M_VZW.Global.CurrentJS.RemoveBindings(); } M_VZW.Global.CurrentJS = M_VZW.MAS_ChoosePhones; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.MAS_ChoosePhones.ResetDropDowns(); M_VZW.MAS_ChoosePhones.GetDeviceFromUA(navigator.userAgent); M_VZW.MAS_ChoosePhones.CreateBindings(); } }; M_VZW.SiteCatalyst = { TrackPage: function (PageName, Server, Channel, Prop1, Prop2, Prop3) { s.pageName = PageName; s.server = Server; s.channel = Channel; if (Prop1 != "") s.prop1 = s.channel + Prop1; else s.prop1 = ""; if (Prop2 != null) s.prop2 = s.prop1 + Prop2; else s.prop2 = ""; /*if (Prop3 != "") s.prop3 = s.prop2 + Prop3; else s.prop3 = "";*/ var custTypeFromCookie = M_VZW.SiteCatalyst.GetCookieForTracking(); s.prop34 = "b2c-mobile-" + custTypeFromCookie; s.eVar41 = s.prop34; s.eVar69 = s.prop1; s.prop35 = 'english'; s.prop54 = s.eVar69 = "mobile"; }, AddCart: function (Events, Prop19, eVar8, eVar9) { s.events = Events; s.prop19 = Prop19; if (eVar8 != "") s.eVar8 = eVar8; else s.eVar8 = ""; if (eVar9 != "") s.eVar9 = eVar9;

else s.eVar9 = ""; }, SaveCart: function (Events, Prop19, CustomerEmail, ShippingMethod, PaymentMe thod, PurchaseType, PurchaseID, State, Zip, Products, ExistingCustomer) { s.events = Events; s.prop19 = Prop19; s.eVar15 = CustomerEmail; s.eVar33 = ShippingMethod; s.eVar34 = PaymentMethod; if (ExistingCustomer.toLowerCase() == 'true') s.eVar41 = 'existing'; // new | existing else s.eVar41 = 'new'; s.eVar37 = M_VZW.SiteCatalyst.PrettyOrderType(PurchaseType); s.purchaseID = PurchaseID; s.transactionID = PurchaseID; s.state = State; s.zip = Zip; s.products = Products; }, AccessoryOnlySaveCart: function (Events, CustomerEmail, ShippingMethod, Paym entMethod, CardType, DiscCode, PurchaseType, PurchaseID, State, Zip, Products, E xistingCustomer) { s.events = Events; s.eVar15 = CustomerEmail; s.eVar33 = ShippingMethod; s.eVar34 = PaymentMethod; s.eVar35 = CardType; s.eVar36 = DiscCode; s.eVar37 = M_VZW.SiteCatalyst.PrettyOrderType(PurchaseType); s.purchaseID = PurchaseID; s.transactionID = PurchaseID; s.state = State; s.zip = Zip; s.products = Products; }, PrettyOrderType: function (PurchaseType) { switch (PurchaseType) { case "NSE": return "NSE"; break; case "Upgrade": return "EUP"; break; case "AccessoryOnly": return "NAO"; break; case "AAL": return "AAL"; break; case "NewServiceOnly": return "NSO";

break; default: return PurchaseType; break; } }, FireTracking: function () { s.t(); }, GetCookieForTracking: function () { var custType; var cookie = M_VZW.Global.getCustomerTypeCookie(); if (cookie == "ExistingCustomer") { custType = "existing"; } else { custType = "new"; } return custType; }, TrackCart: function (type, device, accSKUs) { var s = s_gi(rsidTemp); s.linkTrackVars = 'eVar2,eVar3,list1'; if (device != '') { s.evar2 = 'mobile/shop/phones and devices/device details/' + device; } else { s.eVar2 = ''; } if (accSKUs != '') { s.eVar3 = accSKUs; } else { s.eVar3 = ''; } s.list1 = s.eVar3; s.tl(this, 'o', type); }, TrackTabClick: function (deviceName, tabName) { var s = s_gi(rsidTemp); s.tl(this, 'o', 'tab/' + deviceName + '/' + tabName); }, TrackClick: function (item, status, label) { s.tl(item, status, label); } } M_VZW.Millennial = { //Millennial Mobile Tracking GoalID: "17419", URID: "", URL: "https://cvt.mydas.mobi/handleConversion?", FireTracking: function () {

var URID = M_VZW.Global.readCookie("mm_urid"); if (URID != false) { var ConversionTime = Math.round(new Date().getTime()/1000); var url = M_VZW.Millennial.URL + 'goalid=' + M_VZW.Millennial.GoalID + '&urid=' + URID + '&timestamp=' + ConversionTime; $.get(url); } }, init: function () { var URID = M_VZW.Global.QueryString("mm_urid"); if (URID != null && URID != "" && URID != undefined) { var URID = M_VZW.Global.CreateCookie("mm_urid", URID, 1); } } }; M_VZW.Survey = {} M_VZW.Survey.FullSite = { FullSiteURL: null, CreateBindings: function () { M_VZW.Global.CurrentPage.find("#cart-choices li").unbind("vclick", M_VZW .Survey.FullSite.ChangeTab); M_VZW.Global.CurrentPage.find("#cart-choices li").bind("vclick", M_VZW.S urvey.FullSite.ChangeTab); M_VZW.Global.CurrentPage.find("#btnAddCart").unbind("vclick", M_VZW.Surv ey.FullSite.Continue); M_VZW.Global.CurrentPage.find("#btnAddCart").bind("vclick", M_VZW.Survey .FullSite.Continue); }, RemoveBindings: function () { M_VZW.Global.CurrentPage.find("#cart-choices li").unbind("vclick", M_VZW .Survey.FullSite.ChangeTab); M_VZW.Global.CurrentPage.find("#btnAddCart").unbind("vclick", M_VZW.Surv ey.FullSite.Continue); }, ChangeTab: function (btn) { var btn = $(btn.currentTarget); M_VZW.Global.CurrentPage.find("#cart-choices li").removeClass('currentCh oice').addClass('notChosen'); btn.removeClass('notChosen').addClass('currentChoice'); if (btn.attr('data-value') == 'other') { M_VZW.Global.CurrentPage.find("#txtOther").val(''); M_VZW.Global.CurrentPage.find("#txtContainer").removeClass('hidedeta ils').addClass('showDetails'); } else { M_VZW.Global.CurrentPage.find("#txtContainer").removeClass('showDeta ils').addClass('hidedetails'); } }, Continue: function (btn) { M_VZW.Survey.FullSite.TrackSurvey(btn); if (M_VZW.Survey.FullSite.FullSiteURL != null && M_VZW.Survey.FullSite.F

ullSiteURL != "") { M_VZW.Global.FullSiteURL = M_VZW.Survey.FullSite.FullSiteURL; } M_VZW.Global.GotoFullSite(); }, TrackSurvey: function (btn) { btn = $(btn.currentTarget); var t = M_VZW.Global.CurrentPage.find("#cart-choices li").filter('.curre ntChoice').attr('data-value'); var trackValue = (M_VZW.Survey.FullSite.FullSiteURL != null) ? 'mobile/s urvey/full site support survey/continue to full site/' : 'survey/exitfullsite/my verizon/'; var linktype = (M_VZW.Survey.FullSite.FullSiteURL != null) ? 'e' : 'o'; if (t != undefined) { trackValue += t; if (t == 'other') { trackValue += '/' + M_VZW.Global.CurrentPage.find("#txtOther").v al(); } } else { trackValue += 'undefined'; } M_VZW.SiteCatalyst.TrackClick(btn, linktype, trackValue); }, init: function (PageName) { if (M_VZW.Global.CurrentJS != null) M_VZW.Global.CurrentJS.RemoveBindings(); M_VZW.Global.CurrentJS = M_VZW.Survey.FullSite; M_VZW.Global.CurrentPage = $("#" + PageName); M_VZW.Global.SurveyURL = ""; M_VZW.Survey.FullSite.CreateBindings(); } } M_VZW.TradeIns = { Devices: { "2237": "2118": "2425": "2098": "2286": "2125": "2350": "2266": "2303": "2173": "2069": "2322": "2287": "2362": "2432": "2357": "2104": { { { { { { { { { { { { { { { { { "name": "name": "name": "name": "name": "name": "name": "name": "name": "name": "name": "name": "name": "name": "name": "name": "name": "Apple iPhone", "price": "$185" }, "DROID X by Motorola", "price": "$33" }, "DROID RAZR by Motorola", "price": "$170" }, "DROID INCREDIBLE by HTC", "price": "$28" }, "DROID INCREDIBLE 2 by HTC", "price": "$78" }, "DROID 2 by Motorola", "price": "$20" }, "DROID BIONIC by Motorola", "price": "$85" }, "Apple iPad", "price": "$285" }, "DROID X2 by Motorola", "price": "$50" }, "Samsung Fascinate", "price": "$26" }, "DROID by Motorola", "price": "$7" }, "DROID 3 by Motorola", "price": "$70" }, "DROID CHARGE by Samsung", "price": "$50" }, "Samsung Stratosphere", "price": "$95" }, "Galaxy Nexus by Samsung", "price": "$180" }, "HTC Rezound", "price": "$160" }, "LG Ally", "price": "$10" }

}, GetDeviceFromUA: function () { var serviceURL = "https://services.vzwshop.com/mobile/v4/services/GetDev iceInfo?ua=" + navigator.userAgent + "&apikey=bda11d91-7ade-4da1-855d-24adfe39d1 74&callback=?"; $.getJSON(serviceURL, function (json) { M_VZW.TradeIns.CheckForTradeInDevices(json.ResponseData.WLSPhonePK) }); }, CheckForTradeInDevices: function (PhonePK) { var devices = M_VZW.TradeIns.Devices; var device = devices[PhonePK]; //console.log(device); if (device != undefined) { M_VZW.Cart.ShowDeviceTradeInOption(device); } }, TradeInDeviceSelected: function () { M_VZW.Global.CreateCookie("DeviceTradeIn", 1, 2); }, TradeInDeviceDeSelected: function () { M_VZW.Global.ClearCookie("DeviceTradeIn"); }, CheckForTradeInSelected: function () { var cookie = M_VZW.Global.readCookie("DeviceTradeIn"); if (cookie != false) return true; return false; } }; /*** End Component Includes ***/ /*** Begin Page Code ***/ ///<reference path="/Scripts/mobile/jquery.mobile-1.0.min.js" />

$().ready(function () { /*$.mobile.changePage = function (url) { window.location = url; }*/ //$(document).find('#blackBKG').css('display', 'none'); M_VZW.Global.init(); }); $(document).live("pageshow", function () { M_VZW.Global.loadCartIcon(); }); M_VZW.Global = { CurrentPage: "", SurveyURL: "", CurrentJS: null, CurrentEmailJS: null, CookiesEnabled: false, CurrentDevice: null, FullSiteURL: null, BackBtnURL: null, init: function () { M_VZW.Global.HideURLBar(); M_VZW.Global.AreCookiesEnabled(); if (M_VZW.Global.IsBlackBerry()) { $("#bbtips").css({ display: "block" }); } M_VZW.Millennial.init(); }, loadCartIcon: function () { var cartQty = M_VZW.Global.readCookie('vzw_cart_qty'); if (cartQty) { $('#gn_cartbtn').show(); } //$('.ShoppingCartContainer').load('/Cart/CartIcon'); }, fullSiteClick: function () { document.cookie = "tabCookie" + "= " + "; expires=Thu, 01-Jan-1970 00:00

:01 GM;" + "domain=.verizonwireless.com;" + " path=/"; var exdate = new Date(); var fs = "fs"; exdate.setDate(exdate.getDate() + exdate); document.cookie = fs + "=" + escape("true") + "; expires=" + exdate.toUT CString() + "; domain=.verizonwireless.com; path=/"; window.location = M_VZW.Global.FullSiteURL; }, GotoFullSite: function () { if (M_VZW.Global.SurveyURL == "") { document.cookie = "tabCookie" + "= " + "; expires=Thu, 01-Jan-1970 0 0:00:01 GM;" + "domain=.verizonwireless.com;" + " path=/"; var exdate = new Date(); var fs = "fs"; exdate.setDate(exdate.getDate() + exdate); document.cookie = fs + "=" + escape("true") + "; expires=" + exdate. toUTCString() + "; domain=.verizonwireless.com; path=/"; window.location = M_VZW.Global.FullSiteURL; } else { M_VZW.Global.goto(M_VZW.Global.SurveyURL, true); } }, readCookie: function (name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.leng th); } return false; }, CreateCookie: function (name, value, days) { if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); } else var expires = ""; document.cookie = name + "=" + value + expires + "; path=/"; }, CreateHourCookie: function (name, value, hours) { if (hours) { var date = new Date(); date.setTime(date.getTime() + (hours * 3600 * 1000)); var expires = "; expires=" + date.toGMTString(); } else var expires = ""; document.cookie = name + "=" + value + expires + "; path=/"; },

ClearCookie: function (cookieName) { //Clear a given cookie M_VZW.Global.CreateCookie(cookieName, '', -1); }, goto: function (url, forceReload) { if (forceReload || M_VZW.Global.IsBlackBerryOS5() == true || M_VZW.Globa l.IsFF() == true) { window.location = url; } else { M_VZW.Global.CurrentPage.css("-webkit-backface-visibility", "hidden" ); $.mobile.changePage(url); setTimeout(function () { M_VZW.Global.CurrentPage.css("-webkit-backface-visibility", "vis ible"); }, 500); } }, getCustomerTypeCookie: function () { var i, x, y, ARRcookies = document.cookie.split(";"); var c_name = "CustType"; for (i = 0; i < ARRcookies.length; i++) { x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")); y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1); x = x.replace(/^\s+|\s+$/g, ""); if (x == c_name) { return unescape(y); } else { return "NewCustomer"; } } }, isMaxLength: function (obj) { var mlength = obj.getAttribute ? parseInt(obj.getAttribute("maxlength")) : "" if (obj.getAttribute && obj.value.length > mlength) obj.value = obj.value.substring(0, mlength) }, lettersOnly: function (str) { var nonletters = /[\d\W]/ig; var updatedstr = str.replace(nonletters, ""); return updatedstr; }, numbersOnly: function (str) { var nondigit = /[\D]/ig; var updatedstr = str.replace(nondigit, ""); return updatedstr; }, IsBlackBerryOS5: function () { var uaString = navigator.userAgent.toLowerCase(); var regex = new RegExp("^(blackberry.*/5..*profile)", "gi"); return regex.test(uaString);

}, IsBlackBerry: function () { var uaString = navigator.userAgent.toLowerCase(); var regex = new RegExp("^(blackberry.*profile)", "gi"); return regex.test(uaString); }, IsFF: function () { var uaString = navigator.userAgent.toLowerCase(); var regex = new RegExp("Firefox", "gi"); return regex.test(uaString); }, IsAndroid: function () { var uaString = navigator.userAgent.toLowerCase(); var regex = new RegExp("(android)", "gi"); return regex.test(uaString); }, IsiOS: function () { var uaString = navigator.userAgent.toLowerCase(); var regex = new RegExp("(iPad|iPhone).*(Mac OS)", "gi"); return regex.test(uaString); }, ModifyUrlWithDetection: function (btn) { if (btn.attr("data-device-unique-url") != undefined && btn.attr("details -url") != undefined) { if (btn.attr("data-device-unique-url").toLowerCase() == "false") ret urn btn; var url = btn.attr("details-url"); if (M_VZW.Global.IsiOS() && url.indexOf("/ios") == -1) url += "/ios" ; if (M_VZW.Global.IsAndroid() && url.indexOf("/android") == -1) url + = "/android"; btn.attr("details-url", url); return btn; } else { return btn; } }, OurCollapsible: function () { $(".excerpt").die("vclick"); $(".excerpt").live('vclick', function () { $(this).next(".fulldesc").toggle(); $(this).find("span").toggleClass('arrowdown').toggleClass('arrowrigh t'); }); }, OurCollapsibleSmallArrow: function () { $(".excerpt").die("vclick"); $(".excerpt").live('vclick', function () { $(this).next(".fulldesc").toggle(); $(this).find("span").toggleClass('arrowdown12').toggleClass('arrowri ght12'); }); },

QueryString: function (key) { key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + key + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.href); if (results == null) return ""; else return decodeURIComponent(results[1].replace(/\+/g, " ")); }, HideURLBar: function () { //window.scrollTo(0, 1); }, AreCookiesEnabled: function () { if (M_VZW.Global.TestDomainCookie() || window.location.pathname.toLowerC ase() == "/notice/cookies") { M_VZW.Global.CookiesEnabled = true; } else { M_VZW.Global.CookiesEnabled = false; //M_VZW.Global.goto("/Notice/Cookies"); window.location = "/Notice/Cookies"; } }, TestDomainCookie: function () { M_VZW.Global.CreateCookie("testCookie", "test", 1); var cookieExist = (M_VZW.Global.readCookie("testCookie") != false) ? tru e : false; if (cookieExist) { try { M_VZW.Global.CreateCookie("testCookie", "", -1); } catch (err) { cookieExist = false; } } return cookieExist; }, GetClientDevice: function (ua) { $.mobile.showPageLoadingMsg(); var serviceURL = "https://services.vzwshop.com/mobile/v4/services/GetDev iceInfo?ua=" + ua + "&apikey=bda11d91-7ade-4da1-855d-24adfe39d174&callback=?"; $.getJSON(serviceURL, function (json) { M_VZW.Global.SelectPhone(json) }); }, SelectPhone: function (response) { $.mobile.hidePageLoadingMsg(); M_VZW.Global.CurrentDevice = response.ResponseData; }, RadioSelect: function (btn) { var btn = $(btn.currentTarget); var currentSection = M_VZW.Global.CurrentPage.find("#" + btn.attr("datatype"));

currentSection.find('li').filter(".currentChoice").removeClass("currentC hoice").addClass("notChosen"); btn.removeClass("notChosen").addClass("currentChoice"); }, ChangeTab: function (btn) { var btn = $(btn.currentTarget); var currentSection = M_VZW.Global.CurrentPage.find("#" + btn.attr("datatype")); currentSection.find('li').filter(".current").removeClass("current") currentSection.find('div').filter(".showdetails").removeClass("showdetai ls").addClass("hidedetails"); var TabName = "#" + btn.attr("tabname"); var tab = currentSection.find(TabName); tab.removeClass("hidedetails").addClass("showdetails"); btn.addClass("current"); }, LeaveFeedback: function () { var page = String(window.location); page = encodeURIComponent(page); var opinlabURL = 'https://secure.opinionlab.com/ccc01/o.asp?id=lqArjREC& referer=' + page; try { M_VZW.SiteCatalyst.TrackClick(this, 'e', 'mobile/Leave Feedback'); } catch (e) { //meh -analytics doesnt fire on general error pages } window.location = opinlabURL; } }; /*** End Page Code ***/ })(jQuery);

Anda mungkin juga menyukai