//限制输入更多字符
function leftbyte(objText,intCount){
	if(document.all){
		if(strLenB(objText.value)>intCount){
			alert("不能再输入更多字符")
			while(strLenB(objText.value)>intCount){
				objText.value = objText.value.substring(0,objText.value.length-1)
				eval(objText.name+"count").innerText = intCount - strLenB(objText.value)
			}
		}else{
			eval(objText.name+"count").innerText = intCount - strLenB(objText.value)
		}
	}
}

//检查是否为日期
function isDate(strDate){
	var regexp1 = /^(\d{4}-{1}\d{1,2}-{1}\d{1,2})$/
	if(regexp1.test(strDate)){
		dateArray = strDate.split("-")
		Year = parseInt(dateArray[0])
		Month = parseInt(dateArray[1])
		Day = parseInt(dateArray[2])
		if(Month > 12){
			alert("月份不得大于12!")
			return false
		}
		if(Day > 31) {
			alert("日期不得大于31!")
			return false
		}
		if ((Month == 4) || (Month == 6)|| (Month == 9)|| (Month == 11)){
		     	if (Day == 31){
			 	alert(Month+"月没有31日")
				return false
			}
		} 
		if ((Month == 2)){
			if ((Day == 31)||(Day == 30)){
				alert(Month+"月没有"+Day+"日")
				return false
			}
			if (!isleapyear(Year)){
				if (Day == 29){
					alert(Year+"年"+Month+"月没有"+Day+"日")
					return false
				}
			}
		} 
		return true
	}
	else
	{
		alert("日期格式不对！请确定日期格式为YYYY-MM-DD")
		return false
	}
}

function isTime(strTime)
{
	var regexp1 = /^(\d{1,2}:{1}\d{1,2}:{1}\d{1,2})$/
	if(regexp1.test(strTime)){
		dateArray = strTime.split(":")
		Hour = parseInt(dateArray[0])
		Minute = parseInt(dateArray[1])
		Second = parseInt(dateArray[2])
		//if(!isYear(Year)) return false
		if(Hour > 23){
			alert("小时不得大于23!")
			return false
		}
		if(Minute > 59) {
			alert("分钟不得大于59!")
			return false
		}
		if(Second > 59) {
			alert("秒不得大于59!")
			return false
		} 
		return true
	}
	else
	{
		alert("时间格式不对！请确定日期格式为HH:MM:SS")
		return false
	}

}
function isDateTime(strDateTime)
{
	var regexp1 = /^(\d{4}-{1}\d{1,2}-{1}\d{1,2})\s(\d{1,2}:{1}\d{1,2}:{1}\d{1,2})$/
	if(regexp1.test(strDateTime)){
		dateArray = strDateTime.split(" ")
		strDate = dateArray[0]
		strTime = dateArray[1]

		if ( !isDate(strDate) || !isTime(strTime) )
			return false 
		return true
	}
	else
	{
		alert("日期时间格式不对！请确定日期格式为YYYY-MM-DD HH:MM:SS")
		return false
	}
}

function ConfirmDelete()
{
	if( confirm("确定要删除?"))
		return true
	else
		return false
}

function isYearMonth(strDate){
	var regexp1 = /^(\d{4}-{1}\d{1,2}-{1}})$/
	if(regexp1.test(strDate)){
		var dateArray = strDate.split("-")
		var Year = parseInt(dateArray[0])
		var Day = parseInt(dateArray[2])
		if(Month > 12){
			alert("月份不得大于12!")
			return false
		} 
		return true
	}
	else
	{
		alert("日期格式不对！请确定日期格式为YYYY-MM")
		return false
	}
}




















