//Synacor Widget call
var VzS9N = {};
VzS9N.loadWidget = (function() {
    var widgets = [];
    var loaded = false;

    var callS9N = function() {
        if (!loaded) {
            return;
        }
        var SynacorP2_S9N = SynacorP2_NW_WC;
        var types = [];
        var ids = [];

        for (i = 0; i < widgets.length; i++) {
            types.push(widgets[i].type);
            ids.push(widgets[i].target);
        }

        if (types.length > 0) {
	        for (i = 0; i < widgets.length; i++) {
                widgets[i].callback();
            }	
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = SynacorP2_S9N + '?type=' + types.join(',') + '&id=' + ids.join(',');
            document.getElementsByTagName('head')[0].appendChild(script);            
        }
        
        widgets = [];
    };

    var loadedCallback = function() {
        loaded = true;
        callS9N();
    };

    /*if (window.addEventListener) {
    window.addEventListener('load', loadedCallback, false);
    } else {
    window.attachEvent('onload', loadedCallback);
    }*/

    return function(type, target, callback) {
        if (type != null) {
            widgets.push({ type: type, target: target, callback: callback });
            callS9N();
        }
        else {		
            loaded = true;
            callS9N();
        }
    };

})();

///VZ 2.0 Customize Function
var IsNETProfile = "F";
function changeSDetails(activeTab) {

    if (activeTab == 1) {

        if (document.getElementById('WIcon').className == 'SerPlus') {
            document.getElementById('WIcon').className = 'SerMinus';
            $('#' + 'WCnt').slideDown(600);

            if (document.getElementById('IIcon').className != 'SerPlus') {
                document.getElementById('IIcon').className = 'SerPlus';
                $('#' + 'ICnt').slideUp(600);
            }

            if (document.getElementById('TIcon').className != 'SerPlus') {
                document.getElementById('TIcon').className = 'SerPlus';
                $('#' + 'TCnt').slideUp(600);
            }

            if (document.getElementById('PIcon').className != 'SerPlus') {
                document.getElementById('PIcon').className = 'SerPlus';
                $('#' + 'PCnt').slideUp(600);
            }
        }

        else {
            document.getElementById('WIcon').className = 'SerPlus';
            $('#' + 'WCnt').slideUp(600);
        }
    }
    if (activeTab == 2) {

        if (document.getElementById('IIcon').className == 'SerPlus') {
            document.getElementById('IIcon').className = 'SerMinus';
            $('#' + 'ICnt').slideDown(600);

            if (document.getElementById('WIcon').className != 'SerPlus') {
                document.getElementById('WIcon').className = 'SerPlus';
                $('#' + 'WCnt').slideUp(600);
            }

            if (document.getElementById('TIcon').className != 'SerPlus') {
                document.getElementById('TIcon').className = 'SerPlus';
                $('#' + 'TCnt').slideUp(600);
            }

            if (document.getElementById('PIcon').className != 'SerPlus') {
                document.getElementById('PIcon').className = 'SerPlus';
                $('#' + 'PCnt').slideUp(600);
            }
        }

        else {
            document.getElementById('IIcon').className = 'SerPlus';
            $('#' + 'ICnt').slideUp(600);
        }
    }
    if (activeTab == 3) {

        if (document.getElementById('TIcon').className == 'SerPlus') {
            document.getElementById('TIcon').className = 'SerMinus';
            $('#' + 'TCnt').slideDown(600);

            if (document.getElementById('WIcon').className != 'SerPlus') {
                document.getElementById('WIcon').className = 'SerPlus';
                $('#' + 'WCnt').slideUp(600);
            }
            if (document.getElementById('IIcon').className != 'SerPlus') {
                document.getElementById('IIcon').className = 'SerPlus';
                $('#' + 'ICnt').slideUp(600);
            }

            if (document.getElementById('PIcon').className != 'SerPlus') {
                document.getElementById('PIcon').className = 'SerPlus';
                $('#' + 'PCnt').slideUp(600);
            }
        }

        else {
            document.getElementById('TIcon').className = 'SerPlus';
            $('#' + 'TCnt').slideUp(600);
        }
    }
    if (activeTab == 4) {

        if (document.getElementById('PIcon').className == 'SerPlus') {
            document.getElementById('PIcon').className = 'SerMinus';
            $('#' + 'PCnt').slideDown(600);

            if (document.getElementById('WIcon').className != 'SerPlus') {
                document.getElementById('WIcon').className = 'SerPlus';
                $('#' + 'WCnt').slideUp(600);
            }

            if (document.getElementById('IIcon').className != 'SerPlus') {
                document.getElementById('IIcon').className = 'SerPlus';
                $('#' + 'ICnt').slideUp(600);
            }

            if (document.getElementById('TIcon').className != 'SerPlus') {
                document.getElementById('TIcon').className = 'SerPlus';
                $('#' + 'TCnt').slideUp(600);
            }
        }

        else {
            document.getElementById('PIcon').className = 'SerPlus';
            $('#' + 'PCnt').slideUp(600);
        }
    }

}

function showHideC2C(type) {
    var tab = type;
    if (tab == 'phone') document.getElementById('divC2C').style.display = '';
    if (tab == 'internet') document.getElementById('divC2C').style.display = '';
    if (tab == 'tv') document.getElementById('divC2C').style.display = '';
    if (tab == 'wireless') document.getElementById('divC2C').style.display = 'none';
}

function trackViolationLogin(strtarget,strViolationShown) {
    try {
        var imgData = Math.random() + "";
        var imgDataVal = imgData * 10000000000000;
        var img = new Image(0, 0);
        var envURL = 'https://' + location.hostname.split('.')[0] + '.verizon.com/';
        var imsrc1 = envURL + "vztracker/vzTracker.aspx?appName=ConsumerMyAccount&Type=2|Button&requestUrl=";
        if (window.top != null) {
            imsrc1 += escape(window.location.href) + "&referrer=" + document.referrer + "&Title=" + strtarget + "_" + strViolationShown + "&id=" + imgDataVal;
        }
        else
            imsrc1 += escape(window.location.href) + "&referrer=" + document.referrer + "&Title=" + strtarget + "_" + strViolationShown + "&id=" + imgDataVal;
        img.src = imsrc1;
    }
    catch (ex3) { }
}

function changeLinksFaq(activeTab) {
    document.getElementById('divFaqW').style.display = 'none';
    document.getElementById('divFaqI').style.display = 'none';
    document.getElementById('divFaqT').style.display = 'none';
    document.getElementById('divFaqH').style.display = 'none';
    document.getElementById('divFaqDTV').style.display = 'none';
    if (activeTab == "4") {
        document.getElementById('divFaqW').style.display = 'block';
    }
    if (activeTab == "1") {
        document.getElementById('divFaqI').style.display = 'block';
    }
    if (activeTab == "2") {
        document.getElementById('divFaqT').style.display = 'block';
    }
    if (activeTab == "3") {
        document.getElementById('divFaqH').style.display = 'block';
    }
    if (activeTab == "5") {
        document.getElementById('divFaqDTV').style.display = 'block';
    }

}
function changeLinks(activeTab) {

    document.getElementById('divW').style.display = 'none';
    document.getElementById('divI').style.display = 'none';
    document.getElementById('divT').style.display = 'none';
    document.getElementById('divH').style.display = 'none';
    document.getElementById('divDTV').style.display = 'none';
    if (activeTab == "4") {
        document.getElementById('divW').style.display = 'block';
    }
    if (activeTab == "1") {
        document.getElementById('divI').style.display = 'block';
    }
    if (activeTab == "2") {
        document.getElementById('divT').style.display = 'block';
    }
    if (activeTab == "3") {
        document.getElementById('divH').style.display = 'block';
    }
    if (activeTab == "5") {
        document.getElementById('divDTV').style.display = 'block';
    }

}
function CheckCSTabs() {
    var TId = 'STab'
    var TNo = 1
    var t = 1;
    var lt = TNo;
    var vtabCount = 0;

    if (document.getElementById(TId + '1') != null) {
        document.getElementById(TId + '1').className = 'GTabM';
        vtabCount = 1;
        changeCSTabs('STab1');
    }
    else if (document.getElementById(TId + '2') != null) {
        document.getElementById(TId + '2').className = 'GTabM';
        changeCSTabs('STab2');

    }

    else if (document.getElementById(TId + '3') != null) {

        document.getElementById(TId + '3').className = 'GTabM';
        changeCSTabs('STab3');
    }
    else if (document.getElementById(TId + '4') != null) {
        document.getElementById(TId + '4').className = 'GTabM';
        changeCSTabs('STab4');
    }
    else if (document.getElementById(TId + '5') != null) {
        document.getElementById(TId + '5').className = 'GTabM';
        changeCSTabs('STab5');
    }
    else {
        if (document.getElementById('csTAB') != null) {
            document.getElementById('csTAB').style.display = 'none';
        }
    }
}

function CheckASTabs() {
    var TId = 'ASTab'
    var TNo = 1
    var t = 1;
    var lt = TNo;
    var vtabCount = 0;
    var bShowDTV = "";
    if (document.getElementById("hdnDTVStatus") != null || document.getElementById("hdnDTVStatus") != undefined)
        bShowDTV = document.getElementById("hdnDTVStatus").value;
    if (document.getElementById(TId + '1') != null) {
        document.getElementById(TId + '1').className = 'GTabM';
        vtabCount = 1;
        changeASTabs('ASTab1');
    }
    else if (document.getElementById(TId + '2') != null) {
        document.getElementById(TId + '2').className = 'GTabM';
        changeASTabs('ASTab2');

    }

    else if (document.getElementById(TId + '3') != null) {

        document.getElementById(TId + '3').className = 'GTabM';
        changeASTabs('ASTab3');
    }
    else if (document.getElementById(TId + '4') != null) {
        document.getElementById(TId + '4').className = 'GTabM';
        changeASTabs('ASTab4');
    }
    else if (document.getElementById(TId + '5') != null) {
        document.getElementById(TId + '5').className = 'GTabM';
        changeASTabs('ASTab5');
    }
    else {
        if (document.getElementById('asTAB') != null) {
            document.getElementById('asTAB').style.display = 'none';
        }
    }

}

function changeCSTabs(CTId) {

    var TId = CTId.substring(0, 4);
    var TNo = CTId.charAt(4);
    var t = 1;
    var FTN = 0;
    var LTN = 0;
    var csdtv = "";
    if (document.getElementById("hdnCSDTV") != null || document.getElementById("hdnCSDTV") != undefined)
        csdtv = document.getElementById("hdnCSDTV").value;

    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        FTN = 1
        LTN = 1
        //document.getElementById('TabSep1').style.display = 'block';

    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 2
        if (LTN <= 1)
            LTN = 2

        //document.getElementById('TabSep2').style.display = 'block';

    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 3
        if (LTN <= 2)
            LTN = 3
        //document.getElementById('TabSep3').style.display = 'block';
    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 4
        if (LTN <= 3)
            LTN = 4
    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (csdtv == "Y") {
            if (FTN == 0)
                FTN = 5
            if (LTN <= 4)
                LTN = 5
        }
    }
    if (document.getElementById(CTId) != null)
        document.getElementById(CTId).className = 'WTabM';

    if (TNo == FTN)
        document.getElementById(TId + '_L').className = 'WTabL';
    else
        document.getElementById(TId + '_L').className = 'GTabL';
    if (TNo == LTN)
        document.getElementById(TId + '_R').className = 'WTabR';
    else
        document.getElementById(TId + '_R').className = 'GTabR';

    /*
    if(LTN == 3)
    document.getElementById('TabSep3').style.display = 'none';
    if(LTN == 2){
    document.getElementById('TabSep2').style.display = 'none';
    document.getElementById('TabSep3').style.display = 'none';
    }
    if(LTN == 1 || FTN == 4){
    document.getElementById('TabSep1').style.display = 'none';
    document.getElementById('TabSep2').style.display = 'none';
    document.getElementById('TabSep3').style.display = 'none';
    }
    if(FTN == 2)
    document.getElementById('TabSep1').style.display = 'none';
    if(FTN == 3){
    document.getElementById('TabSep1').style.display = 'none';
    document.getElementById('TabSep2').style.display = 'none';
    }
    */

    if (document.getElementById('divI') != null)
        document.getElementById('divI').style.display = 'none';
    if (document.getElementById('divT') != null)
        document.getElementById('divT').style.display = 'none';
    if (document.getElementById('divH') != null)
        document.getElementById('divH').style.display = 'none';
    if (document.getElementById('divW') != null)
        document.getElementById('divW').style.display = 'none';
    if (FTN == 1)
        document.getElementById('divI').style.display = 'block';
    if (FTN == 2)
        document.getElementById('divT').style.display = 'block';
    if (FTN == 3)
        document.getElementById('divH').style.display = 'block';
    if (FTN == 4)
        document.getElementById('divW').style.display = 'block';

    document.getElementById('divFaqI').style.display = 'none';
    document.getElementById('divFaqT').style.display = 'none';
    document.getElementById('divFaqH').style.display = 'none';
    document.getElementById('divFaqW').style.display = 'none';
    if (FTN == 1)
        document.getElementById('divFaqI').style.display = 'block';
    if (FTN == 2)
        document.getElementById('divFaqT').style.display = 'block';
    if (FTN == 3)
        document.getElementById('divFaqH').style.display = 'block';
    if (FTN == 4)
        document.getElementById('divFaqW').style.display = 'block';

    if (TNo == 1) {

        document.getElementById('csWireless').style.display = 'none'
        document.getElementById('csInternet').style.display = 'block'
        document.getElementById('csTV').style.display = 'none'
        document.getElementById('csPhone').style.display = 'none'
        document.getElementById('csDTV').style.display = 'none'
    }
    if (TNo == 2) {

        document.getElementById('csWireless').style.display = 'none'
        document.getElementById('csInternet').style.display = 'none'
        document.getElementById('csTV').style.display = 'block'
        document.getElementById('csPhone').style.display = 'none'
        document.getElementById('csDTV').style.display = 'none'
    }
    if (TNo == 3) {

        document.getElementById('csWireless').style.display = 'none'
        document.getElementById('csInternet').style.display = 'none'
        document.getElementById('csTV').style.display = 'none'
        document.getElementById('csPhone').style.display = 'block'
        document.getElementById('csDTV').style.display = 'none'
    }
    if (TNo == 4) {
        document.getElementById('csWireless').style.display = 'block'
        document.getElementById('csInternet').style.display = 'none'
        document.getElementById('csTV').style.display = 'none'
        document.getElementById('csPhone').style.display = 'none'
        document.getElementById('csDTV').style.display = 'none'

    }
    if (TNo == 5) {

        document.getElementById('csWireless').style.display = 'none'
        document.getElementById('csInternet').style.display = 'none'
        document.getElementById('csTV').style.display = 'none'
        document.getElementById('csPhone').style.display = 'none'
        document.getElementById('csDTV').style.display = 'block'
    }
}

