/**
 * @描述：基础类库
 * @开发人员：moshco zhu
 * @开发日期：2010-1-16 上午01:16:18
 * @参数：
 * @返回值：any
 * @return
 */
function FHBase() {
	var oComponent = {};
	$.extend(oComponent, FHUtils);
	$.extend(oComponent, FHBase);
	$.extend(oComponent, this);
	$.extend(this, oComponent);
};

// 宽度发生改变
FHBase.ON_RESIZE_WIDTH = 0;

// 高度发生改变
FHBase.ON_RESIZE_HEIGHT = 1;

// 都发生改变
FHBase.ON_RESIZE_BOTH = 2;

// FH目标组件统一编码属性名称
FHBase.TARGET_ATTR_NAME_CODE = "FHBaseui_code";

// FH组件统一编码属性名称
FHBase.ATTR_NAME_CODE = "code";

/**
 * @农历月份信息 (1900 - 2050)
 * @下面从高向低位计
 * @0-3位 (闰月天数:1=30 0=29) "0001"表示：闰月是30天，如果没有闰月，值无意义。
 * @4-15位 (某月<1-12>份的天数:1=30 0=29) "1111 1111 1111"表示：全年1-12月份都是30天。
 * @16-19位 (值即是闰月月份) "0101"表示：闰5月。
 */
FHBase.CHINESE_CALENDAR_MONTH_INFO = [
		0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0,
		0x14977, 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0,
		0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0,
		0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250,
		0x0d558, 0x0b540, 0x0b5a0, 0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50,
		0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50,
		0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0,
		0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0
];

// 农历月份信息,开始年号
FHBase.CHINESE_CALENDAR_MONTH_INFO_BEGIN_YEAR = 1900;

// 公历月份信息,开始年号
FHBase.CALENDAR_MONTH_INFO_BEGIN_YEAR = 1900;

// 起始日期
FHBase.BeginDate = {
	date : new Date(1900, 0, 31),
	lunar : {
		year : 1900,
		month : 1,
		is_leap_month : false,
		day : 1,
		tgdz_y : "庚子",
		tgdz_m : "戊寅",
		tgdz_d : "甲辰"
	}
};

// 最大日期
FHBase.EndDate = {
	date : new Date(2050, 0, 22),
	lunar : {
		year : 2049,
		month : 12,
		is_leap_month : false,
		day : 29,
		tgdz_y : "丙戌",
		tgdz_m : "乙未",
		tgdz_d : "甲午"
	}
};

// 农历：天干数组
FHBase.CHINESE_CALENDAR_TG_ARRAY = [
		"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"
];

// 农历：地支数组
FHBase.CHINESE_CALENDAR_DZ_ARRAY = [
		"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"
];

// 农历：生肖数组
FHBase.CHINESE_CALENDAR_YEAR_OF_BIRTH_ARRAY = [
		"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"
];

// 农历：日期序号前缀数组，分别代表0,10,20,30
FHBase.CHINESE_CALENDAR_DAY_INDEX_PRE_ARRAY = [
		'初', '十', '廿', '卅', '二', '三'
];

// 农历：日期序号后缀数组
FHBase.CHINESE_CALENDAR_DAY_INDEX_POST_ARRAY = [
		"一", "二", "三", "四", "五", "六", "七", "八", "九", "十"
];

// 农历：年序号数组
FHBase.CHINESE_CALENDAR_YEAR_INDEX_ARRAY = [
		"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"
];

// 农历：月份序号数组
FHBase.CHINESE_CALENDAR_MONTH_INDEX_ARRAY = [
		"正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "腊月", "闰月"
];

// 农历：24节气名称
FHBase.CHINESE_CALENDAR_24SOLAR_TERMS = [
		"小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"
];

// 农历：24节气常量，用于计算某年的24节气日期
FHBase.CHINESE_CALENDAR_24SOLAR_TERMS_CONSTANTS = [
		0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224,
		483532, 504758
];

// 公历/农历：节假日(会放假)
FHBase.CALENDAR_HOLIDAYS = [
		{
			title : "元旦",
			year : 1949,
			month : 1,
			day : 1,
			day_num : 3
		}, {
			title : "五一",
			year : 1949,
			origin_year : 1886,
			month : 5,
			day : 1,
			day_num : 1
		}, {
			title : "国庆节",
			year : 1949,
			origin_year : 1949,
			month : 10,
			day : 1,
			day_num : 3
		}, {
			title : "除夕(春节)",
			year : 1949,
			is_lunar : true,
			is_last_day_of_year : true,
			day_num : 3
		}, {
			title : "清明节(寒食)",
			year : 2008,
			is_lunar : true,
			the_24solar_terms_index : 6,
			day_num : 1
		}, {
			title : "端午节",
			year : 2008,
			is_lunar : true,
			month : 5,
			day : 5,
			day_num : 1
		}, {
			title : "中秋节",
			year : 2008,
			is_lunar : true,
			month : 8,
			day : 15,
			day_num : 1
		}
];

// 公历：星座
FHBase.CALENDAR_STARSIGNS = [
		{
			title : "魔羯座",
			begin_month : 12,
			begin_day : 22,
			end_month : 1,
			end_day : 20
		}, {
			title : "水瓶座",
			begin_month : 1,
			begin_day : 21,
			end_month : 2,
			end_day : 19
		}, {
			title : "双鱼座",
			begin_month : 2,
			begin_day : 20,
			end_month : 3,
			end_day : 20
		}, {
			title : "白羊座",
			begin_month : 3,
			begin_day : 21,
			end_month : 4,
			end_day : 20
		}, {
			title : "金牛座",
			begin_month : 4,
			begin_day : 21,
			end_month : 5,
			end_day : 21
		}, {
			title : "双子座",
			begin_month : 5,
			begin_day : 22,
			end_month : 6,
			end_day : 21
		}, {
			title : "巨蟹座",
			begin_month : 6,
			begin_day : 22,
			end_month : 7,
			end_day : 22
		}, {
			title : "狮子座",
			begin_month : 7,
			begin_day : 23,
			end_month : 8,
			end_day : 22
		}, {
			title : "处女座",
			begin_month : 8,
			begin_day : 23,
			end_month : 9,
			end_day : 23
		}, {
			title : "天秤座",
			begin_month : 9,
			begin_day : 24,
			end_month : 10,
			end_day : 23
		}, {
			title : "天蝎座",
			begin_month : 10,
			begin_day : 24,
			end_month : 11,
			end_day : 22
		}, {
			title : "射手座",
			begin_month : 11,
			begin_day : 23,
			end_month : 12,
			end_day : 21
		}
];

/**
 * @描述：读取当前日期所在星座
 * @开发人员：moshco zhu
 * @开发日期：2010-12-10 上午10:04:45
 * @参数：oDt
 * @返回值：any
 * @param oDt
 * @return
 */
FHBase.getStarSign = function(oDt) {
	// 年月日
	var iYear = oDt.getFullYear();
	var iDtMonth = oDt.getMonth() + 1;
	var iDtDay = oDt.getDate();
	var lTime = oDt.getTime();
	// 逐一匹配
	var strStarSign = null;
	var aryStarSign = FHBase.CALENDAR_STARSIGNS;
	var iLength = aryStarSign.length;
	for ( var i = 0; i < iLength; i++) {
		if (aryStarSign[i].begin_month < aryStarSign[i].end_month) {
			// 非 魔羯座
			var oDtBegin = new Date(iYear, aryStarSign[i].begin_month - 1, aryStarSign[i].begin_day);
			var oDtEnd = new Date(iYear, aryStarSign[i].end_month - 1, aryStarSign[i].end_day);
			if ((lTime >= oDtBegin.getTime()) && (lTime <= oDtEnd.getTime())) {
				strStarSign = aryStarSign[i].title;
				break;
			}
		} else if (aryStarSign[i].begin_month > aryStarSign[i].end_month) {
			// 魔羯座
			var oDtBegin = new Date(iYear, aryStarSign[i].begin_month - 1, aryStarSign[i].begin_day);
			var oDtEnd = new Date(iYear, 11, 31);
			if ((lTime >= oDtBegin.getTime()) && (lTime <= oDtEnd.getTime())) {
				strStarSign = aryStarSign[i].title;
				break;
			}
			oDtBegin = new Date(iYear, 0, 1);
			oDtEnd = new Date(iYear, aryStarSign[i].end_month - 1, aryStarSign[i].end_day);
			if ((lTime >= oDtBegin.getTime()) && (lTime <= oDtEnd.getTime())) {
				strStarSign = aryStarSign[i].title;
				break;
			}
		}
	}
	// 返回函数值
	return strStarSign;
};

/**
 * @描述：读取十二生肖年
 * @开发人员：moshco zhu
 * @开发日期：2010-12-14 上午09:59:59
 * @参数：iYear
 * @返回值：any
 * @param iYear
 * @return
 */
FHBase.getAnimalSign = function(iYear) {
	// 函数：读取地支的序号
	var getIndex = function(ary, str) {
		var iIndex = -1;
		$.each(ary, function(iIndex1, str1) {
			if (str1 == str) {
				iIndex = iIndex1;
				return false;
			}
		});
		return iIndex;
	};
	// 读取开始年地支序号
	var strDZ = FHBase.BeginDate.lunar.tgdz_y;
	strDZ = strDZ.charAt(1);
	var iBeginYearDZIndex = getIndex(FHBase.CHINESE_CALENDAR_DZ_ARRAY, strDZ);
	// 计算序号
	var iIndex = iYear - FHBase.BeginDate.lunar.year + iBeginYearDZIndex;
	iIndex %= 12;
	// 十二生肖
	var strAnimalSign = FHBase.CHINESE_CALENDAR_YEAR_OF_BIRTH_ARRAY[iIndex];
	// 返回函数值
	return strAnimalSign;
};

/**
 * @描述：指定日期是否是某月的第几个星期几
 * @开发人员：moshco zhu
 * @开发日期：2010-12-9 上午11:19:11
 * @参数：oDt, iMonth, iWeekIndexOfMonth, iWeek
 * @返回值：any
 * @param oDt
 * @param iMonth
 * @param iWeekIndexOfMonth
 * @param iWeek
 * @return
 */
FHBase.isWeekIndexOfMonth = function(oDt, iMonth, iWeekIndexOfMonth, iWeek) {
	// 年月日
	var iDtYear = oDt.getFullYear();
	var iDtMonth = oDt.getMonth() + 1;
	var iDtDay = oDt.getDate();
	var iDtWeek = oDt.getDay();
	// 日期月份
	if (iMonth != iDtMonth) {
		return false;
	}
	// 星期判断
	if (iWeek != iDtWeek) {
		return false;
	}
	// 当月1日的日期
	var oDtFirst = new Date(iDtYear, iDtMonth - 1, 1);
	var iDtFirstWeek = oDtFirst.getDay();
	// 计算
	var iDaySum = iDtFirstWeek + iDtDay
	var iIndex = iDaySum / 7;
	if ((iDaySum % 7) > 0) {
		iIndex++;
	}
	// 所在月份的第几个星期
	if (iWeekIndexOfMonth != iIndex) {
		return false;
	}
	// 返回函数值
	return true;
};

/**
 * @描述：计算指定农历年的总天数
 * @开发人员：moshco zhu
 * @开发日期：2010-11-25 上午02:41:36
 * @参数：iYear
 * @返回值：any
 * @param iYear
 * @return
 */
FHBase.sumDayNumOfYear = function(iYear) {
	// 计算年序号
	var iYearIndex = iYear - FHBase.CHINESE_CALENDAR_MONTH_INFO_BEGIN_YEAR;
	// 计算闰月月份
	var iLeapMonth = FHBase.CHINESE_CALENDAR_MONTH_INFO[iYearIndex] & 0X0000F;
	// 计算1年的总天数
	var iTotalDayNum = 0;
	for (i = 1; i <= 12; i++) {
		// 每一个自然月的天数
		iTotalDayNum += (FHBase.CHINESE_CALENDAR_MONTH_INFO[iYearIndex] & (0X10000 >> i)) ? 30 : 29;
		// 加上闰月的天数
		if (iLeapMonth == i) {
			iTotalDayNum += (FHBase.CHINESE_CALENDAR_MONTH_INFO[iYearIndex] & 0X10000) ? 30 : 29;
		}
	}
	// 返回函数值
	return iTotalDayNum;
};

/**
 * @描述：计算指定农历日期所在月的总天数
 * @开发人员：moshco zhu
 * @开发日期：2010-11-24 上午07:36:10
 * @参数：oLunar
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.sumDayNumOfMonth = function(iYear, iMonth, bIsLeapMonth) {
	// 计算年序号
	var iYearIndex = iYear - FHBase.CHINESE_CALENDAR_MONTH_INFO_BEGIN_YEAR;
	// 计算当月总天数
	var iSumDayNum = 0;
	if (bIsLeapMonth) {
		// 如果是闰月
		var iLeapMonth = FHBase.CHINESE_CALENDAR_MONTH_INFO[iYearIndex] & 0X0000F; // 计算闰月
		if (iLeapMonth == iMonth) {
			iSumDayNum = (FHBase.CHINESE_CALENDAR_MONTH_INFO[iYearIndex] & 0X10000) ? 30 : 29;
		}
	} else {
		// 如果不是闰月
		iSumDayNum = (FHBase.CHINESE_CALENDAR_MONTH_INFO[iYearIndex] & (0X10000 >> iMonth)) ? 30 : 29;
	}
	// 返回函数值
	return iSumDayNum;
};

/**
 * @描述：读取指定农历年的闰月月份 0表示无闰月
 * @开发人员：moshco zhu
 * @开发日期：2010-11-24 上午08:43:31
 * @参数：iYear
 * @返回值：any
 * @param iYear
 * @return
 */
FHBase.getLeapMonth = function(iYear) {
	// 计算年序号
	var iYearIndex = iYear - FHBase.CHINESE_CALENDAR_MONTH_INFO_BEGIN_YEAR;
	// 计算闰月
	var iLeapMonth = FHBase.CHINESE_CALENDAR_MONTH_INFO[iYearIndex] & 0X0000F;
	// 返回函数值
	return iLeapMonth;
};

/**
 * @描述：指定的农历年月是否就是闰月
 * @开发人员：moshco zhu
 * @开发日期：2010-12-22 上午09:23:07
 * @参数：iYear, iMonth
 * @返回值：any
 * @param iYear
 * @param iMonth
 * @return
 */
FHBase.isLeapMonth = function(iYear, iMonth) {
	// 读取这一年的闰月
	var iLeapMonth = FHBase.getLeapMonth(iYear);
	if (iLeapMonth == iMonth) {
		return true;
	} else {
		return false;
	}
};

/**
 * @描述：是否是闰年
 * @开发人员：moshco zhu
 * @开发日期：2010-12-8 上午10:38:23
 * @参数：iYear
 * @返回值：any
 * @param iYear
 * @return
 */
FHBase.isLeapYear = function(iYear) {
	if (((iYear % 4) == 0) && ((iYear % 100) != 0)) {
		return true;
	} else if ((iYear % 400) == 0) {
		return true;
	} else {
		return false;
	}
};

/**
 * @描述：判断指定的农历日期是否是当月最后一天
 * @开发人员：moshco zhu
 * @开发日期：2011-1-17 上午11:01:37
 * @参数：
 * @返回值：any
 * @return
 */
FHBase.isLastDayOfLunarMonth = function() {

	// 函数参数长度
	var iLength = arguments.length;
	if (iLength != 1 && iLength != 4) {
		var err = new Error();
		err.description = "FHBase.isLastDayOfLunarMonth(...)参数个数不对！";
		throw err;
	}

	// 农历年月日
	var iYear = null;
	var iMonth = null;
	var bIsLeapMonth = null;
	var iDay = null;
	if (iLength == 1) {
		iYear = arguments[0].year;
		iMonth = arguments[0].month;
		bIsLeapMonth = arguments[0].is_leap_month;
		iDay = arguments[0].day;
	} else if (iLength == 4) {
		iYear = arguments[0];
		iMonth = arguments[1];
		bIsLeapMonth = arguments[2];
		iDay = arguments[3];
	}

	// 读取当月总计天数
	var iDayNum = FHBase.sumDayNumOfMonth(iYear, iMonth, bIsLeapMonth);
	// 返回函数值
	return (iDayNum == iDay) ? true : false;
};

