    /*********************************  transfer from old tools.js*************************************/
    // Global variable holding object
    var nxVars = new Hash();
    
    var nxErrLog = new Array(); // error logging records
    
    // global vars declared here
    
    //prod urls
    nxVars.prodUrls=new Array('nextelonline.nextel.com',
        'www.nextel.com',
        'my.nextel.com',
        'www.sprint.com',
        'myaccount.nextel.com',
        'sprintpcs.com',
        'shop.sprint.com',
		'shop2.sprint.com',
        'community.sprint.com',
        'support.sprint.com',
        'mysprint.sprint.com',
        'coverage.sprint.com',
        'coverage.sprintpcs.com',
        'internalshop.corp.sprint.com'
    );
    
    // nextel production URLS
    nxVars.isProd=((nxVars.prodUrls.some(function(val){return (location.href.startsWith('http://'+val)||location.href.startsWith('https://'+val))}))||(location.hostname.toLowerCase()=='nextel.com'));
    nxVars.isNxProd=nxVars.isProd;
    
    //Sprint L&P URLS
    nxVars.lnpUrls=new Array('noltest.nextel.com');
    nxVars.isLnPTest=nxVars.lnpUrls.some(function(val){return (location.href.startsWith('http://'+val)||location.href.startsWith('https://'+val))});
    
    //Sprint Testing/Dev URLS
    nxVars.testUrls=new Array('nolrtb1.nextel.com',
        'nolrtb2.nextel.com',
        'nolrtb1.sprint.com',
        'nolbf.nextel.com',
        'nolbf.sprint.com'
    );
    nxVars.isTest=(location.href.contains('test.sprint.com')||nxVars.testUrls.some(function(val){return (location.href.startsWith('http://'+val)||location.href.startsWith('https://'+val))}));
    
    var debugMode = (!nxVars.isProd||(location.href.getParam('debug')=="true"));
    if(debugMode){
        Logs.enableLogType('dhtml_error');
        Logs.enableLogType('Timeline');
        //  Logs.enableAlert('dhtml_error');
        Events.inQ('DOMLoad',{f:function(){
            Logs.enableLogType('XHR-requests');
            Logs.enableLogType('XHR-errors');
            Logs.enableLogType('XHR-events');
        }});
        
    }
    
    //******************************
    //  Page Redirects
    //******************************
    nxVars.redirs = new Array();
    // checks to see if page is marked to be redirected.
    // if so, it forwards to the new page and replaces the entry in the browsers history
    function nxPageForwarding(){
        nxVars.redirs.forEach(function(val){
            if(location.href.contains(val[0])){
                location.replace(val[1])
                }
        });
    }
    nxVars.redirs.push(['/NASApp/onlinestore/'+nxVars.lang+'/Action/IntlPhoneLanding','/'+nxVars.lang+'/services/worldwide/intl_phones.shtml']);
    nxPageForwarding();
    
    
    
    
    function formatMoney(d){
        var res=''+d;
        var ex=/^(\$)?(\d*)(\.)?(\d)?(\d)?/;
        res=res.match(ex);
        var tot;
        if(res!=null){
            tot=((res[1])?res[1]:'$')+((res[2])?res[2]:'0')+((res[3])?res[3]:'.')+((res[4])?res[4]:'0')+((res[5])?res[5]:'0');
        }
        var p=tot.indexOf('.')-3;
        while(p>1){
            var s=tot.substring(0,p);
            var e=tot.substring(p);
            tot=s+','+e;
            p=tot.indexOf(',')-3;
        }
        
        return tot;
    }
    // deprecated   
    // returns true/false if string str contains only alphabetic (a-z,A-Z) or numeric (0-9) characters
    function isAlphaNumeric(str){
        return !(/[^a-z0-9]/i.test(str));
    }
    // deprecated
    // returns true/false if string str contains only numeric (0-9) characters
    function isNumeric(str){
        if(str.length == 0){
            return false;
        }
        return !(/\D/.test(str));
    }
    // deprecated
    // returns true/false if string str contains only alphabetic (a-z,A-Z) characters
    function isAlpha(str){
        return !(/[^a-z]/i.test(str));
    }
    // deprecated
    //returns true/false if float f contains only digits (0-9.0-9) numbers
    function isFloat(f) {
        return (/^\d*(\.\d*)?$/.test(f));
    }
    
    // deprecated
    function checkEmail(emailStr) {
        var emailPattern=function(){
            var al="a-zA-Z";
            var an=al+"0-9";
            var dm=an+"\\-";
            var ch=dm+"_\\+";
            var ent=ch+"\\.";
            var a=new RegExp("^["+an+"]["+ent+"]*["+an+"]@(["+an+"]["+ent+"]*["+ch+"]\\.)?["+dm+"]{1,63}\\.["+al+"]{2,10}$");
            return a    
            }();
        return ((isValidText(emailStr))&&(emailPattern.test(emailStr)));
    }
    
    
    
    
    // SELECTBOX LIST OPTION MANIPULATION FUNCTIONS
    
    // removes all options in a list
    //
    // listoptions:  the object reference to the list to be cleared
    function clearList(listoptions){
        if(listoptions.length >0){
            for (x=listoptions.length; x >= 0; x--){
                listoptions.remove(x);
            }
        }
    }
    
    // adds an option to a specified list
    // olist: the list object to add the option to (eg: document.formName.selectName)
    // txt: the displayed text for the option
    // val: the actual value of the option
    // def: (true/false) is this option the default selected option (the form resets to the default selection)
    // sel: (true/false) is this option the currently selected option (what is currently selected in the list)
    
    function addoption(olist,txt,val,def,sel){
        olist.options[olist.length] = new Option(txt,val,def,sel)
        }
    
    // Creates a list of days of the month.
    // lst: the list object which the options are to be created in (eg: document.formName.selectName)
    // month/year: the month and year desired
    // defdate: the default day you need to be selected (1 if omitted)
    function createListDays(lst,month, year, defdate){
        var numDays = getDays(year, month);
        clearList(lst);
        for (x=1; x <= numDays; x++){
            if (typeof defdate != "undefined"){
                if(x == defdate){
                    addoption(lst,x,x,true,true);
                }
                else{
                    addoption(lst,x,x,false,false);
                }
            }
            else{
                if(x == 1){
                    addoption(lst,x,x,true,true);
                }
                else{
                    addoption(lst,x,x,false,false);
                }
            }
        }
    }
    
    //  MISC. FUNCTIONS (DATE,TIME,STATES)
    
    // returns true if the year is a leap year
    // returns false otherwise
    function isLeapYear(year){
        if(year % 4 == 0){
            if(year % 100 == 0){
                if(year %400 == 0){
                    return true;
                }
                else{return false}
            }
            return true;
        }
        else{
            return false;
        }
    }
    
    var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
    
    // returns the number of days in a given month and year
    function getDays(year, month){
        var days;
        if (isLeapYear(year)){
            days = new Array(31,29,31,30,31,30,31,31,30,31,30,31);
        }
        else{
            days = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
        }
        return (days[month-1]);
    }
    
    function usState(abbr,name){
        this.abbr=abbr;
        this.name=name;
    }
    var usStateList=new Array(new usState("AL","Alabama"),
    new usState("AK","Alaska"),
    new usState("AZ","Arizona"),
    new usState("AR","Arkansas"),
    new usState("CA","California"),
    new usState("CO","Colorado"),
    new usState("CT","Connecticut"),
    new usState("DE","Delaware"),
    new usState("FL","Florida"),
    new usState("GA","Georgia"),
    new usState("HI","Hawaii"),
    new usState("ID","Idaho"),
    new usState("IL","Illinois"),
    new usState("IN","Indiana"),
    new usState("IA","Iowa"),
    new usState("KS","Kansas"),
    new usState("KY","Kentucky"),
    new usState("LA","Louisiana"),
    new usState("ME","Maine"),
    new usState("MD","Maryland"),
    new usState("MA","Massachusetts"),
    new usState("MI","Michigan"),
    new usState("MN","Minnesota"),
    new usState("MS","Mississippi"),
    new usState("MO","Missouri"),
    new usState("MT","Montana"),
    new usState("NE","Nebraska"),
    new usState("NV","Nevada"),
    new usState("NH","New Hampshire"),
    new usState("NJ","New Jersey"),
    new usState("NM","New Mexico"),
    new usState("NY","New York"),
    new usState("NC","North Carolina"),
    new usState("ND","North Dakota"),
    new usState("OH","Ohio"),
    new usState("OK","Oklahoma"),
    new usState("OR","Oregon"),
    new usState("PA","Pennsylvania"),
    new usState("RI","Rhode Island"),
    new usState("SC","South Carolina"),
    new usState("SD","South Dakota"),
    new usState("TN","Tennessee"),
    new usState("TX","Texas"),
    new usState("UT","Utah"),
    new usState("VT","Vermont"),
    new usState("VA","Virginia"),
    new usState("WA","Washington"),
    new usState("WV","West Virginia"),
    new usState("WI","Wisconsin"),
    new usState("WY","Wyoming"),
    new usState("DC","District of Columbia"),
    new usState("PR","Puerto Rico"),
    new usState("VI","US Virgin Islands"));
    
    
    
    // generates a set of list options with all of the US states
    // Parameters:
    //  len: can be "l","s","m" (long, short, mixed) 
    //          Long = full name displayed and as value
    //          Short = abreviation displayed and as value
    //          Mixed = full name displayed, abbreviation as value
    //  state: the abreviation of the state to be selected (if none, ''=first on list)
    //  format: either "create" or "return" (default).  Create dynamically creates the list and appends the values to the select.  return generates and returns a string of all of the options.
    //  list:  if format is "create" then list is the <select> the options should be appended to (<select> ID or object pointer)
    
    function stateOptions(len,state,format,list){
        function sortByAbbr(a,b){
            return((a.abbr<b.abbr)?-1:1);
        }
        function sortByName(a,b){
            return((a.name<b.name)?-1:1);
        }
        var createList=false;
        if((isDefined(format))&&((format!='return')&&(isDefined(list)))){
            createList=true;
        }
        var val;
        var lst=new Array();
        var longVal;
        var longDisplay;
        switch(len){
        case "l": lst=usStateList.sort(sortByName); 
            longVal=true;
            longDisplay=true;
            break
        case "m": lst=usStateList.sort(sortByName); 
            longVal=false;
            longDisplay=true;
            break
        case "s": lst=usStateList.sort(sortByAbbr); 
            longVal=false;
            longDisplay=false;
            break
        }
        if(createList){
            for(var x=0; x<lst.length; x++){
                var val=((longVal)?lst[x].name:lst[x].abbr);
                var disp=((longDisplay)?lst[x].name:lst[x].abbr);
                var sel=((lst[x].abbr==state)?true:false);
                var opt=new Option(disp,val,sel,sel);
                $(list).options[$(list).options.length]=opt;
            }
            return
        }
        else{
            var ret='';
            for(var x=0; x<lst.length; x++){
                var val=((longVal)?lst[x].name:lst[x].abbr);
                var disp=((longDisplay)?lst[x].name:lst[x].abbr);
                var sel=((lst[x].abbr==state)?' selected="selected"':'');
                ret+='<option value="'+val+'"'+sel+'>'+disp+'</option>';
            }
            return ret
            }
    }
    
    
    
    
    /*********************************  transfer from old tools.js*************************************/
    
    
    nxVars.nxPopUpDef = new Hash(); // pop-up definitions record
    
    /* Start Pop-up functions */
    nxVars.nxPopUpDef["planDetails"] = new Array("/global/popups/plan_details.php","scrollbars,height=500,width=605,top=0,left=0");
    nxVars.nxPopUpDef["updateCartQuantities"] = new Array("/global/popups/updatecartquantities.php","scrollbars,height=300,width=385,top=0,left=0");
    nxVars.nxPopUpDef["phoneSelector"] = new Array("/en/support/phoneSelector.shtml","scrollbars,height=270,width=390,top=0,left=0");
    nxVars.nxPopUpDef["phoneSelectorStore"] = new Array("/dynamic/accessories/phone_selector_store_popup.php","scrollbars,height=345,width=390,top=0,left=0");
    nxVars.nxPopUpDef["tableBuilder"]  = new Array("/assets/tools/table_builder.html","scrollbars,resizable,height=500,width=450,top=0,left=0");
    nxVars.nxPopUpDef["tableBuilderFull"]  = new Array("/assets/tools/table_builder_full.html","scrollbars,resizable,height=750,width=850,top=0,left=0");
    nxVars.nxPopUpDef["printCart"] = new Array("/NASApp/onlinestore/Action/PrintCart","scrollbars,resizable,height=750,width=850,top=0,left=0");
    nxVars.nxPopUpDef["printReceipt"] = new Array("/NASApp/onlinestore/checkout/orderReceipt?isPrintableView=true","scrollbars,menubar,resizable,height=750,width=850,top=0,left=0");
    nxVars.nxPopUpDef["videoLink"] = new Array("/global/popups/popups_generic.php","scrollbars=no,height=463,width=945,top=0,left=0");
    nxVars.nxPopUpDef["generic9"] = new Array("/global/popups/popups_generic.php","scrollbars,resizable,height=800,width=1050,top=125,left=500");
    nxVars.nxPopUpDef["generic8"] = new Array("/global/popups/popups_generic.php","scrollbars,height=575,width=625,top=0,left=0");
    nxVars.nxPopUpDef["generic7"] = new Array("/global/popups/popups_generic.php","scrollbars,resizable,height=650,width=700,top=125,left=500");
    nxVars.nxPopUpDef["generic6"] = new Array("/global/popups/popups_generic.php","scrollbars,height=563,width=655,top=125,left=500");
    nxVars.nxPopUpDef["generic5"] = new Array("/global/popups/popups_generic.php","scrollbars,height=563,width=655,top=0,left=0");
    nxVars.nxPopUpDef["generic4"] = new Array("/global/popups/popups_generic.php","scrollbars,height=300,width=550,top=250,left=60");
    nxVars.nxPopUpDef["generic3"] = new Array("/global/popups/popups_generic.php","scrollbars,resizable,height=500,width=605,top=0,left=0");
    nxVars.nxPopUpDef["generic2"] = new Array("/global/popups/popups_generic.php","scrollbars,height=500,width=410,top=0,left=0");
    nxVars.nxPopUpDef["generic1"] = new Array("/global/popups/popups_generic.php","scrollbars,height=500,width=215,top=0,left=0");
    nxVars.nxPopUpDef["genericShort"] = new Array("/global/popups/popups_generic.php","height=215,width=410,top=0,left=0");
    nxVars.nxPopUpDef["accPhonePopUp"] = new Array("/NASApp/onlinestore/Action/OSBrowseAccessoriesPhonePopup","scrollbars,height=255,width=405,top=0,left=0");
    nxVars.nxPopUpDef["findImeiPopup"] = new Array("/en/support/imei_popup.shtml","scrollbars,height=500,width=410,top=0,left=0");
    nxVars.nxPopUpDef["findSimPopup"] = new Array("/en/support/sim_popup.shtml","scrollbars,height=500,width=410,top=0,left=0");
    nxVars.nxPopUpDef["findImeiSimPopup"] = new Array("/en/support/mynextel/sim_popup.shtml","scrollbars,height=500,width=410,top=0,left=0");
    nxVars.nxPopUpDef["fullWin"] = new Array("/global/popups/popups_generic.php","scrollbars,top=0,left=0,toolbar,resizable,menubar,location");
    nxVars.nxPopUpDef["flashDemo"] = new Array("/global/popups/popups_generic.php","resizable,height=500,width=800,top=0,left=0");
    nxVars.nxPopUpDef["cancelOrderPromo"] = new Array("/dynamic/cancel_order_popup.php","height=420,width=618,top=0,left=0");
    nxVars.nxPopUpDef["mmsDemo"] = new Array("global/popups/popups_generic.php","height=354,width=530,top=0,left=0");
    nxVars.nxPopUpDef["webDemo"] = new Array("global/popups/popups_generic.php","height=325,width=735,top=0,left=0");
    nxVars.nxPopUpDef["nextmailDemo"] = new Array("global/popups/popups_generic.php","height=450,width=475,top=0,left=0");
    nxVars.nxPopUpDef["walkietalkieDemo"] = new Array("global/popups/popups_generic.php","height=400,width=755,top=0,left=0");
    nxVars.nxPopUpDef["cancelOrderSurvey"] = new Array("/dynamic/cancel_order_popup.php","height=600,width=500,top=0,left=0");
    nxVars.nxPopUpDef["widen"] = new Array("global/popups/popups_generic.php","height=600,width=500,top=0,left=0");
    nxVars.nxPopUpDef["comparePhones"] = new Array("/dynamic/phones/compare.html","height=640,width=780,top=0,left=0,menubar,resizable");
    nxVars.nxPopUpDef["comparePhonesPrint"] = new Array("/dynamic/phones/compare_print.html","height=500,width=560,top=0,left=0,menubar,scrollbars,resizable");
    nxVars.nxPopUpDef["zipCode"] = new Array("/global/popups/zip_code_change.php","height=250,width=300,top=0,left=0,");
    nxVars.nxPopUpDef["keySurvey"] = new Array("/global/popups/popups_generic.php","scrollbars,height=500,width=800,top=0,left=0");
    nxVars.nxPopUpDef["i860Demo"] = new Array("/global/popups/popups_generic.php","height=400,width=466,top=0,left=0");
    nxVars.nxPopUpDef["billingDemo"] = new Array("/global/popups/popups_generic.php","height=375,width=625,top=0,left=0");
    nxVars.nxPopUpDef["myNextelDemo"] = new Array("/global/popups/popups_generic.php","height=560,width=740,top=0,left=0");
    nxVars.nxPopUpDef["npiPopUp"] = new Array("/global/popups/popups_generic.php","height=300,width=410,top=0,left=0");
    nxVars.nxPopUpDef["mobile2mobile"] = new Array("/global/popups/popups_generic.php","height=630,width=630,top=0,left=0,scrollbars,resizable");
    nxVars.nxPopUpDef["pcmilerDemo"] = new Array("/global/popups/popups_generic.php","height=403,width=703,top=0,left=0");
    nxVars.nxPopUpDef["ff500"] = new Array("/en/support/faqs/subscriber_activity_summary.html","height=360,width=660,top=0,left=0,scrollbars,resizable");
    nxVars.nxPopUpDef["ff7003"] = new Array("/en/support/faqs/ff_activity_summary.html","height=400,width=800,top=0,left=0,scrollbars,resizable");
    nxVars.nxPopUpDef["flagged"] = new Array("/en/support/faqs/flagged_call.html","height=360,width=675,top=0,left=0,scrollbars,resizable");
    nxVars.nxPopUpDef["usageGreater"] = new Array("/en/support/faqs/shared_usage_greater.html","height=275,width=700,top=0,left=0,scrollbars,resizable");
    nxVars.nxPopUpDef["usageLess"] = new Array("/en/support/faqs/shared_usage_less_or_equal.html","height=275,width=700,top=0,left=0,scrollbars,resizable");
    nxVars.nxPopUpDef["ringtonesDemo"] = new Array("/global/popups/popups_generic.php","height=612,width=810,top=0,left=0");
    nxVars.nxPopUpDef["productDemo"] = new Array("/global/popups/popups_generic.php","height=400,width=475,top=0,left=0");
    nxVars.nxPopUpDef["NascarDemo"] = new Array("/global/popups/popups_generic.php","height=531,width=781,top=0,left=0");
    nxVars.nxPopUpDef["gen400"] = new Array("/global/popups/popups_generic.php","height=400,width=400,top=0,left=0, scrollbars,resizable");
    nxVars.nxPopUpDef["consumerBillingDemo"] = new Array("/global/popups/popups_generic.php","height=460,width=650,top=0,left=0");
    nxVars.nxPopUpDef["impactMap"] = new Array("","height=600,width=700,top=0,left=0, scrollbars,resizable");
    nxVars.nxPopUpDef["testWin"] = new Array("/global/popups/popups_generic.php","top=0,left=0, scrollbars,resizable");
    nxVars.nxPopUpDef["daytonaRules"] = new Array("/global/popups/popups_generic.php","height=440,width=630,top=0,left=0,scrollbars,resizable");
    nxVars.nxPopUpDef["tepChart"] = new Array("/global/popups/popups_generic.php","height=445,width=340,top=0,left=0");
    
    //Commenting this function for the iSearch pop-up issue
    /*
    function nxPopup(name,url,overWrite){
        var cnt = 0;
        var exists = true;
        var loc=(isValidText(url)?url:nxVars.nxPopUpDef[name][0]);
        window.open(loc,name,nxVars.nxPopUpDef[name][1]);
    }
    */
    function nxPopup(name,url,overWrite){ 
        var cnt = 0; 
        var exists = true; 
        var baseTag = document.getElementsByTagName("base"); 
        var baseTagBaseUrl = ""; 
        var loc=(isValidText(url)?url:nxVars.nxPopUpDef[name][0]);
        if((isValidText(url)) && (!url.startsWith("http"))){ //is URL fully qualified? 
            if(baseTag.length > 0){ //check for base tag existance. 
                baseTagBaseUrl = (baseTag[0].href).match("((http[s]?|ftp):\/)?\/?([^:\/\s]+)"); //url[0] is upto the first '/' 
                loc = baseTagBaseUrl[0]+(isValidText(url)?url:nxVars.nxPopUpDef[name][0]); 
            }
            /*else{
                var p=location.protocol;
                var h=location.host;
                loc=p+'//'+h+(isValidText(url)?url:nxVars.nxPopUpDef[name][0]);
            }*/
        }//end of url does not contain http 
        window.open(loc,name,nxVars.nxPopUpDef[name][1]); 
    }//end of nxPopup

    function NewWindow(url){
        nxPopup('fullWin',url);
    }
    
    /* End Pop-up Functions */
    
    
    // used for changing phone selection boxes in static pages
    function phoneSelectorSwap(_obj,imgID,imageArray,changeImage){
        var sInd = _obj.selectedIndex;
        var sOpt = _obj.options[sInd].value;
        if(changeImage == true){
            swap(imgID,imageArray[sInd].src);
        }
    }
    
    
    /* Start Cookie Functions */
    function setNxCookie(name,valStr,persist){
        var dte=new Date();
        if((isDefined(persist))&&(persist == false)){
            spCookies.deleteCookie(name);
            return
        }
        else if((isDefined(persist))&&(persist='session')){
            dte = false;
        }
        else{
            dte.setFullYear(dte.getFullYear()+1);
        }
        spCookies.setCookie(name,''+valStr,((dte instanceof Date)?dte.toGMTString():null));
        nxVars.cookieVal=spCookies.cookieValue;
    }
    
    var spCookies=new Cookies();
    spCookies.setDelimiters('||','^^');
    spCookies.setPath('/');
    if(location.href.contains('nextel.com')){
        spCookies.setDomain('nextel.com');
    }
    spCookies.addReadableCookie("nxcommon","nolCustomAisleToken","customAisleFileCookie","GlobalSuppressedAisle","SMSESSION","indpage","nxprofile","nxpartner","npi_zipcode","nxtestcookie","NXTL_SELECTED_ACCT","managebase","manageSL","sprintEeInfo","LoggedIntoP2k","EXP_COOKIE","hasCart");
    spCookies.load();
    
    
    /* End Cookie Functions */  
    
    
    function nxSetCANameCookie(caName){
        var rg=/^\s*welcome\s*/i;
        caName=caName.replace(rg,'');
        caName=encodeURIComponent(caName); // escape special characters eg: &trade;
        spCookies.setCookieItem(['customAisleFileCookie','aisleCorpName'],caName,'');
    }
    
    
    
    /* Start Error Messaging functions */
    
    // displays Nextel Error Messages
    //
    // parameters:
    // errList: an array of the errors which have been caught (associative reference used in next parameter)
    
    function displayNextelError(errList){
        var obj=$('errorMessagingBox');
        if(!obj){
            obj=$c('errorMessagingBox','div');
            if(obj){
                obj=obj[0];
            }
        }
        else{
            addClass(obj,'errorMessagingBox');
        }
        setDisplay(obj,'block');
        var errMessages = "<p>"+nxVars.hVars.langItems['error_intro']+'</p><ul>'+_NL;
        var errHolder;
        restoreNxErrorFields()
            errList.forEach(function(val,key){
                var fields = nxErrLog[val].fieldName.split(';;');
                fields.forEach(function(v,k){
                    addClass(document.forms[nxErrLog[val].fm].elements[v],'error');
                });     
                var labels = nxErrLog[val].labelId.split(';;');
                labels.forEach(function(v,k){
                    addClass(v,"error");
                });     
                errMessages += "<li>"+nxErrLog[val].mess+"</li>"+_NL;
            });
        errMessages+='</ul>';
        setInnerHTML(obj,errMessages);  
        window.scroll(0,0);                 
    }
    
    function restoreNxErrorFields(){
        nxErrLog.forEach(function(val,key){
            var fields = val.fieldName.split(';;');
            fields.forEach(function(v,k){
                removeClass(document.forms[val.fm].elements[v],'error');
            });
            var labels = val.labelId.split(';;');
            labels.forEach(function(v,k){
                removeClass(v,"error");
            });     
        });
    }
    
    // stores the values for error messages.
    function setNxErrLog(groupId,fmName,fieldName,labelId,message){
        var _t=new Hash();
        _t.fm=fmName;
        _t.fieldName=fieldName;
        _t.labelId = labelId;
        _t.mess = message;
        nxErrLog[groupId] = _t;
    }
    
    
    // DEPRECATED
    var saveNxFormFields=_Empty;
    
    /* End Error Messaging functions */
    
    
    
    /* start Local nav Functions */
    
    
    function nxSortLocalNavList(a,b){
        var aLev;
        var bLev;
        var a1 = -1;
        var a2 = -1;
        var a3 = -1;
        var b1 = -1;
        var b2 = -1;
        var b3 = -1;    
        if(localNavDef[a][0].indexOf('.') > -1){
            aLev = localNavDef[a][0].split(".");
            a1 = parseInt(aLev[0]);
            a2 = parseInt(aLev[1]);
            if(aLev.length == 3){
                a3 = parseInt(aLev[2]);
            }
        }
        else{
            a1 = parseInt(localNavDef[a][0]);
        }
        if(localNavDef[b][0].indexOf('.') >  -1){
            bLev = localNavDef[b][0].split(".");
            b1 = parseInt(bLev[0]);
            b2 = parseInt(bLev[1]);
            if(bLev.length == 3){
                b3 = parseInt(bLev[2]);
            }
        }
        else{
            b1 = parseInt(localNavDef[b][0]);
        }
        if(a1 > b1){return 1;}
        if(a1 < b1){return -1;}
        if((a2 > b2)||(b2 == -1)){return 1;}
        if((a2 < b2)||(a2 == -1)){return -1;}
        if((a3 < b3)||(a3 == -1)){return -1;}
        if((a3 > b3)||(b3 == -1)){return 1;}
        return 0;
    }
    
    function nxGetLocalNavLink(tId,selId){
        var txt;
        var lnkHrefOut;
        var clsID=(tId==selId)?' class="on"':'';
        if(localNavDef[tId][2] != "##"){
            lnkHrefOut=((localNavDef[tId][2].contains('javascript:'))||(localNavDef[tId][2].contains('http'))?'':nxVars.localNavBase)+localNavDef[tId][2];
            txt='<a href="'+lnkHrefOut+'"'+clsID+'>'+localNavDef[tId][1]+'</a>';
        }
        else{       
            txt=localNavDef[tId][1];
        }
        return txt;
    }
    
    function renderLocalNav(localNavID){
        nxVars.localNavBase = ((nxVars.hVars.secureServer)?"https://"+location.host:"");
        if(!isDefined(localNavDef[localNavID])){
            document.writeln("There was an error in processing your request.  Navigation ID not found.");
            return;
        }
        var navID=localNavID.toString();
        var navLevels=navID;
        var baseNum = parseInt(localNavDef[navID][0]);
        var baseID = "";
        var clsID = "";
        var secNum = "";
        if(localNavDef[navID][0].contains('.')){
            navLevels = localNavDef[navID][0].split(".");
            secNum = navLevels[0]+"."+navLevels[1];
        }       
        
        var idArray=localNavDef.filterKeys(function(val,key){
            if(val[0]==baseNum.toString()){
                baseID=key;
            }
            return ((val[0].startsWith(baseNum+"."))&&(!val[2].contains('disable')))
            });
        idArray.sort(nxSortLocalNavList);
        var lnkHrefOut = "";
        var outArr=[];
        outArr.push('<div id="localNavBox" class="moduleSpacer mod1Wid">\n');
        outArr.push('<ul class="outer">\n');
        outArr.push('<li class="first">'+nxGetLocalNavLink(baseID,navID)+'</li>\n');    
        for(var x=0; x<idArray.length;){
            navLevels = localNavDef[idArray[x]][0].split(".");
            outArr.push('<li>'+nxGetLocalNavLink(idArray[x],navID));
            var cnt = x+1;
            var isTertiary = false;     
            while((idArray[cnt]!=null) && (localNavDef[idArray[cnt]][0].split(".")[1] == localNavDef[idArray[x]][0].split(".")[1])){
                var t2ID = localNavDef[idArray[cnt]][0].split(".")[0]+"."+localNavDef[idArray[cnt]][0].split(".")[1];
                if(t2ID == secNum){
                    if(cnt == x+1){
                        outArr.push('<ul class="inner">\n');
                        isTertiary = true;
                    }
                    outArr.push('<li>'+nxGetLocalNavLink(idArray[cnt],navID))+'</li>\n';
                }
                cnt++;
            }   
            if(isTertiary){
                outArr.push('</ul>\n');
            }
            outArr.push('</li>\n');
            x = cnt;    
        }
        outArr.push('</ul></div>\n');
        dwl(outArr.join(_NL));
        localNavDef = new String();
    }
    
    function nxLocalNavRepSpecChars(str){
        var swaps=new Array(['&ntilde;',241],
            ['&Ntilde;',209],
            ['&ntilde;',241],
            ['&Aacute;',193],
            ['&aacute;',225],
            ['&Eacute;',201],
            ['&eacute;',233],
            ['&Iacute;',205],
            ['&iacute;',237],
            ['&Oacute;',211],
            ['&oacute;',243],
            ['&Uacute;',218],
            ['&uacute;',250],
            ['&amp;',38],
            ['&trade;',174],
            ['&iquest;',8482],
            ['&reg;',191]
            );
        var out=str;
        swaps.forEach(function(val){
            var r=new RegExp(val[0],'g');
            out=out.replace(r,String.fromCharCode(val[1]));
        });
        return out;
    }
    
    function createLocalNavList(){
        var args=[];
        for(var x=0; x<arguments.length; x++){
            args[x]=arguments[x];
        }
        var idArray=localNavDef.filterKeys(function(val,key){
            var baseNum = parseInt(val[0]);
            if(args.length >0){
                for(y=0; y<args.length; y++){
                    if((args[y].toString() == baseNum.toString())&&(!val[2].startsWith('disable'))){
                        return true
                        }
                }
            }
            else{           
                if(!val[2].startsWith('disable')){              
                    return true
                    }
            }
            return false    
            });     
        idArray.sort(nxSortLocalNavList);
        var optArray=idArray.map(function(val,key){
            var lev = localNavDef[idArray[x]][0].split(".");
            var div=': ';
            switch(lev.length){
            case 1: break;
            case 2: div+='  -- ';
                break;
            case 3: div+='  -- -- ';
                break;
            }
            return (new Option(localNavDef[val][0]+div+nxLocalNavRepSpecChars(localNavDef[val][1]),val,false,false));           
        }); 
        return optArray;
    }
    
    
    /* End local Nav Functions */
    
    
    
    
    /*  REWRITE */
    
    // Opens a GET form into a 650x440 window     
    function loadloadEePopFromForm(fm){
        var url = fm.action+'?';
        var ct = 0;
        var msg='';
        for(var x=0; x<fm.elements.length;x++){
            if(fm.elements[x].type != 'image'){
                if(ct>0){
                    url+='&';
                }
                url+=fm.elements[x].name+'='+fm.elements[x].value;
                ct++;
            }
        }
        var x = window.open(url,fm.target,'width=650, height=440, top=0, left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes');
        return false;
        
    }
    
    
    // Opens a link into a 650x440 window
    function loadEePopFromLink(lnk){
        var x = window.open(lnk.href,lnk.target,'width=650, height=440, top=0, left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes');
        return false;
        
    }
    
    function nxPdfToNewWin(){
        var lnks = document.getElementsByTagName('a');
        var ptrn = /\.pdf$/i;
        for(var x=0; x<lnks.length; x++){
            if((ptrn.test(lnks[x].href))&&(lnks[x].onclick == null)&&(!nxVars.thirdParty)&&(!nxVars.isAmdocs)){
                var hrf = lnks[x].href;
                lnks[x].href="javascript:nxPopup(\'fullWin\',\'"+hrf+"\');";
            }           
        }   
    }
    
    //setOnLoadScript('nxPdfToNewWin()');
    
    function checkAccessPrivilege(){
        var dms=['teamsite.nextel.com','nolcdt1.nextel.com','nolcdt2.nextel.com'];
        if((nxVars.isCA != true)&&(!dms.some(function(val){return location.href.contains(val)}))){
            document.location.href = "/secure_page.shtml";
        }       
    }
    
    
    /* END REWRITE */ 
    
    
    /*  DEPRECATED CODE MAINTAINED FOR BACKWARDS COMPATIBILITY */
    
    function deleteNxCookie(c){spCookies.deleteCookie(c)}
    function getNxCookie(){spCookies.load();}
    nxVars.cookieVal=spCookies.cookieValue;
    // location.href.getParam instead
    location.getParam=function(p){return location.href.getParam(p)}
    
    DOM.make.elementStyleShortcut(new Hash({
        BGColor:'background-color',
            Color:'color',
            Cursor:'cursor',
            Display:'display',
            BGImage:'background-image',
            ZIndex:'z-index'
        }));
    
    function swap(name, source){
        try{
            $(name).src = source;
        }
        catch(e){
            try{
                document.images[name].src = source;
            }
            catch(e){
                Log('dhtml_error',[e,"Image Name: "+name,"swap"]);
            }
        }
    };
    
    
    /*
        Const: _SPACER
        URL to 1px spacer gif
    */
    var _SPACER='/assets/images/spacer.gif';
    
    
    var isIE=bis.ie;
    function setobj(obj){return $(obj)}
    function getSClass(name){return getClassName(name)}
    
    var dispVal=trDisplayValue=adlib.CSS.tableElements.tr;
    var setInnerHTML=setHTML;
    var getInnerHTML=getHTML;
    
    
    // authors can set multiple window.onload functions without
    // stepping on other onload scripts or putting anything into
    // the body tag using setOnLoadScripts()
    
    var onLoadScriptArray = new Array();
    
    function setOnLoadScript(a){
        onLoadScriptArray[onLoadScriptArray.length] = a;
    }
    
    function nxInitPageScripts() {
        for (var i=0; i<onLoadScriptArray.length; i++) {
            eval(onLoadScriptArray[i]);
        }
    }
    
    function legacyTablePageFix(){
        var tb=$css('table[align="center"]');
        if(tb.length>0){
            tb[0].setAttribute('align','');
            setWidth(tb[0],'100%');
        }
    }
    
    Events.inQ('DOMLoad',nxInitPageScripts);
    Events.inQ('DOMLoad',legacyTablePageFix);
    
    
    
    

