     
var winPopupWindow = new Object();     
N = (document.all) ? 0 : 1;         
function fPopUpCalendarDlg(ctrlobj)     
{     
	//var ctrlobj = document.getElementById(objname);
	//var ctrlobj = eval("document.form[0]."+objname);
	//alert(ctrlobj);
	//alert(N);
	//if(N){
	    showx = 220 ; // + deltaX;     
	    showy = 220; // + deltaY;     
	//}else{
	//    showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;     
	//    showy = event.screenY - event.offsetY + 18; // + deltaY;     
  //}     
	newWINwidth = 210 + 4 + 18;     
	if(N){
	    window.top.captureEvents (Event.CLICK|Event.FOCUS);     
    	    window.top.onclick=IgnoreEvents;     
            window.top.onfocus=HandleFocus;     
            winPopupWindow.args = ctrlobj;     
            winPopupWindow.returnedValue = new Array();      
            // winPopupWindow.returnFunc = PopupRetFunc;     
            winPopupWindow.args = ctrlobj;     
	    			newWINwidth = 202;     
            winPopupWindow.win = window.open("/CalendarDlg.htm","CalendarDialog","dependent=yes,left="+showx + ",top=" + showy + ",width="+newWINwidth + ",height=182px" )     
            winPopupWindow.win.focus() 
            return winPopupWindow;     
	}else{
	    retval = window.showModalDialog("/CalendarDlg.htm", "", "dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );     
  }     
	if( retval != null ){
		var y = retval.substring(0,4);
		var m = retval.substring(4,6);
		var d = retval.substring(6);
		var dates = y+"-"+m+"-"+d;
		//alert(ctrlobj.name);
		ctrlobj.value = dates;
		//ctrlobj.value = retval;   
		//alert(retval);   
	}else{     
		//alert("canceled");     
	}     
}        

