
/*创建日期控件*/
function PutDateCtl(strNM,showCurrDate) {
	var strCurrDate = '';
	var gdCurDate = new Date();
	if (showCurrDate){
		var giYear = gdCurDate.getFullYear();
		var giMonth = gdCurDate.getMonth()+1;
		var giDay = gdCurDate.getDate();
		strCurrDate = giYear+'-'+giMonth+'-'+giDay
	}
	PutInitDateCtl(strNM,strCurrDate);
	return true;
}

/*得到日期*/
function getPopDate(strID,contextPath){
	if (contextPath=="undefined" || contextPath==null){
		 contextPath ="/";
	}
	if (contextPath.lastIndexOf("/")!=contextPath.length-1){
		 contextPath = contextPath + "/";
	}
	var obj = document.all.item(strID);
	showx = event.screenX - event.offsetX - 4 - 210 ;
	showy = event.screenY - event.offsetY + 18;
	var retval = window.showModalDialog(contextPath+"calendar2/CalendarDlg.htm",obj.value, "dialogWidth:240px; dialogHeight:204px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no;help:no");
	if (retval!=null){
		obj.value = retval;
		if (obj.onchange!=null){
			obj.onchange();
		} 
		 
	}
}

/*创建日期控件*/
function PutInitDateCtl(strNM,strTemp,contextPath) {
    if (strTemp==null)
    	strTemp = ""; 
    	
	document.write("<INPUT  type='text' NAME='" + strNM + "' ID='" + strNM + "' value=\""+strTemp +"\"  SIZE=10 class=InputFace onkeypress='doKeyCheck()' readonly>");
	document.write("<INPUT TYPE='BUTTON' VALUE='...' ID='btn" + strNM + "' onclick=\"JavaScript:getPopDate('" + strNM + "','"+ contextPath +"')\" STYLE=\"font:'normal small-caps 6pt serif';\" >");
	document.all.item('btn' + strNM).style.height = 19;
	document.all.item('btn' + strNM).style.width  = 19;
	document.all.item(strNM).style.height = 19;
  	return true;
}


/*选择日期*/
function GetSelectDate(strID) {
	document.all.item(strID).value = getPopDate(document.all.item(strID));
	return true;
}