function changeASTabs(CTId) {
    var TId = CTId.substring(0, 5);
    var TNo = CTId.charAt(5);
    var t = 1;
    var FTN = 0;
    var LTN = 0;
    var bShowDTV = "";
    if (document.getElementById("hdnDTVStatus") != null || document.getElementById("hdnDTVStatus") != undefined)
        bShowDTV = document.getElementById("hdnDTVStatus").value;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        FTN = 1
        LTN = 1
        // document.getElementById('AATabSep1').style.display = 'block';
    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 2
        if (LTN <= 1)
            LTN = 2
        // document.getElementById('AATabSep2').style.display = 'block';
    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 3
        if (LTN <= 2)
            LTN = 3
        //document.getElementById('AATabSep3').style.display = 'block';
    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 4
        if (LTN <= 3)
            LTN = 4
    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (bShowDTV == "Y") {
            if (FTN == 0)
                FTN = 5
            if (LTN <= 4)
                LTN = 5
        }
    }

    if (document.getElementById(CTId) != null)
        document.getElementById(CTId).className = 'WTabM';

    if (TNo == FTN)
        document.getElementById(TId + '_L').className = 'WTabL';
    else
        document.getElementById(TId + '_L').className = 'GTabL';
    if (TNo == LTN)
        document.getElementById(TId + '_R').className = 'WTabR';
    else
        document.getElementById(TId + '_R').className = 'GTabR';
    /*
    if (LTN == 3)
    document.getElementById('AATabSep3').style.display = 'none';
    if (LTN == 2) {
    document.getElementById('AATabSep2').style.display = 'none';
    document.getElementById('AATabSep3').style.display = 'none';
    }
    if (LTN == 1 || FTN == 4) {
    document.getElementById('AATabSep1').style.display = 'none';
    document.getElementById('AATabSep2').style.display = 'none';
    document.getElementById('AATabSep3').style.display = 'none';
    }
    if (FTN == 2)
    document.getElementById('AATabSep1').style.display = 'none';
    if (FTN == 3) {
    document.getElementById('AATabSep1').style.display = 'none';
    document.getElementById('AATabSep2').style.display = 'none';
    }
    */

    if (TNo == 1) {
        document.getElementById('asWireless').style.display = 'none'
        document.getElementById('asInternet').style.display = 'block'
        document.getElementById('asTV').style.display = 'none'
        document.getElementById('asPhone').style.display = 'none'
        document.getElementById('asDTV').style.display = 'none'

    }
    if (TNo == 2) {

        document.getElementById('asWireless').style.display = 'none'
        document.getElementById('asInternet').style.display = 'none'
        //        if(bShowDTV == "Y")
        //        document.getElementById('asDTV').style.display = 'block'
        //        else
        document.getElementById('asTV').style.display = 'block'
        document.getElementById('asPhone').style.display = 'none'

    }
    if (TNo == 3) {
        document.getElementById('asWireless').style.display = 'none'
        document.getElementById('asInternet').style.display = 'none'
        document.getElementById('asTV').style.display = 'none'
        document.getElementById('asPhone').style.display = 'block'
        document.getElementById('asDTV').style.display = 'none'

    }
    if (TNo == 4) {
        document.getElementById('asWireless').style.display = 'block'
        document.getElementById('asInternet').style.display = 'none'
        document.getElementById('asTV').style.display = 'none'
        document.getElementById('asPhone').style.display = 'none'
        document.getElementById('asDTV').style.display = 'none'

    }
    if (TNo == 5) {
        document.getElementById('asWireless').style.display = 'none'
        document.getElementById('asInternet').style.display = 'none'
        //        if(bShowDTV == "Y")
        //        document.getElementById('asDTV').style.display = 'block'
        //        else
        document.getElementById('asDTV').style.display = 'block'
        document.getElementById('asPhone').style.display = 'none'
        document.getElementById('asTV').style.display = 'none'


    }
}

function changeUsageTabs(CTId) {

    var TId = CTId.substring(0, 4);
    var TNo = CTId.charAt(4);
    var t = 1;
    var lt = 0;
    while (document.getElementById(TId + t)) {
        document.getElementById(TId + t).className = 'GTabM';
        //document.getElementById(TId + t).style.display = 'none';
        lt = t;
        t += 1;

    }
    document.getElementById(CTId).className = 'WTabM';
    if (TNo == 1)
        document.getElementById(TId + '_L').className = 'WTabL';
    else
        document.getElementById(TId + '_L').className = 'GTabL';
    if (TNo == lt)
        document.getElementById(TId + '_R').className = 'WTabR';
    else
        document.getElementById(TId + '_R').className = 'GTabR';

    if (TNo == 1) {
        document.getElementById('peakminSelected').style.display = 'block'
        document.getElementById('msgSelected').style.display = 'none'
        document.getElementById('dataSelected').style.display = 'none'

    }
    if (TNo == 2) {

        document.getElementById('peakminSelected').style.display = 'none'
        document.getElementById('msgSelected').style.display = 'block'
        document.getElementById('dataSelected').style.display = 'none'
    }
    if (TNo == 3) {
        document.getElementById('peakminSelected').style.display = 'none'
        document.getElementById('msgSelected').style.display = 'none'
        document.getElementById('dataSelected').style.display = 'block'
    }
}
function ShowFAQForum(divID) {

    if (divID == "FAQ") {
        document.getElementById('divHomeFAQ').style.display = 'block'
        document.getElementById('divHomeForums').style.display = 'none'
        document.getElementById('aFAQ').className = 'Gry';
        document.getElementById('aForum').className = ''
    }
    else {
        document.getElementById('divHomeFAQ').style.display = 'none'
        document.getElementById('divHomeForums').style.display = 'block'
        document.getElementById('aFAQ').className = '';
        document.getElementById('aForum').className = 'Gry'
    }
}

function AcctSubMenu(ActId) {
    var AcctDivs;
    var TabParent = '';
    try {
        if (document.getElementById(ActId)) {
            document.getElementById(ActId).style.display = 'block';
        }

        if (document.getElementById('AcctOverviewLnks') != null)
            document.getElementById('AcctOverviewLnks').style.display = 'none';

        if (document.getElementById('AcctPlansLnks') != null)
            document.getElementById('AcctPlansLnks').style.display = 'none';

        if (document.getElementById('AcctMyBillLnks') != null)
            document.getElementById('AcctMyBillLnks').style.display = 'none';

        if (document.getElementById('AcctPaymentLnks') != null)
            document.getElementById('AcctPaymentLnks').style.display = 'none';

        if (document.getElementById('AcctProfilesLnks') != null)
            document.getElementById('AcctProfilesLnks').style.display = 'none';

        if (document.getElementById(ActId + 'Lnks'))
            document.getElementById(ActId + 'Lnks').style.display = 'block';

    } catch (e) { }
}
function AcctNavig(ActId, type) {
    var AcctDivs;
    var TabParent = '';
    //    if (document.getElementById('Account'))
    //        TabParent = 'Account';
    //    else if (document.getElementById('Support'))
    //        TabParent = 'Support';
    if (TabParent != '') {
        if (document.all) AcctDivs = document.getElementById(TabParent).childNodes;
        else AcctDivs = document.getElementById(TabParent).childNodes;
        for (var i = 0; AcctDivs[i]; i++) {
            if (AcctDivs[i].id != null) {
                var AcctDivId = AcctDivs[i].id
                AcctDivs[i].style.display = 'none';
                if (document.getElementById(AcctDivId + 'Lnks')) document.getElementById(AcctDivId + 'Lnks').style.display = 'none';
            }
        }
    }
    if (document.getElementById(ActId)) document.getElementById(ActId).style.display = 'block';
    if (document.getElementById(ActId + 'Lnks')) document.getElementById(ActId + 'Lnks').style.display = 'block';

    if (ActId == "AcctOverview")
        location.href = "/ForYourHome/MyAccount/Protected/Account/MyAccountoverView.aspx";

    if (ActId == "AcctProfiles")
        location.href = "/ForYourHome/MyAccount/Protected/Account/MyAccountProfile.aspx";



    if (ActId == "AcctMyBill")
        location.href = "https://" + location.hostname + "/ForYourHome/BillView/MyBill.aspx";

    if (ActId == "AcctPayment")
        location.href = "https://" + location.hostname + "/ForYourHome/ebillpay/code/MyVerizon2/Code/PaymentOptions.aspx";

    if (ActId == "AcctPerks")
        location.href = sPerksNavigURL;
}

function AcctIVNavig(ActId) {
    var AcctDivs;
    var TabParent = '';
    if (document.getElementById('Account'))
        TabParent = 'Account';
    else if (document.getElementById('Support'))
        TabParent = 'Support';
    if (TabParent != '') {
        if (document.all) AcctDivs = document.getElementById(TabParent).childNodes;
        else AcctDivs = document.getElementById(TabParent).childNodes;
        for (var i = 0; AcctDivs[i]; i++) {
            if (AcctDivs[i].id != null) {
                var AcctDivId = AcctDivs[i].id
                AcctDivs[i].style.display = 'none';
                if (document.getElementById(AcctDivId + 'Lnks')) document.getElementById(AcctDivId + 'Lnks').style.display = 'none';
            }
        }
    }
    if (document.getElementById(ActId)) document.getElementById(ActId).style.display = 'block';
    if (document.getElementById(ActId + 'Lnks')) document.getElementById(ActId + 'Lnks').style.display = 'block';

    if (ActId == "AcctIVOverview")
        location.href = "/ForYourHome/MyAccount/Protected/Account/MyAccountoverView.aspx";

    if (ActId == "AcctIVProfiles")
        location.href = "/ForYourHome/MyAccount/Protected/Account/MyAccountProfile.aspx";

    if (ActId == "AcctIVPerks")
        location.href = sPerksNavigURL;
}

function AutoAcctSecLnks(LnkDivId, LnkNo) {
    var LinkList = document.getElementById(LnkDivId + 'Lnks').getElementsByTagName('a');
    for (var i = 0; LinkList[i]; i++) {
        if (document.getElementById(LnkDivId + 'Cnt' + (i + 1)))
            document.getElementById(LnkDivId + 'Cnt' + (i + 1)).style.display = 'none';
        LinkList[i].className = '';
    }
     if((document.getElementById(LnkDivId + 'Cnt' + LnkNo) != null) || (document.getElementById(LnkDivId + 'Cnt' + LnkNo)!=undefined))
    document.getElementById(LnkDivId + 'Cnt' + LnkNo).style.display='block';
    if (LinkList[LnkNo - 1] != null)
        LinkList[LnkNo - 1].className = 'AcBlkLnk';
}

function AcctSecLnks(LnkDivId, LnkNo) {
    try {
        var LinkList = document.getElementById(LnkDivId + 'Lnks').getElementsByTagName('a');
        for (var i = 0; LinkList[i]; i++) {
            if (document.getElementById(LnkDivId + 'Cnt' + (i + 1)))
                document.getElementById(LnkDivId + 'Cnt' + (i + 1)).style.display = 'none';
            LinkList[i].className = '';
        }
        document.getElementById(LnkDivId + 'Cnt' + LnkNo).style.display = 'block';
        LinkList[LnkNo - 1].className = 'AcBlkLnk';
    }
    catch (e) { }
}

