var wndCalendario = null; 

function OpenCalendar(idname, postBack, includeTime)
{
	url = "/SigecerVS/Vistas/Utils/Calendar.aspx?formname=" + document.forms[0].name +
		  "&id=" + idname + "&selected=" + document.forms[0].elements[idname].value +
		  "&postBack=" + postBack + "&includeTime=" + includeTime;

	var w = 165;
	var h = 215;
	if (includeTime)
	  h += 45;
	var t = (screen.height - h) / 2 + 20;
	var l = (screen.width - w) / 2 + 10;
	var features = "width=" + w + ",height=" + h + ",top=" + t + ",left=" + l;

	if ((wndCalendario != null) && wndCalendario.open && !wndCalendario.closed) {
	  wndCalendario.location = url;
	  wndCalendario.focus();
	} else {
		wndCalendario = window.open(url, "", features);
	}
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	wndCalendario.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}		

function SetDateTime(formName, id, newDate, newTime, postBack)
{
	eval('var theform = document.' + formName + ';');
	wndCalendario.close();
	theform.elements[id].value = newDate + ' ' + newTime;
	if (postBack)
		__doPostBack(id,'');
}