/**
 * @描述：是否是农历年的最后一天
 * @开发人员：moshco zhu
 * @开发日期：2011-1-17 上午11:02:31
 * @参数：
 * @返回值：any
 * @return
 */
FHBase.isLastDayOfLunarYear = function() {

	// 函数参数长度
	var iLength = arguments.length;
	if (iLength != 1 && iLength != 4) {
		var err = new Error();
		err.description = "FHBase.isLastDayOfLunarYear(...)参数个数不对！";
		throw err;
	}

	// 农历年月日
	var iYear = null;
	var iMonth = null;
	var bIsLeapMonth = null;
	var iDay = null;
	if (iLength == 1) {
		iYear = arguments[0].year;
		iMonth = arguments[0].month;
		bIsLeapMonth = arguments[0].is_leap_month;
		iDay = arguments[0].day;
	} else if (iLength == 4) {
		iYear = arguments[0];
		iMonth = arguments[1];
		bIsLeapMonth = arguments[2];
		iDay = arguments[3];
	}

	// 是否是农历年的最后一天
	var bIsLastDayOfYear = true;
	if ((iMonth == 12) && (!FHBase.isLeapMonth(iYear, 12) || (FHBase.isLeapMonth(iYear, 12) && bIsLeapMonth))) {
		if (!FHBase.isLastDayOfLunarMonth(iYear, iMonth, bIsLeapMonth, iDay)) {
			bIsLastDayOfYear = false;
		}
	} else {
		bIsLastDayOfYear = false;
	}
	// 返回函数值
	return bIsLastDayOfYear;
};

/**
 * @描述：是否是大月
 * @开发人员：moshco zhu
 * @开发日期：2010-12-8 上午10:43:34
 * @参数：iMonth
 * @返回值：any
 * @param iMonth
 * @return
 */
FHBase.isBigMonth = function(iMonth) {
	if ((iMonth == 1) || (iMonth == 3) || (iMonth == 5) || (iMonth == 7) || (iMonth == 8) || (iMonth == 10) || (iMonth == 12)) {
		// 大月
		return true;
	} else if (iMonth == 2) {
		// 2月
		return false;
	} else if ((iMonth == 4) || (iMonth == 6) || (iMonth == 9) || (iMonth == 11)) {
		// 小月
		return false;
	}
};

/**
 * @描述：是否是小月
 * @开发人员：moshco zhu
 * @开发日期：2010-12-15 上午11:47:20
 * @参数：iMonth
 * @返回值：any
 * @param iMonth
 * @return
 */
FHBase.isSmallMonth = function(iMonth) {
	if (FHBase.isBigMonth(iMonth)) {
		// 大月
		return false;
	} else if (iMonth == 2) {
		// 2月
		return false;
	}
	return true;
};

/**
 * @描述：读取公历某年某月的总天数
 * @开发人员：moshco zhu
 * @开发日期：2010-12-15 上午11:41:19
 * @参数：iYear, iMonth
 * @返回值：any
 * @param iYear
 * @param iMonth
 * @return
 */
FHBase.getDayNumOfMonth = function(iYear, iMonth) {
	var iTotalDayNum = 30;
	if (FHBase.isBigMonth(iMonth)) {
		iTotalDayNum = 31;
	} else if (iMonth == 2) {
		if (FHBase.isLeapYear(iYear)) {
			iTotalDayNum = 29;
		} else {
			iTotalDayNum = 28;
		}
	}
	return iTotalDayNum;
};

/**
 * @描述：判断指定的日期是否是这月的最后一天
 * @开发人员：moshco zhu
 * @开发日期：2010-12-16 上午11:32:30
 * @参数：oDt
 * @返回值：any
 * @param oDt
 * @return
 */
FHBase.isLastDayOfMonth = function(oDt) {
	// 函数
	var fn = function(iYear, iMonth, iDay) {
		if (iMonth == 2) {
			// 2月
			if (FHBase.isLeapYear(iYear)) {
				return (iDay == 29) ? true : false;
			} else {
				return (iDay == 28) ? true : false;
			}
		} else {
			if (FHBase.isBigMonth(iMonth)) {
				// 大月
				return (iDay == 31) ? true : false;
			} else {
				// 小月
				return (iDay == 30) ? true : false;
			}
		}
	};
	// 参数长度
	var iArgLength = arguments.length;
	if (iArgLength == 1) {
		// 日期对象
		if (arguments[0] instanceof Date) {
			var oDt = arguments[0];
			var iYear = oDt.getFullYear();
			var iMonth = oDt.getMonth() + 1;
			var iDay = oDt.getDate();
			return fn(iYear, iMonth, iDay);
		} else {
			// 参数类型不对
			var err = new Error();
			err.description = "FHBase.isLastDayOfMonth(...)参数类型不对！";
			throw err;
		}
	} else if (iArgLength == 3) {
		// 年月日分别传递
		return fn(arguments[0], arguments[1], arguments[2]);
	} else {
		// 参数数量错误
		var err = new Error();
		err.description = "FHBase.isLastDayOfMonth(...)参数数量错误！";
		throw err;
	}
	// 函数返回值
	return null;
};

/**
 * @描述：判断指定的农历日期是否是当年最后一个月
 * @开发人员：moshco zhu
 * @开发日期：2010-11-24 上午08:22:49
 * @参数：oLunar
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.isLastMonthOfYear = function(iYear, iMonth, bIsLeapMonth) {
	// 是否是最后一个月
	var bIsLastMonth = false;
	if (iMonth == 12) {
		if (bIsLeapMonth) {
			// 当月是闰月
			bIsLastMonth = true;
		} else if (FHBase.getLeapMonth(iYear) != 12) {
			bIsLastMonth = true;
		}
	}
	// 返回函数值
	return bIsLastMonth;
};

/**
 * @描述：获取农历下一个月份
 * @开发人员：moshco zhu
 * @开发日期：2010-11-24 上午09:04:13
 * @参数：oLunar 格式如：{ year : 1900, month : 1, is_leap_month : false, day : 1, tgdz_y : "庚子", tgdz_m : "戊寅", tgdz_d : "甲辰" }
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.getLunarNextMonth = function(oLunar) {
	if (FHBase.isLastMonthOfYear(oLunar.year, oLunar.month, oLunar.is_leap_month)) {
		// 下一个月在下一年
		return 1;
	} else {
		// 下一个月在本年
		if ((oLunar.is_leap_month) || (oLunar.month != FHBase.getLeapMonth(oLunar.year))) {
			return oLunar.month + 1;
		} else {
			return oLunar.month;
		}
	}
};

/**
 * @描述：计算上一个天干地支
 * @开发人员：moshco zhu
 * @开发日期：2010-12-25 上午11:08:50
 * @参数：strTGDZ
 * @返回值：any
 * @param strTGDZ
 * @return
 */
FHBase.getPreviousTGDZ = function(strTGDZ) {
	if (strTGDZ == null || strTGDZ == "") {
		return null;
	} else {
		return FHBase.getTGDZ(strTGDZ, -1);
	}
};

/**
 * @描述：计算下一个天干地支
 * @开发人员：moshco zhu
 * @开发日期：2010-11-24 上午09:21:07
 * @参数：strTGDZ
 * @返回值：any
 * @param strTGDZ
 * @return
 */
FHBase.getNextTGDZ = function(strTGDZ) {
	return FHBase.getTGDZ(strTGDZ, 1);
};

/**
 * @描述：读取生肖年
 * @开发人员：moshco zhu
 * @开发日期：2011-1-14 上午11:45:24
 * @参数：strTGDZ
 * @返回值：any
 * @param strTGDZ
 * @return
 */
FHBase.getYearOfBirth = function(strTGDZ) {
	// 函数：读取天干或地支的序号
	var getIndex = function(ary, str) {
		var iIndex = -1;
		$.each(ary, function(iIndex1, str1) {
			if (str1 == str) {
				iIndex = iIndex1;
				return false;
			}
		});
		return iIndex;
	};
	// 地支
	var strDZ = strTGDZ.charAt(1);
	// 读取地支序号
	var iDZIndex = getIndex(FHBase.CHINESE_CALENDAR_DZ_ARRAY, strDZ);
	// 读取生肖
	var strYearOfBirth = FHBase.CHINESE_CALENDAR_YEAR_OF_BIRTH_ARRAY[iDZIndex];
	// 返回函数值
	return strYearOfBirth;
};

/**
 * @描述：计算一个天干地支,与给定的天干地支相差指定的天数
 * @开发人员：moshco zhu
 * @开发日期：2010-11-25 上午01:07:40
 * @参数：strTGDZ, lDayNumLength
 * @返回值：any
 * @param strTGDZ
 * @param lDayNumLength
 * @return
 */
FHBase.getTGDZ = function(strTGDZ, lDayNumLength) {
	// 函数：读取天干或地支的序号
	var getIndex = function(ary, str) {
		var iIndex = -1;
		$.each(ary, function(iIndex1, str1) {
			if (str1 == str) {
				iIndex = iIndex1;
				return false;
			}
		});
		return iIndex;
	};
	// 分解起始天干地支 读取它们对应的序号
	var strTG = strTGDZ.charAt(0);
	var iTGIndex = getIndex(FHBase.CHINESE_CALENDAR_TG_ARRAY, strTG);
	var strDZ = strTGDZ.charAt(1);
	var iDZIndex = getIndex(FHBase.CHINESE_CALENDAR_DZ_ARRAY, strDZ);
	// 求下一个天干地支的序数
	var iNextIndexTG = (iTGIndex + lDayNumLength) % 10;
	iNextIndexTG = (iNextIndexTG < 0) ? (iNextIndexTG + 10) : iNextIndexTG;
	var iNextIndexDZ = (iDZIndex + lDayNumLength) % 12;
	iNextIndexDZ = (iNextIndexDZ < 0) ? (iNextIndexDZ + 12) : iNextIndexDZ;
	// 组合干支
	var strNextTGDZ = FHBase.CHINESE_CALENDAR_TG_ARRAY[iNextIndexTG] + FHBase.CHINESE_CALENDAR_DZ_ARRAY[iNextIndexDZ];
	// 返回函数值
	return strNextTGDZ;
};

/**
 * @描述：指定一个农历日期oLunar，计算它的下一天的农历日期
 * @开发人员：moshco zhu
 * @开发日期：2010-11-24 上午07:01:43
 * @参数：oLunar 格式如：{ year : 1900, month : 1, is_leap_month : false, day : 1, tgdz_y : "庚子", tgdz_m : "戊寅", tgdz_d : "甲辰" }
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.getLunarNextDate = function(oLunar) {
	// 日期不能为空
	if (oLunar == null) {
		return null;
	}
	// 复制参数
	oLunar = {
		year : oLunar.year,
		month : oLunar.month,
		is_leap_month : oLunar.is_leap_month,
		day : oLunar.day,
		tgdz_y : oLunar.tgdz_y,
		tgdz_m : oLunar.tgdz_m,
		tgdz_d : oLunar.tgdz_d
	};
	// 计算当月总天数
	var iTotalDayNumLength = FHBase.sumDayNumOfMonth(oLunar.year, oLunar.month, oLunar.is_leap_month);
	if (oLunar.day < iTotalDayNumLength) {
		// 下一天仍在当月
		oLunar.day++;
		oLunar.tgdz_d = FHBase.getNextTGDZ(oLunar.tgdz_d);
	} else {
		// 下一天在下一个月(也有可能是下一年)
		if (FHBase.isLastMonthOfYear(oLunar.year, oLunar.month, oLunar.is_leap_month)) {
			// 下一天在下一年
			oLunar.year++;
			oLunar.month = 1;
			oLunar.is_leap_month = false;
			oLunar.day = 1;
			oLunar.tgdz_y = FHBase.getNextTGDZ(oLunar.tgdz_y);
			oLunar.tgdz_m = FHBase.getNextTGDZ(oLunar.tgdz_m);
			oLunar.tgdz_d = FHBase.getNextTGDZ(oLunar.tgdz_d);
		} else {
			// 下一天在下一个月
			var iNextMonth = FHBase.getLunarNextMonth(oLunar);
			oLunar.is_leap_month = (oLunar.month == iNextMonth) ? true : false;
			oLunar.month = iNextMonth;
			oLunar.day = 1;
			if (!oLunar.is_leap_month) {
				oLunar.tgdz_m = FHBase.getNextTGDZ(oLunar.tgdz_m);
			}
			oLunar.tgdz_d = FHBase.getNextTGDZ(oLunar.tgdz_d);
		}
	}
	// 返回函数值
	return oLunar;
};

/**
 * @描述：指定一个农历日期oLunar，计算它的前一天的农历日期
 * @开发人员：moshco zhu
 * @开发日期：2010-12-22 上午11:30:34
 * @参数：oLunar oLunar 格式如：{ year : 1900, month : 1, is_leap_month : false, day : 1, tgdz_y : "庚子", tgdz_m : "戊寅", tgdz_d : "甲辰" }
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.getLunarPreviousDate = function(oLunar) {
	// 日期不能为空
	if (oLunar == null) {
		return null;
	}
	// 复制参数
	var oPreviousLunar = $.extend({}, oLunar);
	// 年月日
	if (oPreviousLunar.day > 1) {
		// 上一天仍在当月
		oPreviousLunar.day--;
		oPreviousLunar.tgdz_d = FHBase.getPreviousTGDZ(oPreviousLunar.tgdz_d);
	} else {
		// 上一天在上月最后一天
		if (oPreviousLunar.month == 1 && !oPreviousLunar.is_leap_month) {
			// 在上一年
			oPreviousLunar.year--;
			oPreviousLunar.month = 12;
			var iLeapMonth = FHBase.getLeapMonth(oPreviousLunar.year);
			oPreviousLunar.is_leap_month = (iLeapMonth == 12) ? true : false;
			oPreviousLunar.day = FHBase.sumDayNumOfMonth(oPreviousLunar.year, oPreviousLunar.month, oPreviousLunar.is_leap_month);
			if (oPreviousLunar.tgdz_y != null) {
				oPreviousLunar.tgdz_y = FHBase.getPreviousTGDZ(oPreviousLunar.tgdz_y);
				oPreviousLunar.tgdz_m = FHBase.getPreviousTGDZ(oPreviousLunar.tgdz_m);
				oPreviousLunar.tgdz_d = FHBase.getPreviousTGDZ(oPreviousLunar.tgdz_d);
			}
		} else {
			// 在本年
			var iLeapMonth = FHBase.getLeapMonth(oPreviousLunar.year);
			if (oPreviousLunar.is_leap_month) {
				oPreviousLunar.is_leap_month = false;
			} else if ((oPreviousLunar.month - 1) == iLeapMonth) {
				oPreviousLunar.month -= 1;
				oPreviousLunar.is_leap_month = true;
				if (oPreviousLunar.tgdz_m != null) {
					oPreviousLunar.tgdz_m = FHBase.getPreviousTGDZ(oPreviousLunar.tgdz_m);
				}
			} else {
				oPreviousLunar.month -= 1;
				oPreviousLunar.is_leap_month = false;
				if (oPreviousLunar.tgdz_m != null) {
					oPreviousLunar.tgdz_m = FHBase.getPreviousTGDZ(oPreviousLunar.tgdz_m);
				}
			}
			oPreviousLunar.day = FHBase.sumDayNumOfMonth(oPreviousLunar.year, oPreviousLunar.month, oPreviousLunar.is_leap_month);
			if (oPreviousLunar.tgdz_m != null) {
				oPreviousLunar.tgdz_m = FHBase.getPreviousTGDZ(oPreviousLunar.tgdz_m);
			}
		}
	}
	// 返回函数值
	return oPreviousLunar;
};

/**
 * @描述：计算农历日期到月末的总天数
 * @开发人员：moshco zhu
 * @开发日期：2010-11-25 上午12:51:21
 * @参数：oLunar
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.sumDayNumToLunarMonthEnd = function(iYear, iMonth, bIsLeapMonth, iDay) {
	// 计算本月的总天数
	var iDayNumLength = FHBase.sumDayNumOfMonth(iYear, iMonth, bIsLeapMonth);
	// 计算日期到月末的总天数
	var iDayNumLengthToMonthEnd = iDayNumLength - iDay;
	// 返回函数值
	return iDayNumLengthToMonthEnd;
};

/**
 * @描述：计算给定的日期到年末的总天数
 * @开发人员：moshco zhu
 * @开发日期：2010-11-25 上午01:26:26
 * @参数：oLunar
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.sumDayNumToLunarYearEnd = function(iYear, iMonth, bIsLeapMonth, iDay) {
	// 总天数
	var iTotalDayNum = 0;
	// 计算到月末的总天数
	iTotalDayNum = FHBase.sumDayNumToLunarMonthEnd(iYear, iMonth, bIsLeapMonth, iDay);
	// 闰月月份
	var iLeapMonth = FHBase.getLeapMonth(iYear);
	do {
		// 要计算的月份
		if (iMonth == iLeapMonth && !bIsLeapMonth) {
			bIsLeapMonth = true;
		} else {
			iMonth++;
			bIsLeapMonth = false;
		}
		// 计算总天数
		if (iMonth <= 12) {
			iTotalDayNum += FHBase.sumDayNumOfMonth(iYear, iMonth, bIsLeapMonth);
		} else {
			// 中断循环
			break;
		}
	} while (true);
	// 返回函数值
	return iTotalDayNum;
};

/**
 * @描述：计算两个农历日期之间间隔总天数
 * @开发人员：moshco zhu
 * @开发日期：2010-12-21 上午09:20:17
 * @参数：oDt1, oDt2
 * @返回值：any
 * @param oDt1
 * @param oDt2
 * @return
 */