//function ACRename(HdrId, LnkObj) {
//    if (LnkObj.innerHTML == 'Rename') {
//        HdrVal = document.getElementById(HdrId + 'Hdr').innerHTML.toUpperCase();
//        HdrVal1 = HdrVal;
//        document.getElementById(HdrId + 'Hdr').innerHTML = '<input type="text" style="margin-top:15px; width:225px" id="' + HdrId + 'HdrTxt" value="' + HdrVal1 + '" />';
//        document.getElementById(HdrId + 'HdrSpan').innerHTML = '<a href="#" title="Save" onclick="ACRename(\'' + HdrId + '\',this)">Save</a> | <a title="Cancel" href="#" onclick="ACRename(\'' + HdrId + '\',this)">Cancel</a>';
//    }
//    else if (LnkObj.innerHTML == 'Cancel') {
//        document.getElementById(HdrId + 'Hdr').innerHTML = HdrVal;
//        document.getElementById(HdrId + 'HdrSpan').innerHTML = '<a href="#" title="Rename" onclick="ACRename(\'' + HdrId + '\',this)">Rename</a>';
//    }
//    else if (LnkObj.innerHTML == 'Save') {
//        document.getElementById(HdrId + 'Hdr').innerHTML = document.getElementById(HdrId + 'HdrTxt').value;
//        document.getElementById(HdrId + 'HdrSpan').innerHTML = '<a href="#" title="Rename" onclick="ACRename(\'' + HdrId + '\',this)">Rename</a>';
//    }
//}
var HdrVal;
function ACRename(HdrId, LnkObj) {

    var strBTN = '';
    if (LnkObj.innerHTML == 'Rename') {
        strBTN = LnkObj.id;
        strBTN = strBTN.replace("aRename", "");
        var aSave = 'aSave' + strBTN;
        var aCancel = 'aCancel' + strBTN;

        HdrVal = document.getElementById(HdrId + 'Hdr' + strBTN).innerHTML.toUpperCase();
        HdrVal1 = HdrVal;
        document.getElementById(HdrId + 'Hdr' + strBTN).innerHTML = '<input maxlength ="30" type="text" style="margin-top:15px; width:225px" id="' + HdrId + 'HdrTxt" value="' + HdrVal1 + '" />';
        document.getElementById(HdrId + 'Hdr' + strBTN + 'Span').innerHTML = '<a id="' + aSave + '" href="#" title="Save" onclick="ACRename(\'' + HdrId + '\',this)">Save</a> | <a id="' + aCancel + '" title="Cancel" href="#" onclick="ACRename(\'' + HdrId + '\',this)">Cancel</a>';
    }
    else if (LnkObj.innerHTML == 'Cancel') {
        strBTN = LnkObj.id;
        strBTN = strBTN.replace("aCancel", "");
        var aRename = 'aRename' + strBTN;

        document.getElementById(HdrId + 'Hdr' + strBTN).innerHTML = HdrVal;
        document.getElementById(HdrId + 'Hdr' + strBTN + 'Span').innerHTML = '<a id="' + aRename + '" href="#" title="Rename" onclick="ACRename(\'' + HdrId + '\',this)">Rename</a>';
    }
    else if (LnkObj.innerHTML == 'Save') {
        strBTN = LnkObj.id;
        strBTN = strBTN.replace("aSave", "");
        var aRename = 'aRename' + strBTN;
        document.getElementById(HdrId + 'Hdr' + strBTN).innerHTML = document.getElementById(HdrId + 'HdrTxt').value;
        document.getElementById(HdrId + 'Hdr' + strBTN + 'Span').innerHTML = '<a id="' + aRename + '" href="#" title="Rename" onclick="ACRename(\'' + HdrId + '\',this)">Rename</a>';
    }
}
///VZ 2.0 Customize Function
// JavaScript Document

// CSS Browser detection 
browser_version = parseInt(navigator.appVersion);
browser_type = navigator.appName;

function PageHeight() {
    try {
        var objPH = document.getElementById('PageContent');
        if (browser_type == "Netscape" && (browser_version >= 4)) {
            if (objPH != null && objPH != 'undefined')
                objPH.style.height = document.body.clientHeight - 300;
        }
        else {
            if (objPH != null && objPH != 'undefined')
                objPH.style.height = document.body.clientHeight - 300;
        }
    } catch (e) {}
}

function Navigate(NId) {
    var i = 1;
    while (document.getElementById('NC' + i)) {
        document.getElementById('NC' + i).className = 'CirN';
        document.getElementById('NC' + i + '_C').style.display = 'none';
        i += 1;
    }
    document.getElementById(NId).className = 'CirH';
    if (document.all)
        document.getElementById(NId).nextSibling.className = 'Fl Title4';
    else
        document.getElementById(NId).nextElementSibling.className = 'Fl Title4';
    document.getElementById(NId + '_C').style.display = 'block';
}

function changeTabs(CTId) {
    var TId = CTId.substring(0, 4);
    var TNo = CTId.charAt(4);
    var t = 1;
    var lt = 0;
    while (document.getElementById(TId + t)) {
        document.getElementById(TId + t).className = 'GTabM';
        lt = t;
        t += 1;
    }
    document.getElementById(CTId).className = 'WTabM';
    if (TNo == 1)
        document.getElementById(TId + '_L').className = 'WTabL';
    else
        document.getElementById(TId + '_L').className = 'GTabL';
    if (TNo == lt)
        document.getElementById(TId + '_R').className = 'WTabR';
    else
        document.getElementById(TId + '_R').className = 'GTabR';
}


function changeSchN(SchId) {
    var SchN = SchId.substr(0, 2);
    document.getElementById(SchN + '1').className = 'TxtSz12';
    document.getElementById(SchN + '2').className = 'TxtSz12';
    document.getElementById(SchId).className = 'BkLnk';
}

/* Function to show/hide drop downs */
function hideDD() {
    var pgdrop1 = document.getElementsByTagName("select");
    for (i = 0; i < pgdrop1.length; i++)
        pgdrop1[i].style.visibility = 'hidden';
}

function showDD() {
    var pgdrop2 = document.getElementsByTagName("select");
    for (i = 0; i < pgdrop2.length; i++)
        pgdrop2[i].style.visibility = 'visible';
}
/* Function to show/hide drop downs */


var SWCrnR = '';
function changeSWCrnRMOver(SWCrnRId) {
    if (document.getElementById(SWCrnRId).className != SWCrnRId + '_On')
        document.getElementById(SWCrnRId).className = SWCrnRId + '_MO';
}
function changeSWCrnRMOut(SWCrnRId) {
    if (document.getElementById(SWCrnRId).className != SWCrnRId + '_On')
        document.getElementById(SWCrnRId).className = SWCrnRId;
}

function changeSWCrnR(SWCrnRId, e) {
    if (document.getElementById(SWCrnRId).className != SWCrnRId + '_On') {
        var s = 1;
        while (document.getElementById('SWCrnR' + s)) {
            document.getElementById('SWCrnR' + s).className = 'SWCrnR' + s;
            s += 1;
        }
        if (SWCrnRId == 'SWCrnR2') {
            //alert('d');
            //$('#SWCrnRPR').BlindDown(600);
            document.getElementById('SWCrnRPR').style.display = 'block';
        }
        else if (SWCrnRId == 'SWCrnR1') {
            if (document.getElementById('SWCrnRPR').style.display == 'block') {
                //$('#SWCrnRPR').BlindUp(600);
                document.getElementById('SWCrnRPR').style.display = 'none';
                showDD();
            }
            openPopup('Customize your Tabs', document.all ? 762 : 768, 'customize_tabs', e);
        }
        document.getElementById(SWCrnRId).className = SWCrnRId + '_On';
    }
    else {
        document.getElementById(SWCrnRId).className = SWCrnRId;
        if (SWCrnRId == 'SWCrnR2') {
            //$('#SWCrnRPR').BlindUp(600);
            document.getElementById('SWCrnRPR').style.display = 'none';
            showDD();
        }
    }
}
/*Modified on 2nd November*/
function changeSW1(obj, SWId) {
    changeSWMOut(obj, 2);
    var html = document.getElementById('SW15').innerHTML;
    var html1 = document.getElementById(SWId).innerHTML;
    document.getElementById(SWId).innerHTML = html;
    document.getElementById('SW15').innerHTML = html1;
}
function changeSW(SWId) {
    if (SWId == undefined || SWId == null)
    { SWId = 'SW1'; }
    var s = 1;
    var cls = SWId.substring(0, 2);
    while (document.getElementById(cls + s)) {
        var obj = document.getElementById(cls + s);
        obj = obj.firstChild;

        while (obj.nodeType != 1) {
            obj = obj.nextSibling;
        }
        obj.className = 'service_default';
        toggleSWBorders(document.getElementById(cls + s), 1, 1);
        if (document.getElementById(cls + s + '_C'))
            document.getElementById(cls + s + '_C').style.display = '';
        s += 1;
    }
    var obj = document.getElementById(SWId);
    obj = obj.firstChild;
    while (obj.nodeType != 1) {
        obj = obj.nextSibling;
    }
    obj.className = 'service_ON';
    toggleSWBorders(document.getElementById(SWId), 1, 0);
    //document.getElementById(SWId).className = 'service_ON'; 
    if (document.getElementById(SWId + '_C'))
        document.getElementById(SWId + '_C').style.display = 'block';


}
/*Modified on 2nd November Ends*/

function checkSW(SWId) {
    var s = 1; var varSW = '';
    while (document.getElementById('SW' + s)) {
        if (('SW' + s) == SWId)
            varSW = 'SW'
        s += 1;
    }
    if (varSW != '')
        return varSW;
    else
        return 'SW1';
}

function changeSER(CObj) {
    var ParID = CObj.parentNode.id;
    var sr = 0;
    var SWContN;
    var SERObj = document.getElementById(ParID).getElementsByTagName('div');
    while (SERObj[sr]) {
        SERObj[sr].className = 'SWDivTabs';
        if (CObj == SERObj[sr])
            SWContN = sr + 1;
        sr += 1;
    }
    CObj.className = 'SWDivTabs_HL';
    if (document.getElementById(ParID + 'C' + SWContN)) {
        for (var i = 1; i <= sr; i++)
            if (document.getElementById(ParID + 'C' + i))
            document.getElementById(ParID + 'C' + i).style.display = 'none';
        document.getElementById(ParID + 'C' + SWContN).style.display = 'block';
    }

}
/*Modified on 2nd November*/
function changeSWMOver(obj, opt) {
    var temp = obj;
    obj = obj.firstChild;
    while (obj.nodeType != 1) {
        obj = obj.nextSibling;
    }
    if (obj.className != 'service_ON') {
        obj.className = 'service_Hover';
        toggleSWBorders(temp, opt, 0);
    }
}

function changeSWMOut(obj, opt) {
    var temp = obj;
    obj = obj.firstChild;
    while (obj.nodeType != 1) {
        obj = obj.nextSibling;
    }
    if (obj.className != 'service_ON') {
        obj.className = 'service_default';
        toggleSWBorders(temp, opt, 1);
    }
}
/*Modified on 2nd November Ends*/

function changeSER_MOver(TabObj) {
    if (TabObj.className != 'SWDivTabs_HL')
        TabObj.className = 'SWDivTabs_MO';
}

function changeSER_MOut(TabObj) {
    if (TabObj.className != 'SWDivTabs_HL')
        TabObj.className = 'SWDivTabs';
}

function changeRGD_MOver(RGDObj, RGDId) {
    if (document.getElementById(RGDId).className != 'CirH')
        RGDObj.className = 'Fl Title9';
}

function changeRGD_MOut(RGDObj, RGDId) {
    RGDObj.className = 'Fl Title4';
}
// Acounts Tab
function AcTabs(CTId) {

    if (document.getElementById('AcTab_L'))
        document.getElementById('AcTab_L').className = 'AcGTabL';
    if (document.getElementById('AcTab_R'))
        document.getElementById('AcTab_R').className = 'AcGTabR';
    var TId = CTId.substring(0, 5);
    var TNo = CTId.charAt(5);
    var t = 1;
    var lt = 0;
    while (document.getElementById(TId + t)) {
        document.getElementById(TId + t).className = 'AcGTabM';
        if (document.getElementById(TId + 'Sep' + t))
        { document.getElementById(TId + 'Sep' + t).className = 'AcTabSep'; }
        lt = t;
        t += 1;
    }
    document.getElementById(CTId).className = 'AcRTabM';
    if (TNo == 1) {
        document.getElementById(TId + '_L').className = 'AcRTabL';
        document.getElementById(TId + 'Sep' + TNo).className = 'AcTabSepR';
    }
    else if (TNo == lt) {
        document.getElementById(TId + '_R').className = 'AcRTabR';
        document.getElementById(TId + 'Sep' + (TNo - 1)).className = 'AcTabSepR';
    }
    else {
        document.getElementById(TId + '_L').className = 'AcGTabL';
        document.getElementById(TId + '_R').className = 'AcGTabR';
        if (document.getElementById(TId + 'Sep' + (TNo - 1)))
            document.getElementById(TId + 'Sep' + (TNo - 1)).className = 'AcTabSepR';
        document.getElementById(TId + 'Sep' + TNo).className = 'AcTabSepR';
    }
}

