function countryList(blnByLimitList)
{
    var _self = this; //handles scope for contructor vars in function, ie this in function !=  this in constructor
    this.aCountries = new Array();
    this.aDefaults = new Array();
    this.aLimitCountries = new Array();
    this.bByLimitList = blnByLimitList;
    this.init = function()
        {
            _self.aDefaults['US'] = true;
            _self.aCountries.push(new _self.country('AL', 'Albania'));
            _self.aCountries.push(new _self.country('DZ', 'Algeria'));
            _self.aCountries.push(new _self.country('AS', 'American Samoa'));
            _self.aCountries.push(new _self.country('AD', 'Andorra'));
            _self.aCountries.push(new _self.country('AO', 'Angola'));
            _self.aCountries.push(new _self.country('AI', 'Anguilla'));
            _self.aCountries.push(new _self.country('AG', 'Antigua & Barbuda'));
            _self.aCountries.push(new _self.country('AR', 'Argentina'));
            _self.aCountries.push(new _self.country('AM', 'Armenia'));
            _self.aCountries.push(new _self.country('AW', 'Aruba'));
            _self.aCountries.push(new _self.country('AU', 'Australia'));
            _self.aCountries.push(new _self.country('AT', 'Austria'));
            _self.aCountries.push(new _self.country('AP', 'Azores'));
            _self.aCountries.push(new _self.country('BS', 'Bahamas'));
            _self.aCountries.push(new _self.country('BH', 'Bahrain'));
            _self.aCountries.push(new _self.country('BD', 'Bangladesh'));
            _self.aCountries.push(new _self.country('BB', 'Barbados'));
            _self.aCountries.push(new _self.country('BE', 'Belgium'));
            _self.aCountries.push(new _self.country('BZ', 'Belize'));
            _self.aCountries.push(new _self.country('BY', 'Belarus'));
            _self.aCountries.push(new _self.country('BJ', 'Benin'));
            _self.aCountries.push(new _self.country('BM', 'Bermuda'));
            _self.aCountries.push(new _self.country('BT', 'Bhutan'));
            _self.aCountries.push(new _self.country('BO', 'Bolivia'));
            _self.aCountries.push(new _self.country('BL', 'Bonaire'));
            _self.aCountries.push(new _self.country('BA', 'Bosnia'));
            _self.aCountries.push(new _self.country('BW', 'Botswana'));
            _self.aCountries.push(new _self.country('BR', 'Brazil'));
            _self.aCountries.push(new _self.country('VG', 'British Virgin Islands'));
            _self.aCountries.push(new _self.country('BN', 'Brunei'));
            _self.aCountries.push(new _self.country('BG', 'Bulgaria'));
            _self.aCountries.push(new _self.country('BF', 'Burkina Faso'));
            _self.aCountries.push(new _self.country('BI', 'Burundi'));
            _self.aCountries.push(new _self.country('KH', 'Cambodia'));
            _self.aCountries.push(new _self.country('CM', 'Cameroon'));
            _self.aCountries.push(new _self.country('CA', 'Canada'));
            _self.aCountries.push(new _self.country('IC', 'Canary Islands'));
            _self.aCountries.push(new _self.country('CV', 'Cape Verde Islands'));
            _self.aCountries.push(new _self.country('KY', 'Cayman Islands'));
            _self.aCountries.push(new _self.country('CF', 'Central African Republic'));
            _self.aCountries.push(new _self.country('TD', 'Chad'));
            _self.aCountries.push(new _self.country('CD', 'Channel Islands'));
            _self.aCountries.push(new _self.country('CL', 'Chile'));
            _self.aCountries.push(new _self.country('CN', 'China, Peoples Republic of'));
            _self.aCountries.push(new _self.country('CO', 'Colombia'));
            _self.aCountries.push(new _self.country('CG', 'Congo'));
            _self.aCountries.push(new _self.country('CK', 'Cook Islands'));
            _self.aCountries.push(new _self.country('CR', 'Costa Rica'));
            _self.aCountries.push(new _self.country('HR', 'Croatia'));
            _self.aCountries.push(new _self.country('CB', 'Curacao'));
            _self.aCountries.push(new _self.country('CY', 'Cyprus'));
            _self.aCountries.push(new _self.country('CZ', 'Czech Republic'));
            _self.aCountries.push(new _self.country('DK', 'Denmark'));
            _self.aCountries.push(new _self.country('DJ', 'Djibouti'));
            _self.aCountries.push(new _self.country('DM', 'Dominica'));
            _self.aCountries.push(new _self.country('DO', 'Dominican Republic'));
            _self.aCountries.push(new _self.country('EC', 'Ecuador'));
            _self.aCountries.push(new _self.country('EG', 'Egypt'));
            _self.aCountries.push(new _self.country('SV', 'El Salvador'));
            _self.aCountries.push(new _self.country('EN', 'England'));
            _self.aCountries.push(new _self.country('GQ', 'Equitorial Guinea'));
            _self.aCountries.push(new _self.country('ER', 'Eritrea'));
            _self.aCountries.push(new _self.country('EE', 'Estonia'));
            _self.aCountries.push(new _self.country('ET', 'Ethiopia'));
            _self.aCountries.push(new _self.country('FO', 'Faeroe Islands'));
            _self.aCountries.push(new _self.country('FM', 'Federated States of Micronesia'));
            _self.aCountries.push(new _self.country('FJ', 'Fiji'));
            _self.aCountries.push(new _self.country('FI', 'Finland'));
            _self.aCountries.push(new _self.country('FR', 'France'));
            _self.aCountries.push(new _self.country('GF', 'French Guiana'));
            _self.aCountries.push(new _self.country('PF', 'French Polynesia'));
            _self.aCountries.push(new _self.country('GA', 'Gabon'));
            _self.aCountries.push(new _self.country('GM', 'Gambia'));
            _self.aCountries.push(new _self.country('GE', 'Georgia, Republic of'));
            _self.aCountries.push(new _self.country('GE', 'Georgia'));
            _self.aCountries.push(new _self.country('DE', 'Germany'));
            _self.aCountries.push(new _self.country('GH', 'Ghana'));
            _self.aCountries.push(new _self.country('GI', 'Gibraltar'));
            _self.aCountries.push(new _self.country('GR', 'Greece'));
            _self.aCountries.push(new _self.country('GL', 'Greenland'));
            _self.aCountries.push(new _self.country('GD', 'Grenada'));
            _self.aCountries.push(new _self.country('GP', 'Guadeloupe'));
            _self.aCountries.push(new _self.country('GU', 'Guam'));
            _self.aCountries.push(new _self.country('GT', 'Guatemala'));
            _self.aCountries.push(new _self.country('GN', 'Guinea'));
            _self.aCountries.push(new _self.country('GW', 'Guinea-Bissau'));
            _self.aCountries.push(new _self.country('GY', 'Guyana'));
            _self.aCountries.push(new _self.country('HT', 'Haiti'));
            _self.aCountries.push(new _self.country('HO', 'Holland'));
            _self.aCountries.push(new _self.country('HN', 'Honduras'));
            _self.aCountries.push(new _self.country('HK', 'Hong Kong'));
            _self.aCountries.push(new _self.country('HU', 'Hungary'));
            _self.aCountries.push(new _self.country('IS', 'Iceland'));
            _self.aCountries.push(new _self.country('IN', 'India'));
            _self.aCountries.push(new _self.country('ID', 'Indonesia'));
            _self.aCountries.push(new _self.country('IQ', 'Iraq'));
            _self.aCountries.push(new _self.country('IR', 'Iran'));
            _self.aCountries.push(new _self.country('IL', 'Israel'));
            _self.aCountries.push(new _self.country('IT', 'Italy'));
            _self.aCountries.push(new _self.country('CI', 'Ivory Coast'));
            _self.aCountries.push(new _self.country('JM', 'Jamaica'));
            _self.aCountries.push(new _self.country('JP', 'Japan'));
            _self.aCountries.push(new _self.country('JO', 'Jordan'));
            _self.aCountries.push(new _self.country('KZ', 'Kazakhstan'));
            _self.aCountries.push(new _self.country('KE', 'Kenya'));
            _self.aCountries.push(new _self.country('KI', 'Kiribati'));
            _self.aCountries.push(new _self.country('KO', 'Kosrae'));
            _self.aCountries.push(new _self.country('KW', 'Kuwait'));
            _self.aCountries.push(new _self.country('KG', 'Kyrgyzstan'));
            _self.aCountries.push(new _self.country('LA', 'Laos'));
            _self.aCountries.push(new _self.country('LV', 'Latvia'));
            _self.aCountries.push(new _self.country('LB', 'Lebanon'));
            _self.aCountries.push(new _self.country('LS', 'Lesotho'));
            _self.aCountries.push(new _self.country('LR', 'Liberia'));
            _self.aCountries.push(new _self.country('LY', 'Libya'));
            _self.aCountries.push(new _self.country('LI', 'Liechtenstein'));
            _self.aCountries.push(new _self.country('LT', 'Lithuania'));
            _self.aCountries.push(new _self.country('LU', 'Luxembourg'));
            _self.aCountries.push(new _self.country('MO', 'Macau'));
            _self.aCountries.push(new _self.country('MK', 'Macedonia'));
            _self.aCountries.push(new _self.country('MG', 'Madagascar'));
            _self.aCountries.push(new _self.country('ME', 'Madeira'));
            _self.aCountries.push(new _self.country('MW', 'Malawi'));
            _self.aCountries.push(new _self.country('MY', 'Malaysia'));
            _self.aCountries.push(new _self.country('MV', 'Maldives'));
            _self.aCountries.push(new _self.country('ML', 'Mali'));
            _self.aCountries.push(new _self.country('MT', 'Malta'));
            _self.aCountries.push(new _self.country('MH', 'Marshall Islands'));
            _self.aCountries.push(new _self.country('MQ', 'Martinique'));
            _self.aCountries.push(new _self.country('MR', 'Mauritania'));
            _self.aCountries.push(new _self.country('MU', 'Mauritius'));
            _self.aCountries.push(new _self.country('MX', 'Mexico'));
            _self.aCountries.push(new _self.country('MD', 'Moldova'));
            _self.aCountries.push(new _self.country('MC', 'Monaco'));
            _self.aCountries.push(new _self.country('MC', 'Monogolia'));
            _self.aCountries.push(new _self.country('MS', 'Montserrat'));
            _self.aCountries.push(new _self.country('MA', 'Morocco'));
            _self.aCountries.push(new _self.country('MZ', 'Mozambique'));
            _self.aCountries.push(new _self.country('MM', 'Myanmar'));
            _self.aCountries.push(new _self.country('NA', 'Namibia'));
            _self.aCountries.push(new _self.country('NR', 'Nauru'));
            _self.aCountries.push(new _self.country('NP', 'Nepal'));
            _self.aCountries.push(new _self.country('NL', 'Netherlands'));
            _self.aCountries.push(new _self.country('AN', 'Netherlands Antilles'));
            _self.aCountries.push(new _self.country('NC', 'New Caledonia'));
            _self.aCountries.push(new _self.country('NZ', 'New Zealand'));
            _self.aCountries.push(new _self.country('NI', 'Nicaragua'));
            _self.aCountries.push(new _self.country('NE', 'Niger'));
            _self.aCountries.push(new _self.country('NG', 'Nigeria'));
            _self.aCountries.push(new _self.country('NF', 'Norfolk Island'));
            _self.aCountries.push(new _self.country('NB', 'Northern Ireland'));
            _self.aCountries.push(new _self.country('NB', 'Northern Mariana Islands'));
            _self.aCountries.push(new _self.country('NO', 'Norway'));
            _self.aCountries.push(new _self.country('OM', 'Oman'));
            _self.aCountries.push(new _self.country('PK', 'Pakistan'));
            _self.aCountries.push(new _self.country('PW', 'Palau'));
            _self.aCountries.push(new _self.country('PA', 'Panama'));
            _self.aCountries.push(new _self.country('PG', 'Papua New Guinea'));
            _self.aCountries.push(new _self.country('PY', 'Paraguay'));
            _self.aCountries.push(new _self.country('PE', 'Peru'));
            _self.aCountries.push(new _self.country('PH', 'Philippines'));
            _self.aCountries.push(new _self.country('PN', 'Pitcairn Island'));
            _self.aCountries.push(new _self.country('PL', 'Poland'));
            _self.aCountries.push(new _self.country('PO', 'Ponape'));
            _self.aCountries.push(new _self.country('PO', 'Portugal'));
            _self.aCountries.push(new _self.country('PR', 'Puerto Rico'));
            _self.aCountries.push(new _self.country('PR', 'Qatar'));
            _self.aCountries.push(new _self.country('IE', 'Republic of Ireland'));
            _self.aCountries.push(new _self.country('YE', 'Republic of Yemen'));
            _self.aCountries.push(new _self.country('RE', 'Reunion'));
            _self.aCountries.push(new _self.country('RO', 'Romania'));
            _self.aCountries.push(new _self.country('RT', 'Rota'));
            _self.aCountries.push(new _self.country('RU', 'Russia'));
            _self.aCountries.push(new _self.country('RW', 'Rwanda'));
            _self.aCountries.push(new _self.country('RW', 'Saba'));
            _self.aCountries.push(new _self.country('SP', 'Saipan'));
            _self.aCountries.push(new _self.country('SM', 'San Marino'));
            _self.aCountries.push(new _self.country('ST', 'Sao Tome and Principe'));
            _self.aCountries.push(new _self.country('SA', 'Saudi Arabia'));
            _self.aCountries.push(new _self.country('SF', 'Scotland'));
            _self.aCountries.push(new _self.country('SN', 'Senegal'));
            _self.aCountries.push(new _self.country('SC', 'Seychelles'));
            _self.aCountries.push(new _self.country('SC', 'Sierra Leone'));
            _self.aCountries.push(new _self.country('SG', 'Singapore'));
            _self.aCountries.push(new _self.country('SK', 'Slovakia'));
            _self.aCountries.push(new _self.country('SI', 'Slovenia'));
            _self.aCountries.push(new _self.country('SB', 'Solomon Islands'));
            _self.aCountries.push(new _self.country('ZA', 'South Africa'));
            _self.aCountries.push(new _self.country('KR', 'South Korea'));
            _self.aCountries.push(new _self.country('ES', 'Spain'));
            _self.aCountries.push(new _self.country('LK', 'Sri Lanka'));
            _self.aCountries.push(new _self.country('NT', 'St. Barthelemy'));
            _self.aCountries.push(new _self.country('SW', 'St. Christopher'));
            _self.aCountries.push(new _self.country('SX', 'St. Croix'));
            _self.aCountries.push(new _self.country('EU', 'St. Eustatius'));
            _self.aCountries.push(new _self.country('UV', 'St. John'));
            _self.aCountries.push(new _self.country('KN', 'St. Kitts &amp; Nevis'));
            _self.aCountries.push(new _self.country('LC', 'St. Lucia'));
            _self.aCountries.push(new _self.country('MB', 'St. Maarten'));
            _self.aCountries.push(new _self.country('TB', 'St. Martin'));
            _self.aCountries.push(new _self.country('VL', 'St. Thomas'));
            _self.aCountries.push(new _self.country('VC', 'St. Vincent &amp; the Grenadines'));
            _self.aCountries.push(new _self.country('SD', 'Sudan'));
            _self.aCountries.push(new _self.country('SR', 'Suriname'));
            _self.aCountries.push(new _self.country('SZ', 'Swaziland'));
            _self.aCountries.push(new _self.country('SE', 'Sweden'));
            _self.aCountries.push(new _self.country('CH', 'Switzerland'));
            _self.aCountries.push(new _self.country('SY', 'Syria'));
            _self.aCountries.push(new _self.country('TA', 'Tahiti'));
            _self.aCountries.push(new _self.country('TW', 'Taiwan'));
            _self.aCountries.push(new _self.country('TJ', 'Tajikistan'));
            _self.aCountries.push(new _self.country('TZ', 'Tanzania'));
            _self.aCountries.push(new _self.country('TH', 'Thailand'));
            _self.aCountries.push(new _self.country('TI', 'Tinian'));
            _self.aCountries.push(new _self.country('TG', 'Togo'));
            _self.aCountries.push(new _self.country('TO', 'Tonga'));
            _self.aCountries.push(new _self.country('TL', 'Tortola'));
            _self.aCountries.push(new _self.country('TT', 'Trinidad &amp; Tobago'));
            _self.aCountries.push(new _self.country('TU', 'Truk'));
            _self.aCountries.push(new _self.country('TN', 'Tunisia'));
            _self.aCountries.push(new _self.country('TR', 'Turkey'));
            _self.aCountries.push(new _self.country('TM', 'Turkmenistan'));
            _self.aCountries.push(new _self.country('TC', 'Turks & Caicos Islands'));
            _self.aCountries.push(new _self.country('TV', 'Tuvalu'));
            _self.aCountries.push(new _self.country('UG', 'Uganda'));
            _self.aCountries.push(new _self.country('UA', 'Ukraine'));
            _self.aCountries.push(new _self.country('VC', 'Union Island'));
            _self.aCountries.push(new _self.country('AE', 'United Arab Emirates'));
            _self.aCountries.push(new _self.country('GB', 'United Kingdom'));
            _self.aCountries.push(new _self.country('US', 'United States'));
            _self.aCountries.push(new _self.country('UY', 'Uruguay'));
            _self.aCountries.push(new _self.country('VI', 'US Virgin Islands'));
            _self.aCountries.push(new _self.country('UZ', 'Uzbekistan'));
            _self.aCountries.push(new _self.country('VU', 'Vanuatu'));
            _self.aCountries.push(new _self.country('VA', 'Vatican City'));
            _self.aCountries.push(new _self.country('VE', 'Venezuela'));
            _self.aCountries.push(new _self.country('VN', 'Vietnam'));
            _self.aCountries.push(new _self.country('VR', 'Virgin Gorda'));
            _self.aCountries.push(new _self.country('WK', 'Wake Island'));
            _self.aCountries.push(new _self.country('WL', 'Wales'));
            _self.aCountries.push(new _self.country('WF', 'Wallis &amp; Futuna Islands'));
            _self.aCountries.push(new _self.country('WS', 'Western Samoa'));
            _self.aCountries.push(new _self.country('YA', 'Yap'));
            _self.aCountries.push(new _self.country('YU', 'Yugoslavia'));
            _self.aCountries.push(new _self.country('ZR', 'Zaire'));
            _self.aCountries.push(new _self.country('ZM', 'Zambia'));
            _self.aCountries.push(new _self.country('ZW', 'Zimbabwe'));
        };
    this.country = function(sCountryCode, sDisplayValue)
        {
            this.ctryCode = sCountryCode;
            this.displayValue = sDisplayValue;
        };
    this.setdefaultSel = function(sCountry)
        {
            _self.defaultSel = sCountry;
        };
    this.addSelectCountry = function(sSelectedCountry)
        {
            if(!_self.aDefaults[sSelectedCountry]) _self.aDefaults[sSelectedCountry] = true;
        };
    this.removeSelectCountry = function(sSelectedCountry)
        {
            if(_self.aDefaults[sSelectedCountry]) _self.aDefaults[sSelectedCountry] = false;
        };
    this.returnCntrySel = function(sTagName, iSize, bMultiple, sInitialOpt)
		{
			var aHTML = new Array();
			if(!arguments[1]) iSize = 1;
			var sMultiple = (arguments[2])?' size="' + iSize + '" multiple="multiple"':'';
			aHTML.push('<select name="' + sTagName + '" id="' + sTagName + '"' + sMultiple + '><option value="">' +  ((sInitialOpt != null)?'All Countries':'Select a Country') + '</option>');
			for(var i=0; i < _self.aCountries.length; i++)
			{
			    if( !_self.bByLimitList || (_self.aLimitCountries[_self.aCountries[i].ctryCode] && _self.bByLimitList) )
			    {
				    var sSelect = (_self.aDefaults[this.aCountries[i].ctryCode])?' selected="selected"':'';
				    aHTML.push('<option value="' + _self.aCountries[i].ctryCode + '"' + sSelect + '>' + _self.aCountries[i].displayValue + '</option>');
                }
			}
			aHTML.push('</select>');
			return aHTML.join('');
		};
	this.returnCountryName = function(sCode)
	    {
	        for(var i=0; i<_self.aCountries.length; i++)
	            if(sCode.toUpperCase() == _self.aCountries[i].code.toUpperCase())
	                return _self.aCountries[i].displayValue;
	        return '';
	    };
    this.returnLimitedCountries = function()
        {
            var aCountries = new Array();
            var bIsLimited = false;
            for(var i=0; i<_self.aCountries.length; i++)
            {
                if(_self.aDefaults[_self.aCountries[i].ctryCode])
                {
                    aCountries.push(_self.aCountries[i].displayValue)
                    bIsLimited = true;
                }
            }
            return (!bIsLimited)?'You currently allow shipments to all countries':'You currently limit shipments to:<br /><span style="padding-left: 15px;">' + aCountries.join(', ') + '</span>';
        };
    this.returnUserLimitedCountries = function()
        {
            var aCountries = new Array();
            var bIsLimited = false;
            for(var i=0; i<_self.aCountries.length; i++)
            {
                if(_self.aLimitCountries[_self.aCountries[i].ctryCode])
                {
                    aCountries.push(_self.aCountries[i].displayValue)
                    bIsLimited = true;
                }
            }
            return (!bIsLimited)?'':'<br />Shipments are limited to the following:<br /><span style="padding-left: 15px;">' + aCountries.join(', ') + '</span>';
        };
    this.addLimitCountry = function(sSelectedCountry)
        {
            if(!_self.aLimitCountries[sSelectedCountry]) _self.aLimitCountries[sSelectedCountry] = true;
        }
}
var oCountryList = new countryList(false)
oCountryList.init();