FHBase.sumLunarDayNum = function(oDt1, oDt2) {

	// 日期不能为空
	if (oDt1 == null || oDt2 == null) {
		// 抛出异常
		var err = new Error();
		err.description = "FHBase.sumLunarDayNum(...)参数不能为空！";
		throw err;
	}

	// 函数：累计计算同一年内两个月之间（不包含结尾月）所有月份总天数的和
	var fn_SumDayNumMulMonth = function(iYear, iMonth1, bIsLeapMonth1, iMonth2, bIsLeapMonth2) {
		// 总天数
		var iTotalDayNum = 0;
		// 累计每一个月的总天数
		var iMonthTmp = iMonth1;
		var bIsLeapMonthTmp = bIsLeapMonth1;
		while ((iMonthTmp < iMonth2) || ((iMonthTmp == iMonth2) && !bIsLeapMonthTmp && bIsLeapMonth2)) {
			// 计算总天数
			iTotalDayNum += FHBase.sumDayNumOfMonth(iYear, iMonthTmp, bIsLeapMonthTmp);
			if (!bIsLeapMonthTmp && FHBase.isLeapMonth(iYear, iMonthTmp)) {
				bIsLeapMonthTmp = true;
			} else {
				iMonthTmp++;
				bIsLeapMonthTmp = false;
			}
		}
		// 返回函数值
		return iTotalDayNum;
	};

	// 函数：累计计算两年之间（不包含结尾年）所有年份总天数的和
	var fn_SumDayNumMulYear = function(iYear1, iYear2) {
		// 总天数
		var iTotalDayNum = 0;
		var iYearTmp = iYear1;
		while (iYearTmp < iYear2) {
			// 读取农历年的总天数
			iTotalDayNum += FHBase.sumDayNumOfYear(iYearTmp);
			// 下一年
			iYearTmp++;
		}
		// 返回函数值
		return iTotalDayNum;
	};

	// 读取年月日
	var iLunarYear1 = oDt1.year;
	var iLunarMonth1 = oDt1.month;
	var bIsLeapMonth1 = oDt1.is_leap_month;
	var iDay1 = oDt1.day;
	var iLunarYear2 = oDt2.year;
	var iLunarMonth2 = oDt2.month;
	var bIsLeapMonth2 = oDt2.is_leap_month;
	var iDay2 = oDt2.day;

	// 计算总天数
	var iTotalDayNum = 0;
	if (iLunarYear1 == iLunarYear2) {
		// 在同一年
		if ((iLunarMonth1 == iLunarMonth2) && (bIsLeapMonth1 == bIsLeapMonth2)) {
			// 在同一月
			iTotalDayNum = iDay2 - iDay1;
		} else {
			// 不在同一个月
			// 累计计算同一年内两个月之间（不包含结尾月）所有月份总天数的和
			iTotalDayNum = fn_SumDayNumMulMonth(iLunarYear1, iLunarMonth1, bIsLeapMonth1, iLunarMonth2, bIsLeapMonth2);
			iTotalDayNum = iTotalDayNum - iDay1 + iDay2;
		}
	} else {
		// 不在同一年
		// 累计计算两年之间（不包含结尾年）所有年份总天数的和
		iTotalDayNum = fn_SumDayNumMulYear(iLunarYear1 + 1, iLunarYear2 + 1);
		iTotalDayNum += FHBase.sumDayNumToLunarYearEnd(iLunarYear1, iLunarMonth1, bIsLeapMonth1, iDay1);
		iTotalDayNum -= FHBase.sumDayNumToLunarYearEnd(iLunarYear2, iLunarMonth2, bIsLeapMonth2, iDay2);
	}

	// 返回函数值
	return iTotalDayNum;
};

/**
 * @描述：计算指定日期到年末的总月份数
 * @开发人员：moshco zhu
 * @开发日期：2010-12-24 上午10:52:59
 * @参数：iYear, iMonth, bIsLeapMonth
 * @返回值：any
 * @param iYear
 * @param iMonth
 * @param bIsLeapMonth
 * @return
 */
FHBase.sumMonthNumToYearEnd = function(iYear, iMonth, bIsLeapMonth) {
	// 闰月月份
	var iLeapMonth = FHBase.getLeapMonth(iYear);
	// 到年末的总月份数
	var iTotalMonthNum = 12 - iMonth;
	if ((iLeapMonth == iMonth && !bIsLeapMonth) || (iLeapMonth > iMonth)) {
		iTotalMonthNum++;
	}
	// 返回函数值
	return iTotalMonthNum;
};

/**
 * @描述：计算指定农历年iYear的总月份数
 * @开发人员：moshco zhu
 * @开发日期：2010-12-25 上午09:15:28
 * @参数：iYear
 * @返回值：any
 * @param iYear
 * @return
 */
FHBase.sumMonthNumOfYear = function(iYear) {
	return (FHBase.getLeapMonth(iYear) > 0) ? 13 : 12;
};

/**
 * @描述：计算两个农历日期之间相差的总月份数
 * @开发人员：moshco zhu
 * @开发日期：2010-12-22 上午11:51:22
 * @参数：oBeginLunar, oLunar oLunar 格式如：{ year : 1900, month : 1, is_leap_month : false, day : 1 }
 * @返回值：any
 * @param oBeginLunar
 * @param oLunar
 * @return
 */
FHBase.sumMonthNum = function(oBeginLunar, oLunar) {

	// 函数：指定日期dtLunar是否在周期起始日期dtPeriodLunar的前面
	var fn_IsBefore = function(dtPeriodLunar, dtLunar) {
		// 起始年日期
		var iYearTmp = dtPeriodLunar.year;
		var iMonthTmp = dtPeriodLunar.month;
		var bIsLeapMonthTmp = dtPeriodLunar.is_leap_month;
		var iDayTmp = dtPeriodLunar.day;
		// 结束年日期
		var iYearTmp2 = dtLunar.year;
		var iMonthTmp2 = dtLunar.month;
		var bIsLeapMonthTmp2 = dtLunar.is_leap_month;
		var iDayTmp2 = dtLunar.day;

		// 指定日期dtLunar是否在周期起始日期dtPeriodLunar的前面
		var bIsBefore = false;

		// 比较日序号
		var iDayNum1 = FHBase.sumDayNumOfMonth(iYearTmp, iMonthTmp, bIsLeapMonthTmp);
		var iDayNum2 = FHBase.sumDayNumOfMonth(iYearTmp2, iMonthTmp2, bIsLeapMonthTmp2);
		if ((iDayTmp <= iDayNum2) && (iDayTmp2 < iDayTmp)) {
			bIsBefore = true;
		} else if ((iDayTmp > iDayNum2) && !((iDayNum1 == iDayTmp) && (iDayNum2 == iDayTmp2))) {
			bIsBefore = true;
		}

		// 返回函数值
		return bIsBefore;
	};

	// 总月份数
	var iTotalMonthNum = 0;
	if (oBeginLunar.year == oLunar.year) {
		// 同一年
		// 相差
		iTotalMonthNum = oLunar.month - oBeginLunar.month;
		// 读取闰月月份
		var iLeapMonthTmp = FHBase.getLeapMonth(oBeginLunar.year);
		// 闰月月份是否在中间
		if ((iLeapMonthTmp > oBeginLunar.month) && (iLeapMonthTmp < oLunar.month)) {
			iTotalMonthNum++;
		} else if ((!oBeginLunar.is_leap_month && iLeapMonthTmp == oBeginLunar.month) || oLunar.is_leap_month) {
			iTotalMonthNum++;
		}
		// 指定日期可能在周期点的前面
		iTotalMonthNum -= (fn_IsBefore(oBeginLunar, oLunar)) ? 1 : 0;
	} else {
		// 不在同一年
		// 起始年到年末的月份数
		var iYearTmp = oBeginLunar.year;
		iTotalMonthNum = FHBase.sumMonthNumToYearEnd(iYearTmp, oBeginLunar.month, oBeginLunar.is_leap_month);

		// 合计每年的月份数
		iYearTmp++;
		while (iYearTmp < oLunar.year) {
			// 合计每年月份
			iTotalMonthNum += FHBase.sumMonthNumOfYear(iYearTmp);
			// 下一年
			iYearTmp++;
		}

		// 月份数
		iTotalMonthNum += oLunar.month;
		// 闰月月份
		var iLeapMonthTmp = FHBase.getLeapMonth(oLunar.year);
		if ((iLeapMonthTmp < oLunar.month) || oLunar.is_leap_month) {
			iTotalMonthNum++;
		}
		// 指定日期可能在周期点的前面
		iTotalMonthNum -= (fn_IsBefore(oBeginLunar, oLunar)) ? 1 : 0;
	}
	// 返回函数值
	return iTotalMonthNum;
};

/**
 * @描述：给定一个起始农历日期，计算lDayNumLength天后的一个农历日期
 * @开发人员：moshco zhu
 * @开发日期：2010-11-24 上午07:00:03
 * @参数：oLunar, lDayNumLength oLunar 格式如：{ year : 1900, month : 1, is_leap_month : false, day : 1, tgdz_y : "庚子", tgdz_m : "戊寅", tgdz_d : "甲辰" }
 * @返回值：any
 * @param oLunar
 * @param lDayNumLength
 * @return
 */
FHBase.getLunarDate = function(oLunar, lDayNumLength) {
	// 日期对象不能为空
	if (oLunar == null) {
		return null;
	}
	// 创建农历日期对象
	var oLunar1 = {
		year : oLunar.year,
		month : oLunar.month,
		is_leap_month : oLunar.is_leap_month,
		day : oLunar.day,
		tgdz_y : oLunar.tgdz_y,
		tgdz_m : oLunar.tgdz_m,
		tgdz_d : oLunar.tgdz_d
	};
	// 计算日期到月末的总天数
	var iDayNumLengthToMonthEnd = FHBase.sumDayNumToLunarMonthEnd(oLunar.year, oLunar.month, oLunar.is_leap_month, oLunar.day);
	if (iDayNumLengthToMonthEnd >= lDayNumLength) {
		// 要计算的日期与给定日期在同一个月
		oLunar1.day = oLunar1.day + lDayNumLength;
		oLunar1.tgdz_d = FHBase.getTGDZ(oLunar.tgdz_d, lDayNumLength);
	} else {
		// 要计算的日期与给定日期不在同一个月

		// 计算从某月初一开始，间隔指定天数后的一个日期，这一日期在年内
		var fn = function(iYear, iMonth, bIsLeapMonth, iDayNumLength) {
			// 计算指定年的闰月月份
			var iLeapMonth = FHBase.getLeapMonth(iYear);
			// 计算月份总天数
			var iDayNumOfMonth = FHBase.sumDayNumOfMonth(iYear, iMonth, bIsLeapMonth);
			// 剩余天数
			var lLaveDayNumLength = iDayNumLength;
			while (lLaveDayNumLength > iDayNumOfMonth) {
				// 剩余天数
				lLaveDayNumLength -= iDayNumOfMonth;
				// 下一个月
				if (iMonth == iLeapMonth && !bIsLeapMonth) {
					bIsLeapMonth = true;
				} else {
					iMonth++;
					bIsLeapMonth = false;
				}
				// 计算月份总天数
				iDayNumOfMonth = FHBase.sumDayNumOfMonth(iYear, iMonth, bIsLeapMonth);
			}
			// 确定日期
			var oLunar2 = {};
			oLunar2.year = iYear;
			oLunar2.month = iMonth;
			oLunar2.is_leap_month = bIsLeapMonth;
			oLunar2.day = lLaveDayNumLength;
			// 返回函数值
			return oLunar2;
		};

		// 计算日期到年末的总天数
		var iDayNumLengthToYearEnd = FHBase.sumDayNumToLunarYearEnd(oLunar.year, oLunar.month, oLunar.is_leap_month, oLunar.day);
		if (iDayNumLengthToYearEnd >= lDayNumLength) {
			// 要计算的日期与给定日期在同一年
			// 剩余天数
			var lLaveDayNumLength = lDayNumLength - iDayNumLengthToMonthEnd;
			// 闰月月份
			var iLeapMonth = FHBase.getLeapMonth(oLunar1.year);
			// 月份
			var iMonth = oLunar1.month;
			// 是否闰月
			var bIsLeapMonth = oLunar1.is_leap_month;
			// 要计算的月份
			if (iMonth == iLeapMonth && !bIsLeapMonth) {
				bIsLeapMonth = true;
			} else {
				iMonth++;
			}
			// 计算日期
			var Lunar2 = fn(oLunar1.year, iMonth, bIsLeapMonth, lLaveDayNumLength);
			// 确定日期
			oLunar1.month = Lunar2.month;
			oLunar1.is_leap_month = Lunar2.is_leap_month;
			oLunar1.day = Lunar2.day;
			oLunar1.tgdz_m = FHBase.getTGDZ(oLunar.tgdz_m, (Lunar2.month - oLunar.month));
			oLunar1.tgdz_d = FHBase.getTGDZ(oLunar.tgdz_d, lDayNumLength);
		} else {
			// 要计算的日期与给定日期不在同一年
			// 剩余天数
			var lLaveDayNumLength = lDayNumLength - iDayNumLengthToYearEnd;
			var iYear = oLunar.year + 1;
			var iDayNumOfYear = FHBase.sumDayNumOfYear(iYear);
			// 计算年序号
			while (lLaveDayNumLength > iDayNumOfYear) {
				// 剩余天数
				lLaveDayNumLength -= iDayNumOfYear;
				// 下一年
				iYear++;
				// 计算1年的总天数
				iDayNumOfYear = FHBase.sumDayNumOfYear(iYear);
			}
			// 计算日期
			var oLunar2 = fn(iYear, 1, false, lLaveDayNumLength);
			// 确定日期
			oLunar1.year = oLunar2.year;
			oLunar1.month = oLunar2.month;
			oLunar1.is_leap_month = oLunar2.is_leap_month;
			oLunar1.day = oLunar2.day;
			oLunar1.tgdz_y = FHBase.getTGDZ(oLunar.tgdz_y, (oLunar2.year - oLunar.year));
			oLunar1.tgdz_m = FHBase.getTGDZ(oLunar.tgdz_m, ((12 - oLunar.month) + (oLunar2.year - oLunar.year - 1) * 12 + oLunar2.month));
			oLunar1.tgdz_d = FHBase.getTGDZ(oLunar.tgdz_d, lDayNumLength);
		}
	}
	// 返回函数值
	return oLunar1;
};