function AcIVTabs(CTId) {
    var TId = CTId.substring(0, 7);
    var TNo = CTId.charAt(7);
    var t = 1;
    var lt = 0;
    while (document.getElementById(TId + t)) {
        document.getElementById(TId + t).className = 'AcGTabM';
        if (document.getElementById(TId + 'Sep' + t))
        { document.getElementById(TId + 'Sep' + t).className = 'AcTabSep'; }
        lt = t;
        t += 1;
    }
    document.getElementById(CTId).className = 'AcRTabM';
    if (TNo == 1) {
        document.getElementById(TId + '_L').className = 'AcRTabL';
        document.getElementById(TId + 'Sep' + TNo).className = 'AcTabSepR';
    }
    else if (TNo == lt) {
        document.getElementById(TId + '_R').className = 'AcRTabR';
        document.getElementById(TId + 'Sep' + (TNo - 1)).className = 'AcTabSepR';
    }
    else {
        document.getElementById(TId + '_L').className = 'AcGTabL';
        document.getElementById(TId + '_R').className = 'AcGTabR';
        if (document.getElementById(TId + 'Sep' + (TNo - 1)))
            document.getElementById(TId + 'Sep' + (TNo - 1)).className = 'AcTabSepR';
        document.getElementById(TId + 'Sep' + TNo).className = 'AcTabSepR';
    }
}
function DispObj(DispId) {
    document.getElementById(DispId).style.display = 'block';
    document.getElementById(DispId + 'AnGif').className = 'ACContBg Ht5 TxtSz1';
    document.getElementById(DispId + 'AnGif').innerHTML = '';
}



function SHDetails(SHId) {
    if (document.getElementById(SHId + 'Icon').className == 'Icon7') {
        document.getElementById(SHId + 'Icon').className = 'Icon8';
        //$('#'+SHId+'Cnt').BlindUp(600);
        document.getElementById(SHId + 'Cnt').style.display = 'none';
    }
    else {
        document.getElementById(SHId + 'Icon').className = 'Icon7';
        //$('#'+SHId+'Cnt').BlindDown(600);
        document.getElementById(SHId + 'Cnt').style.display = 'block';
    }
}

function SDetails(SHId) {
    if (document.getElementById(SHId + 'Icon').className == 'SerMinus') {
        document.getElementById(SHId + 'Icon').className = 'SerPlus';
        //$('#'+SHId+'Cnt').BlindUp(600);
        document.getElementById(SHId + 'Cnt').style.display = 'none';
    }
    else {
        document.getElementById(SHId + 'Icon').className = 'SerMinus';
        //$('#'+SHId+'Cnt').BlindDown(600);
        document.getElementById(SHId + 'Cnt').style.display = 'block';
    }
}

function getParamValue(name) {
    var q = window.location.search.substring(1);
    var aq = q.split('&');
    for (t = 0; t < aq.length; t++) {
        iq = aq[t].split('=');
        if (name == iq[0])
            return iq[1];
    }
}

/* script for Message Tab in Messages */
function MsgTab(MTId) {
    var MTTable = document.getElementById(MTId);
    var MTAnchor = MTTable.getElementsByTagName('a');
    for (var i = 0; MTAnchor[i]; i++)
        MTAnchor[i].className = 'MsgInAct';
    var MTActAnchor;
    if (document.all)
        MTActAnchor = event.srcElement.parentElement;
    else
        MTActAnchor = document.activeElement;
    MTActAnchor.className = 'MsgAct';
}

function TabCntDisp(TabId, TabNo) {
    for (var i = 1; document.getElementById(TabId + i); i++)
        document.getElementById(TabId + i).style.display = 'none';
    document.getElementById(TabId + TabNo).style.display = 'block';
}

/*Scripts added on 21st October*/
function changeSecNavTabs(id) {
    changeTabs(id);
    var TId = id.substr(0, 4);
    var t = 1;
    while (document.getElementById(TId + 'C_' + t)) {
        document.getElementById(TId + 'C_' + t).style.display = 'none';
        if (document.getElementById(TId + 'C_' + t + '_head'))
            document.getElementById(TId + 'C_' + t + '_head').style.display = 'none';
        t += 1;
    }
    var ref = id.substr(4);
    document.getElementById(TId + 'C_' + ref).style.display = 'block';
    if (document.getElementById(TId + 'C_' + ref + '_head'))
        document.getElementById(TId + 'C_' + ref + '_head').style.display = 'block';
}
/*Scripts added on 23rd October*/
var popInnerCont, popContentId, aSelect;
function hideSelectBox() {
    var ob = document.getElementsByTagName('select');
    aSelect = [];
    for (var t = 0; t < ob.length; t++) {
        aSelect.push(ob[t]);
        ob[t].style.visibility = 'hidden';
    }

    var objMyVzPr_optPRDay1 = document.getElementById("MyVzPr_optPRDay1");
    var objMyVzPr_optPRDay2 = document.getElementById("MyVzPr_optPRDay2");

    if (objMyVzPr_optPRDay1 != null && objMyVzPr_optPRDay2 != null) {
        document.getElementById('MyVzPr_optPRDay1').style.visibility = 'visible';
        document.getElementById('MyVzPr_optPRDay2').style.visibility = 'visible';
    }
    if (document.getElementById("PersonalInfo1_DDSQues") != null)
        document.getElementById('PersonalInfo1_DDSQues').style.visibility = 'visible';

    if (document.getElementById("optPRDay1") != null && document.getElementById("optPRDay2") != null) {
        document.getElementById('optPRDay1').style.visibility = 'visible';
        document.getElementById('optPRDay2').style.visibility = 'visible';
    }
    /*if (document.getElementById("Notifications1_chkPREmail") != null)
        document.getElementById('Notifications1_chkPREmail').style.visibility = 'visible';
    if (document.getElementById("Notifications1_chkPRText") != null)
        document.getElementById('Notifications1_chkPRText').style.visibility = 'visible';*/
    if (document.getElementById('drpSubAccAdmin') != null)
        document.getElementById('drpSubAccAdmin').style.visibility = 'visible';
    if (document.getElementById('SubAccount1_drpCSSecretQ') != null)
        document.getElementById('SubAccount1_drpCSSecretQ').style.visibility = 'visible';

}
function revealSelectBox() {
    try
    {
        for (var t = 0; t < aSelect.length; t++) {
            aSelect[t].style.visibility = 'visible';
        }
        aSelect = null;
    }
    catch(e){}
}
function openPopup(T, W, poptype, e) {
    if (arguments.length == 0) {
        alert('Invalid arguments. onclick="openPopup(Title, Width, Popup Type)"');
        return;
    }
    hideSelectBox();
    popContentId = poptype;
    popContent = '&nbsp;';

    if (poptype == 'customize_home_page') {
        var sid = sid = randomString();
        //document.getElementById('iframeCustomize').src = '/ForYourHome/MyAccount/Protected/Overview/MyVzCustomize.aspx?sid=' + randomString();

        if (document.getElementById('iframeCustomize') == null) {
            document.getElementById('customize_home_page').innerHTML = '';
            var iframes = document.createElement('iframe');
            iframes.id = 'iframeCustomize';
            iframes.frameBorder = "no";
            iframes.height = "605px";
            iframes.width = "830px";
            iframes.src = '/ForYourHome/MyAccount/Protected/Overview/MyVzCustomize.aspx?sid=' + randomString();
            document.getElementById('customize_home_page').appendChild(iframes);

        }

    }


    if (poptype == 'customize_tabs') {
        if (true) {
            var innerHTML = BuildCutomizeInnerHTML(Tabs);
            popContent = popInnerCont = innerHTML; // 'Hi';//document.getElementById(poptype).innerHTML;
        }
        if (false) {
            popContent = popInnerCont = document.getElementById(poptype).innerHTML;
        }
    }
    else
        popContent = popInnerCont = document.getElementById(poptype).innerHTML;
    document.getElementById(poptype).innerHTML = '';

    var poptitle = T;
    var popwidth = W;
    var obj = document.createElement('div');
    obj.id = 'popouter';
    obj.style.zIndex = "1001";
    obj.style.width = document.body.clientWidth + 'px';
    obj.style.height = document.body.scrollHeight + 'px';
    document.body.appendChild(obj);

    obj = document.createElement('div');
    obj.id = 'popupbox';
    obj.style.zIndex = "1002";
    obj.style.width = popwidth + 'px';
    obj.style.left = (document.body.clientWidth - popwidth) / 2 + 'px';
    document.body.appendChild(obj);
    var popcnt = '<table width="100%" cellpadding="0" cellspacing="0" border="0">'
			   + '<tr>'
			   + '<td class="popup_top_ltcurve" width="5" nowrap></td>'
			   + '<td class="popup_topH_bg" width="100%">'
			   + '<div class="Fl popup_title" title="' + poptitle + '">' + poptitle + '</div>'
			   + '  <div class="Fr PadT4">'
			   + '<a  class="Fl" href="javascript:closePopup();" title="Close"><u>Close</u></a>'
			   + '<a href="javascript:closePopup();" class="popup_ico_close MarR5" title="Close"></a>'
			   + ' </div>'
			   + '</td>'
			   + '<td id="popup_top_rtcurve" class="popup_top_rtcurve" width="5" nowrap></td>'
			   + '</tr>'
			   + '<tr>'
			   + '<td colspan="4" class="popup_cont_bg" valign="top">' + popContent + '</td>'
			   + '</tr>'
			   + '<tr>'
			   + '<td colspan="4">'
			   + '<b class="VZ_PopupCnr1"><b class="VZ_PopupCnr1B4"></b>' +
			   +'<b class="VZ_PopupCnr1B3"></b><b class="VZ_PopupCnr1B2"></b><b class="VZ_PopupCnr1B1"></b></b>' +
			   +'</td>'
			   + '</tr>'
			   + '</table>';
    if (poptype != 'AtchViewer' && poptype != "FDVLayout")
        document.getElementById('popupbox').innerHTML = popcnt;
    else
        document.getElementById('popupbox').innerHTML = popContent;
    var offHeight = document.getElementById('popupbox').offsetHeight;
    var scrTop = (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop) || 0;
    document.getElementById('popupbox').style.top = scrTop + 100 + 'px';

    if (poptype == 'customize_tabs' || poptype == 'customize_news_bar') {
        addEvent('mousemove', moveHotPoint);
        addEvent('mouseup', cancelAllEvents);
    }

}

function closePopup() {
    var obj = document.getElementById('popupbox');
    document.body.removeChild(obj);
    var obj = document.getElementById('popouter');
    document.body.removeChild(obj);
    if (document.getElementById(popContentId))
        document.getElementById(popContentId).innerHTML = popInnerCont;
    revealSelectBox();
    if (document.getElementById('SWCrnR1'))
        document.getElementById('SWCrnR1').className = 'SWCrnR1';

    if (IsCalledUnderNotify) { ResetCheckBoxesToOldPostion(); }
    if (IsCalledUnderOptOut) { ResetChkBoxOptOut(); }

    NewSPRCheck();
}

function ProvidePermission() {
    var obj = document.getElementById('popupbox');
    document.body.removeChild(obj);
    var obj = document.getElementById('popouter');
    document.body.removeChild(obj);
    if (document.getElementById(popContentId))
        document.getElementById(popContentId).innerHTML = popInnerCont;
    revealSelectBox();
    if (document.getElementById('SWCrnR1'))
        document.getElementById('SWCrnR1').className = 'SWCrnR1';

    IsCalledUnderNotify = false;

    NewSPRCheck();
}

/*Script added on 27th October*/
function getChild(obj, nodeName) {
    var childNodes = obj.childNodes;
    if (childNodes.length > 0) {
        for (var i = 0; i < childNodes.length; i++) {
            if (childNodes[i].nodeType == 3) continue;

            if (childNodes[i].nodeName.toUpperCase() == nodeName.toUpperCase()) {
                return childNodes[i];
            }
        }
    } else {
        alert('invalid');
    }
}
function toggleShowHide(e, obj) {
    var captionDiv = getChild(obj, 'div');
    if (obj.className.match(/popup_drag_hide_icon/)) {
        obj.className = 'CurP popup_drag_show_icon PR';
        obj.title = 'Show';
        captionDiv.innerHTML = 'SHOW';
    } else {
        obj.className = 'CurP popup_drag_hide_icon PR';
        obj.title = 'Hide';
        captionDiv.innerHTML = 'HIDE';
    }
}
/*Styles added on 29th October*/
function customizeNews(e) {
    openPopup('Customize Your News Bar', document.all ? 653 : 653, 'customize_news_bar', e);
}

/*Scripts Added on 2nd November*/
function toggleSWBorders(obj, mode, status) {
    var temp = obj;
    var refClass = mode == 1 ? 'SWSep' : 'SW1Sep';
    do {
        temp = temp.nextSibling;
    } while (temp != null && temp.nodeType != 1)

    if (temp != null && status && temp.className == '') {
        temp.className = refClass;
    } else if (temp != null && !status && temp.className == refClass) {
        temp.className = '';
    }

    do {
        obj = obj.previousSibling;
    } while (obj != null && obj.nodeType != 1)

    if (obj != null && status && obj.className == '') {
        obj.className = refClass;
    } else if (obj != null && !status && obj.className == refClass) {
        obj.className = '';
    }
}
/*Scripts Added on 2nd November Ends*/

