function CalendarWindowOpen(Formato, ControlID, left, top)
{
	// NOTA: ControlID já vem encodificado.

	//var ctlTarget = document.getElementById(ControlID + "_" + "TextBoxDate");
	var ctlTarget = document.getElementById(unescape(ControlID));

	var strTarget =  
		"/GacsNet/Dialogs/DateSelectionIFrame.aspx?" + 
		"id=" + encodeURI(ControlID) + "&" +
		"formato=" + Formato + "&" +
		"date=" + encodeURI(ctlTarget.value);

	window.showModalDialog(strTarget, window, "dialogTop:" + top + "; dialogLeft:" + left + "; dialogHeight: 196px ; dialogWidth: 216px ; Help : no ; scroll : no ; center : no ; help : no ; resizable : no ; status : no ; unadorned : no");
}

function WriteCalendarValueForm1(id, datestring)
{
	var control;
	
	control = unescape(id);	// faz o decoding do url
	window.document.all[control].value = datestring;
}

function WriteCalendarValueForm2(id, day, month, year, hour, minute)
{
	var intDay, intMonth, intHour, intMinute;
	var control;		

	if (day < 10) {
		intDay = "0" + day
	}else{
		intDay = day
	}
	
	if (month < 10) {
		intMonth = "0" + month
	}else{
		intMonth = month
	}		
	
	//control = id + "_" + "TextBoxDate";	
	control = unescape(id);	// faz o decoding do url
	window.document.all[control].value = intDay + "/" + intMonth + "/" + year;		
		
	if ("<%=this.GeneralFormat%>" == "True")
	{
		if (hour < 10){
			intHour = "0" + hour
		}else{
			intHour = hour;
		}
		
		if (minute < 10){
			intMinute = "0" + minute;
		}else{
			intMinute = minute;
		}
				
		control = id + "_" + "TextBoxHour";			
		window.document.all[control].value = intHour;
		control = id + "_" + "TextBoxMinute";
		window.document.all[control].value = intMinute;
	}
}

function onLoad()
{
	recalcWindowSize();
	window.setTimeout("timerClose()", 60000);
}

function timerClose()
{
	window.close();
}

