U.UI = {
	/*_controls : {},
	Create : function(type, element) {
		if (this._controls[element]) return this._controls[element];
		else {
			//alert($A(arguments).removeAt(0).length)
			
			alert(this[type])
			return new this[type].apply(null, Array.slice(arguments, 0));
		}
	},
	_registerControl : function(control, element) {
		var id = (typeof(element) == 'string')?element:element.id;
		this._controls[id] = control;
	},*/
	Select : new Class({
		Extends : U.Element,
		initialize : function(element, onchange) {
			this.parent(element);
			this._onchange = onchange || $empty;
			if (this.element) {
				this.hasWm = this.element.hasClass('watermark');
				this.element.addEvent('change', this._onChange.bind(this));
			}
		},
		_onChange : function() {
			this._onchange();
			if (this.hasWm) {
				if (!this.getValue().containedIn("-1,")) this.element.removeClass('watermark');
				else this.element.addClass('watermark');
			}
		},
		getValue : function() {
			return this.element.getSelected().get('value')[0];
		},
		getText : function() {
			return this.element.getSelected().get('html')[0];
		},
		getIndex : function() {
			return this.element.selectedIndex;
		},
		setIndex : function(index) {
			var elm = this.element;
			elm.selectedIndex = index;
			$(elm.options[index]).set('selected','selected');
			return this;
		},
		selectByText : function(text) {
			var elm = this.element;
			$A(this.element.options).each(function(opt, i) {
				if (opt.get('html') == text) {
					opt.set('selected','selected');
					elm.selectedIndex = i;
					return this;
				}
			}, this);
			return this;
		},
		selectByValue : function(val) {
			var elm = this.element;
			$A(this.element.options).each(function(opt, i) {
				if (opt.get('value') == val) {
					opt.set('selected','selected');
					elm.selectedIndex = i;
					return this;
				}
			}, this);
			return this;
		},
		addOption : function(val, text, className) {
			var elm = new Element('option', {
				value: val,
				text : text
			}).inject(this.element);
			if (className) elm.addClass(className);
			return this;
		}
	}),
	_TextBoxes : {},
	GetTextBox : function(element) {
		$log('reference='+U.UI._TextBoxes[element]+' element = '+element)
		if (U.UI._TextBoxes[element]) return U.UI._TextBoxes[element];
		else return new U.UI.TextBox(element);
	},
	TextBox : new Class({
		Extends : U.Element,
		initialize : function(element) {
			this.parent(element);
			U.UI._TextBoxes[typeof(element) == 'string'?element:element.id] = this;
			//U.UI._registerControl(this, element);
			$log('constructor='+U.UI._TextBoxes[element]+' element = '+element)
			if(this.element) {
				this.autoClear = this.element.hasClass('watermark');
			}
			if (this.autoClear && this.element.value == "") {
				this.defaultValue = this.element.get('defvalue');
				this.element.value = this.defaultValue;
				$log('adding blur event')
				this.element.addEvent('focus', this._focus.bind(this));
				this.element.addEvent('blur', this._blur.bind(this));
			}
		},
		addEvent : function(evt, call) {
			this.element.addEvent(evt, call);
		},
		_focus : function() {
			var val = this.element.value;
			if (val == this.defaultValue) this.element.set('value', '').removeClass('watermark');
		},
		_blur : function() {
			if (this.element.value == '') this.element.set('value', this.defaultValue).addClass('watermark');
		},
		getValue : function() {
			var val = this.element.get('value');
			if (this.autoClear && val == this.defaultValue) val = '';
			return val;
		},
		setValue : function(text) {
			this.element.set('value', text);
			this.autoClear = false;
		},
		setDefaultValue : function(text) {
			this.defaultValue = text;
		}
	}),
	Password : new Class({
		Extends : U.Element,
		initialize : function(element) {
			this.parent(element);
			this.element.value = "";
			this.text = $(this.element.id+'-mark').addEvent('click', this._show.bind(this)).addEvent('focus', this._show.bind(this));
			this.element.addEvent('blur', this._hide.bind(this));
		},
		_show : function() {
			this.show();
			this.text.hide();
			this.element.focus();
			this.element.value = "";
		},
		_hide : function() {
			if (this.element.value.length == 0) {
				this.hide();
				this.text.show();
			}
		},
		getValue : function() { return this.element.value; }
	}),
	FileUpload : new Class({
		Implements : Events,
		initialize : function(element) {
			if (!U.Request.Manager.hasConfig('fileprogress')) {
				U.Request.Manager.addConfig('fileprogress', 'CheckFileStatus', {upload_key:'',checking:true});
				//U.Request.Manager.addConfig('uploadfile', '/photo_upload/xml_avatar_upload', {upload_key:''});
				U.Request.Manager.addConfig('uploadfile', '/photo_upload/xml_avatar_upload', {upload_key:''});
			}
			this.element = $(element);
			this.submitName = this.element.name;
			$log('fileUpload.submitName = '+this.submitName);
			this.element.name = this.element.id;
			this.form = this.element.form;
			this.container = this.element.getParent('.file-input');
			this.fileContainer = this.container.getElements('div')[0];
			this.prefix = this.container.get('id');
			$log('FileUpload = '+this.prefix)
			this.file = $(this.prefix+'-file');
			this.fileId = $(this.prefix+'-fileid');
			this.progress = $(this.prefix+'-progress');
			this.progressBar = this.progress.getElements('.progress')[0];
			this.preview = $(this.prefix+'-preview');
			this.upload = $(this.prefix+'-upload');//.addEvent('click', this._uploadClick.bind(this));
			this.firstLoaded = false;
			this.disabled = false;
			this.iframe = new IFrame({
				id : this.prefix+'-iframe',
				src:'about:blank',
				styles: {
					position:'absolute',
					width:'1px',
					height:'1px',
					border:'0px solid #fff',
					top:'-2000px',
					left:'-2000px'
				},
				events : {
					load : this._loadAvatarUploadWindow.bind(this)
				}
			});
			this.iframe.inject(document.body);
			this.request = null;
			this._setEvents();
			this.frequency = 0.8;
			this.fx =new Fx.Tween(this.progressBar, { 'duration': this.frequency*1100 });
		},
		_setEvents : function() {
			this.element.addEvents({
				'change' : this._loadAvatarUploadWindow.bind(this),
				'mouseover' : this._changeClass.bind(this, true),
				'mouseout' : this._changeClass.bind(this, false)
			});
			
		},
		_changeClass : function(on) {
			this.upload[on?'addClass':'removeClass']('fake-input-on');
		},
		_uploadClick : function() {
			this.fireEvent('disabledClick', this);
		},
		_loadAvatarUploadWindow : function() {
			if (!this.firstLoaded) {
				this.firstLoaded = true;
				return;
			}			
			var fileUpload = this.element;
			var formUpload = this.form;
			if (this.element.className == "identity") {
				var url = imageUploadURL;
			} else {
				var url = imageUploadMaskURL;
			}
			//var url = YAHOO.util.Dom.getAttribute(fileUpload, 'rel');
			var fileUrl = YAHOO.util.Dom.getAttribute(fileUpload, 'value');
			$log(fileUpload);
			var url1 = url.split(",");
			getSignUpAvatarCropper(url1[0], url1[1], formUpload, this.element);
			
		},
		_iframeLoad : function(contentWindow, thedocument) {
			if (!this.firstLoaded) {
				$log('iframe firstLoaded')
				this.firstLoaded = true;
				return;
			}
			//	this.fx.start('width',this.progressWidth);
			//	this._finishUpload.delay(1000, this, status);
			//document.write(this.iframe.contentWindow.document.body.innerHTML);
			$log('iframe has loaded = '+this.iframe.contentWindow.document.body.innerHTML);
			this._reportProgress(this.iframe.contentWindow.document.body.innerHTML);
			// do something here
			return true;
		},
		_onChange : function() {
			// store old form info and create guid
			if (this.disabled) return; 
			this.fireEvent('start', this);
			$log('_onChange');
			var oldTarget = this.form.target;
			var oldAction = this.form.action;
			var guid = $guid();
			// get upload config
			//$log('_onChange form = '+this.form);
			var config = U.Request.Manager.getConfig('uploadfile');
			$log('_onChange config url = '+config.url);
			// set new form props and post
			this.form.target = this.prefix+'-iframe';
			this.form.action = (this.prefix.indexOf('mask')>0)?config.url+'/mask':config.url+'/identity'; //updated by keith on 20090305 because we need to distinguish between mask and identity
			this.fileId = guid;
			this.element.name = this.submitName;
			$log('_onChange on before form submit');
			this.form.submit();
			// reset default form props
			this.element.name = this.element.id;
			this.form.action = oldAction;
			this.form.target = oldTarget;
			// start upload
			this.fileContainer.hide();
			this.preview.hide();
			this.progress.show();
			this.progressBar.setStyle('width','0%');
			this.progressWidth = null;
			//config = U.Request.Manager.getConfig('fileprogress');
			//config.data.upload_key = guid;
			//this.request = new U.Request();
			//this.request.sendPeriodical(config, this._reportProgress.bind(this), this.frequency);
		},
		disable : function() {
			this.file.hide();
		},
		enable : function() {
			this.file.show();
		},
		_reportProgress : function(responseText) {
			/*var w = window.open();
			w.document.open();
			w.document.write(responseText+' ('+responseText.replace(/json/gi,'json').getTagContent('json')+')')
			w.document.close();*/
			var status = eval('('+responseText.replace(/json/gi,'json').getTagContent('json')+')');
			if (!this.progressWidth) this.progressWidth = this.progress.getSize().x-2;
			
			if (status.cancel_upload) {
				this._finishUpload(false);
				this.fireEvent('fail', [this, status.error]);
			} else if (!status.done) {
				var pct = 0;
				if (status.current != 0) pct = parseInt(this.progressWidth*(status.current/status.total));
				this.fx.start('width',pct);//this.progressBar.setStyle('width',pct+'%');
				this.fireEvent('uploading', [this, status.current, status.total, pct]);
			} else if (status.done) {
				//this.progressBar.setStyle('width','100%');
				this.fx.start('width',this.progressWidth);
				this._finishUpload.delay(1000, this, status);
			}
		},
		_finishUpload : function(status) {
			this.progress.hide();
			if (status) this.preview.set('html', '<img src="'+status.temp_filename+'" />');
			this.fileContainer.show();
			this.preview.show();
			if (status) this.fireEvent('complete', [this, {container: this.prefix, filename: status.temp_filename, input: this.file}]);
			//this.request.stopPeriodical();
			this.element.set('value', '');
		}
		
	}),
	Location : new Class({
		Implements : new Events,
		initialize : function(id) {
			$log(id);//
			
			$log(U.UI.GetTextBox(id+'-input-city'));$log(U.UI.GetTextBox(id+'-input-city'));$log(U.UI.GetTextBox(id+'-input-city'));
			
			if(U.UI.GetTextBox(id+'-input-city').element) {
				this.city = U.UI.GetTextBox(id+'-input-city');
				this.state = new U.UI.Select(id+'-option-state', this._setState.bind(this)).show();
				this.country = new U.UI.Select(id+'-option-country', this._setStates.bind(this, true)).show();
				this.country.element.addEvent('blur', this._showCountry.bind(this,false));
				this.countryName = $(id+'-country-name').hide();
				this.countryActivator = $(id+'-country-activator').addEvent('click', this._showCountry.bind(this,true));
				this.countryFlag = this.countryActivator.getElements('.flag')[0];
				$log(this.countryFlag)
				this.selectedCountry = 'defaultCountry'.translate();
				this.stateText = new U.UI.TextBox(id+'-input-state', 'state'.translate()).hide();
				this.stateValue = $(id+'-hidden-state');
				this.stateText.element.addEvent('blur', this._setState.bind(this));
				this.hasStates = false;
				this._build();
			}
		},
		getLocation : function() {
			return {city:this.city.getValue(), state: this.stateValue.value, country: this.country.getValue()}
		},
		getValue : function(divider) {
			var city = this.city.getValue();
			if (city.length > 0 && divider) city +=divider;
			if (this.hasStates) return city+' '+this.stateValue.value;
			else return city+' '+this.country.getText();
		},
		setLocation : function(city, state, country) {
			this.city.setValue(city, true);
			this.stateValue.value = state;
			this.country.selectByValue(country);
			this._setStates();
			if (this.hasStates) this.state.selectByValue(state == ''?0:state);
			else this.stateText.setValue(state);
			return this;
		},
		_build : function() {
			U.UI.Location.Countries.each(function(value, key) {
				this.country.addOption(key, value);
			}, this);
			this.country.selectByValue(this.selectedCountry);
			this._setStates();
			this._displayCountry();
		},
		_setState : function() {
			this.stateValue.value = "";
			var val = this.state.getValue();
			$log('_setstate = '+val)
			if (this.hasStates && val != '' && val != -1) this.stateValue.value = val;
			else this.stateValue.value = this.stateText.getValue();
			
			if (this.stateValue.value != '') this.fireEvent('change');
		},
		_setStateWithValue : function(val) {
			this.stateValue.value = "";
			this.state.selectByValue(val);
			$log('_setstate = '+val)
			if (this.hasStates && val != '' && val != -1) this.stateValue.value = val;
			else this.stateValue.value = this.stateText.getValue();
			
			if (this.stateValue.value != '') this.fireEvent('change');
		},
		_setStates : function(fireEvent) {
			var state = this.state.element;
			this.hasStates = this._hasStates();
			if (this.hasStates && this.country.getValue() == "US") {
				this.state.show();
				//this.stateText.hide();
				state.empty();
				this.countryName.hide();
				this._populateStates();
			} else {
				this.state.hide();
				$log('show country name')
				this.countryName.show();
				//this.stateText.show();
			}
			this.countryActivator.set('title', this.country.getText());
			this._displayCountry();
			this._showCountry(false);
			if (fireEvent) this.fireEvent('change');
		},
		_populateStates : function() {
			var currCountry = this.country.getValue();
			
			this.state.addOption(-1, 'state'.translate(), 'watermark');
			U.UI.Location.States.forEach(function(value, key) {
				if (key.substr(0,2) == currCountry) {
					this.state.addOption(key.substr(3).replace(/_/gi,' '),value);
				}
			}, this);
			this.state.setIndex(0);
		},
		_displayCountry : function() {
			this.countryFlag.setStyle('background-image','url(http://static.lg15.com/img/flags/'+this.country.getValue().toLower()+'.gif)');
			this.countryFlag.setStyle('background-repeat','no-repeat');
			this.countryName.set('html', this.country.getText());
		},
		_hasStates : function() {
			var currentCountry = this.country.getValue();
			
			for(var i in U.UI.Location.States) {
				if (i.substr(0,2) == currentCountry) return true;
			}
			return false;
		},
		_showCountry : function(show) {
			$(this.country.element.parentNode)[show?'show':'hide']();
			$(this.state.element.parentNode.parentNode)[show?'hide':'show']();
			//this.state.element[show?'hide':'show']();
		}
	}),
	Expandable : new Class({
		initialize : function(element) {
			var objs = element.getElements('.expander');
			if (objs.length > 0) {
				this.element = element;
				this.opened = this.element.hasClass('expanded');
				objs.each(function(item) {item.addEvent('click', this._toggle.bind(this))}, this);
			}
			return this;
		},
		_toggle : function(event) {
			new Event(event).stop();
			if (this.opened) this.element.removeClass('expanded');
			else this.element.addClass('expanded');
			this.opened = !this.opened;
		}
	})
};
U.UI.Location.States = new Hash({US_AK : 'Alaska',US_AL : 'Alabama',US_AR : 'Arkansas',/*US_AS : 'American Samoa',*/US_AZ : 'Arizona',US_CA : 'California',US_CO : 'Colorado',US_CT : 'Connecticut',US_DC : 'D.C.',US_DE : 'Delaware',US_FL : 'Florida'/*,US_FM : 'Micronesia'*/,US_GA : 'Georgia'/*,US_GU : 'Guam'*/,US_HI : 'Hawaii',US_IA : 'Iowa',US_ID : 'Idaho',US_IL : 'Illinois',US_IN : 'Indiana',US_KS : 'Kansas',US_KY : 'Kentucky',US_LA : 'Louisiana',US_MA : 'Massachusetts',US_MD : 'Maryland',US_ME : 'Maine',US_MH : 'Marshall Islands',US_MI : 'Michigan',US_MN : 'Minnesota',US_MO : 'Missouri'/*,US_MP : 'Marianas'*/,US_MS : 'Mississippi',US_MT : 'Montana',US_NC : 'North Carolina',US_ND : 'North Dakota',US_NE : 'Nebraska',US_NH : 'New Hampshire',US_NJ : 'New Jersey',US_NM : 'New Mexico',US_NV : 'Nevada',US_NY : 'New York',US_OH : 'Ohio',US_OK : 'Oklahoma',US_OR : 'Oregon',US_PA : 'Pennsylvania',US_PR : 'Puerto Rico',/*US_PW : 'Palau',*/US_RI : 'Rhode Island',US_SC : 'South Carolina',US_SD : 'South Dakota',US_TN : 'Tennessee',US_TX : 'Texas',US_UT : 'Utah',US_VA : 'Virginia',US_VI : 'Virgin Islands',US_VT : 'Vermont',US_WA : 'Washington',US_WI : 'Wisconsin',US_WV : 'West Virginia',US_WY : 'Wyoming',CA_AB : 'Alberta',CA_MB : 'Manitoba',CA_AB : 'Alberta',CA_BC : 'British Columbia',CA_MB : 'Manitoba',CA_NB : 'New Brunswick',CA_NL : 'Newfoundland and Labrador',CA_NS : 'Nova Scotia',CA_NT : 'Northwest Territories',CA_NU : 'Nunavut',CA_ON : 'Ontario',CA_PE : 'Prince Edward Island',CA_QC : 'Quebec',CA_SK : 'Saskatchewan',CA_YT : 'Yukon Territory',AU_AAT : 'Australian Antarctic Territory',AU_ACT : 'Australian Capital Territory',AU_NT : 'Northern Territory',AU_NSW : 'New South Wales',AU_QLD : 'Queensland',AU_SA : 'South Australia',AU_TAS : 'Tasmania',AU_VIC : 'Victoria',AU_WA : 'Western Australia',BR_AC : 'Acre',BR_AL : 'Alagoas',BR_AM : 'Amazonas',BR_AP : 'Amapa',BR_BA : 'Baia',BR_CE : 'Ceara',BR_DF : 'Distrito Federal',BR_ES : 'Espirito Santo',BR_FN : 'Fernando de Noronha',BR_GO : 'Goias',BR_MA : 'Maranhao',BR_MG : 'Minas Gerais',BR_MS : 'Mato Grosso do Sul',BR_MT : 'Mato Grosso',BR_PA : 'Para',BR_PB : 'Paraiba',BR_PE : 'Pernambuco',BR_PI : 'Piaui',BR_PR : 'Parana',BR_RJ : 'Rio de Janeiro',BR_RN : 'Rio Grande do Norte',BR_RO : 'Rondonia',BR_RR : 'Roraima',BR_RS : 'Rio Grande do Sul',BR_SC : 'Santa Catarina',BR_SE : 'Sergipe',BR_SP : 'Sao Paulo',BR_TO : 'Tocatins',NL_DR : 'Drente',NL_FL : 'Flevoland',NL_FR : 'Friesland',NL_GL : 'Gelderland',NL_GR : 'Groningen',NL_LB : 'Limburg',NL_NB : 'Noord Brabant',NL_NH : 'Noord Holland',NL_OV : 'Overijssel',NL_UT : 'Utrecht',NL_ZH : 'Zuid Holland',NL_ZL : 'Zeeland',UK_AVON : 'Avon',UK_BEDS : 'Bedfordshire',UK_BERKS : 'Berkshire',UK_BUCKS : 'Buckinghamshire',UK_CAMBS : 'Cambridgeshire',UK_CHESH : 'Cheshire',UK_CLEVE : 'Cleveland',UK_CORN : 'Cornwall',UK_CUMB : 'Cumbria',UK_DERBY : 'Derbyshire',UK_DEVON : 'Devon',UK_DORSET : 'Dorset',UK_DURHAM : 'Durham',UK_ESSEX : 'Essex',UK_GLOUS : 'Gloucestershire',UK_GLONDON : 'Greater London',UK_GMANCH : 'Greater Manchester',UK_HANTS : 'Hampshire',UK_HERWOR : 'Hereford & Worcestershire',UK_HERTS : 'Hertfordshire',UK_HUMBER : 'Humberside',UK_IOM : 'Isle of Man',UK_IOW : 'Isle of Wight',UK_KENT : 'Kent',UK_LANCS : 'Lancashire',UK_LEICS : 'Leicestershire',UK_LINCS : 'Lincolnshire',UK_MERSEY : 'Merseyside',UK_NORF : 'Norfolk',UK_NHANTS : 'Northamptonshire',UK_NTHUMB : 'Northumberland',UK_NOTTS : 'Nottinghamshire',UK_OXON : 'Oxfordshire',UK_SHROPS : 'Shropshire',UK_SOM : 'Somerset',UK_STAFFS : 'Staffordshire',UK_SUFF : 'Suffolk',UK_SURREY : 'Surrey',UK_SUSS : 'Sussex',UK_WARKS : 'Warwickshire',UK_WMID : 'West Midlands',UK_WILTS : 'Wiltshire',UK_YORK : 'Yorkshire',EI_CO_ANTRIM : 'County Antrim',EI_CO_ARMAGH : 'County Armagh',EI_CO_DOWN : 'County Down',EI_CO_FERMANAGH : 'County Fermanagh',EI_CO_DERRY : 'County Londonderry',EI_CO_TYRONE : 'County Tyrone',EI_CO_CAVAN : 'County Cavan',EI_CO_DONEGAL : 'County Donegal',EI_CO_MONAGHAN : 'County Monaghan',EI_CO_DUBLIN : 'County Dublin',EI_CO_CARLOW : 'County Carlow',EI_CO_KILDARE : 'County Kildare',EI_CO_KILKENNY : 'County Kilkenny',EI_CO_LAOIS : 'County Laois',EI_CO_LONGFORD : 'County Longford',EI_CO_LOUTH : 'County Louth',EI_CO_MEATH : 'County Meath',EI_CO_OFFALY : 'County Offaly',EI_CO_WESTMEATH : 'County Westmeath',EI_CO_WEXFORD : 'County Wexford',EI_CO_WICKLOW : 'County Wicklow',EI_CO_GALWAY : 'County Galway',EI_CO_MAYO : 'County Mayo',EI_CO_LEITRIM : 'County Leitrim',EI_CO_ROSCOMMON : 'County Roscommon',EI_CO_SLIGO : 'County Sligo',EI_CO_CLARE : 'County Clare',EI_CO_CORK : 'County Cork',EI_CO_KERRY : 'County Kerry',EI_CO_LIMERICK : 'County Limerick',EI_CO_TIPPERARY : 'County Tipperary',EI_CO_WATERFORD : 'County Waterford'});
U.UI.Location.Countries = new Hash({AF : 'Afghanistan',AL : 'Albania',DZ : 'Algeria',AS : 'American Samoa',AD : 'Andorra',AO : 'Angola',AI : 'Anguilla',AQ : 'Antarctica',AG : 'Antigua and Barbuda',AR : 'Argentina',AM : 'Armenia',AW : 'Aruba',AU : 'Australia',AT : 'Austria',AZ : 'Azerbaijan',AP : 'Azores',BS : 'Bahamas',BH : 'Bahrain',BD : 'Bangladesh',BB : 'Barbados',BY : 'Belarus',BE : 'Belgium',BZ : 'Belize',BJ : 'Benin',BM : 'Bermuda',BT : 'Bhutan',BO : 'Bolivia',BA : 'Bosnia And Herzegowina',XB : 'Bosnia-Herzegovina',BW : 'Botswana',BV : 'Bouvet Island',BR : 'Brazil',IO : 'British Indian Ocean Territory',VG : 'British Virgin Islands',BN : 'Brunei Darussalam',BG : 'Bulgaria',BF : 'Burkina Faso',BI : 'Burundi',KH : 'Cambodia',CM : 'Cameroon',CA : 'Canada',CV : 'Cape Verde',KY : 'Cayman Islands',CF : 'Central African Republic',TD : 'Chad',CL : 'Chile',CN : 'China',CX : 'Christmas Island',CC : 'Cocos (Keeling) Islands',CO : 'Colombia',KM : 'Comoros',CG : 'Congo',CD : 'Congo, The Democratic Republic O',CK : 'Cook Islands',XE : 'Corsica',CR : 'Costa Rica',CI : 'Cote d` Ivoire (Ivory Coast)',HR : 'Croatia',CU : 'Cuba',CY : 'Cyprus',CZ : 'Czech Republic',DK : 'Denmark',DJ : 'Djibouti',DM : 'Dominica',DO : 'Dominican Republic',TP : 'East Timor',EC : 'Ecuador',EG : 'Egypt',SV : 'El Salvador',GQ : 'Equatorial Guinea',ER : 'Eritrea',EE : 'Estonia',ET : 'Ethiopia',FK : 'Falkland Islands (Malvinas)',FO : 'Faroe Islands',FJ : 'Fiji',FI : 'Finland',FR : 'France (Includes Monaco)',FX : 'France, Metropolitan',GF : 'French Guiana',PF : 'French Polynesia',TA : 'French Polynesia (Tahiti)',TF : 'French Southern Territories',GA : 'Gabon',GM : 'Gambia',GE : 'Georgia',DE : 'Germany',GH : 'Ghana',GI : 'Gibraltar',GR : 'Greece',GL : 'Greenland',GD : 'Grenada',GP : 'Guadeloupe',GU : 'Guam',GT : 'Guatemala',GN : 'Guinea',GW : 'Guinea-Bissau',GY : 'Guyana',HT : 'Haiti',HM : 'Heard And Mc Donald Islands',VA : 'Holy See (Vatican City State)',HN : 'Honduras',HK : 'Hong Kong',HU : 'Hungary',IS : 'Iceland',IN : 'India',ID : 'Indonesia',IR : 'Iran',IQ : 'Iraq',IE : 'Ireland',EI : 'Ireland (Eire)',IL : 'Israel',IT : 'Italy',JM : 'Jamaica',JP : 'Japan',JO : 'Jordan',KZ : 'Kazakhstan',KE : 'Kenya',KI : 'Kiribati',KP : 'Korea, Democratic People\'S Repub',KW : 'Kuwait',KG : 'Kyrgyzstan',LA : 'Laos',LV : 'Latvia',LB : 'Lebanon',LS : 'Lesotho',LR : 'Liberia',LY : 'Libya',LI : 'Liechtenstein',LT : 'Lithuania',LU : 'Luxembourg',MO : 'Macao',MK : 'Macedonia',MG : 'Madagascar',ME : 'Madeira Islands',MW : 'Malawi',MY : 'Malaysia',MV : 'Maldives',ML : 'Mali',MT : 'Malta',MH : 'Marshall Islands',MQ : 'Martinique',MR : 'Mauritania',MU : 'Mauritius',YT : 'Mayotte',MX : 'Mexico',FM : 'Micronesia, Federated States Of',MD : 'Moldova, Republic Of',MC : 'Monaco',MN : 'Mongolia',MS : 'Montserrat',MA : 'Morocco',MZ : 'Mozambique',MM : 'Myanmar (Burma)',NA : 'Namibia',NR : 'Nauru',NP : 'Nepal',NL : 'Netherlands',AN : 'Netherlands Antilles',NC : 'New Caledonia',NZ : 'New Zealand',NI : 'Nicaragua',NE : 'Niger',NG : 'Nigeria',NU : 'Niue',NF : 'Norfolk Island',MP : 'Northern Mariana Islands',NO : 'Norway',OM : 'Oman',PK : 'Pakistan',PW : 'Palau',PS : 'Palestinian Territory, Occupied',PA : 'Panama',PG : 'Papua New Guinea',PY : 'Paraguay',PE : 'Peru',PH : 'Philippines',PN : 'Pitcairn',PL : 'Poland',PT : 'Portugal',PR : 'Puerto Rico',QA : 'Qatar',RE : 'Reunion',RO : 'Romania',RU : 'Russian Federation',RW : 'Rwanda',KN : 'Saint Kitts And Nevis',SM : 'San Marino',ST : 'Sao Tome and Principe',SA : 'Saudi Arabia',SN : 'Senegal',XS : 'Serbia-Montenegro',SC : 'Seychelles',SL : 'Sierra Leone',SG : 'Singapore',SK : 'Slovak Republic',SI : 'Slovenia',SB : 'Solomon Islands',SO : 'Somalia',ZA : 'South Africa',GS : 'South Georgia And The South Sand',KR : 'South Korea',ES : 'Spain',LK : 'Sri Lanka',NV : 'St. Christopher and Nevis',SH : 'St. Helena',LC : 'St. Lucia',PM : 'St. Pierre and Miquelon',VC : 'St. Vincent and the Grenadines',SD : 'Sudan',SR : 'Suriname',SJ : 'Svalbard And Jan Mayen Islands',SZ : 'Swaziland',SE : 'Sweden',CH : 'Switzerland',SY : 'Syrian Arab Republic',TW : 'Taiwan',TJ : 'Tajikistan',TZ : 'Tanzania',TH : 'Thailand',TG : 'Togo',TK : 'Tokelau',TO : 'Tonga',TT : 'Trinidad and Tobago',XU : 'Tristan da Cunha',TN : 'Tunisia',TR : 'Turkey',TM : 'Turkmenistan',TC : 'Turks and Caicos Islands',TV : 'Tuvalu',UG : 'Uganda',UA : 'Ukraine',AE : 'United Arab Emirates',UK : 'United Kingdom',GB : 'Great Britain',US : 'United States',UM : 'United States Minor Outlying Isl',UY : 'Uruguay',UZ : 'Uzbekistan',VU : 'Vanuatu',XV : 'Vatican City',VE : 'Venezuela',VN : 'Vietnam',VI : 'Virgin Islands (U.S.)',WF : 'Wallis and Furuna Islands',EH : 'Western Sahara',WS : 'Western Samoa',YE : 'Yemen',YU : 'Yugoslavia',ZR : 'Zaire',ZM : 'Zambia',ZW : 'Zimbabwe'});
U.UI.Select.getValue = function(element) {
	return element.getSelected().get('value')[0];
};