function UrlConvertOnly() {
    if (strAM_AddressToCheckURL1 == null || strAM_AddressToCheckURL1 == '') {
        strAM_AddressToCheckURL1 = '/FORYOURHOME/BILLVIEW/;/FORYOURHOME/EBILLPAY/;/FORYOURHOME/ONEBILL/;/FORYOURHOME/MYVERIZON/CHANGEBILLINGADDRESS/';
    }
    if (trim(strAM_AddressToCheckURL1) != '' && strAM_AddressToCheckURL1.length > 10)
        strAllAddressesToCheck = strAM_AddressToCheckURL1;

    var smwords = strAllAddressesToCheck.split(';');
    var aTags = document.getElementsByTagName && document.getElementsByTagName('A');
    if (location.href.indexOf('http:') >= 0) {
        for (var i = 0; i < aTags.length; i++) {
            var v = aTags[i].href;
            for (var j = 0; j < smwords.length; j++) {
                if (v.toUpperCase().indexOf(smwords[j].toUpperCase()) > -1) {
                    if (aTags[i].href.toUpperCase().indexOf('HTTPS') < 0) {
                        //alert(aTags[i].href);
                        if (aTags[i].href.toUpperCase().indexOf('HTTP') > -1) {
                            aTags[i].href = aTags[i].href.replace('http', 'https');
                        }
                        else {
                            var str = aTags[i].href;
                            if (aTags[i].href.toUpperCase().indexOf("/FORYOURHOME/") > 0) {
                                var pos = str.toUpperCase().indexOf('/FORYOURHOME/')
                                if (pos > 0) {
                                    str = str.substring(0, pos) + "https://" + document.domain + str.substring(pos);
                                    aTags[i].href = str;
                                }
                            } else {
                                aTags[i].href = 'https://' + document.domain + aTags[i].href;
                            }
                        }
                    }
                }
            }
        }
    }

}

function UrlConvert() {
    try {
        if (strAM_AddressToCheckURL1 == null || strAM_AddressToCheckURL1 == '') {
            strAM_AddressToCheckURL1 = '/FORYOURHOME/BILLVIEW/;/FORYOURHOME/EBILLPAY/;/FORYOURHOME/ONEBILL/;/FORYOURHOME/MYVERIZON/CHANGEBILLINGADDRESS/';
        }
        if (trim(strAM_AddressToCheckURL1) != '' && strAM_AddressToCheckURL1.length > 10)
            strAllAddressesToCheck = strAM_AddressToCheckURL1;

        var smwords = strAllAddressesToCheck.split(';');
        var aTags = document.getElementsByTagName && document.getElementsByTagName('A');
        if (location.href.indexOf('http:') >= 0) {
            for (var i = 0; i < aTags.length; i++) {
                var v = aTags[i].href;
                for (var j = 0; j < smwords.length; j++) {
                    if (v.toUpperCase().indexOf(smwords[j].toUpperCase()) > -1) {
                        if (aTags[i].href.toUpperCase().indexOf('HTTPS') < 0) {
                            //alert(aTags[i].href);
                            if (aTags[i].href.toUpperCase().indexOf('HTTP') > -1) {
                                aTags[i].href = aTags[i].href.replace('http', 'https');
                            }
                            else {
                                var str = aTags[i].href;
                                if (aTags[i].href.toUpperCase().indexOf("/FORYOURHOME/") > 0) {
                                    var pos = str.toUpperCase().indexOf('/FORYOURHOME/')
                                    if (pos > 0) {
                                        str = str.substring(0, pos) + "https://" + document.domain + str.substring(pos);
                                        aTags[i].href = str;
                                    }
                                } else {
                                    aTags[i].href = 'https://' + document.domain + aTags[i].href;
                                }
                            }
                        }
                    }
                }
            }
        }
        urlconvert_sub();
    }
    catch (e) { }
}

function urlconvert_sub() {
    try {
        var strVerrizonNet = "www.verizon.net/central@my.verizon.com/central;www.verizon.net/ssowebapp@signin.verizon.com/sso;";
        var urlspltChange = strVerrizonNet.split(';');
        var aTags = document.getElementsByTagName && document.getElementsByTagName('A');
        for (var i = 0; i < aTags.length; i++) {
            var v = aTags[i].href;
            for (var j = 0; j < urlspltChange.length; j++) {
                if (v.indexOf(urlspltChange[j].split('@')[0]) > 0) {
                    v = v.replace(urlspltChange[j].split('@')[0], urlspltChange[j].split('@')[1]);
                    aTags[i].href = v;
                }
            }
        }
    }
    catch (e) { }
}

function UpdateAd() {
    document.getElementById('Bottom').innerHTML = document.getElementById('BottomAd').innerHTML;
    document.getElementById('Bottom1').innerHTML = document.getElementById('Bottom1Ad').innerHTML;
    document.getElementById('BottomRight').innerHTML = document.getElementById('BottomRightAd').innerHTML;
    document.getElementById('AdsBottom').style.display = "";
}

function UpdateWdgtDispState(savedLst, widgetId, state) {
    var curr = "";
    var posn = "";
    var updt = widgetId + ":" + state;
    posn = savedLst.indexOf(widgetId)
    if (posn > -1) {

        curr = savedLst.substring(posn, posn + 4);

    }
    savedLst = savedLst.replace(curr, updt);
    if (savedLst != "") {
        document.getElementById('hdnSavedWdgtLst').value = savedLst;
        SaveCustWidgets(savedLst);
    }
}



function ToggleCont(id) {
    var wdgtList = document.getElementById('hdnSavedWdgtLst').value;
    var saveCust = true;
    if (isIACIO || isIPad || isIPhone)
        saveCust = false;
    if
	(document.getElementById(id).className.match(/on/i)) {
        document.getElementById(id).className = 'off';
        document.getElementById(id + '_Cont').style.display = 'none';
        document.getElementById(id + '_Opt').innerHTML = 'Show';
        if (wdgtList != "") {
            if (saveCust) {
                UpdateWdgtDispState(wdgtList, id, '0');
            }
        }
    }
    else {            
        document.getElementById(id).className = 'on';
        document.getElementById(id + '_Cont').style.display = 'block';
        document.getElementById(id + '_Opt').innerHTML = 'Hide';
        if (document.getElementById(id + '_Response').innerHTML == "") {
            LoadWidgets(id, '1', 'True');
        }
        if (wdgtList != "") {
            if (saveCust) {
                UpdateWdgtDispState(wdgtList, id, '1');
            }
        }
    }
}

var HPModules = {
    'Mod_1': { 'ID': 'NewsW', 'Display': 'block' },
    'Mod_2': { 'ID': 'PosterW', 'Display': 'block' },
    'Mod_3': { 'ID': 'Bill', 'Display': 'block' },
    'Mod_4': { 'ID': 'ACAct', 'Display': 'block' },
    'Mod_5': { 'ID': 'ACServ', 'Display': 'block' },
    'Mod_6': { 'ID': 'FiOS', 'Display': 'block' },
    'Mod_7': { 'ID': 'Announc', 'Display': 'block' }
}

function doCustomizePage(e) {
    openPopup('Customize Your Home Page', document.all ? 860 : 860, 'customize_home_page', e);
}

function LoadBillingWidget() {
    var bIsSubAccount = document.getElementById("hdnIsSubAcc").value;
    var bIsSubAdmin = document.getElementById("hdnIsSubAdmin").value;
    var bIsVASOnlyUser = document.getElementById("hdnIsVasOnly").value;
    var bIsCustLecBill = document.getElementById("hdnIsLecBill").value;
    var strWidgtBTN = document.getElementById("hdnBTN").value;
    var strSplitBillAccountNumber = "";
    
    if (document.getElementById("hdnSplitBillAccountNumber") != null)
        strSplitBillAccountNumber = document.getElementById("hdnSplitBillAccountNumber").value;
    if (isIACIO) {
        document.getElementById('BL_ProgressBar').style.display = 'none';
        document.getElementById('BL_Response').innerHTML = document.getElementById('divInstantBill').innerHTML;
        document.getElementById('Bill_Response').style.display = "";
    }
    else {
        if (bIsVASOnlyUser.toUpperCase() == "FALSE") {
            document.getElementById('BL_ProgressBar').style.display = 'none';
            document.getElementById('BL_Response').innerHTML = document.getElementById('Bill_Widget').innerHTML;
            
            if (bIsSubAccount = "T" && bIsSubAdmin != "False") {
                 document.getElementById('Bill_ProgressBar').style.display = 'none';
                    document.getElementById('BL_Response').innerHTML = document.getElementById('dvSubNonAdmin').innerHTML;
                    document.getElementById('Bill_Response').style.display = "";
            }
            if (bIsSubAccount = "F") {
            
                if (bIsCustLecBill.toUpperCase() == "TRUE") {
                    document.getElementById('Bill_ProgressBar').style.display = 'none';
                    document.getElementById('BL_Response').innerHTML = document.getElementById('divLecBill').innerHTML;
                    document.getElementById('Bill_Response').style.display = "";
                }
                else {
                    LoadSummary('Bill', strWidgtBTN);
                    if (strSplitBillAccountNumber != '') {
                        LoadSummary('DSBill', strSplitBillAccountNumber);
                    }
                }
            }            
        }
    }
}

function LoadAccActionWidget() {

    document.getElementById('AC_ProgressBar').style.display = 'none';
    document.getElementById('AC_Response').innerHTML = document.getElementById('AccountActions_Widget').innerHTML;
    loadServiceStatus('Overview');


}

function LoadSupportWidget() {
    document.getElementById('SP_ProgressBar').style.display = 'none';
    document.getElementById('SP_Response').innerHTML = document.getElementById('CustomerSupport_Widget').innerHTML;
    var bIsVASOnlyUser = document.getElementById("hdnIsVasOnly").value;

    if (bIsVASOnlyUser != null && bIsVASOnlyUser != '') {
        if (bIsVASOnlyUser.toUpperCase() == "FALSE") {
            loadCustomerSupport('Overview');
        }
        else {

            document.getElementById('CustomerSupport_ProgressBar').style.display = 'none';
            document.getElementById('CustomerSupport').innerHTML = document.getElementById('divVasOnlyCustSupp').innerHTML;
        }
    }


}
function LoadAnnounceWidget() {
    document.getElementById('AN_ProgressBar').style.display = 'none';
    document.getElementById('AN_Response').innerHTML = document.getElementById('myAnnounceDiv_Widget').innerHTML;
    var bIsVASOnlyUser = document.getElementById("hdnIsVasOnly").value;
    setDiv('ANNOUNCEMENT');

}
function LoadAdWidget() {

}
function LoadNewsWidget(showHdr) {
    DivId = "vzNewsWidget";
    var script = document.createElement('script');
    script.type = 'text/javascript';
    if (showHdr == 'True') {
        document.getElementById('NW_ProgressBar').style.display = 'none';
        DivId = 'NW_Response';
        document.getElementById('vzNewsWidget_ProgressBar').style.display = 'none';
        document.getElementById('NW_Response').className = '';
        document.getElementById('NW_Cont').style.display = '';
        script.src = '//media.verizon.com/media/scripts/widget.ashx?widget=vzNews&container=' + DivId + '&ready=false&params=header:true';

    }
    else {
        script.src = '//media.verizon.com/media/scripts/widget.ashx?widget=vzNews&container=' + DivId + '&ready=false';
    }
    document.getElementsByTagName('head')[0].appendChild(script);

}
function LoadMediaWidget(showHdr) {
    DivId = "vzSliderWidget";
    var script = document.createElement('script');
    script.type = 'text/javascript';
    if (showHdr == 'True') {
        DivId = 'EN_Response';
        document.getElementById('EN_ProgressBar').style.display = 'none';
        document.getElementById('vzSliderWidget_ProgressBar').style.display = 'none';
        document.getElementById('EN_Response').className = '';
        document.getElementById('EN_Cont').style.display = '';
        script.src = '//media.verizon.com/media/scripts/widget.ashx?widget=vzMedia&container=' + DivId + '&ready=false&params=header:true';
    }
    else {
        script.src = '//media.verizon.com/media/scripts/widget.ashx?widget=vzMedia&container=' + DivId + '&ready=false';
    }
    document.getElementsByTagName('head')[0].appendChild(script);
}

function LoadEasyOrderingUpgrade(showHdr) {
    if (c_IsEasyOrderingHomePage == false || c_IsEasyOrdering == false) {
        if (document.getElementById("EO") != null)
            document.getElementById("EO").style.display = 'none';
        if (document.getElementById("EO_Cont") != null)
            document.getElementById("EO_Cont").style.display = 'none';
        return;
    }
    var scriptUrl = "";
    var strdivId = 'EO_Response';
    if (showHdr == 'True') {
        scriptUrl = c_scriptForEasyOrderingWidget + '?eouysdiv=' + strdivId + '&eouysdivprodtype=all&eouysheader=N' + c_versionForUYSUrl;
    }
    else {
        scriptUrl = c_scriptForEasyOrderingWidget + '?eouysdiv=' + strdivId + '&eouysdivprodtype=all&eouysheader=Y' + c_versionForUYSUrl;
    }

    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = scriptUrl;
    if (document.getElementById(strdivId) != null && document.getElementById(strdivId) != undefined) {
        document.getElementById(strdivId).className = '';
        if (document.getElementById("EO_ProgressBar") != null)
            document.getElementById("EO_ProgressBar").style.display = 'none';
    }
    document.getElementsByTagName('head')[0].appendChild(script);

}

