Uwd.System.UserDetails = function(data) {
	config = {
		data: data
	};
	
	Ext.apply(this, config);
	
	Uwd.System.UserDetails.superclass.constructor.call(this);
	
	this.defaultLanguageChanged = false;
	this.firstnameChanged = false;
	this.lastnameChanged = false;
	this.addressChanged = false;
	this.zipChanged = false;
	this.cityChanged = false;
	this.countryChanged = false;
	this.fonChanged = false;
	this.faxChanged = false;
	
};

Ext.extend(Uwd.System.UserDetails, Ext.util.Observable, {
	
	getProfileImage : function() {
		return this.data.profileImage == 0 ? '../profile.Images/default.jpg' : '../profile.Images/' + window.system.user.getId() + '.jpg#d=' + new Date().format('U');
	},
	
	setProfileImage : function(bool) {
		return this.data.profileImage = bool === false ? 0 : 1;
	},
	
	getSex : function() {
		if (Ext.isEmpty(this.data.sex)) {
			return '';	
		}
		return this.data.sex === 'f' ? Uwd.System.SystemLanguage.female : Uwd.System.SystemLanguage.male;
	},
	
	setSex : function(value) {
		this.sexChanged = true;
		return this.data.sex = value;
	},
	
	getDefaultLanguage : function() {
		return this.data.defaultLanguage;
	},
	
	setDefaultLanguage : function(lang) {
		if (window.system.isAllowdLanguage(lang)) {
			this.defaultLanguageChanged = true;
			this.data.defaultLanguage = lang;
			return true;
		}
		return false;
	},
	
	getFirstname : function() {
		return this.data.firstname;
	},
	
	setFirstname : function(name) {
		this.firstnameChanged = true;
		this.data.firstname = name;
		return true;
	},
	
	getLastname : function() {
		return this.data.lastname;
	},
	
	setLastname : function(name) {
		this.lastnameChanged = true;
		this.data.lastname = name;
		return true;
	},
	
	getAddress : function() {
		return this.data.address;
	},
	
	setAddress : function(ad) {
		this.addressChanged = true;
		this.data.address = ad;
		return true;
	},
	
	getZip : function() {
		return this.data.zip;
	},
	
	setZip : function(z) {
		this.zipChanged = true;
		this.data.zip = z;
		return true;
	},
	
	getCity : function() {
		return this.data.city;
	},
	
	setCity : function(c) {
		this.cityChanged = true;
		this.data.city = c;
		return true;
	},
	
	getCountry : function() {
		return this.data.country;
	},
	
	setCountry : function(c) {
		this.countryChanged = true;
		this.data.country = c;
		return true;
	},
	
	getDateRegister : function() {
		return this.data.dateRegister;
	},
	
	getFon : function() {
		return this.data.fon;
	},
	
	setFon : function(fon) {
		this.fonChanged = true;
		this.data.fon = fon;
		return true;
	},
	
	getFax : function() {
		return this.data.fax;
	},
	
	setFax : function(fax) {
		this.faxChanged = true;
		this.data.fax = fax;
		return true;
	},
	
	getChanged : function() {
		var ret = {};
		if (this.sexChanged === true) {
			ret.sex = this.data.sex;
		}
		
		if (this.defaultLanguageChanged === true) {
			ret.defaultLanguage = this.data.defaultLanguage;
		}
		
		if (this.firstnameChanged === true) {
			ret.firstname = this.data.firstname;
		}
		
		if (this.lastnameChanged === true) {
			ret.lastname = this.data.lastname;
		}
		
		if (this.addressChanged === true) {
			ret.address = this.data.address;
		}
		
		if (this.zipChanged === true) {
			ret.zip = this.data.zip;
		}
		
		if (this.cityChanged === true) {
			ret.city = this.data.city;
		}
		
		if (this.countryChanged === true) {
			ret.country = this.data.country;
		}
		
		if (this.fonChanged === true) {
			ret.fon = this.data.fon;
		}
		
		if (this.faxChanged === true) {
			ret.fax = this.data.fax;
		}
		
		
		return ret;
	},
	
	clearAll : function() {
		this.defaultLanguageChanged = false;
		this.firstnameChanged = false;
		this.lastnameChanged = false;
		this.addressChanged = false;
		this.zipChanged = false;
		this.cityChanged = false;
		this.countryChanged = false;
		this.fonChanged = false;
		this.faxChanged = false;
	}
	
});