/**
 * @描述：将一个公历日期转换为一个农历日期
 * @开发人员：moshco zhu
 * @开发日期：2010-11-25 上午10:46:40
 * @参数：dt
 * @返回值：any oLunarDate 格式如：{ year : 1900, month : 1, is_leap_month : false, day : 1, tgdz_y : "庚子", tgdz_m : "戊寅", tgdz_d : "甲辰" }
 * @param dt
 * @return
 */
FHBase.transformLunarDate = function(dt) {
	// 日期不能为空
	if (dt == null) {
		return null;
	}
	// 计算距离起始日期的总天数
	var lTime = dt.getTime();
	var lMinTime = FHBase.BeginDate.date.getTime();
	var lDayNumLength = parseInt((lTime - lMinTime) / (24 * 60 * 60 * 1000));
	// 农历日期
	var oLunarDate = FHBase.getLunarDate(FHBase.BeginDate.lunar, lDayNumLength);
	// 返回函数值
	return oLunarDate;
};

/**
 * @描述：将一个农历日期转换为一个公历日期
 * @开发人员：moshco zhu
 * @开发日期：2010-12-22 上午10:24:39
 * @参数：oLunarDate oLunarDate 格式如：{ year : 1900, month : 1, is_leap_month : false, day : 1 }
 * @返回值：any
 * @param oLunarDate
 * @return
 */
FHBase.transformDate = function(oLunarDate) {
	// 日期不能为空
	if (oLunarDate == null) {
		return null;
	}
	// 计算距离起始日期的总天数
	var oBeginLunar = FHBase.BeginDate.lunar;
	var iTotalDayNum = FHBase.sumDayNum(oBeginLunar, oLunarDate);
	// 计算日期
	var oDt = new Date(FHBase.BeginDate.date.getTime() + iTotalDayNum * 24 * 60 * 60 * 1000);
	// 返回函数值
	return oDt;
};

/**
 * @描述：转换为农历日期
 * @开发人员：moshco zhu
 * @开发日期：2010-12-22 上午10:35:59
 * @参数：dt
 * @返回值：any
 * @param dt
 * @return
 */
FHBase.toLunar = function(dt) {
	return FHBase.transformLunarDate(dt);
};

/**
 * @描述：读取节假日，如果不是则为空
 * @开发人员：moshco zhu
 * @开发日期：2011-1-18 上午10:41:07
 * @参数：oDt, bIsOnlyFestival, bIsOnlyHolidayFirstDay
 * @返回值：any
 * @param oDt
 * @param bIsOnlyFestival
 * @param bIsOnlyHolidayFirstDay
 * @return
 */
FHBase.getCalendarHoliday = function(oDt, bIsOnlyFestival, bIsOnlyHolidayFirstDay) {

	// 函数：是否有效的年份
	var fn_IsValidYear = function(oHoliday, iYearIndex, bIsOnlyFestival) {
		// 是否有效
		var bIsValid = true;
		// 年序号限制
		if (bIsOnlyFestival != null && bIsOnlyFestival) {
			// 只是节日，不是假日：起源年之后，成为假日年之前
			if (oHoliday.origin_year != null && iYearIndex < oHoliday.origin_year) {
				bIsValid = false;
			} else if (oHoliday.year != null && iYearIndex >= oHoliday.year) {
				bIsValid = false;
			}
		} else {
			// 假日：成为假日年之后
			// 节日还没有诞生
			if (oHoliday.year != null && iYearIndex < oHoliday.year) {
				bIsValid = false;
			}
		}
		// 返回函数值
		return bIsValid;
	};

	// 农历假日匹配
	var fn_MatchHoliday_Lunar = function(aryHoliday, oMatchDate, oMatchHoliday, bIsOnlyFestival) {
		// 农历日期
		var oLunar = oMatchDate.lunar;
		var iLunarYear = oLunar.year;
		var iLunarMonth = oLunar.month;
		var bIsLeapMonth = oLunar.is_leap_month;
		var iLunarDay = oLunar.day;
		// 二十四节气序号
		var i24SolarTermsIndex = oMatchDate.the24SolarTermsIndex;
		// 是否农历月份的最后一天
		var bIsLastDayOfMonth = oMatchDate.isLastDayOfMonth;
		// 是否农历年的最后一天
		var bIsLastDayOfYear = oMatchDate.isLastDayOfYear;
		// 年序号限制
		if (!fn_IsValidYear(oMatchHoliday, iLunarYear, bIsOnlyFestival)) {
			// 非假日
			return false;
		}
		if (oMatchHoliday.day != null) {
			// 指定日期
			if ((oMatchHoliday.month == iLunarMonth) && (oMatchHoliday.day == iLunarDay)) {
				aryHoliday.push(oMatchHoliday);
				// 是假日
				return true;
			}
		} else if (oMatchHoliday.is_last_day_of_month != null && oMatchHoliday.is_last_day_of_month) {
			// 农历某月最后一天
			if ((oMatchHoliday.month == iLunarMonth) && bIsLastDayOfMonth) {
				// 是否农历月的最后一天
				aryHoliday.push(oMatchHoliday);
				// 是假日
				return true;
			}
		} else if (oMatchHoliday.is_last_day_of_year != null && oMatchHoliday.is_last_day_of_year) {
			// 农历某年最后一天
			if (bIsLastDayOfYear) {
				aryHoliday.push(oMatchHoliday);
				// 是假日
				return true;
			}
		} else if (oMatchHoliday.the_24solar_terms_index != null) {
			// 二十四节气
			if (i24SolarTermsIndex == oMatchHoliday.the_24solar_terms_index) {
				aryHoliday.push(oMatchHoliday);
				// 是假日
				return true;
			}
		}
		// 返回函数值
		return false;
	};

	// 公历假日匹配
	var fn_MatchHoliday_Gregorian = function(aryHoliday, oMatchDate, oMatchHoliday, bIsOnlyFestival) {
		// 公历日期
		var dt = oMatchDate.date;
		var iYear = dt.getFullYear();
		var iMonth = dt.getMonth() + 1;
		var iDay = dt.getDate();
		// 年序号限制
		if (!fn_IsValidYear(oMatchHoliday, iYear, bIsOnlyFestival)) {
			// 非假日
			return false;
		}
		if ((oMatchHoliday.month == iMonth) && (oMatchHoliday.day == iDay)) {
			aryHoliday.push(oMatchHoliday);
			// 是假日
			return true;
		}
		// 返回函数值
		return false;
	};

	// 函数：匹配假日
	var fn_MatchHoliday = function(aryHoliday, oMatchDate, oMatchHoliday, bIsOnlyFestival) {
		if (oMatchHoliday.is_lunar != null && oMatchHoliday.is_lunar) {
			// 农历假日匹配
			return fn_MatchHoliday_Lunar(aryHoliday, oMatchDate, oMatchHoliday, bIsOnlyFestival);
		} else {
			// 公历假日匹配
			return fn_MatchHoliday_Gregorian(aryHoliday, oMatchDate, oMatchHoliday, bIsOnlyFestival);
		}
		// 返回函数值
		return false;
	};

	// 函数：读取匹配日期
	var getMatchDate = function(oDt, iDayIndex) {
		// 当前日期
		if (iDayIndex == null || iDayIndex == 0) {
			return oDt;
		}
		// 匹配日期的日期
		var oMatchDate = null;
		// 在前日期数组中找寻
		if (oDt.dayIndexDates != null && oDt.dayIndexDates[iDayIndex - 1] != null) {
			oMatchDate = oDt.dayIndexDates[iDayIndex - 1];
		}
		// 计算这一日期
		if (oMatchDate == null) {
			// 日期数组
			if (oDt.dayIndexDates == null) {
				$.extend({
					dayIndexDates : null
				}, oDt);
				oDt.dayIndexDates = new Array();
			}
			// 匹配日期
			oMatchDate = {
				date : null,
				lunar : null
			};
			// 公历日期
			oMatchDate.date = new Date(oDt.date.getTime() - iDayIndex * 24 * 60 * 60 * 1000);
			// 农历日期
			oMatchDate.lunar = FHBase.toLunar(oMatchDate.date);
			// 二十四节气序号
			var i24SolarTermsIndex = FHBase.get24SolarTermIndex(oMatchDate.date);
			// 是否农历月份的最后一天
			var bIsLastDayOfMonth = FHBase.isLastDayOfLunarMonth(oMatchDate.lunar);
			// 是否农历年的最后一天
			var bIsLastDayOfYear = FHBase.isLastDayOfLunarYear(oMatchDate.lunar);
			oMatchDate = $.extend(oMatchDate, {
				the24SolarTermsIndex : i24SolarTermsIndex,
				isLastDayOfMonth : bIsLastDayOfMonth,
				isLastDayOfYear : bIsLastDayOfYear
			});
			// 加入到日期数组
			if (oDt.dayIndexDates.length < iDayIndex) {
				oDt.dayIndexDates.push({});
			}
			oDt.dayIndexDates[iDayIndex - 1] = oMatchDate;
		}
		// 返回日期
		return oMatchDate;
	};

	// 公历部分
	if (oDt instanceof Date) {
		oDt = {
			date : oDt,
			lunar : null
		};
	}
	// 农历部分
	if (oDt.lunar == null) {
		oDt = $.extend(oDt, {
			lunar : FHBase.transformLunarDate(oDt.date)
		});
	}
	// 其它
	// 二十四节气序号
	var i24SolarTermsIndex = FHBase.get24SolarTermIndex(oDt.date);
	// 是否农历月份的最后一天
	var bIsLastDayOfMonth = FHBase.isLastDayOfLunarMonth(oDt.lunar);
	// 是否农历年的最后一天
	var bIsLastDayOfYear = FHBase.isLastDayOfLunarYear(oDt.lunar);
	oDt = $.extend(oDt, {
		the24SolarTermsIndex : i24SolarTermsIndex,
		isLastDayOfMonth : bIsLastDayOfMonth,
		isLastDayOfYear : bIsLastDayOfYear
	});

	// 节假日数组
	var aryHoliday = new Array();
	// 节假日数组
	var ary = FHBase.CALENDAR_HOLIDAYS;
	// 是否仅仅匹配节日第一天
	bIsOnlyHolidayFirstDay = (bIsOnlyHolidayFirstDay == null) ? true : bIsOnlyHolidayFirstDay;
	// 是否仅仅匹配节日：即假日诞生之后，成为法定假日之前
	bIsOnlyFestival = (bIsOnlyFestival == null) ? false : bIsOnlyFestival;
	// 如果要读取的只是节日，那么就只能是第一天
	if (bIsOnlyFestival) {
		bIsOnlyHolidayFirstDay = true;
	}
	// 逐一匹配每一个假日
	$.each(ary, function(iIndex, oHoliday) {
		var oMatchHoliday = $.extend({
			day_index : 0
		}, oHoliday);
		var iHolidayLength = (oMatchHoliday.day_num == null) ? 1 : oMatchHoliday.day_num;
		for ( var i = 1; i <= iHolidayLength; i++) {
			var iDayIndex = i - 1;
			var oMatchDate = getMatchDate(oDt, iDayIndex);
			if (fn_MatchHoliday(aryHoliday, oMatchDate, oMatchHoliday, bIsOnlyFestival)) {
				oMatchHoliday.day_index = iDayIndex;
				break;
			}
			if (bIsOnlyHolidayFirstDay) {
				break;
			}
		}
	});
	// 返回函数值
	return (aryHoliday.length == 0) ? null : aryHoliday;
};

/**
 * @描述：读取指定公历日期的二十四节气序号，如果不是则为-1
 * @开发人员：moshco zhu
 * @开发日期：2011-1-17 上午10:53:10
 * @参数：
 * @返回值：any
 * @return
 */
FHBase.get24SolarTermIndex = function() {

	// 函数参数长度
	var iLength = arguments.length;
	if (iLength != 1 && iLength != 3) {
		var err = new Error();
		err.description = "FHBase.get24SolarTermIndex(...)参数个数不对！";
		throw err;
	}

	// 年月日
	var iYear = null;
	var iMonth = null;
	var iDay = null;
	if (iLength == 1 && (arguments[0] instanceof Date)) {
		// 日期对象
		iYear = arguments[0].getFullYear();
		iMonth = arguments[0].getMonth() + 1;
		iDay = arguments[0].getDate();
	} else if (iLength == 3) {
		// 年月日
		iYear = arguments[0];
		iMonth = arguments[1];
		iDay = arguments[2];
	}

	// 节气序号
	var i24SolarTermIndex = -1;
	// 年序号
	var iYearIndex = iYear - FHBase.CHINESE_CALENDAR_MONTH_INFO_BEGIN_YEAR;
	// 开始计算
	for ( var i = 0; i < 24; i++) {
		// 日期
		var lTime = 0;
		lTime += 31556925974.7 * iYearIndex + FHBase.CHINESE_CALENDAR_24SOLAR_TERMS_CONSTANTS[i] * 60000;
		lTime += Date.UTC(FHBase.CHINESE_CALENDAR_MONTH_INFO_BEGIN_YEAR, 0, 6, 2, 5);
		var dt = new Date(lTime);
		// 年月日
		var iYear1 = dt.getUTCFullYear();
		var iMonth1 = dt.getUTCMonth() + 1;
		var iDay1 = dt.getUTCDate();
		var iHour1 = dt.getUTCHours();
		var iMinute = dt.getUTCMinutes();
		var iSecond = dt.getUTCSeconds();
		if ((iYear1 == iYear) && (iMonth1 == iMonth) && (iDay1 == iDay)) {
			i24SolarTermIndex = i;
			break;
		}
	}
	// 返回函数值
	return i24SolarTermIndex;
};

/**
 * @描述：读取指定公历日期的二十四节气，如果不是则为空
 * @开发人员：moshco zhu
 * @开发日期：2010-11-25 上午07:06:14
 * @参数：iYear, iMonth, bIsLeapMonth, iDay
 * @返回值：any
 * @param iYear
 * @param iMonth
 * @param iDay
 * @return
 */
FHBase.get24SolarTerm = function() {
	// 函数参数长度
	var iLength = arguments.length;
	if (iLength != 1 && iLength != 3) {
		var err = new Error();
		err.description = "FHBase.get24SolarTerm(...)参数个数不对！";
		throw err;
	}

	// 节气序号
	var iIndex = -1;
	if (iLength == 1 && !(arguments[0] instanceof Date)) {
		iIndex = arguments[0];
	} else if (iLength == 3) {
		iIndex = FHBase.get24SolarTermIndex(arguments[0], arguments[1], arguments[2]);
	} else {
		iIndex = FHBase.get24SolarTermIndex(arguments[0]);
	}
	// 节气名称
	var str24SolarTermTitle = null;
	if (iIndex >= 0) {
		str24SolarTermTitle = FHBase.CHINESE_CALENDAR_24SOLAR_TERMS[iIndex];
	}

	// 返回函数值
	return str24SolarTermTitle;
};

/**
 * @描述：计算下一个节气的日期和序号
 * @开发人员：moshco zhu
 * @开发日期：2011-1-26 上午10:08:47
 * @参数：dtDate, bIsNext
 * @返回值：any
 * @param dtDate
 * @param bIsNext
 * @return
 */
FHBase.getNextThe24SolarTerms = function(dtDate, bIsNext) {
	// 日期时间值
	dtDate = new Date(dtDate.getFullYear(), dtDate.getMonth(), dtDate.getDate());
	var lTime = dtDate.getTime();
	// 节气对象
	var oSalarTerms = null;
	while (oSalarTerms == null) {
		// 年月日
		var iYear = dtDate.getFullYear();
		var iMonth = dtDate.getMonth() + 1;
		var iDay = dtDate.getDate();
		var iIndex = FHBase.get24SolarTermIndex(iYear, iMonth, iDay);
		// alert(iYear + " " + iMonth + " " + iDay + " : " + iIndex);
		if (iIndex >= 0) {
			oSalarTerms = {
				index : iIndex,
				date : dtDate
			};
			break;
		}
		// 上一日期值
		if (bIsNext == null || bIsNext) {
			lTime += 24 * 60 * 60 * 1000;
		} else {
			lTime -= 24 * 60 * 60 * 1000;
		}
		delete dtDate;
		dtDate = new Date(lTime);
	}
	// 返回函数值
	return oSalarTerms;
};

