
//opens the content of a Node in a new window and prints it
function agPrintDiv(divId)
{
	var div = document.getElementById(divId);
	var html = div.cloneNode(true);
	cleanDocument(html);
	
	var myWindow = window.open("","Afdrukken","width=600px,height=600px,location=no,menubar=no,scrollbars=yes");
	myWindow.document.write("<html>");
    myWindow.document.write("<header><link rel='stylesheet' href='/kassamanager/static/SiteColorCSS.css' type='text/css'></header>")
    myWindow.document.write("<body style='background-color:#FFFFFF;'>"+ html.innerHTML +"</body></html>");
	myWindow.document.close();
	myWindow.print();
}

function agZoomDiv(divId)
{
	var div = document.getElementById(divId);
	var html = div.cloneNode(true);
	cleanDocument(html);
	
	var myWindow = window.open("","Zoom","width=600px,height=600px,location=no,menubar=yes,scrollbars=yes,resizable=yes");
	myWindow.document.write("<html>");
    myWindow.document.write("<header><link rel='stylesheet' href='/kassamanager/static/SiteColorCSS.css' type='text/css'></header>")
    myWindow.document.write("<body style='background-color:#FFFFFF;'>"+ html.innerHTML +"</body></html>");
	myWindow.document.close();
}

//function to close the popupgroup in activegrid
//element is an element within the popupgroup (often element == this)
function eljakimClosePopupMenu(element)
{
		if(document.body==element)return;
		if(element.className && element.className.indexOf("PopUpDiv")!=-1)
		{
			hidePopup(element);
		}
		else
		{
			eljakimClosePopupMenu(element.parentNode);
		}
}
//id is the id of the popupgroup
function eljakimClosePopupMenuById(id)
{
		var element = document.getElementById(id);
		if(element.className && element.className.indexOf("PopUpDiv")!=-1)
		{
			hidePopup(element);
		}
}
function addDays(dateinput,days)
{
	var date = new Date();
	date.setDate(date.getDate()+days);
	document.getElementById(dateinput).setDateObject(date);
}

function removeSpaces(nodeId)
{
	var node = document.getElementById(nodeId);
	addEvent(node,"change",function(){node.value = node.value.replace(/\s/gi,"");})
}

function trySetFocus(id)
{
	var element = document.getElementById('GeboorteDatumSearch');
	if(!element || !element.parentNode || !element.focus)
		setTimeout(function(){trySetFocus(id);},100);
	try{
			element.focus();
		}catch(e){}
}