
//The Id of user control that is being loaded into Customers Central
var ucSelectSubscriberId = 'ctl00_eContent_ucSubscriberDetail_ucSelectSubscriber';

if (typeof (CustomerCentral) != 'undefined') {

    CustomerCentral[ucSelectSubscriberId] = new Object();

    CustomerCentral[ucSelectSubscriberId].RequestManager = Sys.WebForms.PageRequestManager.getInstance();

    CustomerCentral[ucSelectSubscriberId].EndRequestHandler = function (sender, args) {
        $('[id$=_ucSelectSubscriber_tblLoading]')[0].style.display = 'none';

        try {
            // If IE 6
            if (navigator.appVersion.indexOf('MSIE 6.0') >= 0) {
                var panelSubscriberResults = $('[id$=_pnlSubscriberResults]')[0];
                if (panelSubscriberResults) {
                    panelSubscriberResults.style.height = '300px';
                }
            }
        } catch (e) {
            //                        debugger;
        }
    };

    CustomerCentral[ucSelectSubscriberId].BeginRequestHandler = function (sender, args) {
        if (sender._postBackSettings.sourceElement.id !== $('[id$=_ucSelectSubscriber_tblLoading]').attr('id'))
            $('[id$=_ucSelectSubscriber_tblLoading]')[0].style.display = 'inline';
    };

    if (CustomerCentral[ucSelectSubscriberId].RequestManager != null) {
        CustomerCentral[ucSelectSubscriberId].RequestManager.add_endRequest(CustomerCentral[ucSelectSubscriberId].EndRequestHandler);
        CustomerCentral[ucSelectSubscriberId].RequestManager.add_beginRequest(CustomerCentral[ucSelectSubscriberId].BeginRequestHandler);
    }

    CustomerCentral[ucSelectSubscriberId].ClosePopup = function () {
        try {
            var temp = $find('CloseSearch');
            if (temp) {
                temp.hide();
            }
        }
        catch (e) {
            alert($('[id$=_hdAlertAnexceptionoccurredinSelectSubscriber]').val());
        }

        return false;
    }
}

function CCValidate(source, args) {
    if ($('[id$=_txtCC6Number]').val() !== '' && $('[id$=_txtCC4Number]').val() === '') {
        args.IsValid = false;
        return;
    }

    if ($('[id$=_txtCC6Number]').val() === '' && $('[id$=_txtCC4Number]').val() !== '') {
        args.IsValid = false;
        return;
    }
}

function btnSelect_ClientClick() {
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);

        if (rv < 8.0) {

            $('[id$=_UpdatePanel2]').attr('style', 'height: 449px !important');
            $('[id$=_pnlHandsetHistory]').attr('style', 'margin-top: 8px !important');
        }
    }
}