function LoadWidgets(strWidgtId, strWdgtState, bShowHeader) {    
    if (bShowHeader == 'True') {
        if (strWdgtState == 1) {
            document.getElementById(strWidgtId).className = 'on';
            document.getElementById(strWidgtId + '_Cont').style.display = 'block';
            document.getElementById(strWidgtId + '_Opt').innerHTML = 'Hide';
        }
        else {
            document.getElementById(strWidgtId).className = 'off';
            document.getElementById(strWidgtId + '_Cont').style.display = 'none';
            document.getElementById(strWidgtId + '_Opt').innerHTML = 'Show';
        }
    }
    
    if (strWdgtState == 1) {
        switch (strWidgtId) {
          case 'BL':
                LoadBillingWidget();
                break;
            case 'SP':
                LoadSupportWidget();
                break;
            case 'AC':
                LoadAccActionWidget();
                break;
            case 'AN':
                LoadAnnounceWidget();
                break;
            case 'AD':
                LoadAdWidget();
                break;
            case 'NW':
                //window.setTimeout("LoadNewsWidget('" + bShowHeader + "');", 25);
                if (bSynacorPhase2 == "Y") {
                    if (typeof (callsingle_s9n) == 'undefined' || callsingle_s9n == null || callsingle_s9n == '' || callsingle_s9n == 'N') {
                        window.setTimeout("LoadDCWidget_Old('" + bShowHeader + "');", 25); // NEW SYNACOR NEWS
                    }
                    else
                    { LoadDCWidget(bShowHeader); }
                }
                else
                    window.setTimeout("LoadNewsWidget('" + bShowHeader + "');", 25);
                break;
            case 'EN':
                window.setTimeout("LoadMediaWidget('" + bShowHeader + "');", 25);
                break;
            case 'EO':
                window.setTimeout("LoadEasyOrderingUpgrade('" + bShowHeader + "');", 25);
                break;
            case 'WC':
                if (typeof (callsingle_s9n) == 'undefined' || callsingle_s9n == null || callsingle_s9n == '' || callsingle_s9n == 'N') {
                    window.setTimeout("LoadWCWidget_Old('" + bShowHeader + "');", 25);
                }
                else {
                    LoadWCWidget(bShowHeader);
                }
                break;                              
            default:
                ;
                break;
        }
    }

}

function LoadWCWidget(showHdr) {
    var DivId = "watercooler";
    var callback = function() {};
    if (showHdr == 'True') {
        DivId = 'WC_Response';
        callback = function() {
            document.getElementById('WC_ProgressBar').style.display = 'none';
            document.getElementById('WC_Response').className = 'PadL20 PadT10';            
            document.getElementById('WC_Cont').style.display = '';	    
        }
    }
    VzS9N.loadWidget('watercooler', DivId, callback);
}


function LoadDCWidget(showHdr) {
    var DivId = "vzNewsWidget";
    var callback = function() { };
    if (showHdr == 'True') {
        DivId = 'NW_Response';
        callback = function() {
            document.getElementById('NW_ProgressBar').style.display = 'none';
            document.getElementById('NW_Response').className = 'PadL20 PadT10';            
            document.getElementById('NW_Cont').style.display = '';
        }
    }

    VzS9N.loadWidget('dcc', DivId, callback);
}

function LoadWCWidget_Old(showHdr) {
    DivId = "watercooler";
    var script = document.createElement('script');
    script.type = 'text/javascript';
    if (showHdr == 'True') {
        document.getElementById('WC_ProgressBar').style.display = 'none';
        DivId = 'WC_Response';

        //document.getElementById('watercooler_ProgressBar').style.display = 'none';
        document.getElementById('WC_Response').className = 'PadL20 PadT10';
        document.getElementById('WC_Cont').style.display = '';
        script.src = SynacorP2_NW_WC + '?type=watercooler&id=' + DivId + '';

    }
    else {
        script.src = SynacorP2_NW_WC + '?type=watercooler&id=' + DivId + '';
    }
    document.getElementsByTagName('head')[0].appendChild(script);

}


function LoadDCWidget_Old(showHdr) {
    //alert(showHdr);
    DivId = "vzNewsWidget";
    var script = document.createElement('script');
    script.type = 'text/javascript';
    if (showHdr == 'True') {
        document.getElementById('NW_ProgressBar').style.display = 'none';
        DivId = 'NW_Response';

        document.getElementById('NW_ProgressBar').style.display = 'none';
        document.getElementById('NW_Response').className = 'PadL20 PadT10';
        document.getElementById('NW_Cont').style.display = '';
        script.src = SynacorP2_NW_WC + '?type=dcc&id=' + DivId + '';

    }
    else {
        script.src = SynacorP2_NW_WC + '?type=dcc&id=' + DivId + '';
    }
    document.getElementsByTagName('head')[0].appendChild(script);

}

function PopulatePR(strDay1, strDay2, strPREmail, strPRText) {
    var objPRDay1 = document.getElementById("MyVzPr_optPRDay1");
    var objPRDay2 = document.getElementById("MyVzPr_optPRDay2");

    objPRDay1.value = strDay1;
    objPRDay2.value = strDay2;

    if ((strDay1 != "") && (strDay1 != "0"))
        document.getElementById('PR1DelDiv').style.display = 'inline';
    else
        document.getElementById('PR1DelDiv').style.display = 'none';

    if ((strDay2 != "") && (strDay2 != "0"))
        document.getElementById('PR2DelDiv').style.display = 'inline';
    else
        document.getElementById('PR2DelDiv').style.display = 'none';

    if (strPREmail == "1") {
        document.getElementById('chkPREmail').checked = true;
    }
    else {
        document.getElementById('chkPREmail').checked = false;
    }
    if (strPRText == "1") {
        document.getElementById('checkPRText').checked = true;
    }
    else {
        document.getElementById('checkPRText').checked = false;
    }
}

//Script to Show/Hide Account Action links for Instant Account Users
function fnShowHideIALinks(divId) {
    var aElements;
    if (document.getElementById(divId) != null && document.getElementById(divId) != undefined) {
        aElements = document.getElementById(divId).getElementsByTagName('a');
        if (aElements) {
            var i = 0;
            if (bIO) {
                for (i = 0; i < aElements.length; i++) {
                    if (aElements[i].title == "Check Order Status") {
                        aElements[i].href = "https://my.verizon.com/whatsnext";
                    }
                    if (aElements[i].getAttribute("chkio").toUpperCase() == "HIDE") {
                        aElements[i].className = "displNone";
                    }
                }
            }
            else if (bIAC) {
                for (i = 0; i < aElements.length; i++) {
                    if (aElements[i].title == "Check Order Status") {
                        aElements[i].href = "https://my.verizon.com/whatsnext";
                    }
                    if (aElements[i].getAttribute("chkiac").toUpperCase() == "HIDE") {
                        aElements[i].className = "displNone";
                    }
                }
            }
        }
    }
}

function fnOpenLink(strRelativeurl, mode, type) {
    var env = "https://" + location.hostname + "/";
    var strRedirectURL = "";
    if (strRelativeurl.indexOf("/") == 0) {
        strRelativeurl = strRelativeurl.substring(1);
    }
    if (type.toUpperCase() == "UNSECURE") {
        env = "http://" + location.hostname + "/";
    }
    if (mode.toUpperCase() == "NEWWIN") {
        strRedirectURL = env + strRelativeurl;
        window.open(strRedirectURL);
    }
    else {
        strRedirectURL = env + strRelativeurl;
        window.location.href = strRedirectURL;
    }
}
function getElement(element) {
    return document.getElementById(element);
}

function getObject(ref) {
    if (typeof ref == 'string') {
        return getElement(ref);
    } else if (typeof ref == 'object') {
        return ref;
    }
}

function ChangeBtn(obj) {
    try {
        getObject(obj).className = 'BtnRed1';
    } catch (e) { }
}

function ToggleDiv(div1, div2) {
    document.getElementById(div1).style.display = 'block';
    document.getElementById(div2).style.display = 'none';
}


function CreatSubAc(Obj, div1, div2, page) {


    if ($(Obj).hasClass('BtnRed1')) {

        if (ValidateSubAc1()) {
            var objErr = document.getElementById('SQErr2');
            if (objErr != null && objErr != 'undefined')
                objErr.innerHTML = '';

            ToggleDiv(div1, div2); PopPage(page);
        }
    }

}


function PopPage(obj) {
    if (obj == '1') {
        document.getElementById('AcPopPage').innerHTML = 'Step 1 of 2';
    }
    else if (obj == '2') {
        document.getElementById('AcPopPage').innerHTML = 'Step 2 of 2';
    }
    else {
        document.getElementById('AcPopPage').innerHTML = '';
    }
}




function openPopup1(T, W, poptype, e) {
    if (arguments.length == 0) {
        alert('Invalid arguments. onclick="openPopup(Title, Width, Popup Type)"');
        return;
    }
    hideSelectBox();
    popContentId = poptype;
    popContent = '&nbsp;';
    popContent = popInnerCont = document.getElementById(poptype).innerHTML;
    document.getElementById(poptype).innerHTML = '';

    var poptitle = T;
    if (poptype == 'CreateSubAc') {
        poptitle = '<div class="PopTitle">' + T + '</div><div class="Fl PopSTit" id="AcPopPage">Step 1 of 2</div>'
    }
    else {
        poptitle = '<div class="PopTitle">' + poptitle + '</div>';
    }
    var popwidth = W;
    var obj = document.createElement('div');
    obj.id = 'popouter_drag';
    if (document.all)
        obj.style.width = document.body.clientWidth + 'px';
    else
        obj.style.width = document.body.clientWidth + 'px';
    obj.style.height = document.body.scrollHeight + 30 + 'px';
    document.body.appendChild(obj);

    obj = document.createElement('div');
    obj.id = 'popupbox_drag';
    obj.style.width = popwidth + 'px';
    obj.style.left = (document.body.clientWidth - popwidth) / 2 + 'px';
    document.body.appendChild(obj);



    var popcnt = '<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
			   '<tr class="PopHd">' +
			   '<td width="100%" valign="top">' + poptitle +
			  '<div class="PopClose" onclick="closePopup();"><div class="CloseTxt">Close</div><div class="CloseIco"></div></div></td>' +
			 '</tr>' +
			 '<tr>' +
			 '<td  width="100%" class="PopCBg">' + popContent + '</td>' +

			  '</tr>' +
			'</table>';
    if (poptype != 'VZWelcome')
        document.getElementById('popupbox_drag').innerHTML = popcnt;
    else
        document.getElementById('popupbox_drag').innerHTML = popContent;
    if (poptype == 'signIn_pop') {
        //document.getElementById('popup_top_rcurve').style.width=7;
    }
    else if (poptype == 'VZWelcome') {
        //document.getElementById('popup_top_rcurve').style.width=7;
    }
    var offHeight = document.getElementById('popupbox_drag').offsetHeight;
    var scrTop = (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop) || 0;
    document.getElementById('popupbox_drag').style.top = scrTop + 100 + 'px';

    if (poptype == 'ConfirmDate') {
        if (scTxt == 1) {
            document.getElementById('ConfirmDate_Txt').innerHTML = 'DIRECTV&reg;';
            scTxt = 0;
        }
        else
            document.getElementById('ConfirmDate_Txt').innerHTML = 'FiOS TV';
    }

    if (poptype == 'customize_tabs' || poptype == 'customize_news_bar') {
        addEvent('mousemove', moveHotPoint);
        addEvent('mouseup', cancelAllEvents);
    } else if (poptype == 'customize_home_page') {
        document.getElementById('iframeCustomize').src = 'Customize/Homepage.htm';
    }
}

function closePopup1() {
    var obj = document.getElementById('popupbox_drag');
    document.body.removeChild(obj);
    var obj = document.getElementById('popouter_drag');
    document.body.removeChild(obj);
    if (document.getElementById(popContentId))
        document.getElementById(popContentId).innerHTML = popInnerCont;
    revealSelectBox();
    if (document.getElementById('SWCrnR1'))
        document.getElementById('SWCrnR1').className = 'SWCrnR1';
}

function openWelcomeBasketPopup(T, W, poptype, e) {
    if (arguments.length == 0) {
        alert('Invalid arguments. onclick="openPopup(Title, Width, Popup Type)"');
        return;
    }
    hideSelectBox();
    popContentId = poptype;
    popContent = '&nbsp;';
    popContent = popInnerCont = document.getElementById(poptype).innerHTML;
    document.getElementById(poptype).innerHTML = '';

    var poptitle = T;
    var popwidth = W;
    var obj = document.createElement('div');
    obj.id = 'popouter';
    obj.style.width = document.body.clientWidth + 'px';
    obj.style.height = document.body.scrollHeight + 'px';
    document.body.appendChild(obj);

    obj = document.createElement('div');
    obj.id = 'popupbox';
    obj.style.width = popwidth + 'px';
    obj.style.left = (document.body.clientWidth - popwidth) / 2 + 'px';
    document.body.appendChild(obj);
    var popcnt = '<table width="100%" cellpadding="0" cellspacing="0" border="0">'
			   + '<tr>'
				+ '	<td colspan="4" class="PopCBg" valign="top">' + popContent
				+ '    </td>'
				+ '</tr>'
			+ '</table>';

    if (poptype != 'AtchViewer') {
        document.getElementById('popupbox').innerHTML = popcnt;
    }
    else {

        document.getElementById('popupbox').innerHTML = popContent;
    }
    var offHeight = document.getElementById('popupbox').offsetHeight;
    var scrTop = (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop) || 0;
    document.getElementById('popupbox').style.top = scrTop + 100 + 'px';
}

