function OpenCalendar(idname,postBack,h,w)
{
	var ww = 480, wh = 340, leftPos = null, topPos = null; 

	IE=(document.all)?true:false; 
	var wh = (IE)?document.body.clientHeight : window.innerHeight; 
	var ww = (IE)?document.body.clientWidth : window.innerWidth; 
	
	if (top.screen){ 
		if (screen.width){ 
			leftPos = Math.round((ww-w-10)/2); 
			topPos = Math.round((wh-h-29)/2); 
		} else { 
			leftPos = 50 
			topPos = 50 
		} 
	} 
	
	popUp = window.open('custom/kalender/Default.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=' + w + ',height=' + h + ',left=' + leftPos + ',top=' + topPos + '');
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}		

function CloseWindow()
{
	self.close();
}
