﻿// Ensure Root Namespaces are existing..
if( aspdnsf == undefined || aspdnsf == null ) {
    var aspdnsf = new function(){};
}

if( aspdnsf.Controls == undefined || aspdnsf.Controls == null ) {
    aspdnsf.Controls = new function(){};
}

aspdnsf.Controls.AddressControl = Class.create();
aspdnsf.Controls.AddressControl.prototype = {

    initialize : function(id) {
        this.id = id;
        this.validationController = new aspdnsf.Validators.ValidationController();
        
        var elemBusinessType = $(id + "_BusinessType");
        if(null != elemBusinessType) {
            elemBusinessType.observe('change', this.switchBusinessType.bindAsEventListener(this));
        }
        
        var elemCountry = $(id + "_Country");
        if(null != elemCountry) {
            elemCountry.observe('change', this.switchCountry.bindAsEventListener(this));
        }
        
        // now check for the auto input value of text for account name
        var elemFirstName = $(this.id + "_FirstName");
        var elemLastName = $(this.id + "_LastName");
        var elemAccountName = $(this.id + "_AccountName");
        
        if( null != elemFirstName && 
            null != elemLastName && 
            null != elemAccountName) {
            
            var updateAccountName = function() {
                var currentValue = elemAccountName.value;
                if(currentValue == '')
                {
                    currentValue = elemFirstName.value + ' ' + elemLastName.value;
                    elemAccountName.value = currentValue;
                }
            }
            
            elemLastName.observe('blur', updateAccountName);
        }
    },
    
    switchBusinessType : function() {
        var elemBusinessType = $(this.id + "_BusinessType");
        
        var taxRowId = $(this.id + '_TaxNumberRow');
        
        if(elemBusinessType.value == "WholeSale") {
            //rowTaxNumberSelector.show();            
            aspdnsf.Utils.showRow(taxRowId);
        }
        else {
            aspdnsf.Utils.hideRow(taxRowId);
        }
    },
    
    clearStates : function() {
        var elemState = $(this.id + "_WithStateState");
        if(elemState) {
            elemState.options.length = 0;
        }
    },
    
    switchCountry : function() {
        var elemCountry = $(this.id + "_Country");
        var elemState = $(this.id + "_WithStateState");
        
        if(null != elemCountry) {
            var country = aspdnsf.Controls.CountryRepository.findCountry(elemCountry.value);
            
            if(country.withState) {
                
                aspdnsf.Utils.showRow(this.id + '_WithStateCityStatePostalRow');
                aspdnsf.Utils.hideRow(this.id + '_WithoutStateCityRow');
                aspdnsf.Utils.hideRow(this.id + '_WithoutStateCountyPostalRow');
                
                var populateState = function(states) {
                    if(states.length == 0) {
                        elemState.options[0] = new Option('None', '');
                    }
                    else {
                        country.states.each(
                            function(state, idx) {
                                var display = state.code + " - " + state.description;
                                
                                elemState.options[idx] = new Option(display, state.code);
                            }
                        );
                    }
                    
                    elemState.disabled = false;
                }
                
                // clear the values then repopulate
                this.clearStates();
                elemState.options[0] = new Option('Fetching', '');
                elemState.disabled = true;
                
                if(null != country.states) {
                    populateState(country.states);
                }
                
                else {
                    // request for the states 
                    var url = 'address.axd?action=getStates&country=' + encodeURIComponent(country.code);
                    
                    new Ajax.Request(
                        url,
                        {
                            method : 'get',
                            onSuccess : function(transport) {
                                var response = transport.responseText.evalJSON();
                                if(response) {
                                    country.states = response;
                                    populateState(response);
                                }
                            }
                        }
                    );
                }
            }
            else {
                this.clearStates();
                
                aspdnsf.Utils.hideRow(this.id + '_WithStateCityStatePostalRow');
                aspdnsf.Utils.showRow(this.id + '_WithoutStateCityRow');
                aspdnsf.Utils.showRow(this.id + '_WithoutStateCountyPostalRow');
            }
        }
    },
    
    getFirstName : function() {
        var elem = $(this.id + '_FirstName');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getLastName : function() {
        var elem = $(this.id + '_LastName');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getAccountName : function() {
        var elem = $(this.id + '_AccountName');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getCountry : function() {
        var elem = $(this.id + '_Country');
        if(elem) {
            return elem.options[elem.selectedIndex].value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getAddress : function() {
        var elem = $(this.id + '_Address');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getResidenceType : function() {
        var elem = $(this.id + '_ResidenceType');
        if(elem) {
            return elem.options[elem.selectedIndex].value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getBusinessType : function() {
        var elem = $(this.id + '_BusinessType');
        if(elem) {
            return elem.options[elem.selectedIndex].value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getTaxNumber : function() {
        var elem = $(this.id + '_TaxNumber');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getWithStateCity : function() {
        var elem = $(this.id + '_WithStateCity');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getWithStateState : function() {
        var elem = $(this.id + '_WithStateState');
        if(elem) {
            return elem.options[elem.selectedIndex].value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getWithStatePostalCode : function() {
        var elem = $(this.id + '_WithStatePostalCode');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getWithoutStateCity : function() {
        var elem = $(this.id + '_WithoutStateCity');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getWithoutStatePostalCode : function() {
        var elem = $(this.id + '_WithoutStatePostalCode');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getCounty : function() {
        var elem = $(this.id + '_County');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    getPhone : function() {
        var elem = $(this.id + '_Phone');
        if(elem) {
            return elem.value;
        }
        
        return aspdnsf.Constants.EMPTY_STRING;
    },
    
    setFirstName : function(value) {
        var elem = $(this.id + '_FirstName');
        if(elem) {
            elem.value = value;
        }
    },
    
    setLastName : function(value) {
        var elem = $(this.id + '_LastName');
        if(elem) {
            elem.value = value;
        }
    },
    
    setAccountName : function(value) {
        var elem = $(this.id + '_AccountName');
        if(elem) {
            elem.value = value;
        }
    },
    
    setCountry : function(value) {
        var elem = $(this.id + '_Country');
        if(elem) {
            // check if we should need to
            if(this.getCountry() != value) {
                var idx = 0;
                for(var ctr=0; ctr<elem.options.length; ctr++) {
                    var option = elem.options[ctr];
                    if(option.value == value) {
                        idx = ctr;
                        break;
                    }
                }
                
                elem.selectedIndex = idx;
                
                this.switchCountry();
            }
        }
    },
    
    setAddress : function(value) {
        var elem = $(this.id + '_Address');
        if(elem) {
            elem.value = value;
        }
    },
    
    setResidenceType : function(value) {
        var elem = $(this.id + '_ResidenceType');
        if(elem) {
            var idx = 0;
            for(var ctr=0; ctr<elem.options.length; ctr++) {
                var option = elem.options[ctr];
                if(option.value == value) {
                    idx = ctr;
                    break;
                }
            }
            elem.selectedIndex = idx;
        }
    },
    
    setBusinessType : function(value) {
        var elem = $(this.id + '_Businesstype');
        if(elem) {
            var idx = 0;
            for(var ctr=0; ctr<elem.options.length; ctr++) {
                var option = elem.options[ctr];
                if(option.value == value) {
                    idx = ctr;
                    break;
                }
            }
            elem.selectedIndex = idx;
            
            this.switchBusinessType();
        }
    },
    
    setTaxNumber : function(value) {
        var elem = $(this.id + '_TaxNumber'); 
        if(elem) {
            elem.value = value;
        }
    },
    
    setWithStateCity : function(value) {
        var elem = $(this.id + '_WithStateCity');
        if(elem) {
            elem.value = value;
        }
    },
    
    setWithStateState : function(value) {
        var elem = $(this.id + '_WithStateState');
        if(elem) {
            var idx = 0;
            for(var ctr=0; ctr<elem.options.length; ctr++) {
                var option = elem.options[ctr];
                if(option.value == value) {
                    idx = ctr;
                    break;
                }
            }
            
            elem.selectedIndex = idx;
        }
    },
    
    setWithStatePostalCode : function(value) {
        var elem = $(this.id + '_WithStatePostalCode');
        if(elem) {
            elem.value = value;
        }
    },
    
    setWithoutStateCity : function(value) {
        var elem = $(this.id + '_WithoutStateCity');
        if(elem) {
            elem.value = value;
        }
    },
    
    setWithoutStatePostalCode : function(value) {
        var elem = $(this.id + '_WithoutStatePostalCode');
        if(elem) {
            elem.value = value;
        }
    },
    
    setCounty : function(value) {
        var elem = $(this.id + '_County');
        if(elem) {
            elem.value = value;
        }
    },
    
    setPhone : function(value) {
        var elem = $(this.id + '_Phone');
        if(elem) {
            elem.value = value;
        }
    },
    
    getValue : function() {
        var country = this.getCountry();
        var countryInfo = aspdnsf.Controls.CountryRepository.findCountry(country);
        var city = aspdnsf.Constants.EMPTY_STRING;
        var state = aspdnsf.Constants.EMPTY_STRING;
        var postalCode = aspdnsf.Constants.EMPTY_STRING;
        var county = aspdnsf.Constants.EMPTY_STRING;
        
        if(countryInfo.withState) {
            city = this.getWithStateCity();
            state = this.getWithStateState();
            postalCode=  this.getWithStatePostalCode();
        }
        else {
            city = this.getWithoutStateCity();
            postalCode = this.getWithoutStatePostalCode();
        }
        
        var address = {
            firstName       : this.getFirstName(),
            lastName        : this.getLastName(),
            accountName     : this.getAccountName(),
            address         : this.getAddress(),
            country         : country,
            city            : city,
            state           : state,
            withState       : countryInfo.withState,
            postalCode      : postalCode,
            county          : this.getCounty(),
            residenceType   : this.getResidenceType(),
            phone           : this.getPhone()
        }
        
        return address;
    },
    
    setValue : function(address) {
        if(address) {
            this.setFirstName(address.firstName);
            this.setLastName(address.lastName);
            this.setAccountName(address.accountName);
            this.setCountry(address.country);
            this.setAddress(address.address);
            this.setResidenceType(address.residenceType);
            this.setWithStateCity(address.city);
            if(address.withState) {
                this.setWithStateState(address.state);
            }
            else {
                this.clearStates();
            }
            this.setWithStatePostalCode(address.postalCode);
            this.setWithoutStateCity(address.city);
            this.setWithoutStatePostalCode(address.postalCode);
            this.setCounty(address.county);
            this.setPhone(address.phone);
        }
    },
    
    serialize : function() {
        var info = this.getValue();
        
        var serialized = 
        "FirstName=" + encodeURIComponent(info.firstName) +
        "&LastName=" + encodeURIComponent(info.lastName) +
        "&AccountName=" + encodeURIComponent(info.accountName) +
        "&Address=" + encodeURIComponent(info.address) +
        "&Country=" + encodeURIComponent(info.country) +
        "&City=" + encodeURIComponent(info.city) +
        "&State=" + encodeURIComponent(info.state) +
        "&PostalCode=" + encodeURIComponent(info.postalCode) +
        "&County=" + encodeURIComponent(info.county) +
        "&ResidenceType=" + encodeURIComponent(info.residenceType) + 
        "&Phone=" + encodeURIComponent(info.phone);
        
        return serialized;
    },
    
    setValidationSummary : function(summary) {
        this.validationController.setValidationSummary(summary);
    },
    
    clearValidationSummary : function() {
        this.validationController.clear();
    },
    
    registerValidator : function(validator) {
        this.validationController.register(validator);
    },
    
    validate : function(clear) {
        return this.validationController.validate(clear);
    },
    
    clear : function() {
        this.setFirstName("");
        this.setLastName("");
        this.setAccountName("");
        this.setCountry("");
        this.setAddress("");        
        this.setResidenceType("");
        this.setWithStateCity("");        
        this.setWithStatePostalCode("");
        this.setWithoutStateCity("");
        this.setWithoutStatePostalCode("");
        this.setCounty("");
        this.setPhone("");
    }
    
};

aspdnsf.Controls.CountryRepository = {
    
    initialize : function() {
        this.countries = new Hash();
        this.countriesArray = null;
    },
    
    setCountries : function(countriesDTO) {
        
        var countries = this.countries;
        
        this.countriesArray = countriesDTO;
        
        countriesDTO.each(
            function(country, index) {
                countries[country.code] = country;
            }
        );
    },
    
    findCountry : function(code) {
        return this.countries[code];
    }
    
}

aspdnsf.Controls.CountryRepository.initialize();




aspdnsf.Controls.AddressController = {
    
    initialize : function() {
        this.addresses = new Hash();
        this.observers = new Array();
    },
    
    registerControl : function(addressId) {
        var addr = new aspdnsf.Controls.AddressControl(addressId);
        
        this.addresses[addressId] = addr;
        
        this.notifyObservers(addr);
        
        return addr;
    },
    
    addObserver : function(observer) {
        if(observer) {
            this.observers[this.observers.length] = observer;
        }
    },
    
    notifyObservers : function(control) {
        for(var ctr=0; ctr< this.observers.length; ctr++) {
            this.observers[ctr].notify(control);
        }
    },
    
    getControl : function(id) {
        var ctrl = this.addresses[id];
        return ctrl;
    }
        
}

aspdnsf.Controls.AddressController.initialize();

aspdnsf.Controls.AddressSelectorControl = Class.create();
aspdnsf.Controls.AddressSelectorControl.prototype = {
    
    initialize : function(id, addresses) {
        this.id = id;
        this.control = $(id);
        this.addresses = null; 
        
        if(this.control) {
            this.control.observe('change', this.onSelectedAddressChanged.bindAsEventListener(this));
        }
        
        this.selectedAddresChangedEventHandler = null;
    },
    
    setAddresses : function(addresses) {
        this.addresses = addresses;
    },
    
    getSelectedAddress : function() {
        var idx = this.control.selectedIndex;
        if(this.addresses && this.addresses.length >= idx) {
            return this.addresses[idx];
        }
        
        return null;
    },
    
    onSelectedAddressChanged : function() {
        
        if(this.selectedAddresChangedEventHandler) {
            this.selectedAddresChangedEventHandler();
        }
    },
    
    setSelectedAddressChangedEventHandler : function(handler) {
        this.selectedAddresChangedEventHandler = handler;
    },
    
    addAddress : function(newAddress, setSelected) {
        this.control.options[this.control.options.length] = new Option(newAddress.full, newAddress.id);
        
        if(setSelected) {
            this.control.selectedIndex = (this.control.options.length - 1);
        }
    }
}

aspdnsf.Controls.AddressSelectorController = {

    initialize : function() {
        this.selectors = new Hash();
        this.observers = new Array();
    },
    
    registerControl : function(id) {
        var control = new aspdnsf.Controls.AddressSelectorControl(id);
        
        this.selectors[id] = control;
        
        this.notifyObservers(control);
        
        return control;
    },
    
    addObserver : function(observer) {
        if(observer) {
            this.observers[this.observers.length] = observer;
        }
    },
    
    notifyObservers : function(control) {
        for(var ctr=0; ctr< this.observers.length; ctr++) {
            this.observers[ctr].notify(control);
        }
    },
    
    getControl : function(id) {
        var ctrl = this.selectors[id];
        return ctrl;
    },
    
    getControls : function() {
        return this.selectors.values();
    }
    
}

aspdnsf.Controls.AddressSelectorController.initialize();


aspdnsf.Constants.ADDRESS_STATE_HIDDEN = 0;
aspdnsf.Constants.ADDRESS_STATE_VISIBLE = 1;

aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_MOUSEOVER = 0;
aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_MOUSEOUT = 1;
aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_POPUP = 2;
aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_POPUPCLOSED = 3;

aspdnsf.Controls.AddNewAddressControl = Class.create();
aspdnsf.Controls.AddNewAddressControl.prototype = {

    initialize : function(id) {
        this.id = id;
        this.control = $(id);
        this.pnlAddNew = $(this.id + '_pnlAddNew');
        this.addNewLink = $(this.id + '_AddNew');
        this.saveLink = $(this.id + '_Save');
        this.cancelLink = $(this.id + '_Cancel');
        this.addressContainer = $(this.id + '_Content');
        
        this.pnlCommand = $(this.id + '_pnlCommand');
        this.saveLink.onclick = this.saveAddress.bind(this);
        
        this.pnlAddNew.onclick = this.toggleVisibility.bind(this);
        this.pnlAddNew.observe("mouseover", this.addNewLinkMouseOverEventHandler.bind(this));
        this.pnlAddNew.observe("mouseout", this.addNewLinkMouseOutEventHandler.bind(this));
        
        this.cancelLink.onclick = this.toggleVisibility.bind(this);
        
        this.state = aspdnsf.Constants.ADDRESS_STATE_HIDDEN;
        
        this.addressControlId = '';
        this.addressControl = null;
        
        this.addressAddedEventHandlers = new Array();
    },
    
    addNewLinkMouseOverEventHandler : function(withPopUpShown) {
        if(this.state != aspdnsf.Constants.ADDRESS_STATE_VISIBLE) {
            this.setAddNewLinkPanelAppearance(aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_MOUSEOVER);
        }
    },
    
    addNewLinkMouseOutEventHandler : function() {
        if(this.state != aspdnsf.Constants.ADDRESS_STATE_VISIBLE) {
            this.setAddNewLinkPanelAppearance(aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_MOUSEOUT);
        }
    },
    
    setAddNewLinkPanelAppearance : function(action) {
        switch(action) {
            case aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_MOUSEOVER:
                this.pnlAddNew.className = "AddNewAddressLinkHover";
                break;
            case aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_MOUSEOUT:
                this.pnlAddNew.className = "AddNewAddressLink";
                break;
            case aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_POPUP:
                this.pnlAddNew.className = "AddNewAddressLinkWithPopUp";
                break;
            case aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_POPUPCLOSED:
                this.pnlAddNew.className = "AddNewAddressLink";
                break;
        }
    },

    addAddressAddedEventHandler : function(handler) {
        this.addressAddedEventHandlers.push(handler);
    },
    
    onAddressAdded : function(newAddress) {
        for(var ctr=0; ctr<this.addressAddedEventHandlers.length;ctr++) {
            var handler = this.addressAddedEventHandlers[ctr];
            handler(newAddress);
        }
        
        this.enableCommands();
        
        if(this.addressControl) {
            this.addressControl.clear();
            this.toggleVisibility();
        }
    },
    
    enableCommands : function() {
        this.pnlCommand.className = "AddNewAddressCommand";
        this.saveLink.onclick = this.saveAddress.bind(this);
    },
    
    disableCommands : function() {
        this.pnlCommand.className = "AddNewAddressCommandDisabled";
        this.saveLink.onclick = null;
    },

    setAddressControlId : function(id) {
        this.addressControlId = id;
        
        var control = aspdnsf.Controls.AddressController.getControl(id);
        if(control) {
            this.setAddressControl(control);
        }
        else {
            aspdnsf.Controls.AddressController.addObserver(this);
        }
    },
    
    notify : function(control) {
        if(control.id == this.addressControlId) {
            this.setAddressControl(control);
        }
    },
    
    setAddressControl : function(control) {
        this.addressControl = control;
    },
    
    saveAddress : function() {
        if(this.addressControl) {
            if(this.addressControl.validate(true)) {            
                var value = this.addressControl.serialize();                                
                var onAddressAddedDelegate = this.onAddressAdded.bind(this);
                
                this.disableCommands();
            
                var req = new Ajax.Request('action.axd?action=addNewShippingAddress',
                    {
                        method : 'post',
                        parameters : value,
                        onSuccess : function(transport) {
                            try {
                                var newAddress = eval("(" + transport.responseText + ")");
                                onAddressAddedDelegate(newAddress);
                            }
                            catch(e) {
                                alert(e);
                            }
                        },
                        
                        onFailure : function(transport) {
                        }
                    }
                );
            }
        }
    },
    
    toggleVisibility : function(forcedState) {
    
        var state = this.state;
        if(forcedState) {
            state = this.state;
        }
        switch(state) {
            case aspdnsf.Constants.ADDRESS_STATE_HIDDEN:
                this.showAddress(); 
                this.state = aspdnsf.Constants.ADDRESS_STATE_VISIBLE;
                this.setAddNewLinkPanelAppearance(aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_POPUP);
                break;                
                
            case aspdnsf.Constants.ADDRESS_STATE_VISIBLE:
                this.hideAddress(); 
                this.state = aspdnsf.Constants.ADDRESS_STATE_HIDDEN;
                this.setAddNewLinkPanelAppearance(aspdnsf.Constants.ADDRESS_ADD_NEW_LINK_ACTION_POPUPCLOSED);
                break;
                
        }
    },
    
    handleOnBodyClick : function() {
        if(this.isVisible()) {
            this.hideAddress();
        }
    },
    
    isVisible : function() {
        return this.state == aspdnsf.Constants.ADDRESS_STATE_VISIBLE;
    },
    
    showAddress : function() {
        this.addressContainer.style.display = '';
        this.addressContainer.style.zIndex = 999999;
    },
    
    hideAddress : function() {
        this.addressContainer.style.display = 'none';
    }    

}

aspdnsf.Controls.AddNewAddressController = {

    initialize : function() {
        this.controls = new Hash();
        this.observers = new Array();
    },
    
    registerControl : function(id) {
        var control = new aspdnsf.Controls.AddNewAddressControl(id);
        
        this.controls[id] = control;
        
        this.notifyObservers(control);
        
        return control;
    },
    
    addObserver : function(observer) {
        if(observer) {
            this.observers[this.observers.length] = observer;
        }
    },
    
    notifyObservers : function(control) {
        for(var ctr=0; ctr< this.observers.length; ctr++) {
            this.observers[ctr].notify(control);
        }
    },
    
    getControl : function(id) {
        var ctrl = this.controls[id];
        return ctrl;
    }
    
}

aspdnsf.Validators.DisallowShippingToPOBoxesValidator = Class.create();
aspdnsf.Validators.DisallowShippingToPOBoxesValidator.prototype = {
    
    initialize : function(controlId, errorMessage, next) {
        Object.extend(this, aspdnsf.Validators.BaseValidator);
        this.control = $(controlId);
        this.errorMessage = errorMessage;
        this.next = next;
        
        this.isValid = true;
    },
    
    validate : function() {
        this.isValid = true;
        
        if(this.control) {
            var value = this.control.value.toLowerCase().replace(/./g, "").replace(/ /g, "");            

            if((value.indexOf('pobox') != -1) || (value.indexOf('p.o.box') != -1) || (value.indexOf('postoffice') != -1)) {
                this.isValid = false;
                return;
            }           
           
        }
    },
    
    toString : function() {
        return 'POBox Address Validator';
    }
}

aspdnsf.Controls.AddNewAddressController.initialize();
