var consulent = 'Consulent';
var medewerker = 'Medewerker';
var bedrijf = 'Bedrijf';
var datagridBedrijfBegin = '_ctl0_DataGrid1__ctl';
var datagridBedrijfEind = '_Id';
var datagridConsultBegin = '_ctl0_DataGrid1__ctl';
var datagridConsultEind = '_Id';
var datagridUitvBegin = '_ctl0_DataGrid1__ctl';
var datagridUitvEind = '_Id';
var datagridBedrijfUserBegin = '_ctl0_VolgerGrid__ctl';
var datagridBedrijfUserEind = '_Id';

function centerMenu()
{
	//Als actiecntrl niet bestaat alles weggoien
	if (document.getElementById("actieCntrl") == null &&
		document.getElementById("boxInhoudActie") != null &&
		document.getElementById("boxInhoudActie2") != null) {
		document.getElementById("boxInhoudActie").style.visibility = 'hidden';
		document.getElementById("boxInhoudActie2").style.visibility = 'hidden';
	}
	
}

function openPopup(actie, item) 
{
	myWindow = window.open("../UI/PopupForm.aspx?actie=" + actie + "&item=" + item, "popup", "height=505, width=580, status=yes");
}

function openReport(actie, filter) 
{
	document.location = "../UI/PDFForm.aspx?actie=" + actie + "&filter=" + filter;
}

function openCalendar(box)
{
	myWindow = window.open("../UI/CalendarForm.aspx?CalendarBox=" + box + "&date=" + document.getElementById(box).value, "popup2", "height=235, width=215, status=yes");
}

function setParentVar(varid, value, varid_datagrid, no)
{
	if (opener.document.getElementById('_ctl0' + varid) != null) {
		//'Normale' control
		opener.document.getElementById('_ctl0' + varid).value = value;
	}
	if (opener.document.getElementById(varid) != null) {
		//Datagrid control
		opener.document.getElementById(varid).value = 'Index=' + (no-3) + '&Id=' + value;
		
		//Aanvraagformulier opnieuw submitten
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
			theform = opener.document.Form1;
		}
		else {
			theform = opener.document.forms["Form1"];
		}
		theform.__EVENTTARGET.value = varid_datagrid;
		theform.__EVENTARGUMENT.value = '';
		theform.submit();
	}
}

function setParentVar(varid, value)
{
	if (opener.document.getElementById(varid) != null) {
		//'Normale' control
		opener.document.getElementById(varid).value = value;
	}
	if (varid.indexOf('Grid')>0) {
		//Aanvraagformulier opnieuw submitten
		if (opener.document.getElementById(varid) != null) 
		{
			var theform;
			if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
				theform = opener.document.Form1;
			}
			else {
				theform = opener.document.forms["Form1"];
			}
			theform.__EVENTTARGET.value = varid;
			theform.__EVENTARGUMENT.value = '';
			theform.submit();
		}
	}
}

function selectDate()
{
	if (document.getElementById('ReturnBox') != null) {
		if (document.getElementById('DateBox') != null) {
			if (document.getElementById('DateBox').value != "") {
				if (opener.document.getElementById(document.getElementById('ReturnBox').value) != null) {
					opener.document.getElementById(document.getElementById('ReturnBox').value).value = document.getElementById('DateBox').value;
					window.close();
				}
			}
		}
	}
}

