//**时间框
	function fPopUpCalendarDlg(ctrlobj)
	{
		showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
		showy = event.screenY - event.offsetY + 18; // + deltaY;
		newWINwidth = 210 + 4 + 18;
		var  formfield = eval("document.forms[0]." + ctrlobj); 

		retval = window.showModalDialog("CalendarDlg.htm", "Calendar", "dialogWidth:220px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable:no;help:no; "  );
		if ( retval != null ){
			formfield.value = retval;     
			////alert (retval);      
		}
			else{
			//alert("canceled");
		}
	}

	//提交时检查时间格式
	function check(){
		var form = document.forms[0];	
		if(form.startDate.value!="")
		{
		if(checkDate(form.startDate.value)=="0")
		{
			form.startDate.focus();
			alert("您输入的日期格式不对！");
			return;
		}
		}
		
		if(form.endDate.value!="")
		{
		if(checkDate(form.endDate.value)=="0")
		{
			form.endDate.focus();
			alert("您输入的日期格式不对！");
			return;
		}
		}
		form.submit();
	}

	/**
 * 功能：检查是否为日期
 * 用法：checkDate(form.txtName.value)
 * 说明：返回值：0：不是日期  1：是日期;时间格式为2003-12-12
 */
function checkDate(datestr)
{
	var lthdatestr
	if (datestr != "")
		lthdatestr= datestr.length ;
	else
		lthdatestr=0;
		
	var tmpy="";
	var tmpm="";
	var tmpd="";
	//var datestr;
	var status;
	status=0;
	if ( lthdatestr== 0)
		return 0

	
	for (i=0;i<lthdatestr;i++)
	{	if (datestr.charAt(i)== '-')
		{
			status++;
		}
		if (status>2)
		{
			//alert("Invalid format of date!");
			return 0;
		}
		if ((status==0) && (datestr.charAt(i)!='-'))
		{
			tmpy=tmpy+datestr.charAt(i)
		}
		if ((status==1) && (datestr.charAt(i)!='-'))
		{
			tmpm=tmpm+datestr.charAt(i)
		}
		if ((status==2) && (datestr.charAt(i)!='-'))
		{
			tmpd=tmpd+datestr.charAt(i)
		}

	}
	year=new String (tmpy);
	month=new String (tmpm);
	day=new String (tmpd)
	//	alert(year);
	//	alert(month);
	//	alert(day);
	//tempdate= new String (year+month+day);
	//alert(tempdate);
	if ((tmpy.length!=4) || (tmpm.length>2) || (tmpd.length>2))
	{
		//alert("Invalid format of date!");
		return 0;
	}
	if (!((1<=month) && (12>=month) && (31>=day) && (1<=day)) )
	{
		//alert ("Invalid month or day!");
		return 0;
	}
	if (!((year % 4)==0) && (month==2) && (day==29))
	{
		//alert ("This is not a leap year!");
		return 0;
	}
	if ((month<=7) && ((month % 2)==0) && (day>=31))
	{
		//alert ("This month is a small month!");
		return 0;
	
	}
	if ((month>=8) && ((month % 2)==1) && (day>=31))
	{
		//alert ("This month is a small month!");
		return 0;
	}
	if ((month==2) && (day==30))
	{
		alert("The Febryary never has this day!");
		return 0;
	}
	return 1;
}