/**
 * @描述：计算指定日期下一个节气的日期
 * @开发人员：moshco zhu
 * @开发日期：2011-1-26 上午10:05:38
 * @参数：dtDate, bIsNext
 * @返回值：any
 * @param dtDate
 * @param bIsNext
 * @return
 */
FHBase.getNextThe24SolarTermsDate = function(dtDate, bIsNext) {
	// 返回函数值
	var oSalarTerms = FHBase.getNextThe24SolarTerms(dtDate, bIsNext);
	return oSalarTerms.date;
};

/**
 * @描述：计算指定日期下一个节气的序号
 * @开发人员：moshco zhu
 * @开发日期：2011-1-26 上午10:04:52
 * @参数：dtDate, bIsNext
 * @返回值：any
 * @param dtDate
 * @param bIsNext
 * @return
 */
FHBase.getNextThe24SolarTermsIndex = function(dtDate, bIsNext) {
	// 返回函数值
	var oSalarTerms = FHBase.getNextThe24SolarTerms(dtDate, bIsNext);
	return oSalarTerms.index;
};

/**
 * @描述：读取农历日的标题 '初', '十', '廿', '卅', '二', '三'
 * @开发人员：moshco zhu
 * @开发日期：2010-11-24 上午07:08:05
 * @参数：iLunarDay
 * @返回值：any
 * @param iLunarDay
 * @return
 */
FHBase.getLunarDayTitle = function(iLunarDay) {
	// 标题
	var strTitle = "";
	var aryPre = FHBase.CHINESE_CALENDAR_DAY_INDEX_PRE_ARRAY;
	var aryPost = FHBase.CHINESE_CALENDAR_DAY_INDEX_POST_ARRAY;
	if (iLunarDay >= 1 && iLunarDay <= 10) {
		strTitle = aryPre[0] + aryPost[iLunarDay - 1];
	} else if (iLunarDay >= 11 && iLunarDay <= 19) {
		strTitle = aryPre[1] + aryPost[iLunarDay - 11];
	} else if (iLunarDay == 20) {
		strTitle = aryPre[4] + aryPost[9];
	} else if (iLunarDay >= 21 && iLunarDay <= 29) {
		strTitle = aryPre[2] + aryPost[iLunarDay - 21];
	} else if (iLunarDay == 30) {
		strTitle = aryPre[5] + aryPost[9];
	}
	// 返回函数值
	return strTitle;
};

/**
 * @描述：计算农历年的标题
 * @开发人员：moshco zhu
 * @开发日期：2010-12-14 上午10:14:20
 * @参数：iYear
 * @返回值：any
 * @param iYear
 * @return
 */
FHBase.getLunarYearTitle = function(iYear) {
	// 标题
	var strTitle = "";
	// 年序号数组 "零", "一", "二", "三", "四", "五", "六", "七", "八", "九"
	var aryYearIndex = FHBase.CHINESE_CALENDAR_YEAR_INDEX_ARRAY;
	if (iYear < 0) {
		strTitle += "公元前";
		iYear *= -1;
	} else if (iYear == 0) {
		strTitle += "公元元年";
	}
	// 转换为中文表示
	if (iYear > 0) {
		// 除数
		var iDiv = FHBase.getBaseDivisor(iYear);
		while (iDiv >= 1) {
			var iIndex = parseInt(iYear / iDiv);
			iYear %= iDiv;
			iDiv /= 10;
			strTitle += aryYearIndex[iIndex];
		}
		strTitle += "年";
	}
	// 返回函数值
	return strTitle;
};

/**
 * @描述：读取农历日期标题 月日
 * @开发人员：moshco zhu
 * @开发日期：2011-1-8 上午09:53:47
 * @参数：oLunar
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.getLunarDateMonthDayTitle = function(oLunar) {

	// 农历年
	var strName = "";

	// 月序号数组 "正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月",
	// "腊月", "闰月"
	var aryMonthIndex = FHBase.CHINESE_CALENDAR_MONTH_INDEX_ARRAY;

	// 月
	var iMonth = oLunar.month;
	strName = aryMonthIndex[iMonth - 1];

	// 是否闰月
	var bIsLeapMonth = oLunar.is_leap_month;
	if (bIsLeapMonth) {
		strName += "（闰月）";
	}

	// 日
	var iDay = oLunar.day;
	strName += FHBase.getLunarDayTitle(iDay);

	// 返回函数值
	return strName;
};

/**
 * @描述：读取农历日期标题
 * @开发人员：moshco zhu
 * @开发日期：2010-12-10 上午10:29:08
 * @参数：oLunar oLunar格式如：{ year : 1900, month : 1, is_leap_month : false, day : 1, tgdz_y : "庚子", tgdz_m : "戊寅", tgdz_d : "甲辰" }
 * @返回值：any
 * @param oLunar
 * @return
 */
FHBase.getLunarDateTitle = function(oLunar, bIsGZ) {

	// 农历年
	var strName = "";

	// 年序号数组 "零", "一", "二", "三", "四", "五", "六", "七", "八", "九"
	var aryYearIndex = FHBase.CHINESE_CALENDAR_YEAR_INDEX_ARRAY;

	// 年
	var iYear = oLunar.year;
	if (iYear < 0) {
		strName += "公元前";
		iYear *= -1;
	} else if (iYear == 0) {
		strName += "公元元年";
	}
	// 转换为中文表示
	if (iYear > 0) {
		// 除数
		var iDiv = FHBase.getBaseDivisor(iYear);
		while (iDiv >= 1) {
			var iIndex = parseInt(iYear / iDiv);
			iYear %= iDiv;
			iDiv /= 10;
			strName += aryYearIndex[iIndex];
		}
		strName += "年";
	}

	// 月序号数组 "正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月",
	// "腊月", "闰月"
	var aryMonthIndex = FHBase.CHINESE_CALENDAR_MONTH_INDEX_ARRAY;

	// 月
	var iMonth = oLunar.month;
	strName += aryMonthIndex[iMonth - 1];

	// 是否闰月
	var bIsLeapMonth = oLunar.is_leap_month;
	if (bIsLeapMonth) {
		strName += "（闰月）";
	}

	// 日
	var iDay = oLunar.day;
	strName += FHBase.getLunarDayTitle(iDay);

	// 天干地支日期
	if ((bIsGZ != null && !bIsGZ) || (oLunar.tgdz_y == null)) {
	} else {
		strName += "[";
		strName += oLunar.tgdz_y + "年";
		strName += " " + oLunar.tgdz_m + "月";
		strName += " " + oLunar.tgdz_d + "日";
		strName += "]";
	}

	// 返回函数值
	return strName;
};

/**
 * @描述：设置组件不能被选择
 * @开发人员：moshco zhu1
 * @开发日期：2010-9-14 上午10:26:57
 * @参数：oComponent
 * @返回值：any
 * @param oComponent
 * @return
 */
FHBase.setUnableSelect = function(oComponent) {
	oComponent.bind("drag", function() {
		return false;
	}).bind("selectstart", function() {
		return false;
	});
};

/**
 * @描述：设置滚动条样式
 * @开发人员：moshco zhu1
 * @开发日期：2010-8-26 下午09:20:59
 * @参数：
 * @返回值：any
 * @return
 */
FHBase.setScrollbar = function(oDiv) {
	var strScrollBarColor = "#5EC2F6"; // #00CD00-绿色
	oDiv.css({
		overflow : "auto",
		"scrollbar-3dlight-color" : strScrollBarColor,// 设置或获取滚动条上滚动按钮和滚动滑块的左上颜色
		"scrollbar-arrow-color" : "#FFFFFF",// 设置或获取滚动箭头标识的颜色。
		"scrollbar-base-color" : "#FFFFFF",// 设置或获取滚动条的主要颜色，其中包含滚动按钮和滚动滑块。
		"scrollbar-darkshadow-color" : "#FFFFFF",// 设置或获取滚动条上滑槽的颜色。
		"scrollbar-face-color" : strScrollBarColor,// 滚动条和滚动条的滚动箭头的颜色。
		"scrollbar-highlight-color" : strScrollBarColor,// 设置或获取滚动框和滚动条滚动箭头的左上边缘颜色。
		"scrollbar-shadow-color" : strScrollBarColor,// 设置或获取滚动框和滚动条滚动箭头的右下边缘颜色。
		"scrollbar-track-color" : "#FFFFFF" // 设置或获取滚动条轨迹元素的颜色。
	});
	return oDiv;
};

/**
 * @描述：读取开始时间和结束时间的联合表示
 * @开发人员：moshco zhu1
 * @开发日期：2010-8-26 下午09:14:55
 * @参数：strBeginTime, strEndTime
 * @返回值：any
 * @param strBeginTime
 * @param strEndTime
 * @return
 */
FHBase.getBeginEndTime = function(strBeginTime, strEndTime) {
	// 联合字符串
	var strBeginEndTime = "";
	// 转换为日期对象
	var dtBegin = FHBase.toDate(strBeginTime);
	var dtEnd = FHBase.toDate(strEndTime);
	// 读取日期
	strBeginEndTime = FHBase.getDateStr(dtBegin)
	if (FHBase.isSameDay(dtBegin, dtEnd)) {
		strBeginEndTime += " " + FHBase.getTimeHMStr(dtBegin);
		strBeginEndTime += " - " + FHBase.getTimeHMStr(dtEnd);
	} else {
		strBeginEndTime += " " + FHBase.getTimeHMStr(dtBegin);
		strBeginEndTime += " - " + FHBase.getDateStr(dtBegin) + " " + FHBase.getTimeHMStr(dtEnd);
	}
	// 返回函数值
	return strBeginEndTime;
};

/**
 * @描述：读取日期的字符串
 * @开发人员：moshco zhu1
 * @开发日期：2010-8-26 下午09:44:50
 * @参数：dt
 * @返回值：any
 * @param dt
 * @returns
 */
FHBase.getDateStr = function(dt) {
	if ((dt == null) || !(dt instanceof Date)) {
		return null;
	}
	var iYear = dt.getFullYear();
	var iMonth = dt.getMonth() + 1;
	var iDate = dt.getDate();
	var strDate = iYear + "-";
	strDate += ((iMonth <= 9) ? ("0" + iMonth) : iMonth) + "-";
	strDate += (iDate <= 9) ? ("0" + iDate) : iDate;
	return strDate;
};

/**
 * @描述：读取小时和分钟的字符串
 * @开发人员：moshco zhu1
 * @开发日期：2010-8-26 下午09:45:04
 * @参数：dt
 * @返回值：any
 * @param dt
 * @returns
 */
FHBase.getTimeHMStr = function(dt) {
	if (dt == null) {
		return null;
	}
	var iHour = dt.getHours();
	var iMinute = dt.getMinutes();
	var strTime = ((iHour <= 9) ? ("0" + iHour) : iHour) + ":";
	strTime += (iMinute <= 9) ? ("0" + iMinute) : iMinute;
	return strTime;
};

/**
 * @描述：是否是同一天
 * @开发人员：moshco zhu1
 * @开发日期：2010-8-26 下午09:18:37
 * @参数：dt1, dt2
 * @返回值：any
 * @param dt1
 * @param dt2
 * @return
 */
FHBase.isSameDay = function(dt1, dt2) {
	// 两个日期都不能为空
	if (dt1 == null || dt2 == null) {
		return false;
	}
	// 比较年
	var iYear1 = dt1.getYear();
	var iYear2 = dt2.getYear();
	if (iYear1 != iYear2) {
		return false;
	}
	// 比较月
	var iMonth1 = dt1.getMonth();
	var iMonth2 = dt2.getMonth();
	if (iMonth1 != iMonth2) {
		return false;
	}
	// 比较日
	var iDay1 = dt1.getDate();
	var iDay2 = dt2.getDate();
	if (iDay1 != iDay2) {
		return false;
	}
	// 返回函数值
	return true;
};

/**
 * @描述：转换为日期对象
 * @开发人员：moshco zhu1
 * @开发日期：2010-8-26 下午09:16:21
 * @参数：strDate
 * @返回值：any
 * @param strDate
 * @return
 */
FHBase.toDate = function(strDate) {

	// 参数长度
	var iLength = arguments.length;
	if (iLength != 1) {
		var err = new Error();
		err.description = "FHBase.toDate(...)参数个数不对！";
		throw err;
	}

	// 函数：从字符串转换为一个日期对象
	var fn = function(strDate) {
		// 分隔日期和时间
		var stra = strDate.split(" ");
		// 日期 年月日
		var stra1 = stra[0].split("-");
		for ( var i = 0; i < stra1.length; i++) {
			if (stra1[i].length == 2 && stra1[i].indexOf("0") == 0) {
				stra1[i] = parseInt(stra1[i].charAt(1));
			} else {
				stra1[i] = parseInt(stra1[i]);
			}
		}
		// 时间 小时 分秒
		var stra2 = [
				0, 0, 0
		];
		if (stra.length > 1) {
			stra2 = stra[1].split(":");
			for ( var i = 0; i < stra2.length; i++) {
				if (stra2[i].length == 2 && stra2[i].indexOf("0") == 0) {
					stra2[i] = parseInt(stra2[i].charAt(1));
				} else {
					stra2[i] = parseInt(stra2[i]);
				}
			}
		}
		// 毫秒
		var iMs = 0;
		if (stra.length > 2) {
			iMs = parseInt(stra[2]);
		}
		// 创建日期对象
		var dt = new Date(stra1[0], stra1[1] - 1, stra1[2], stra2[0], stra2[1], stra2[2], iMs);
		// 返回函数值
		return dt;
	};

	// 转换
	var dt = null;
	if (arguments[0] instanceof String) {
		dt = fn(arguments[0]);
	} else {
		// 农历转换为公历
		dt = FHBase.transformDate(arguments[0]);
	}

	// 返回函数值
	return dt;
};

/**
 * @描述：读取文件名
 * @开发人员：moshco zhu
 * @开发日期：2010-10-20 上午11:05:49
 * @参数：strFileName
 * @返回值：any
 * @param strFileName
 * @return
 */
FHBase.getFileName = function(strFileName) {
	if (strFileName == null) {
		return null;
	}
	var stra = strFileName.split(/\/|\\/);
	if (stra != null && stra.length > 0) {
		return stra[stra.length - 1];
	} else {
		return null;
	}
};

/**
 * @描述：将字符串分隔为多维数组对象
 * @开发人员：moshco zhu
 * @开发日期：2010-10-22 下午06:33:08
 * @参数：str, straSplit
 * @返回值：any
 * @param str
 * @param straSplit
 * @return
 */
FHBase.getArray = function(str, straSplit, iIndex) {
	// 删除两边字符串
	str = trim(str);
	// 分隔字符串序号
	if (iIndex == null) {
		iIndex = 0;
	}
	// 被分隔后的数组
	var stra = null;
	if (straSplit.length - 1 == iIndex) {
		// 最后一级分隔
		stra = str.split(straSplit[iIndex]);
	} else {
		// 分隔字符串
		// 创建数组
		stra = new Array();
		// 分隔当前级别字符串
		var stra1 = str.split(straSplit[iIndex++]);
		var iLength = (stra1 == null) ? 0 : stra1.length;
		// 向下级专递
		for ( var i = 0; i < iLength; i++) {
			var str1 = trim(stra1[i]);
			stra.push(getArray(str1, straSplit, iIndex));
		}
	}
	// 返回函数值
	return stra;
};

/**
 * @描述：行数据 转换为对象数组
 * @开发人员：moshco zhu
 * @开发日期：2010-10-23 下午04:18:18
 * @参数：aryRowData, aryAttrName
 * @返回值：any
 * @param aryRowData
 * @param aryAttrName
 * @return
 */
