
var UserSetting = (function() {

	var account = "";
	var id = "";
	var colorSet = {
		id: "white",
		type: "preset"
	};
	var font = {
		id: "system",
		type: "preset"
	};
	var background = {
		imageUrl: "",
		alpha: ""
	};
	var contry = "US";
	var language = ("en" === "") ? "en" : "en";
	var timezone = "";
	var dateLongFormat = "MMM D YY";
	var dateLongWithDoWFormat = "MMM D YY [(]dd[)]";
	var dateShortFormat = "MMM D";
	var dateShortWithDoWFormat = "MMM D [(]dd[)]";
	var dateSimpleSeparatorFormat = "MMM/D/YYYY";
	var dateInputFormat = "MMM Do YY [(]dd[)]";
	var dateDayWithDoWFormat = "D [(]dd[)]";
	var timeFormat = "H:mm";
	var timeFormatType = "24";
	var startWeek = "0";
	var gender = "";
	var holidayCalId = "";
	var headerMonthFormat = "MMM";
	var headerMonthSuffix = "";
	var headerYearSuffix = "";
	var premium = false;
	var manager = false
	var textSize = 1;
	var guest = true;

	
	function estimateTimezone(offset) {
		var zone = "UTC";
		switch(offset) {
		case "+1400":
			zone = "Pacific/Kiritimati";
			break;
		case "+1300":
			zone = "Pacific/Apia";
			break;
		case "+1245":
			zone = "Pacific/Chatham";
			break;
		case "+1200":
			zone = "Pacific/Auckland";
			break;
		case "+1130":
			zone = "Pacific/Norfolk";
			break;
		case "+1100":
			zone = "Asia/Vladivostok";
			break;
		case "+1030":
			zone = "Australia/Lord_Howe";
			break;
		case "+1000":
			zone = "Pacific/Guam";
			break;
		case "+0930":
			zone = "Australia/Adelaide";
			break;
		case "+0900":
			zone = "Asia/Tokyo";
			break;
		case "+0845":
			zone = "Australia/Eucla";
			break;
		case "+0800":
			zone = "Asia/Shanghai";
			break;
		case "+0700":
			zone = "Asia/Bangkok";
			break;
		case "+0630":
			zone = "Asia/Rangoon";
			break;
		case "+0600":
			zone = "Asia/Dhaka";
			break;
		case "+0545":
			zone = "Asia/Kathmandu";
			break;
		case "+0530":
			zone = "Asia/Kolkata";
			break;
		case "+0500":
			zone = "Asia/Karachi";
			break;
		case "+0430":
			zone = "Asia/Kabul";
			break;
		case "+0400":
			zone = "Europe/Moscow";
			break;
		case "+0330":
			zone = "Asia/Tehran";
			break;
		case "+0300":
			zone = "Asia/Riyadh";
			break;
		case "+0200":
			zone = "Africa/Tripoli";
			break;
		case "+0100":
			zone = "Europe/Paris";
			break;
		case "+0000":
			zone = "Europe/London";
			break;
		case "-0100":
			zone = "America/Scoresbysund";
			break;
		case "-0200":
			zone = "America/Noronha";
			break;
		case "-0300":
			zone = "America/Sao_Paulo";
			break;
		case "-0330":
			zone = "America/St_Johns";
			break;
		case "-0400":
			zone = "America/Santiago";
			break;
		case "-0430":
			zone = "America/Caracas";
			break;
		case "-0500":
			zone = "America/Havana";
			break;
		case "-0600":
			zone = "America/Chicago";
			break;
		case "-0700":
			zone = "America/Hermosillo";
			break;
		case "-0800":
			zone = "America/Dawson";
			break;
		case "-0900":
			zone = "America/Yakutat";
			break;
		case "-0930":
			zone = "Pacific/Marquesas";
			break;
		case "-1000":
			zone = "Pacific/Honolulu";
			break;
		case "-1100":
			zone = "Pacific/Midway";
			break;
		}
		return zone;
	}


	return {
		getAccount: function(){
			return account;
		},
		getJorteId: function(){
			return id;
		},
		getColorSet: function(){
			return colorSet;
		},
		getFont: function(){
			return font;
		},
		getBackground: function(){
			return background;
		},
		getCountry: function(){
			return contry;
		},
		getLanguage: function() {
			return language;
		},
		getTimezone: function(){
			if (timezone == null || timezone == "") {
				timezone = estimateTimezone(moment().format("ZZ"));
			}
			return timezone;
		},
		getDateLongFormat: function() {
			return dateLongFormat;
		},
		getDateLongWithDoWFormat: function() {
			return dateLongWithDoWFormat;
		},
		getDateShortFormat: function() {
			return dateShortFormat;
		},
		getDateShortWithDoWFormat: function() {
			return dateShortWithDoWFormat;
		},
		getDateSimpleSeparaterFormat: function() {
			return dateSimpleSeparatorFormat;
		},
		getDateInputFormat: function() {
			return dateInputFormat;
		},
		getDateDayWithDoWFormat: function() {
			return dateDayWithDoWFormat;
		},
		getTimeFormat: function(){
			return timeFormat;
		},
		getTimeFormatType: function(){
			return timeFormatType;
		},
		getStartWeek: function(){
			return startWeek;
		},
		getGender: function() {
			if (gender == null || gender == "") {
				return "2";
			} else {
				return gender;
			}
		},
		getHolidayCalendarId: function() {
			return holidayCalId;
		},
		getHeaderMonthFormat: function() {
			if (headerMonthFormat == null || headerMonthFormat == "") {
				return "MMM";
			} else {
				return headerMonthFormat;
			}
		},
		getHeaderMonthSuffix: function() {
			if (headerMonthSuffix == null) {
				return "";
			} else {
				return headerMonthSuffix;
			}
		},
		getHeaderYearSuffix: function() {
			if (headerYearSuffix == null) {
				return "";
			} else {
				return headerYearSuffix;
			}
		},
		isPremium: function() {
			return premium;
		},
		isManager: function() {
			return manager;
		},
		getTextSize: function() {
			return textSize;
		},
		isGuest: function() {
			return guest;
		}
	};
})();