function ActiveRow(id, NoRow) {
    for (var i = 1; i <= NoRow; i++) {
        document.getElementById("Row" + i).className = "";
    }
    document.getElementById("Row" + id).className = "ActiveR";
}

function showError(id) {
    try {
        var TId = id.substring(0, 7);
        var TNo = id.charAt(7);
        var t = 1;
        while (document.getElementById(TId + t)) {
            document.getElementById(TId + t).style.display = 'none';
            t += 1;
        }
        document.getElementById(TId + TNo).style.display = "block";
    }
    catch (e) { }
}
var IsCalledUnderNotify = false;
var IsCalledUnderOptOut = false;
function openPopup2(T, W, poptype, e) {
    var objPop = document.getElementById('popupbox');

    if (objPop != null) return;
    
    if (poptype == 'ChgSecretQues' || poptype == 'ChgUserId' || poptype == 'ChgAlias' || poptype == 'ChgEAlias') {
        var strAccessLevel = '';
        var strHref = '';
        strAccessLevel = document.getElementById('hdnAccessLevel').value;        
        strHref = document.location.href;
        if (strAccessLevel == 'L') {
            //closePopup();
            strHref = "/ForyourHome/Registration/Reg/AuthenticateTPin.aspx?Target=" + document.location.href + "&src=MA";
            window.location.href = strHref;
            closePopup();
        }
        
        if(T.indexOf('Create') > -1){
            if(poptype == 'ChgAlias') {         
                document.getElementById('spnChgAlias').innerHTML = "Create";
            }
            else if(poptype == 'ChgUserId'){
                document.getElementById('spnChgUserId').innerHTML = "Create";
            }
        }
        else{           
            document.getElementById('spnChgAlias').innerHTML = "Change";           
        }
    }    
   
    if (arguments.length == 0) {
        alert('Invalid arguments. onclick="openPopup(Title, Width, Popup Type)"');
        return;
    }
    hideSelectBox();
    popContentId = poptype;
    popContent = '&nbsp;';
    popContent = popInnerCont = document.getElementById(poptype).innerHTML;
    document.getElementById(poptype).innerHTML = '';

    var poptitle = T;
    var popwidth = W;
    var poptitle = T;
    if (poptype == 'CreateSubAc') {
        poptitle = '<div class="PopTitle" id="divPopTitle">' + T + '</div><div class="Fl PopSTit" id="AcPopPage">Step 1 of 2</div>'
    }
    else {
        poptitle = '<div class="PopTitle" id="divPopTitle">' + poptitle + '</div>';
    }
    var obj = document.createElement('div');
    obj.id = 'popouter';
    obj.style.width = document.body.clientWidth + 'px';
    obj.style.height = document.body.scrollHeight + 'px';
    document.body.appendChild(obj);

    obj = document.createElement('div');
    obj.id = 'popupbox';
    obj.style.width = popwidth + 'px';
    obj.style.left = (document.body.clientWidth - popwidth) / 2 + 'px';
    document.body.appendChild(obj);
    var popcnt = '<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
			   '<tr class="PopHd">' +
			   '<td valign="top" width="100%">' +
			    poptitle +
			    '<div class="PopClose" onclick="closePopup();"><div class="CloseTxt">Close</div>' +
		        '<div class="CloseIco"></div></div>' +
		       '</td>' +
			 '</tr>' +
			 '<tr>' +
			 '<td  width="100%" style="background-color:#e2e2e2" id="popContent">' + popContent + '</td>' +

			  '</tr>' +
			'</table>';
    if (poptype != 'AtchViewer')
        document.getElementById('popupbox').innerHTML = popcnt;
    else
        document.getElementById('popupbox').innerHTML = popContent;
    var offHeight = document.getElementById('popupbox').offsetHeight;
    var scrTop = (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop) || 0;
    //document.getElementById('popupbox').style.top = scrTop + 100 + 'px';

    PopulateAccProfilePopup(poptype, e);

    if (T == 'Create a Sub-Account') {
       // var cboM = document.getElementById('txtCSMonth'); if (cboM != null && cboM != 'undefined') { cboM.style.visibility = 'visible'; }
       // var cboD = document.getElementById('txtCSDay'); if (cboD != null && cboD != 'undefined') cboD.style.visibility = 'visible';

       // var rdoM = document.getElementById('rdoCSMale'); if (rdoM != null && rdoM != 'undefined') rdoM.checked = true;
    }
    if (T == 'Change Sub-Account') {
       // var cboME = document.getElementById('txtCSMonthE'); if (cboME != null && cboME != 'undefined') { cboME.style.visibility = 'visible'; }
       // var cboDE = document.getElementById('txtCSDayE'); if (cboDE != null && cboDE != 'undefined') cboDE.style.visibility = 'visible';

        //var rdoME = document.getElementById('rdoSMale'); if (rdoME != null && rdoME != 'undefined') rdoME.checked = true;
    }

    if (T == 'Create a Sub-Account' || T == 'Change Sub-Account') {
        document.getElementById('popupbox').style.top = scrTop + 55 + 'px';
    }
    else if (T == 'Email Settings') {
        document.getElementById('popupbox').style.top = scrTop + 85 + 'px';
    }
    else {
        document.getElementById('popupbox').style.top = scrTop + 100 + 'px';
    }
    
    if(poptype!='ChgNotification')
        IdentifyControlToSetFocus();

    if (poptype == 'SetPay') {
        IsCalledUnderNotify = false;
        IsCalledUnderOptOut = false;
        RestObject = null;
        NewNotificationCheck();
    }
}

function openPopupSynacor3(T, W, poptype, e) {
    var objPop = document.getElementById('popupbox');

    if (objPop != null) return;

   if (arguments.length == 0) {
        alert('Invalid arguments. onclick="openPopup(Title, Width, Popup Type)"');
        return;
    }
    hideSelectBox();
    popContentId = poptype;
    popContent = '&nbsp;';
    popContent = popInnerCont = document.getElementById(poptype).innerHTML;
    document.getElementById(poptype).innerHTML = '';

    var poptitle = T;
    var popwidth = W;
    var poptitle = T;
    var obj = document.createElement('div');
    obj.id = 'popouter';
    obj.style.width = document.body.clientWidth + 'px';
    obj.style.height = document.body.scrollHeight + 'px';
    document.body.appendChild(obj);

    obj = document.createElement('div');
    obj.id = 'popupbox';
    obj.style.width = popwidth + 'px';
    obj.style.left = (document.body.clientWidth - popwidth) / 2 + 'px';
    document.body.appendChild(obj);
    var popcnt = '<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
			   '<tr class="PopHd">' +
			   '<td valign="top" width="100%" class="welcome_title3"><div style="float:left;width:700px;"> <img src="/ForYourHome/MyAccount/UnProtected/Images3/BgImages/welcome_overlaytitle.png" /></div>' +
			    '<div class="PopClose1" onclick="closePopup();"><div class="CloseTxt">Close</div>' +
		        '<div class="CloseIco"></div></div>' +
		       '</td>' +
			 '</tr>' +
			 '<tr>' +
			 '<td  width="100%" style="background-color:#e2e2e2" id="popContent">' + popContent + '</td>' +

			  '</tr>' +
			'</table>';
    if (poptype != 'AtchViewer')
        document.getElementById('popupbox').innerHTML = popcnt;
    else
        document.getElementById('popupbox').innerHTML = popContent;
    var offHeight = document.getElementById('popupbox').offsetHeight;
    var scrTop = (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop) || 0;
    document.getElementById('popupbox').style.top = scrTop + 100 + 'px';


}

// SPR - Setup Payment Reminder
function NewSPRCheck() {
    var chkAcc_SMS = document.getElementById('chkAccSMS');
    var chkBill_SMS = document.getElementById('chkBillNotiSMS');
    var dvMTN = document.getElementById('NotifiyNew_lblMobileNumber');

    if (chkAcc_SMS != null && chkAcc_SMS != 'undefined' && chkBill_SMS != null && chkBill_SMS != 'undefined' && dvMTN != null && dvMTN != 'undefined') {
        var strMTN = dvMTN.innerHTML;
        strMTN = strMTN.toUpperCase();

        if ((chkAcc_SMS.checked == false && chkBill_SMS.checked == false) || strMTN == '' || strMTN.indexOf('N') > -1) {

            document.getElementById('PR_SMS').innerHTML = 'Not Enrolled';
            
            var objPRText = document.getElementById('NotifiyNew_hdnPRText');
            
            if (objPRText != null && objPRText != 'undefined')
                objPRText.value = '0';

            var chkPR_Text = document.getElementById('chkPRText');

            if (chkPR_Text != null && chkPR_Text != 'undefined')
                chkPR_Text.checked = false;

            var objPR_PR = document.getElementById('NotifiyNew_lblPaymentReminder')

            var objPR_EMail = document.getElementById('PR_eMail');

            var objPR_SMS = document.getElementById('PR_SMS');

            if (objPR_EMail != 'undefined' && objPR_EMail != null && objPR_SMS != 'undefined' && objPR_SMS != null) {
                var PREmail = objPR_EMail.innerHTML;
                var PRSMS = objPR_SMS.innerHTML;

                PREmail = Trim(PREmail);
                PRSMS = Trim(PRSMS);

                if (PREmail == 'Not Enrolled' && PRSMS == 'Not Enrolled')
                    objPR_PR.innerHTML = "<a href='javascript:;' style='font-weight:normal' onclick=\"openPopup2('Setup Payment Reminder', document.all ? 550 : 550,'SetPay');\">Setup</a>";
                else if (PREmail == 'Enrolled' && PRSMS == 'Not Enrolled')
                    objPR_PR.innerHTML = "<a href='javascript:;' style='font-weight:normal' onclick=\"openPopup2('Edit Payment Reminder', document.all ? 550 : 550,'SetPay');PopulateAcPR();\">Edit</a>";
                else if (PREmail == 'Not Enrolled' && PRSMS == 'Enrolled')
                    objPR_PR.innerHTML = "<a href='javascript:;' style='font-weight:normal' onclick=\"openPopup2('Edit Payment Reminder', document.all ? 550 : 550,'SetPay');PopulateAcPR();\">Edit</a>";
                else if (PREmail == 'Enrolled' && PRSMS == 'Enrolled')
                    objPR_PR.innerHTML = "<a href='javascript:;' style='font-weight:normal' onclick=\"openPopup2('Edit Payment Reminder', document.all ? 550 : 550,'SetPay');PopulateAcPR();\">Edit</a>";
            }

        }
        
    }
}

function NewNotificationCheck() {
    /*if (NewNotificationCall == 'Y') {*/
        var chkAcc_SMS = document.getElementById('chkAccSMS');
        var chkBill_SMS = document.getElementById('chkBillNotiSMS');
        var chkPR_Text = document.getElementById('chkPRText');
        var dvSMS_Text = document.getElementById('dvSMSText');
        var dvMTN = document.getElementById('NotifiyNew_lblMobileNumber');

        if (chkAcc_SMS != null && chkAcc_SMS != 'undefined' && chkBill_SMS != null && chkBill_SMS != 'undefined' && dvMTN != null && dvMTN != 'undefined') {

            var strMTN = dvMTN.innerHTML;
            strMTN = strMTN.toUpperCase();

            if ((chkAcc_SMS.checked == false && chkBill_SMS.checked == false) || strMTN == '' || strMTN.indexOf('N') > -1) {
                chkPR_Text.disabled = true;
                chkPR_Text.checked = false;
                dvSMS_Text.style.display = 'block';
            }
            else if ((chkAcc_SMS.checked == true || chkBill_SMS.checked == true) && strMTN != '' && strMTN.indexOf('N') < 0) {
                chkPR_Text.disabled = false;
                dvSMS_Text.style.display = 'none';
            }
        } 
    /* } */
}