FHBase.getObjectArray = function(aryRowData, aryAttrName) {
	// 总行数
	var iLength = (aryRowData == null) ? 0 : aryRowData.length;
	// 对象数组
	var oObjectArray = (iLength > 0) ? (new Array()) : null;
	// 创建数组对象
	for ( var i = 0; i < iLength; i++) {
		// 对象
		var oObject = {};
		// 每一个属性
		for ( var j = 0; j < aryAttrName.length; j++) {
			var strAttrName = aryAttrName[j];
			oObject[strAttrName] = aryRowData[i][j];
		}
		// 加入数组
		oObjectArray.push(oObject);
	}
	// 返回函数值
	return oObjectArray;
};

/**
 * @描述：将对象数组转换为字符串
 * @开发人员：moshco zhu
 * @开发日期：2010-10-23 下午04:28:56
 * @参数：oObjectArray, arySplit
 * @返回值：any
 * @param oObjectArray
 * @param arySplit
 * @return
 */
FHBase.toStr = function(oObjectArray, arySplit) {
	// 总行数
	var iLength = (oObjectArray == null) ? 0 : oObjectArray.length;
	// 字符串对象
	var str = (iLength > 0) ? "" : null;
	// 组行转换
	for ( var i = 0; i < iLength; i++) {
		if (i > 0) {
			str += arySplit[0];
		}
		var bFlag = false;
		$.each(oObjectArray[i], function(strAttrName, strValue) {
			if (bFlag) {
				str += arySplit[1];
			}
			str += strValue;
			if (!bFlag) {
				bFlag = true;
			}
		});
	}
	// 返回函数值
	return str;
};

/**
 * @描述：将字符串数组转换为字符串列表形式
 * @开发人员：moshco zhu
 * @开发日期：2011-1-9 上午09:44:57
 * @参数：aryStr, strSplit, fnFilter
 * @返回值：any
 * @param aryStr
 * @param strSplit
 * @param fnFilter
 * @param fnAdornRow
 * @return
 */
FHBase.toStrList = function(aryStr, strSplit, fnFilter, fnAdornRow) {

	// 字符串数组不能为空
	if (aryStr == null || aryStr.length == 0) {
		return null;
	}

	// 函数：修复最后一个字符
	var fn_LastChar = function(strLine) {
		if (strLine == null || strLine == "") {
			return "";
		}
		if (strSplit == " " || strSplit == "、") {
			return strLine;
		}
		// 读取最后一个字符
		var cLastChar = strLine.substr(strLine.length - 1);
		// 修复最后一个字符
		if (cLastChar == "；" || cLastChar == ";" || cLastChar == "。" || cLastChar == "." || cLastChar == "，") {
			strLine = strLine.substr(0, strLine.length - 1);
		} else if (cLastChar == ",", cLastChar == "！" || cLastChar == "!" || cLastChar == "？" || cLastChar == "?") {
			strLine = strLine.substr(0, strLine.length - 1);
		}
		strLine += "；";
		// 返回函数值
		return strLine;
	};

	// 结果字符串
	var strResult = null;
	// 数组每一行
	var iIndex = 1;// 序号
	for ( var i = 0; i < aryStr.length; i++) {
		// 过滤
		var strLine = null;
		if (fnFilter == null) {
			strLine = aryStr[i];
		} else {
			strLine = fnFilter(aryStr[i]);
		}
		if (strLine == null) {
			continue;
		}
		// 添加行间分隔符
		if (iIndex > 1) {
			if (strSplit == null) {
				strResult += "\n\t";
			} else {
				strResult += strSplit;
			}
		} else {
			strResult = "";
		}
		// 修饰
		if (fnAdornRow == null) {
			// 设置序号
			strResult += iIndex + " " + fn_LastChar(strLine);
			// 序号自加
			iIndex++;
		} else {
			var oRow = fnAdornRow(iIndex, fn_LastChar(strLine), aryStr[i]);
			if (oRow.row_str == null) {
				strResult += oRow;
				// 序号自加
				iIndex++;
			} else {
				if (oRow.row_index != null) {
					// 序号自加
					iIndex = oRow.row_index;
				}
				strResult += oRow.row_str;
			}
		}

	}

	// 最后一个字符是句号
	if (strResult != null && strResult != "" && !(strSplit.indexOf("、") >= 0 || strSplit.indexOf(" ") >= 0)) {
		// 读取最后一个字符
		var cLastChar = strResult.charAt(strResult.length - 1);
		// 修复最后一个字符
		if (cLastChar == "；") {
			strResult = strResult.substring(0, strResult.length - 1) + "。";
		}
	}

	// 返回函数值
	return strResult;
};

/**
 * @描述：读取格式化处理以后的日期时间
 * @开发人员：moshco zhu
 * @开发日期：2010-1-7 下午03:52:11
 * @参数：
 * @返回值：any
 * @return
 */
FHBase.getFormatDateTime = function(strBegin, strEnd) {
	// 读取开始日期和结束日期
	var dtBegin = getDate(strBegin);
	var dtEnd = getDate(strEnd);
	// 判断两个日期是否是同一天 读取不同的格式化字符串
	var strDate = "";
	if (isSameDay(dtBegin, dtEnd)) {
		// 同一天
		// 年
		var iYear = dtBegin.getYear();
		if (iYear < 1970) {
			iYear += 1900;
		}
		strDate = iYear;
		// 月
		var iMonth = dtBegin.getMonth() + 1;
		strDate += "-" + ((iMonth <= 9) ? "0" : "") + iMonth;
		// 日
		var iDay = dtBegin.getDate();
		strDate += "-" + ((iDay <= 9) ? "0" : "") + iDay;
		// 回车
		strDate += "<br />";

		// 开始小时
		var iHour1 = dtBegin.getHours();
		strDate += ((iHour1 <= 9) ? "0" : "") + iHour1;
		// 开始分钟
		var iMinute1 = dtBegin.getMinutes();
		strDate += ":" + ((iMinute1 <= 9) ? "0" : "") + iMinute1;

		// 分隔符号
		strDate += "-";

		// 结束小时
		var iHour2 = dtEnd.getHours();
		strDate += ((iHour2 <= 9) ? "0" : "") + iHour2;
		// 结束分钟
		var iMinute2 = dtEnd.getMinutes();
		strDate += ":" + ((iMinute2 <= 9) ? "0" : "") + iMinute2;
	} else {
		// 不是同一天
		// 年
		var iYear1 = dtBegin.getYear();
		if (iYear1 < 1970) {
			iYear1 += 1900;
		}
		strDate = iYear1;
		// 月
		var iMonth1 = dtBegin.getMonth() + 1;
		strDate += "-" + ((iMonth1 <= 9) ? "0" : "") + iMonth1;
		// 日
		var iDay1 = dtBegin.getDate();
		strDate += "-" + ((iDay1 <= 9) ? "0" : "") + iDay1;

		// 开始小时
		var iHour1 = dtBegin.getHours();
		strDate += "&nbsp;" + ((iHour1 <= 9) ? "0" : "") + iHour1;
		// 开始分钟
		var iMinute1 = dtBegin.getMinutes();
		strDate += ":" + ((iMinute1 <= 9) ? "0" : "") + iMinute1;

		// 回车
		strDate += "<br />";

		// 年
		var iYear2 = dtEnd.getYear();
		strDate += iYear2;
		// 月
		var iMonth2 = dtEnd.getMonth() + 1;
		strDate += "-" + ((iMonth2 <= 9) ? "0" : "") + iMonth2;
		// 日
		var iDay2 = dtEnd.getDate();
		strDate += "-" + ((iDay2 <= 9) ? "0" : "") + iDay2;

		// 结束小时
		var iHour2 = dtEnd.getHours();
		strDate += "&nbsp;" + ((iHour2 <= 9) ? "0" : "") + iHour2;
		// 结束分钟
		var iMinute2 = dtEnd.getMinutes();
		strDate += ":" + ((iMinute2 <= 9) ? "0" : "") + iMinute2;
	}
	// 返回函数值
	return strDate;
};

/**
 * @描述：计算指定数的基础除数 基础除数：10的幂数，大于等于它，小于它的10陪
 * @开发人员：moshco zhu
 * @开发日期：2010-12-10 上午11:33:16
 * @参数：
 * @返回值：any
 * @return
 */
FHBase.getBaseDivisor = function(iNum) {
	// 基础除数
	var iBaseDiv = 1;
	if (iNum > 0) {
		while (iNum > 10) {
			iNum /= 10;
			iBaseDiv *= 10;
		}
	} else {
		iBaseDiv = 0;
	}
	// 返回函数值
	return iBaseDiv;
};

/**
 * @描述：获取在指定毫秒后的日期时间
 * @开发人员：moshco zhu
 * @开发日期：2010-12-13 下午03:54:17
 * @参数：strDt, iAfterMillisecond
 * @返回值：any
 * @param strDt
 * @param iAfterMillisecond
 * @return
 */
FHBase.getAfterDate = function(strDt, iAfterMillisecond) {
	// 读取时间
	var dt = FHBase.getDate(strDt);
	// 计算
	var dt1 = null;
	if (iAfterMillisecond > 0) {
		var lTime = dt.getTime() + iAfterMillisecond;
		dt1 = new Date(lTime);
	} else {
		var lTime = dt.getTime() - Math.abs(iAfterMillisecond);
		dt1 = new Date(lTime);
	}
	// 转换为字符串
	var strDate = null;
	if (dt1 != null) {
		var iYear = dt1.getYear();
		var iMonth = dt1.getMonth() + 1;
		var iDate = dt1.getDate();
		var iHour = dt1.getHours();
		var iMinute = dt1.getMinutes();
		var iSecond = dt1.getSeconds();
		var iMillisecond = dt1.getMilliseconds();
		strDate = iYear + "-" + iMonth + "-" + iDate;
		strDate += " " + iHour + ":" + iMinute + ":" + iSecond + " " + iMillisecond;
	}
	// 返回函数值
	return strDate;
};

/**
 * @描述：获取日期时间对象
 * @开发人员：moshco zhu
 * @开发日期：2009-10-8 下午06:59:35
 * @参数：oContainer, oParam
 * @返回值：any
 */
FHBase.toDate = function(strDt) {
	// 分隔日期和时间
	var stra = strDt.split(" ");
	// 日期 年月日
	var stra1 = stra[0].split("-");
	for ( var i = 0; i < stra1.length; i++) {
		if (stra1[i].length == 2 && stra1[i].indexOf("0") == 0) {
			stra1[i] = parseInt(stra1[i].charAt(1));
		} else {
			stra1[i] = parseInt(stra1[i]);
		}
	}
	// 时间 小时 分秒
	var stra2 = [
			0, 0, 0
	];
	if (stra.length > 1) {
		stra2 = stra[1].split(":");
		for ( var i = 0; i < stra2.length; i++) {
			if (stra2[i].length == 2 && stra2[i].indexOf("0") == 0) {
				stra2[i] = parseInt(stra2[i].charAt(1));
			} else {
				stra2[i] = parseInt(stra2[i]);
			}
		}
	}
	// 毫秒
	var iMs = 0;
	if (stra.length > 2) {
		iMs = parseInt(stra[2]);
	}
	// 创建日期对象
	var dt = new Date(stra1[0], stra1[1] - 1, stra1[2], stra2[0], stra2[1], stra2[2], iMs);
	// 返回函数值
	return dt;
};

/**
 * @描述：读取日期的简单表示
 * @开发人员：moshco zhu
 * @开发日期：2010-12-13 下午03:58:41
 * @参数：strDt
 * @返回值：any
 * @param strDt
 * @return
 */
FHBase.getDateSimpleStr = function(strDt) {
	// 转换为日期对象
	var dt = FHBase.getDate(strDt);
	// 转换为字符串
	var str = "";
	// 转换为字符串
	var iYear = dt.getYear();
	if (iYear < 1970) {
		iYear += 1900;
	}
	str += iYear + "-";
	var iMonth = dt.getMonth() + 1;
	str += ((iMonth <= 9) ? ("0" + iMonth) : iMonth) + "-";
	var iDate = dt.getDate();
	str += ((iDate <= 9) ? ("0" + iDate) : iDate) + " ";
	var iHour = dt.getHours();
	str += ((iHour <= 9) ? ("0" + iHour) : iHour) + ":";
	var iMinute = dt.getMinutes();
	str += ((iMinute <= 9) ? ("0" + iMinute) : iMinute);
	// 返回函数值
	return str;
};

/**
 * @描述：读取Radio的值
 * @开发人员：moshco zhu
 * @开发日期：2010-12-13 下午04:00:04
 * @参数：strFormName, strName
 * @返回值：any
 * @param strFormName
 * @param strName
 * @return
 */
FHBase.getRadioValue = function(strFormName, strName) {
	// 找寻指定Name的Radio的值
	var strValue = null;
	$("form[name=" + strFormName + "]").find("input[type=radio]").each(function() {
		var strName1 = $(this).attr("name");
		if ((strName1 == strName) && $(this).attr("checked")) {
			strValue = $(this).val();
			return;
		}
	});
	// 返回函数值
	return strValue;
};

/**
 * @描述：读取Select当前选择的Option的Text的值
 * @开发人员：moshco zhu
 * @开发日期：2010-5-20 上午11:50:58
 * @参数：strFormName, strSelect
 * @返回值：any
 * @param strFormName
 * @param strSelectName
 * @return
 */
FHBase.getSelectedOptionText = function(strFormName, strSelectName) {
	var strText = null;
	$("form[name=" + strFormName + "]").find("select[name=" + strSelectName + "]").each(function() {
		var oSelect = $(this);
		var strValue = oSelect.val();
		strText = oSelect.find("option[value=" + strValue + "]").attr("text");
		return false;
	});
	return strText;
};

/**
 * @描述：转换为整型值
 * @开发人员：moshco zhu
 * @开发日期：2010-3-8 下午01:57:03
 * @参数：strInt, iDefaultValue
 * @返回值：any
 * @param strInt
 * @param iDefaultValue
 * @return
 */
FHBase.toInt = function(strInt, iDefaultValue) {
	// 使用默认值
	if (iDefaultValue == null) {
		iDefaultValue = 0;
	}
	var iInt = iDefaultValue;
	if (strInt != null && !isNaN(strInt)) {
		iInt = parseInt(strInt);
	}
	// 返回函数值
	return iInt;
};

/**
 * @描述：第二个日期是否在第一个日期的后面
 * @开发人员：moshco zhu
 * @开发日期：2010-12-15 上午09:02:36
 * @参数：oDt1, oDt2
 * @返回值：any
 * @param oDt1
 * @param oDt2
 * @return
 */
FHBase.isAfter = function(oDt1, oDt2) {

	// 日期比较：公历
	var fn1 = function(oDt1, oDt2) {
		var iTime1 = oDt1.getTime();
		var iTime2 = oDt2.getTime();
		if (iTime2 > iTime1) {
			return true;
		} else {
			return false;
		}
	};

	// 日期比较：农历
	var fn2 = function(oDt1, oDt2) {
		// 比较结果
		var bIsAfter = true;
		if (oDt2.year < oDt1.year) {
			bIsAfter = false;
		} else if (oDt2.year == oDt1.year) {
			if (oDt2.month < oDt1.month) {
				bIsAfter = false;
			} else if (oDt2.month == oDt1.month) {
				var bIs1 = (oDt1.is_leap_month == null) ? false : oDt1.is_leap_month;
				var bIs2 = (oDt2.is_leap_month == null) ? false : oDt2.is_leap_month;
				if (bIs1 && !bIs2) {
					bIsAfter = false;
				} else if ((bIs1 && bIs2) || (!bIs1 && !bIs2)) {
					if (oDt2.day <= oDt1.day) {
						bIsAfter = false;
					}
				}
			}
		}
		// 返回函数值
		return bIsAfter;
	};

	// 农历 还是公历
	if ((oDt1 instanceof Date) && (oDt2 instanceof Date)) {
		// 公历
		return fn1(oDt1, oDt2);
	} else {
		// 农历
		return fn2(oDt1, oDt2);
	}

};

/**
 * @描述：第二个日期是否在第一个日期前面
 * @开发人员：moshco zhu
 * @开发日期：2010-12-15 上午09:04:35
 * @参数：oDt1, oDt2
 * @返回值：any
 * @param oDt1
 * @param oDt2
 * @return
 */
FHBase.isBefore = function(oDt1, oDt2) {

	// 日期比较：公历
	var fn1 = function(oDt1, oDt2) {
		var lTime1 = oDt1.getTime();
		var lTime2 = oDt2.getTime();
		if (lTime2 < lTime1) {
			return true;
		} else {
			return false;
		}
	};

	// 日期比较：农历
	var fn2 = function(oDt1, oDt2) {
		// 比较结果
		var bIsBefore = true;
		if (oDt2.year > oDt1.year) {
			bIsBefore = false;
		} else if (oDt2.year == oDt1.year) {
			if (oDt2.month > oDt1.month) {
				bIsBefore = false;
			} else if (oDt2.month == oDt1.month) {
				var bIs1 = (oDt1.is_leap_month == null) ? false : oDt1.is_leap_month;
				var bIs2 = (oDt2.is_leap_month == null) ? false : oDt2.is_leap_month;
				if (bIs2 && !bIs1) {
					bIsBefore = false;
				} else if ((bIs1 && bIs2) || (!bIs1 && !bIs2)) {
					if (oDt2.day > oDt1.day) {
						bIsBefore = false;
					}
				}
			}
		}
		// 返回函数值
		return bIsBefore;
	};

	// 农历 还是公历
	if ((oDt1 instanceof Date) && (oDt2 instanceof Date)) {
		// 公历
		return fn1(oDt1, oDt2);
	} else {
		// 农历
		return fn2(oDt1, oDt2);
	}

};

/**
 * @描述：计算两个日期之间间隔的总天数
 * @开发人员：moshco zhu
 * @开发日期：2010-12-15 上午09:31:49
 * @参数：enclosing_method_arguments
 * @返回值：return_type
 */
FHBase.sumDayNum = function(oDt1, oDt2) {

	// 计算两个日期之间间隔的总天数：公历
	var fn1 = function(oDt1, oDt2) {
		var lTime1 = oDt1.getTime();
		var lTime2 = oDt2.getTime();
		var lLength = lTime2 - lTime1;
		var iTotalDayNum = parseInt(lLength / (24 * 60 * 60 * 1000));
		return iTotalDayNum;
	};

	// 计算两个日期之间间隔的总天数：农历
	var fn2 = function(oDt1, oDt2) {
		return FHBase.sumLunarDayNum(oDt1, oDt2);
	};

	// 农历 还是公历
	if ((oDt1 instanceof Date) && (oDt2 instanceof Date)) {
		// 公历
		return fn1(oDt1, oDt2);
	} else {
		// 农历
		return fn2(oDt1, oDt2);
	}

};

/**
 * @描述：计算判断指定日期oDtCell是否在日期区间(oDt1, oDt2)内
 * @开发人员：moshco zhu
 * @开发日期：2010-12-17 上午10:47:40
 * @参数：
 * @返回值：any
 * @return
 */
FHBase.isInDateRange = function() {
	// 是否在区间范围内
	var bIsBelong = true;
	// 参数长度
	var iArgLength = arguments.length;
	if (iArgLength >= 2) {
		// 格子日期
		var oCellDate = arguments[0];
		// 开始日期验证
		var oDt1 = null;
		if (arguments[1] != null) {
			// 开始日期
			oDt1 = arguments[1];
			// 指定日期不能在开始日期之前
			if (FHBase.isBefore(oDt1, oCellDate)) {
				bIsBelong = false;
			}
		}
		// 有结束日期限制
		if (iArgLength >= 3 && arguments[2] != null) {
			if ((arguments[2] instanceof Date) || (arguments[2].year != null)) {
				// 结束日期
				var oDt2 = arguments[2];
				// 指定日期不能在结束日期之后
				if (FHBase.isAfter(oDt2, oCellDate)) {
					bIsBelong = false;
				}
			} else {
				// 循环长度
				var iCycleLength = arguments[2];
				// 循环长度l：从开始日期开始计算，指定日期必须在l天内
				if ((oDt1 != null) && (FHBase.sumDayNum(oDt1, oCellDate) > (iCycleLength - 1))) {
					bIsBelong = false;
				}
			}
		}
	} else {
		// 参数个数错误
		// 是否在区间范围内
		bIsBelong = false;
		var err = new Error();
		err.description = "FHBase.isInDateRange(...)参数个数错误！";
		throw err;
	}
	// 返回函数值
	return bIsBelong;
};

// 面板绘制模式：默认绘制模式
FHBase.PANEL_PAINT_PATTERN_DEFAULT = 0;

/**
 * @描述：创建一个面板
 * @开发人员：moshco zhu
 * @开发日期：2011-2-18 上午11:32:04
 * @参数：oContainer, oParam
 * @返回值：any
 * @param oContainer
 * @param oParam
 * @return
 */
FHBase.panel = function(oContainer, oParam) {
	// 容器对象不能为空
	if (oContainer == null || oContainer.length == 0) {
		return null;
	}
	// 面板对象
	var oPanel = null;
	// 面板内容部分样式
	var strPanelContentCss = null;
	// 绘制模式
	var iPaintPattern = (oParam.paint_pattern == null) ? FHBase.PANEL_PAINT_PATTERN_DEFAULT : oParam.paint_pattern;
	if (iPaintPattern == FHBase.PANEL_PAINT_PATTERN_DEFAULT) {
		// 默认绘制模式
		oPanel = FHBase.createPanel0(oContainer, oParam.csses, oParam.width, oParam.height);
		// 面板内容部分样式
		strPanelContentCss = oParam.csses.top_mid;
	}
	// 面板内容部分样式
	oPanel.attr("content_css", strPanelContentCss);

	// 返回函数值
	return oPanel;
};

/**
 * @描述：创建面板
 * @开发人员：moshco zhu
 * @开发日期：2011-2-18 上午11:49:03
 * @参数：oContainer, oCsses, iWidth, iHeight
 * @返回值：any
 * @param oContainer
 * @param oCsses
 * @param iWidth
 * @param iHeight
 * @return
 */
FHBase.createPanel0 = function(oContainer, oCsses, iWidth, iHeight) {
	// 容器对象不能为空
	if (oContainer == null || oContainer.length == 0) {
		return null;
	}
	// 面板
	oContainer.append("<div />");
	var oPanel = oContainer.find(">div:last-child");
	var strDialogCss = oCsses.frame;
	oPanel.addClass(strDialogCss);
	oPanel.width(iWidth);
	oPanel.height(iHeight);

	// 顶部
	oPanel.append("<div />");
	var oTop = oPanel.find(">div:last-child");
	var strPanelTopCss = oCsses.top;
	oTop.addClass(strPanelTopCss).css({
		position : "static",
		width : iWidth + "px",
		overflow : "hidden"
	});
	// 顶部高度
	var iTopHeight = 1;

	// 顶部 左边
	oTop.append("<div />");
	var oTopLeft = oTop.find(">div:last-child");
	var strPanelTopLeftCss = oCsses.top_left;
	oTopLeft.addClass(strPanelTopLeftCss).css({
		position : "static",
		float : "left",
		height : iTopHeight + "px",
		overflow : "hidden"
	});
	// 顶部左边宽度
	var iTopLeftWidth = oTopLeft.outerWidth();

	// 顶部中间
	oTop.append("<div />");
	var oTopMid = oTop.find(">div:last-child");
	var strPanelTopMidCss = oCsses.top_mid;
	oTopMid.addClass(strPanelTopMidCss).css({
		position : "static",
		float : "left",
		height : iTopHeight + "px",
		overflow : "hidden"
	});

	// 顶部右边
	oTop.append("<div />");
	var oTopRight = oTop.find(">div:last-child");
	var strPanelTopRightCss = oCsses.top_right;
	oTopRight.addClass(strPanelTopRightCss).css({
		position : "static",
		float : "right",
		height : iTopHeight + "px",
		overflow : "hidden"
	});
	// 顶部右边宽度
	var iTopRightWidth = oTopRight.outerWidth();

	// 设置顶部中间宽度
	var iTopMidWidth = iWidth - iTopLeftWidth - iTopRightWidth;
	oTopMid.width(iTopMidWidth);

	// 底部
	oPanel.append("<div />");
	var oBottom = oPanel.find(">div:last-child");
	var strPanelBottomCss = oCsses.bottom;
	oBottom.addClass(strPanelBottomCss).css({
		position : "static",
		width : iWidth + "px",
		overflow : "hidden"
	});
	// 底部高度
	var iBottomHeight = oBottom.height();

	// 底部左边
	oBottom.append("<div />");
	var oBottomLeft = oBottom.find(">div:last-child");
	var strPanelBottomLeftCss = oCsses.bottom_left;
	oBottomLeft.addClass(strPanelBottomLeftCss).css({
		position : "static",
		float : "left",
		height : iBottomHeight + "px",
		overflow : "hidden"
	});
	// 底部左边宽度
	var iBottomLeftWidth = oBottomLeft.outerWidth();

	// 底部中间
	oBottom.append("<div />");
	var oBottomMid = oBottom.find(">div:last-child");
	var strPanelBottomMidCss = oCsses.bottom_mid;
	oBottomMid.addClass(strPanelBottomMidCss).css({
		position : "static",
		float : "left",
		height : iBottomHeight + "px",
		overflow : "hidden"
	});

	// 底部右边
	oBottom.append("<div />");
	var oBottomRight = oBottom.find(">div:last-child");
	var strPanelBottomRightCss = oCsses.bottom_right;
	oBottomRight.addClass(strPanelBottomRightCss).css({
		position : "static",
		float : "right",
		height : iBottomHeight + "px",
		overflow : "hidden"
	});
	// 底部右边宽度
	var iBottomRightWidth = oBottomRight.outerWidth();

	// 设置底部中间宽度
	var iBottomMidWidth = iWidth - iBottomLeftWidth - iBottomRightWidth;
	oBottomMid.width(iBottomMidWidth);

	// 设置顶部高度
	iTopHeight = iHeight - oBottom.outerHeight();
	oTop.height(iTopHeight);
	oTop.find(">div").height(iTopHeight);

	// 返回函数值
	return oPanel;
}

// 对话框绘制模式：默认绘制模式
FHBase.DIALOG_PAINT_PATTERN_DEFAULT = 0;

// 对话框绘制模式：内外绘制模式
FHBase.DIALOG_PAINT_PATTERN_OUTINSIDE = 1;

/**
 * @描述：创建一个对话框窗体
 * @开发人员：moshco zhu
 * @开发日期：2011-2-16 上午09:57:09
 * @参数：oContainer, oParam
 * @返回值：any
 * @param oContainer
 * @param oParam
 * @return
 */
FHBase.dialog = function(oContainer, oParam) {
	// 容器对象不能为空
	if (oContainer == null || oContainer.length == 0) {
		return null;
	}
	// 对话框窗体
	var oDialogWin = null;
	// 对话框内容部分样式
	var strDialogContentCss = null;
	// 绘制模式
	var iPaintPattern = (oParam.paint_pattern == null) ? FHBase.DIALOG_PAINT_PATTERN_DEFAULT : oParam.paint_pattern;
	if (iPaintPattern == FHBase.DIALOG_PAINT_PATTERN_DEFAULT) {
		// 默认绘制模式
		oDialogWin = FHBase.createDialog0(oContainer, oParam.csses, oParam.width, oParam.height);
		// 对话框内容部分样式
		strDialogContentCss = oParam.csses.mid_mid;
	} else if (iPaintPattern == FHBase.DIALOG_PAINT_PATTERN_OUTINSIDE) {
		// 内外绘制模式
		oDialogWin = FHBase.createDialog1(oContainer, oParam.csses, oParam.width, oParam.height, oParam.out_in_space_width);
		// 对话框内容部分样式
		strDialogContentCss = oParam.csses.in_border;
	}
	// 对话框内容部分样式
	oDialogWin.attr("content_css", strDialogContentCss);
	// 绘制对话框内容
	if (oParam.fn_paint_content != null) {
		oDialogWin.paintContent = oParam.fn_paint_content;
		oDialogWin.paintContent(oDialogWin.find("." + strDialogContentCss));
	}

	// 隐藏对话框
	oDialogWin.hide();

	// 函数：打开对话框
	if (oParam.fn_open != null) {
		oDialogWin.open = oParam.fn_open;
	} else {
		oDialogWin.open = function() {
			$(this).show();
			return true;
		};
	}

	// 函数：单击关闭图标
	var fn_ClickClose = function() {
		// 对话框窗体
		var strDialogCss = $(this).attr("dialog_css");
		var oDialogWin = $(this).parents("." + strDialogCss);
		// 调用关闭函数
		var bIsHide = true;
		if (oParam.fn_close != null) {
			oDialogWin.fn_close = oParam.fn_close;
			var b = oDialogWin.fn_close($(this));
			bIsContinue = (b == null) ? true : b;
		}
		// 隐藏窗体
		if (bIsHide) {
			var strDialogContentCss = oDialogWin.attr("content_css");
			if (strDialogContentCss != null && strDialogContentCss != "") {
				oDialogWin.find("." + strDialogContentCss).find(">div").hide();
			}
			var iMarginLeft = parseInt(oDialogWin.outerWidth() / 2);
			var iMarginTop = parseInt(oDialogWin.outerHeight() / 2);
			oDialogWin.animate({
				width : 0,
				height : 0,
				marginLeft : iMarginLeft,
				marginTop : iMarginTop,
				fontSize : 0,
				borderWidth : 2,
				opacity : 0
			}, 1200);
		}
	};
	// 关闭按钮单击事件
	oDialogWin.find(".FHBaseDialogClose").click(fn_ClickClose);

	// 返回函数值
	return oDialogWin;
};

/**
 * @描述：创建对话框窗体
 * @开发人员：moshco zhu
 * @开发日期：2011-2-16 上午11:15:16
 * @参数：oContainer, oCsses, iWidth, iHeight, iOutInSpaceWidth
 * @返回值：any
 * @param oContainer
 * @param oCsses
 * @param iWidth
 * @param iHeight
 * @param iOutInSpaceWidth
 * @return
 */
FHBase.createDialog1 = function(oContainer, oCsses, iWidth, iHeight, iOutInSpaceWidth) {
	// 容器对象不能为空
	if (oContainer == null || oContainer.length == 0) {
		return null;
	}
	// 对话框窗体
	oContainer.append("<div />");
	var oDialogWin = oContainer.find(">div:last-child");
	var strDialogCss = oCsses.frame;
	oDialogWin.addClass(strDialogCss);
	oDialogWin.width(iWidth);
	oDialogWin.height(iHeight);

	// 顶部容器
	oDialogWin.append("<div />");
	var oDialogTopContainer = oDialogWin.find(">div:last-child");
	oDialogTopContainer.css({
		position : "static",
		width : iWidth + "px",
		height : "0px",
		overflow : "visible"
	});

	// 关闭图标
	oDialogTopContainer.append("<div />");
	var oClose = oDialogTopContainer.find(">div:last-child");
	var strDialogCloseCss = oCsses.close;
	oClose.addClass(strDialogCloseCss).addClass("FHBaseDialogClose").css({
		position : "absolute",
		overflow : "hidden"
	});
	// 设置对话框的CSS
	oClose.attr("dialog_css", strDialogCss);
	oClose.css("margin-left", (iWidth - oClose.outerWidth() - 5) + "px");

	// 对话框 外框
	oDialogWin.append("<div />");
	var oDialogOutBorder = oDialogWin.find(">div:last-child");
	var strDialogOutBorderCss = oCsses.out_border;
	oDialogOutBorder.addClass(strDialogOutBorderCss).css({
		position : "static",
		overflow : "hidden"
	});
	// 设置外框尺寸
	var iOutBorderWidth = parseInt(oDialogOutBorder.css("border-width"));
	var iOutWidth = iWidth - iOutBorderWidth * 2;
	var iOutHeight = iHeight - iOutBorderWidth * 2;
	oDialogOutBorder.width(iOutWidth);
	oDialogOutBorder.height(iOutHeight);

	// 对话框内框
	oDialogOutBorder.append("<div />");
	var oDialogInBorder = oDialogOutBorder.find(">div:last-child");
	var strDialogInBorderCss = oCsses.in_border;
	oDialogInBorder.addClass(strDialogInBorderCss).css({
		position : "static",
		overflow : "hidden",
		"margin-left" : iOutInSpaceWidth + "px",
		"margin-top" : iOutInSpaceWidth + "px"
	});
	// 设置内框尺寸
	var iInBorderWidth = parseInt(oDialogInBorder.css("border-width"));
	var iInWidth = iOutWidth - iInBorderWidth * 2 - iOutInSpaceWidth * 2;
	var iInHeight = iOutHeight - iInBorderWidth * 2 - iOutInSpaceWidth * 2;
	oDialogInBorder.width(iInWidth);
	oDialogInBorder.height(iInHeight);

	// 返回函数值
	return oDialogWin;
};