function openPopupGeo(T, W, poptype, e) {
    var objPop = document.getElementById('popupbox');

    // if (objPop != null) return;
    if (arguments.length == 0) {
        alert('Invalid arguments. onclick="openPopup(Title, Width, Popup Type)"');
        return;
    }
    hideSelectBox();
    popContentId = poptype;
    popContent = '&nbsp;';
    popContent = popInnerCont = document.getElementById(poptype).innerHTML;
    document.getElementById(poptype).innerHTML = '';

    var poptitle = T;
    var popwidth = W;
    var poptitle = T;
    poptitle = '<div class="PopTitle" id="divPopTitle">' + poptitle + '</div>';
    var obj = document.createElement('div');
    obj.id = 'popouter';
    obj.style.width = document.body.clientWidth + 'px';
    obj.style.height = document.body.scrollHeight + 'px';
    document.body.appendChild(obj);

    obj = document.createElement('div');
    obj.id = 'popupbox';
    obj.style.width = popwidth + 'px';
    obj.style.left = (document.body.clientWidth - popwidth) / 2 + 'px';
    document.body.appendChild(obj);
    var popcnt = '<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
			   '<tr class="PopHd">' +
			   '<td valign="top" width="100%">' +
			    poptitle +
			    '<div class="PopClose" onclick="closePopup();"><div class="CloseTxt">Close</div>' +
		        '<div class="CloseIco"></div></div>' +
		       '</td>' +
			 '</tr>' +
			 '<tr>' +
			 '<td  width="100%" style="background-color:#e2e2e2" id="popContent">' + popContent + '</td>' +

			  '</tr>' +
			'</table>';
    if (poptype != 'AtchViewer')
        document.getElementById('popupbox').innerHTML = popcnt;
    else
        document.getElementById('popupbox').innerHTML = popContent;
    var offHeight = document.getElementById('popupbox').offsetHeight;
    var scrTop = (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop) || 0;
    document.getElementById('popupbox').style.top = scrTop + 100 + 'px';

}

function Chg1(BObj, obj) {
    if ($(BObj).hasClass('BtnRed1')) {
        document.getElementById(obj + '1').style.display = 'none';
        document.getElementById(obj + '3').style.display = 'block';
        setTimeout(function() { document.getElementById(obj + '2').style.display = 'block'; document.getElementById(obj + '3').style.display = 'none'; }, 2000);
    }
}


function openPopup3(T, W, poptype, e) {
    if (arguments.length == 0) {
        alert('Invalid arguments. onclick="openPopup(Title, Width, Popup Type)"');
        return;
    }


    popContentId = poptype;
    popContent = '&nbsp;';
    popContent = document.getElementById(poptype).innerHTML;

    var poptitle = T;
    var popwidth = W;
    var obj = document.createElement('div');
    obj.id = 'popouter';
    obj.style.width = document.body.clientWidth + 'px';
    obj.style.height = document.body.scrollHeight + 'px';
    document.body.appendChild(obj);

    obj = document.createElement('div');
    obj.id = 'popupbox';
    obj.style.width = popwidth + 'px';
    obj.style.left = (document.body.clientWidth - popwidth) / 2 + 'px';
    document.body.appendChild(obj);
    var popcnt = '<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
			   '<tr class="PopHd">' +
			   '<td valign="top" class="PopTitle" width="100%">' +
			    '<div class="PopTitle" title="Customize your Tabs">' + poptitle + '</div>' +
			    '<div class="PopClose" onclick="closePopup();"><div class="CloseTxt">Close</div>' +
		        '<div class="CloseIco"></div></div>' +
		       '</td>' +
			 '</tr>' +
			 '<tr>' +
			 '<td  width="100%" class="PopCBg" id="divOL_Repsonse">' + popContent + '</td>' +

			  '</tr>' +
			'</table>';

    if (poptype != 'AtchViewer') {
        try {

            document.getElementById('popupbox').innerHTML = popcnt;
        }
        catch (e) { }
    }
    else
        document.getElementById('popupbox').innerHTML = popContent;
    var offHeight = document.getElementById('popupbox').offsetHeight;
    var scrTop = (document.documentElement && document.documentElement.scrollTop) || (document.body &&
document.body.scrollTop) || 0;
    document.getElementById('popupbox').style.top = scrTop + 100 + 'px';

}
// IHA implementation - Vinoth J
function GetHNMAPIResponse() {
    try {

        $.ajax({ url: 'GetIHAResponse.aspx',
            type: 'POST',
            cache: false,
            async: true,
            data: '',
            timeout: 60000,
            dataType: 'html',
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                //alert(textStatus);
            },
            success: function(html) {
                if (html == 'Y') {
                    OpenFAPopup();
                }
            }
        });
    }
    catch (e) {
        alert(e.message.toString());
    }
}
function getBrowserDimensions() {
    var intH = 0;
    var intW = 0;

    if (typeof window.innerWidth == 'number') {
        intH = window.innerHeight;
        intW = window.innerWidth;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        intH = document.documentElement.clientHeight;
        intW = document.documentElement.clientWidth;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        intH = document.body.clientHeight;
        intW = document.body.clientWidth;
    }

    return { width: parseInt(intW), height: parseInt(intH) };
}
function OpenFAPopup() {
    var bws = getBrowserDimensions();
    var obj = document.createElement('div');
    obj.id = 'popouter';
    /*obj.style.width = bws.width.toString() + 'px';
    obj.style.height = bws.height.toString() + 'px';*/
    obj.style.width = document.body.clientWidth + 'px';
    obj.style.height = document.body.scrollHeight + 'px';
    document.body.appendChild(obj);

    var objBox = document.getElementById('divFAPopup');
    objBox.style.left = (document.body.clientWidth - 450) / 2 + 'px';
    var scrTop = (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop) || 0;
    objBox.style.top = scrTop + 100 + 'px';
    objBox.style.display = 'block';
}

function CloseFAPopup() {
    document.getElementById('divFAPopup').style.display = 'none';
    var obj = document.getElementById('popouter');
    document.body.removeChild(obj);
    document.frmOverview.submit();
}
// end IHA implementation - Vinoth J

function ValidateSubAc1() {
    var bSAReturnval = false;
    var SAfname = document.getElementById("txtCSFirstName").value;
    SAfname.length = 5;
    var SLfname = document.getElementById('txtCSLastName').value;
   
    var SAzip = document.getElementById('txtCSZip').value;
   
    var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
   
    if (SAfname != null || SAfname != "") {
        for (var i = 0; i < document.getElementById("txtCSFirstName").value.length; i++) {
            if (iChars.indexOf(document.getElementById("txtCSFirstName").value.charAt(i)) != -1) {
                document.getElementById('SQErr2').innerHTML = "First Name field has Invalid Characters";
                return false;
            }
        }

    }
    if (SLfname != null || SLfname != "") {
        for (var i = 0; i < document.getElementById("txtCSLastName").value.length; i++) {
            if (iChars.indexOf(document.getElementById("txtCSLastName").value.charAt(i)) != -1) {
                document.getElementById('SQErr2').innerHTML = "Last Name field has Invalid Characters";
                return false;
            }
        }

    }
    if (SAfname == null || SAfname == "") {
        document.getElementById('SQErr2').innerHTML = "Please Enter the First Name";
        document.getElementById("txtCSFirstName").focus();
        return false;
    }
    if (SAfname.indexOf(" ") != -1) {
        document.getElementById('SQErr2').innerHTML = "Invalid First Name";
        document.getElementById("txtCSFirstName").value = '';
        document.getElementById("txtCSFirstName").focus();
        return false;
    }
    if (SLfname == null || SLfname == "") {
        document.getElementById('SQErr2').innerHTML = "Please Enter the Last Name";        
        document.getElementById("txtCSLastName").focus();
        return false;
    }

    if (SLfname.indexOf(" ") != -1) {
        document.getElementById('SQErr2').innerHTML = "Invalid Last Name";
        document.getElementById("txtCSLastName").value = '';
        document.getElementById("txtCSLastName").focus();
        return false;
    }

    if (SAzip == null || SAzip == "") {
        document.getElementById("txtCSZip").focus();
        document.getElementById('SQErr2').innerHTML = "Please enter Zip Code";
        return false;
    }

    if ((!(SAzip == null || SAzip == ""))) {
        if ((SAzip.length < 5) || (SAzip == "00000")) {
            document.getElementById("txtCSZip").focus();
            document.getElementById('SQErr2').innerHTML = "Please Enter a valid Zip Code";
            return false;
        }
        else
            return true;
    }
    else
        return true;

}

function OnlyNumbers(myfield, e) {
    var key;
    var keychar;

    if (window.event)
       key = window.event.keyCode;
    else if (e)
       key = e.which;
    else
       return true;
    keychar = String.fromCharCode(key);

    // control keys
    if ((key==null) || (key==0) || (key==8) || 
        (key==9) || (key==13) || (key==27) )
       return true;

    // numbers
    else if ((("0123456789").indexOf(keychar) > -1)) {
        return true;
    }
    else
       return false;
}

function numbersonly(myfield, e, dec) {
    var key;
    var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

    // numbers
    else if ((("0123456789").indexOf(keychar) > -1)) {
        return true;
    }
    else
        return false;
}

function cleardiv() {
    document.getElementById('SQErr2').innerHTML = "";
}

function IdentifyControlToSetFocus() {
    try {
        var objParent = document.getElementById('popContent').getElementsByTagName('input');
        if (objParent != null && objParent != 'undefined') {
            for (var i = 0; i < 1; i++) {
                if (objParent.item(i).getAttribute('type') == 'text' || objParent.item(i).getAttribute('type') == 'password') {
                    var objID = objParent.item(i).getAttribute('id');

                    var objControl = document.getElementById(objID);

                    if (objControl != null && objControl != 'undefined') {
                        objControl.focus();
                    }
                }
            }
        }
    }
    catch (e) { }
}


function ShowForum() 
{
        document.getElementById('divHomeForums').style.display = 'block'
        document.getElementById('aForum').className = 'Gry'
}

function changeComTabs(CTId) {

    var TId = CTId.substring(0, 4);
    var TNo = CTId.charAt(4);
    var t = 1;
    var FTN = 0;
    var LTN = 0;
    var csdtv = "";
    if (document.getElementById("hdnCSDTV") != null || document.getElementById("hdnCSDTV") != undefined)
        csdtv = document.getElementById("hdnCSDTV").value;

    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        FTN = 1
        LTN = 1
        //document.getElementById('TabSep1').style.display = 'block';

    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 2
        if (LTN <= 1)
            LTN = 2

        //document.getElementById('TabSep2').style.display = 'block';

    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 3
        if (LTN <= 2)
            LTN = 3
        //document.getElementById('TabSep3').style.display = 'block';
    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (FTN == 0)
            FTN = 4
        if (LTN <= 3)
            LTN = 4
    }
    t += 1;
    if (document.getElementById(TId + t) != null) {
        document.getElementById(TId + t).className = 'GTabM';
        if (csdtv == "Y") {
            if (FTN == 0)
                FTN = 5
            if (LTN <= 4)
                LTN = 5
        }
    }
    if (document.getElementById(CTId) != null)
        document.getElementById(CTId).className = 'WTabM';

    if (TNo == FTN)
        document.getElementById(TId + '_L').className = 'WTabL';
    else
        document.getElementById(TId + '_L').className = 'GTabL';
    if (TNo == LTN)
        document.getElementById(TId + '_R').className = 'WTabR';
    else
        document.getElementById(TId + '_R').className = 'GTabR';

    

    if (document.getElementById('divI') != null)
        document.getElementById('divI').style.display = 'none';
    if (document.getElementById('divT') != null)
        document.getElementById('divT').style.display = 'none';
    if (document.getElementById('divH') != null)
        document.getElementById('divH').style.display = 'none';
    if (document.getElementById('divW') != null)
        document.getElementById('divW').style.display = 'none';
    if (FTN == 1)
        document.getElementById('divI').style.display = 'block';
    if (FTN == 2)
        document.getElementById('divT').style.display = 'block';
    if (FTN == 3)
        document.getElementById('divH').style.display = 'block';
    if (FTN == 4)
        document.getElementById('divW').style.display = 'block';

   
}

var RestObject = null;
function showRegulatoryNotification(obj)
{
    try {

        IsCalledUnderNotify = true;

        RestObject = obj;
        
        if(obj.checked)
        {
            openPopup2('Notification By Email', document.all ? 550 : 550, 'RegulatoryNotices');
        }
        else
        {
            openPopup2('Notification By Email', document.all ? 550 : 550, 'RegulatoryNoticesUC');
        }        
    }
    catch(ex) {}
}

function showAccountNotification(obj, altControl)
{
    try
    {
        if (obj != null) {

            IsCalledUnderNotify = true;

            RestObject = obj;
            
            //document.getElementById(altControl).checked = obj.checked;

            if (obj.checked) {
                openPopup2('Notification By Text Message', document.all ? 550 : 550, 'AccountNotification');
            }
            else {
                openPopup2('Notification By Text Message', document.all ? 550 : 550, 'AccountNotificationUC');
            }            
        }              
    }
    catch(ex) {}
}

function showBillNotification(obj, altControl)
{
    try
    {
        if (obj != null) {

            IsCalledUnderNotify = true;

            RestObject = obj;
            
            //document.getElementById(altControl).checked = obj.checked;

            if (obj.checked) {
                openPopup2('Notification By Text Message', document.all ? 550 : 550, 'BillNotification');
            }
            else {
                openPopup2('Notification By Text Message', document.all ? 550 : 550, 'BillNotificationUC');
            }            
        }              
    }
    catch(ex) {}
}


function showBillNotificationEMail(obj) {
    try {
        if (obj != null) {

            IsCalledUnderNotify = true;

            RestObject = obj;

            //document.getElementById(altControl).checked = obj.checked;

            if (obj.checked) {
                openPopup2('Notification By Email', document.all ? 550 : 550, 'BillEMailC');
            }
            else {
                openPopup2('Notification By Email', document.all ? 550 : 550, 'BillEMailUC');
            }
        }
    }
    catch (ex) { }
}