/**
 * @描述：创建对话框窗体
 * @开发人员：moshco zhu
 * @开发日期：2011-2-14 上午11:50:43
 * @参数：oContainer, oCsses, iWidth, iHeight
 * @返回值：any
 * @param oContainer
 * @param oCsses
 * @param iWidth
 * @param iHeight
 * @return
 */
FHBase.createDialog0 = function(oContainer, oCsses, iWidth, iHeight) {
	// 容器对象不能为空
	if (oContainer == null || oContainer.length == 0) {
		return null;
	}
	// 对话框窗体
	oContainer.append("<div />");
	var oDialogWin = oContainer.find(">div:last-child");
	var strDialogCss = oCsses.frame;
	oDialogWin.addClass(strDialogCss);
	oDialogWin.width(iWidth);
	oDialogWin.height(iHeight);

	// 顶部
	oDialogWin.append("<div />");
	var oTop = oDialogWin.find(">div:last-child");
	var strDialogTopCss = oCsses.top;
	oTop.addClass(strDialogTopCss).css({
		position : "static",
		width : iWidth + "px",
		overflow : "hidden"
	});
	// 顶部高度
	var iTopHeight = oTop.height();

	// 顶部 左边
	oTop.append("<div />");
	var oTopLeft = oTop.find(">div:last-child");
	var strDialogTopLeftCss = oCsses.top_left;
	oTopLeft.addClass(strDialogTopLeftCss).css({
		position : "static",
		float : "left",
		height : iTopHeight + "px",
		overflow : "hidden"
	});
	// 顶部左边宽度
	var iTopLeftWidth = oTopLeft.outerWidth();

	// 顶部中间
	oTop.append("<div />");
	var oTopMid = oTop.find(">div:last-child");
	var strDialogTopMidCss = oCsses.top_mid;
	oTopMid.addClass(strDialogTopMidCss).css({
		position : "static",
		float : "left",
		height : iTopHeight + "px",
		overflow : "hidden"
	});

	// 关闭按钮
	oTopMid.append("<div />");
	var oTopClose = oTopMid.find(">div:last-child");
	var strDialogTopCloseCss = oCsses.top_close;
	oTopClose.addClass(strDialogTopCloseCss).addClass("FHBaseDialogClose").css({
		position : "static",
		float : "right",
		height : iTopHeight + "px",
		overflow : "hidden"
	});
	// 设置对话框的CSS
	oTopClose.attr("dialog_css", strDialogCss);

	// 顶部右边
	oTop.append("<div />");
	var oTopRight = oTop.find(">div:last-child");
	var strDialogTopRightCss = oCsses.top_right;
	oTopRight.addClass(strDialogTopRightCss).css({
		position : "static",
		float : "right",
		height : iTopHeight + "px",
		overflow : "hidden"
	});
	// 顶部右边宽度
	var iTopRightWidth = oTopRight.outerWidth();

	// 设置顶部中间宽度
	var iTopMidWidth = iWidth - iTopLeftWidth - iTopRightWidth;
	oTopMid.width(iTopMidWidth);

	// 中部
	oDialogWin.append("<div />");
	var oMid = oDialogWin.find(">div:last-child");
	var strDialogMidCss = oCsses.mid;
	oMid.addClass(strDialogMidCss).css({
		position : "static",
		width : iWidth + "px",
		overflow : "hidden"
	});

	// 底部
	oDialogWin.append("<div />");
	var oBottom = oDialogWin.find(">div:last-child");
	var strDialogBottomCss = oCsses.bottom;
	oBottom.addClass(strDialogBottomCss).css({
		position : "static",
		width : iWidth + "px",
		overflow : "hidden"
	});
	// 底部高度
	var iBottomHeight = oBottom.height();

	// 底部左边
	oBottom.append("<div />");
	var oBottomLeft = oBottom.find(">div:last-child");
	var strDialogBottomLeftCss = oCsses.bottom_left;
	oBottomLeft.addClass(strDialogBottomLeftCss).css({
		position : "static",
		float : "left",
		height : iBottomHeight + "px",
		overflow : "hidden"
	});
	// 底部左边宽度
	var iBottomLeftWidth = oBottomLeft.outerWidth();

	// 底部中间
	oBottom.append("<div />");
	var oBottomMid = oBottom.find(">div:last-child");
	var strDialogBottomMidCss = oCsses.bottom_mid;
	oBottomMid.addClass(strDialogBottomMidCss).css({
		position : "static",
		float : "left",
		height : iBottomHeight + "px",
		overflow : "hidden"
	});

	// 底部右边
	oBottom.append("<div />");
	var oBottomRight = oBottom.find(">div:last-child");
	var strDialogBottomRightCss = oCsses.bottom_right;
	oBottomRight.addClass(strDialogBottomRightCss).css({
		position : "static",
		float : "right",
		height : iBottomHeight + "px",
		overflow : "hidden"
	});
	// 底部右边宽度
	var iBottomRightWidth = oBottomRight.outerWidth();

	// 设置底部中间宽度
	var iBottomMidWidth = iWidth - iBottomLeftWidth - iBottomRightWidth;
	oBottomMid.width(iBottomMidWidth);

	// 设置中部高度
	var iMidHeight = iHeight - oTop.outerHeight() - oBottom.outerHeight();
	oMid.height(iMidHeight);

	// 绘制中部

	// 中部左边
	oMid.append("<div />");
	var oMidLeft = oMid.find(">div:last-child");
	var strDialogMidLeftCss = oCsses.mid_left;
	oMidLeft.addClass(strDialogMidLeftCss).css({
		position : "static",
		float : "left",
		height : iMidHeight + "px",
		overflow : "hidden"
	});
	// 中部左边宽度
	var iMidLeftWidth = oMidLeft.outerWidth();

	// 中部中间
	oMid.append("<div />");
	var oMidMid = oMid.find(">div:last-child");
	var strDialogMidMidCss = oCsses.mid_mid;
	oMidMid.addClass(strDialogMidMidCss).css({
		position : "static",
		float : "left",
		height : iMidHeight + "px",
		overflow : "hidden"
	});

	// 中部右边
	oMid.append("<div />");
	var oMidRight = oMid.find(">div:last-child");
	var strDialogMidRightCss = oCsses.mid_right;
	oMidRight.addClass(strDialogMidRightCss).css({
		position : "static",
		float : "right",
		height : iMidHeight + "px",
		overflow : "hidden"
	});
	// 中部右边宽度
	var iMidRightWidth = oMidRight.outerWidth();

	// 设置底部中间宽度
	var iMidMidWidth = iWidth - iMidLeftWidth - iMidRightWidth;
	oMidMid.width(iMidMidWidth);

	// 返回函数值
	return oDialogWin;
};

/**
 * @描述:保存BaseUI
 * @开发人员:moshco zhu
 * @开发时间:2011-6-11 上午11:15:50
 * @param oBaseUI
 * @param strCode
 */
FHBase.saveBaseUI = function(oBaseUI, strCode) {
	var oUIPacket = null;
	try {
		if (BaseUIs.length > 0) {
			$.each(BaseUIs, function(iIndex, oBaseUIPacket) {
				if (oBaseUIPacket.code == strCode) {
					oBaseUIPacket.ui = oBaseUI;
					oUIPacket = oBaseUIPacket;
					return false;
				}
				return true;
			});
		}
		if (oUIPacket == null) {
			oUIPacket = {
				code : strCode,
				ui : oBaseUI
			};
			BaseUIs.push(oUIPacket);
			// alert(BaseUIs.length);
		}
	} catch (e) {
		alert(e.message);
	}
	return oUIPacket;
};

/**
 * @描述:读取BaseUI
 * @开发人员:moshco zhu
 * @开发时间:2011-6-11 上午11:16:03
 * @param oBaseUITarget
 */
FHBase.getBaseUI = function(oBaseUITarget) {
	try {
		if (arguments[0] == null || arguments[0] == "") {
			return null;
		}
		if ($.isFunction(arguments[0].charCodeAt)) {
			// 编码字符串
			var oUI = null;
			var strCode = arguments[0];
			$.each(BaseUIs, function(iIndex, oBaseUIPacket) {
				if ((oBaseUIPacket.code + "") == (strCode + "")) {
					oUI = oBaseUIPacket.ui;
					return false;
				}
				return true;
			});
			return oUI;
		} else {
			// jQuery对象
			var strCode = oBaseUITarget.attr(FHBase.TARGET_ATTR_NAME_CODE);
			strCode = (strCode == null || strCode == "") ? oBaseUITarget.attr(FHBase.ATTR_NAME_CODE) : strCode;
			if (strCode == null || strCode == "") {
				throw new Error(-1, "要读取的UI组件的code属性为空。");
			} else {
				strCode += "";
				return getBaseUI(strCode);
			}
		}
	} catch (e) {
		alert(e.message);
	}
};

/**
 * --------------------------------------------------------------------------------------------------------------------
 */

/**
 * @描述:风火定时任务 构造函数
 * @开发人员:moshco zhu
 * @开发时间:2011-6-15 下午04:27:47
 */
function FHTimeTask(oParam) {
	// 任务运行间隔时长（单位：毫秒）
	this.intervalDuration = (oParam.intervalDuration == null) ? 3000 : oParam.intervalDuration;
	// 任务数组尺寸
	this.tasks = (oParam.taskArraySize == null) ? (new Array(20)) : new Array(oParam.taskArraySize);
	// 定时任务名称
	this.name = (oParam.name == null) ? "TimeTask_" + randomNum(6) : oParam.name;
	// 设置到window对象属性
	window[this.name] = this;
	// 设置初始任务
	this.tasks[0] = {
		code : "100000",
		intervalDuration : 3000,
		runParam : {
			url : "http://www.baidu.com",
			business : 31001,
			position : -1
		},
		isRun : function(oTask) {
			return false;
		},
		run : function(oRunParam) {
		// alert("hello,定时任务！");
		// msg("hello,定时任务！");
		},
		runNum : 0,
		successNum : 0,
		failNum : 0,
		errorNum : 0
	};
	// 初始添加一些任务
	if (oParam.tasks != null && oParam.tasks.length > 0) {
		var oTimeTasks = this.tasks;
		var iIndex = 0;
		for ( var i = 0; i < oTimeTasks.length; i++) {
			if (oTimeTasks[i] == null) {
				if (oParam.tasks[iIndex].run == null) {
					alert("添加的任务缺少必须的函数run");
					oParam.tasks[iIndex].isRun = function(oTask) {
						return false;
					};
					oParam.tasks[iIndex].run = function(oRunParam) {
						return true;
					};
				}
				// 设置任务
				oTimeTasks[i] = oParam.tasks[iIndex];
				// 下一个
				iIndex++;
				if (iIndex >= oParam.tasks.length) {
					break;
				}
			}
		}
	}
};

// 时间任务数组
FHTimeTask.prototype.tasks = null;

// 对象名称
FHTimeTask.prototype.name = null;

// 时间Id
FHTimeTask.prototype.timeId = -1;

// 间隔时长（单位：毫秒）
FHTimeTask.prototype.intervalDuration = -1;

/**
 * @描述：任务运行函数
 * @开发人员：moshco zhu
 * @开发时间：2011-6-15 下午04:34:46
 */
FHTimeTask.prototype.runTimeTask = function() {
	try {
		// 复制任务数组
		var aryTask = window[this.name].tasks;
		// 依次执行每一个任务
		for ( var i = 0; i < aryTask.length; i++) {
			// 任务对象
			var oTask = null;
			try {
				// 任务对象
				oTask = aryTask[i];
				if (oTask == null) {
					continue;
				}
				// 是否要执行任务
				var bIsRun = false;
				if (oTask.isRun != null) {
					bIsRun = oTask.isRun(oTask);
					bIsRun = (bIsRun == null) ? true : bIsRun;
				}
				// 不需要执行该任务
				if (!bIsRun) {
					continue;
				}
				// 执行次数
				oTask.runNum = (oTask.runNum == null) ? 1 : (++oTask.runNum);
				// 调用函数
				var bIsSucess = oTask.run(oTask.runParam);
				bIsSucess = (bIsSucess == null) ? false : bIsSucess;
				// 成功次数 失败次数
				if (bIsSucess) {
					oTask.successNum = (oTask.successNum == null) ? 1 : (++oTask.successNum);
				} else {
					oTask.failNum = (oTask.failNum == null) ? 1 : (++oTask.failNum);
				}
			} catch (e) {
				if (oTask != null) {
					oTask.errorNum = (oTask.errorNum == null) ? 1 : (++oTask.errorNum);
				}
				oThis.debug(e.message);
			} finally {
			}
		}
	} catch (e) {
	} finally {
		// 间隔一段时间后再次执行
		var strJs = "";
		strJs += "if (window[\"" + this.name + "\"] != null){";
		strJs += "window[\"" + this.name + "\"].runTimeTask();";
		strJs += "}";
		window[this.name].timeId = window.setTimeout(strJs, window[this.name].intervalDuration);
	}
	// 返回函数值
	return true;
};

/**
 * @描述:启动定时任务
 * @开发人员:moshco zhu
 * @开发时间:2011-6-15 上午11:36:40
 */
FHTimeTask.prototype.startTimeTask = function() {
	// 启动
	window[this.name].runTimeTask();
	// 返回函数值
	return true;
};

/**
 * @描述:添加一个新的定时任务
 * @开发人员:moshco zhu
 * @开发时间:2011-6-15 下午04:58:53
 * @param oTask
 * @returns
 */
FHTimeTask.prototype.addTimeTask = function(oTask) {
	// 定时任务
	if (oTask != null && oTask.run == null) {
		alert("添加的任务缺少必须的函数run");
		oTask.isRun = function(oTask) {
			return false;
		};
		oTask.run = function(oRunParam) {
			return true;
		};
	}
	// 定时任务数组
	var oTimeTasks = this.tasks;
	for ( var i = 0; i < oTimeTasks.length; i++) {
		if (oTimeTasks[i] == null) {
			// 设置任务
			oTimeTasks[i] = oTask;
			// 中断循环
			break;
		}
	}
	// 返回函数值
	return oTimeTasks;
};

/**
 * @描述：从任务队列中删除指定的任务对象
 * @开发人员：moshco zhu
 * @开发时间：2011-6-15 下午03:15:26
 */
FHTimeTask.prototype.removeTimeTask = function(oTask) {
	// 是否删除
	var b = false;
	// 从任务队列中删除任务
	var oTasks = this.tasks;
	var iLength = (oTasks == null) ? 0 : oTasks.length;
	for ( var i = 0; i < iLength; i++) {
		if (oTasks[i] != null && oTasks[i].code == oTask.code) {
			oTasks[i] = null;
			b = true;
		}
	}
	// 返回函数值
	return b;
};

/**
 * @描述:输出调式信息
 * @开发人员:moshco zhu
 * @开发时间:2011-6-15 下午04:54:50
 * @param strMsg
 * @returns {Boolean}
 */
FHTimeTask.prototype.debug = function(strMsg) {
	return false;
};

/**
 * --------------------------------------------------------------------------------------------------------------------
 */

// 实例化基础库对象
var FHBASE = new FHBase();

// BaseUI数组 编码 ui对象
var BaseUIs = new Array();

// 实例化基础库对象
if (window.FHBASE == null) {
	window.FHBASE = FHBASE;
}

// 将FHBase静态方法扩展到window对象
if (window.isExtendFHBase == null || !window.isExtendFHBase) {
	$.extend(window, FHBase);
	$.extend(window, FHBASE);
	window.isExtendFHBase = true;
}
