<?php
/**
* Immomanager Verhuur op jaarbasis
* 
* Geschreven door	: David Herregat a.k.a. Darklandz (www.darklandz.be) 
* Aangepast door Westdesign 8/1/2008
*
*/


function bg_color() {
	global $bg;
 	if(++$bg % 2 == 0)
  	return '#EEEEEE';
 	else
  	return '#FFFFFF';
}


function Overzicht(){
	
	global $vrtlmod,$CoreTaal;

	$dbconnect	= mysql_connect (DBhost,DBgebruiker,DBwachtwoord) or die ("Kan niet verbinden: " . mysql_error());
	$dbselect 	= mysql_select_db (DBnaam,$dbconnect);
	$sql_result = mysql_query ("SELECT * FROM calendar ORDER BY id");
	$aantalRecords	= mysql_num_rows($sql_result);
	$aantalRecordsPerPagina = '24';
	$aantalPaginas 	= ceil($aantalRecords/$aantalRecordsPerPagina);
	$huidigePagina 	= $_GET['pagina'];

	if ($huidigePagina == ''){ $huidigePagina = '0'; }

	$recordPointer 	= $huidigePagina * $aantalRecordsPerPagina;
	$sql_result 		= mysql_query ("SELECT * FROM calendar ORDER BY id LIMIT $recordPointer,$aantalRecordsPerPagina");

		coreTabbalk($vrtlmod['tab1'].'|'.$vrtlmod['tab2'].'|'.$vrtlmod['tab5'],'index.php?tl='.$CoreTaal.'|index.php?a=Toevoegen&tl='.$CoreTaal.'|index.php?a=Verschil&tl='.$CoreTaal,'0');
	
	?>
	
	<div id="wis">&nbsp;</div>
	<div id="plaatsHouder">
	
	<div id="nieuwsBerichtenTitel">
		<table width="840" border="0" cellspacing="0" cellpadding="0">
  		<tr>
  			<td width="460" height="24" align="left" valign="top">
					<div class="titelTekst" align="left"><?php echo $vrtlmod['overzichtTitel']; ?></div>
				</td>
  			<td width="380" height="24" align="right" valign="top">
					
				</td>
  		</tr>
		</table>
	</div>	
	<div id="nieuwsBerichtenInhoud">
	<?php

	if ($aantalRecords == '0'){
		

	} else {
		
	?>

		<table width="100%" cellpadding="4" cellspacing="0">
			<tr>
				<td width="40" align="center" class="titelNieuws"><?php echo $vrtlmod['akties']; ?></td>
				<td width="100" align="left" class="titelNieuws">Jaar</td>
				<td width="100" align="left" class="titelNieuws">Maand</td>
				<td width="400" align="left" class="titelNieuws">Verlofdagen</td>
			</tr>
	
	<?php

	while ($row=mysql_fetch_array ($sql_result)) { 

		?>
		<tr bgcolor="<?php echo bg_color(); ?>">
			<td width="60" align="center">
				<a href="index.php?a=Details&tl=<?php echo $CoreTaal; ?>&id=<?php echo $row['id']; ?>">
					<img src="<?php echo CORE_Path; ?>images/edit_klein.png" width="16" height="16" border="0">
				</a>
				<a href="index.php?a=Wissen&tl=<?php echo $CoreTaal; ?>&id=<?php echo $row['id']; ?>" 
				onclick="javascript:return confirm ('<?php echo $vrtlmod['nieuwbouwProjectWissen'];?>')">
					<img src="<?php echo CORE_Path; ?>images/wis_klein.png" width="16" height="16" border="0">
				</a>
				<a href="index.php?a=Klok&tl=<?php echo $CoreTaal; ?>&id=<?php echo $row['id']; ?>">
					<img src="<?php echo CORE_Path; ?>images/clock.png" width="16" height="16" border="0">
				</a>
			</td>
			<td width="100">
					<?php echo $row['year']; ?>
			</td>
			<td width="100">
					<?php echo $row['month']; ?>
			</td>
			<td width="400">
			<a href="index.php?a=Details&tl=<?php echo $CoreTaal; ?>&id=<?php echo $row['id']; ?>">
				<?php echo $row['date']; ?>
			</a>
			</td>
			
		<?php
	
		
		
		echo '</tr>';
	}

	echo '<tr><td colspan="4" align="center">';

	if ($aantalPaginas == '1'){
		$toonPagina = $huidigePagina + 1;	
		echo $vrtlmod['pagina'].' '.$toonPagina.'/'.$aantalPaginas.'</td></tr></table>';	
	} elseif ($huidigePagina == '0'){
		$toonPagina = $huidigePagina + 1;	
		echo $vrtlmod['pagina'].' '.$toonPagina.'/'.$aantalPaginas.' &nbsp;&nbsp;&nbsp;&nbsp;
		<a href="index.php?a=aktieveLeden&pagina='.$toonPagina.'&tl='.$CoreTaal.'">'.$vrtlmod['volgendePagina'].'</a></td></tr></table>';	
	} elseif ($huidigePagina == ($aantalPaginas-1)){
		$toonPagina = $huidigePagina + 1;
		$toonVorigePagina = $huidigePagina -1;
		echo '<a href="index.php?a=aktieveLeden&pagina='.$toonVorigePagina.'">'.$vrtlmod['vorigePagina'].'</a>&nbsp;&nbsp;&nbsp;'.$vrtlmod['pagina'].' '.$toonPagina.'/'.$aantalPaginas.'	</td></tr></table>';	
	} else {
		$toonPagina = $huidigePagina + 1;
		$toonVorigePagina = $huidigePagina -1;
		echo '<a href="index.php?a=aktieveLeden&pagina='.$toonVorigePagina.'">'.$vrtlmod['vorigePagina'].'</a>&nbsp;&nbsp;&nbsp;'.$vrtlmod['pagina'].' '.$toonPagina.'/'.$aantalPaginas.'&nbsp;&nbsp;&nbsp;<a href="index.php?a=aktieveLeden&pagina='.$toonPagina.'">'.$vrtlmod['volgendePagina'].'</a></td></tr></table>';	
	}				
	}
	mysql_close($dbconnect);
	
	echo '</div><br>';	
}

/**
*  Toevoegen =======================================================================================
*/

function Toevoegen(){
	
	global $vrtlmod,$CoreTaal;
	
	$nTaal	= strtoupper($_GET['nTaal']); if ($nTaal == ''){$nTaal = $CoreTaal;}
	
	coreTabbalk($vrtlmod['tab1'].'|'.$vrtlmod['tab2'].'|'.$vrtlmod['tab5'],'index.php?tl='.$CoreTaal.'|index.php?a=Toevoegen&tl='.$CoreTaal.'|index.php?a=Verschil&tl='.$CoreTaal,'1');

?>
	<div id="wis">&nbsp;</div>
	<div id="plaatsHouder">
	<div id="testimonialTitel">
		<table width="840" border="0" cellspacing="0" cellpadding="0">
  		<tr>
  			<td width="460" height="31" align="left" valign="top">
					<div class="titelTekst" align="left"><?php echo $vrtlmod['nieuwbouwprojectToevoegen']; ?></div>
				</td>
  			<td width="380" height="31" align="right" valign="top">
					<div class="sluitTekst" align="right">
						<img id="testje" src="<? echo CORE_Path; ?>images/collapseall.png" border="0" width="13" height="13" onclick="switchMenu('testimonialInhoud','testje');" /></div>
				</td>
  		</tr>
		</table>
	</div>	
	
	<div id="testimonialInhoud">
		
		<form name="formHoofdberoep" method="post" 
			action="index.php?a=Opslaan&tl=<? echo $CoreTaal; ?>&nTaal=<?php echo $nTaal; ?>" 
			onsubmit="return checkform_hoofdBeroep<?php echo $CoreTaal; ?>(this);">
		<table width="100%" cellspacing="3" cellpadding="3">
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Jaar
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="jaar" type="text" id="jaar" size="30" maxlength="250">
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Maand
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="maand" type="text" id="maand" size="30" maxlength="250">
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Verlofdagen (datum gescheiden door comma ",")
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="dagen" type="text" id="dagen" size="90" maxlength="500">
				</td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#dddddd" width="100%" align="center" valign="top" class="tekst_normaal">
					<input type="submit" name="submit" value="Wijzigingen Opslaan">
				</td>
			</tr>
		</table>
		</form>
	</div>
	<br>

	<?php


}

/**
*  Nieuwbouwproject Details ======================================================================================
*/

function Details(){
	
	global $vrtlmod,$CoreTaal;
	
	$nTaal	= strtoupper($_GET['nTaal']); if ($nTaal == ''){$nTaal = $CoreTaal;}
	
	coreTabbalk($vrtlmod['tab1'].'|'.$vrtlmod['tab2'].'|'.$vrtlmod['tab3'],'index.php?tl='.$CoreTaal.'|index.php?a=Toevoegen&tl='.$CoreTaal.'|index.php?a=Toevoegen&tl='.$CoreTaal,'2');
	
	
?>
	<div id="wis">&nbsp;</div>
	<div id="plaatsHouder">
	<div id="testimonialTitel">
		<table width="840" border="0" cellspacing="0" cellpadding="0">
  		<tr>
  			<td width="460" height="31" align="left" valign="top">
					<div class="titelTekst" align="left">Artikel: </div>
				</td>
  			<td width="380" height="31" align="right" valign="top">
					<div class="sluitTekst" align="right">
						<img id="testje" src="<? echo CORE_Path; ?>images/collapseall.png" border="0" width="13" height="13" onclick="switchMenu('testimonialInhoud','testje');" /></div>
				</td>
  		</tr>
		</table>
	</div>	
	
	<div id="testimonialInhoud">
 <?php
    $id = $_GET['id'];	
		$detPagina	= $_GET['p'];
		if ($detPagina == ''){$detPagina = '0';}

		ProjectHeader();
	
		coreDetailbalk('Details','
			index.php?a=Details&p=0&id='.$id.'&tl='.$CoreTaal.'|
			index.php?a=Details&p=1&id='.$id.'&tl='.$CoreTaal.'|
			index.php?a=ProjectDetails&p=2&id='.$id.'&nTaal=UK&tl='.$CoreTaal.'|
			index.php?a=ProjectDetails&p=3&id='.$id.'&nTaal=DE&tl='.$CoreTaal,$detPagina);
	
		if ($detPagina == '0'){detailPagina0();}
		if ($detPagina == '1'){detailPagina1();}	
		if ($detPagina == '2'){detailPagina2();}
		if ($detPagina == '3'){detailPagina3();}
	
?>		
	</div>
	<br>

	<?php
}

/**
*  Klok per dag ======================================================================================
*/

function Klok(){
	
	global $vrtlmod,$CoreTaal;
	
	$nTaal	= strtoupper($_GET['nTaal']); if ($nTaal == ''){$nTaal = $CoreTaal;}
	
	coreTabbalk($vrtlmod['tab1'].'|'.$vrtlmod['tab4'],'index.php?tl='.$CoreTaal.'|index.php?a=Klok&tl='.$CoreTaal.'&id=' . $_GET['id'],'1');
	
	
?>
	<div id="wis">&nbsp;</div>
	<div id="plaatsHouder">
	<div id="testimonialTitel">
		<table width="840" border="0" cellspacing="0" cellpadding="0">
  		<tr>
  			<td width="460" height="31" align="left" valign="top">
					<div class="titelTekst" align="left">Klok: </div>
				</td>
  			<td width="380" height="31" align="right" valign="top">
					<div class="sluitTekst" align="right">
						<img id="testje" src="<? echo CORE_Path; ?>images/collapseall.png" border="0" width="13" height="13" onclick="switchMenu('testimonialInhoud','testje');" /></div>
				</td>
  		</tr>
		</table>
	</div>	
	
	<div id="testimonialInhoud">
 <?php
    $id = $_GET['id'];	
		$klokPagina	= $_GET['p'];
		if ($klokPagina == ''){$klokPagina = '0';}

		ProjectHeader();
	
		if ($klokPagina == '0'){klokPagina0();}
?>		
	</div>
	<br>

	<?php
}

/**
*  Tijdsverschil tussen actuele tijd en reservatie  ===========================================================================
*/

function Verschil(){
	
	global $vrtlmod,$CoreTaal;
	
	$nTaal	= strtoupper($_GET['nTaal']); if ($nTaal == ''){$nTaal = $CoreTaal;}
	
	coreTabbalk($vrtlmod['tab1'].'|'.$vrtlmod['tab2'].'|'.$vrtlmod['tab5'],'index.php?tl='.$CoreTaal.'|index.php?a=Toevoegen&tl='.$CoreTaal.'|index.php?a=Verschil&tl='.$CoreTaal,'2');
	
	$dbconnect	= mysql_connect (DBhost,DBgebruiker,DBwachtwoord) or die ("Kan niet verbinden: " . mysql_error());
	$dbselect 	= mysql_select_db (DBnaam,$dbconnect);
	$sql_result = mysql_query ("SELECT * FROM tijd_verschil WHERE id=1");
	$row = mysql_fetch_assoc($sql_result);
?>
	<div id="wis">&nbsp;</div>
	<div id="plaatsHouder">
	<div id="testimonialTitel">
		<table width="840" border="0" cellspacing="0" cellpadding="0">
  		<tr>
  			<td width="460" height="31" align="left" valign="top">
					<div class="titelTekst" align="left">Klok: </div>
				</td>
  			<td width="380" height="31" align="right" valign="top">
					<div class="sluitTekst" align="right">
						<img id="testje" src="<? echo CORE_Path; ?>images/collapseall.png" border="0" width="13" height="13" onclick="switchMenu('testimonialInhoud','testje');" /></div>
				</td>
  		</tr>
		</table>
	</div>	
	
	<div id="testimonialInhoud">
		<form name="formHoofdberoep" method="post" action="index.php?a=VerschilOpslaan&tl=<? echo $CoreTaal; ?>&nTaal=<?php echo $nTaal; ?>">
		<table width="100%" cellspacing="3" cellpadding="3">
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Verschil tussen reserveringstijd en actuele tijd (min)
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="verschil" type="text" id="verschil" size="30" maxlength="250" value="<?php echo $row['verschil']; ?>">
				</td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#dddddd" width="100%" align="center" valign="top" class="tekst_normaal">
					<input type="submit" name="submit" value="Wijzigingen Opslaan">
				</td>
			</tr>
		</table>
		</form>
	</div>
	<br>

	<?php
}

/**
* Nieuwbouwproject header info ==============================================================================
*/

function ProjectHeader(){
	
	global $vrtlmod,$CoreTaal,$id;
	
	$id = $_GET['id'];
	$nieuwsTaal	= strtoupper($_GET['nieuwsTaal']); if ($nieuwsTaal == ''){$nieuwsTaal = $CoreTaal;}

	$dbconnect	= mysql_connect (DBhost,DBgebruiker,DBwachtwoord) or die ("Kan niet verbinden: " . mysql_error());
	$dbselect 	= mysql_select_db (DBnaam,$dbconnect);
	$sql_result = mysql_query ("SELECT * FROM calendar WHERE id=".$id);

	while ($row=mysql_fetch_array ($sql_result)) { 
	
		echo 'Verlofdagen van: '.$row['month'].' - '.$row['year'];
	
	
	}
}

/**
* Detailpaginas ============================================================================================= 
*/

function detailPagina0() {
	
	global $vrtlmod,$CoreTaal,$id;
	
	$id = $_GET['id'];
	$nieuwsTaal	= strtoupper($_GET['nieuwsTaal']); if ($nieuwsTaal == ''){$nieuwsTaal = $CoreTaal;}

	$dbconnect	= mysql_connect (DBhost,DBgebruiker,DBwachtwoord) or die ("Kan niet verbinden: " . mysql_error());
	$dbselect 	= mysql_select_db (DBnaam,$dbconnect);
	$sql_result = mysql_query ("SELECT * FROM calendar WHERE id=".$id);

	while ($row=mysql_fetch_array ($sql_result)) { 

	
	?>
	<form name="formHoofdberoep" method="post" 
			action="index.php?a=DetailsOpslaan&id=<? echo $id; ?>&tl=<? echo $CoreTaal; ?>&nTaal=<?php echo $nTaal; ?>" 
			onsubmit="return checkform_hoofdBeroep<?php echo $CoreTaal; ?>(this);">
		<table width="100%" cellspacing="3" cellpadding="3">
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Jaar
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="jaar" type="text" id="jaar" size="30" maxlength="250" value="<?php echo $row['year']; ?>">
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Maand
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="maand" type="text" id="maand" size="30" maxlength="250"value="<?php echo $row['month']; ?>">
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Verlofdagen (datum gescheiden door comma ",")
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="dagen" type="text" id="dagen" size="90" maxlength="500"value="<?php echo $row['date']; ?>">
				</td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#dddddd" width="100%" align="center" valign="top" class="tekst_normaal">
					<input type="submit" name="submit" value="Wijzigingen Opslaan">
				</td>
			</tr>
		</table>
		</form>	
	<?	
	}
	echo '</div><br>';
}


function detailPagina1() 
{
	
	global $vrtlmod,$CoreTaal,$id;
	
	$id = $_GET['id'];
	$nieuwsTaal	= strtoupper($_GET['nieuwsTaal']); if ($nieuwsTaal == ''){$nieuwsTaal = $CoreTaal;}

	$dbconnect	= mysql_connect (DBhost,DBgebruiker,DBwachtwoord) or die ("Kan niet verbinden: " . mysql_error());
	$dbselect 	= mysql_select_db (DBnaam,$dbconnect);
	$sql_result = mysql_query ("SELECT * FROM mod_WebLinks WHERE id=".$id);

	while ($row=mysql_fetch_array ($sql_result)) 
	{ 

	
	?>
	<form name="formHoofdberoep" method="post" 
			action="index.php?a=DetailsOpslaan&id=<? echo $id; ?>&tl=<? echo $CoreTaal; ?>&nTaal=<?php echo $nTaal; ?>" 
			onsubmit="return checkform_hoofdBeroep<?php echo $CoreTaal; ?>(this);">
		<table width="100%" cellspacing="3" cellpadding="3">
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Titel
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="titel" type="text" id="titel" size="90" maxlength="250" value="<?php echo $row['Titel']; ?>">
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Link (vb. http://www.westdesign.be)
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input name="weblink" type="text" id="weblink" size="90" maxlength="250"value="<?php echo $row['WebLink']; ?>">
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Korte Omschrijving in het FRANS
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<input type="hidden" name="omschrijving" value="<?php echo $row['Omschrijving']; ?>">
					<textarea id="omschrijving_fr" name="omschrijving_fr" rows="10" cols="70"><?php echo $row['Omschrijving_fr']; ?></textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#dddddd" width="100%" align="center" valign="top" class="tekst_normaal">
					<input type="submit" name="submit" value="Wijzigingen Opslaan">
				</td>
			</tr>
		</table>
		</form>	
	<?	
	}
	echo '</div><br>';
}
	
function toonFotos($Id){
	
	global $vrtlmod,$CoreTaal;

	$dbconnect			= mysql_connect (DBhost,DBgebruiker,DBwachtwoord) or die ("Kan niet verbinden: " . mysql_error());
	$dbselect 			= mysql_select_db (DBnaam,$dbconnect);

	$sql = mysql_query ("SELECT * FROM mod_ArtikelsFotos WHERE id=".$Id);
	$tmp = '';
	$FotoPath = 'http://webmanager.westdesign.info/fotos/';
	
	while ($row=mysql_fetch_array ($sql)) {
	
		$tmp .= '<img src="'.$FotoPath.$row['bestandsNaam'].'" width="200">
							<a href="index.php?a=wisFoto&tl='.$CoreTaal.'&id='.$Id.'&fotoId='.$row['recId'].'">
								<img src="'.CORE_Path.'images/wis_klein.png" width="16" height="16" border="0">
							<a>
						 <br><br>';
	
	}
	
	return $tmp;
}

function days_in_month($month, $year)  {
	return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31); 
} 

function klokPagina0() {
	
	global $vrtlmod,$CoreTaal,$id;
	
	$id = $_GET['id'];
	$nieuwsTaal	= strtoupper($_GET['nieuwsTaal']); if ($nieuwsTaal == ''){$nieuwsTaal = $CoreTaal;}

	$dbconnect	= mysql_connect (DBhost,DBgebruiker,DBwachtwoord) or die ("Kan niet verbinden: " . mysql_error());
	$dbselect 	= mysql_select_db (DBnaam,$dbconnect);
	$sql_result = mysql_query ("SELECT * FROM calendar WHERE id=".$id);

	while ($row=mysql_fetch_array ($sql_result)) { 

	
	?>
	
	<script language="JavaScript">
		function toggle(which, source, tijd_dag) {
			if (which == "1"){
				$("input").each(function() {
					var re = new RegExp("tijd_" + tijd_dag + "_");
					if(
						$(this).prop("name").match(re)
					){
						if($(source).val().match(/^indeterminate/)) { // eigenlijk unchecked... ivm manier van aanroepen (onclick)
							$(this).tristate('state', false);
						} else if($(source).val().match(/^unchecked/)) { // eigenlijk checked
							$(this).tristate('state', true);
						} else { // indeterminate
							$(this).tristate('state', null);
						}
					}
				});
			} else {
				$("input").each(function() {
					var re = new RegExp(tijd_dag);
					if(
						$(this).prop("name").match(/tijd/) &&
						$(this).val().match(re)
					){
						if($(source).val().match(/^indeterminate/)) { // eigenlijk unchecked... ivm manier van aanroepen (onclick)
							$(this).tristate('state', false);
						} else if($(source).val().match(/^unchecked/)) { // eigenlijk checked
							$(this).tristate('state', true);
						} else { // indeterminate
							$(this).tristate('state', null);
						}
					}
				});
			}
		}
		
		$(function() {
			$('.tristate').tristate();
		});
		
		function saveForm () {
			
			$('.tristate').each(function() {
				value = $(this).val();
				if($(this).val().match(/^indeterminate/)){
					$(this).prop('checked', true);
					$(this).prop('value', value);
				} else if($(this).val().match(/^unchecked/)){
					// niets
				} else {
					$(this).prop('checked', true);
					$(this).prop('value', value);
				}
			});
			
			$('[name=formHoofdberoep]').submit();
		}
	</script>	
	<form name="formHoofdberoep" method="post" 
			action="index.php?a=KlokOpslaan&id=<? echo $id; ?>&tl=<? echo $CoreTaal; ?>&nTaal=<?php echo $nTaal; ?>" 
	>
		<table width="100%" cellspacing="3" cellpadding="3" style="position: relative; left: -125px; background-color: #cecece">
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Jaar
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<?php echo $row['year']; ?><input type="hidden" name="year" value="<?php echo $row['year']; ?>">
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Maand
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<?php echo $row['month']; ?><input type="hidden" name="month" value="<?php echo $row['month']; ?>">
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" valign="middle" class="celTitel">
					Verlofdagen (datum gescheiden door comma ",")
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
					<?php echo $row['date']; ?>
				</td>
			</tr>
			<tr>
				<td bgcolor="#2E3B56" width="170" align="right" class="celTitel" valign="top">
					Dagen open
				</td>
				<td bgcolor="#dddddd" width="500" align="left" class="tekst_normaal">
				<table border="1" width="98%">
					<th> 
						<td width="50">
							<input type="checkbox" class="tristate" name="checkTime" value="12:00" checkedvalue="12:00" uncheckedvalue="unchecked_12:00" indeterminatevalue="indeterminate_12:00" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td width="50">
							<input type="checkbox" class="tristate" name="checkTime" value="12:15" checkedvalue="12:15" uncheckedvalue="unchecked_12:15" indeterminatevalue="indeterminate_12:15" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="12:30" checkedvalue="12:30" uncheckedvalue="unchecked_12:30" indeterminatevalue="indeterminate_12:30" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="checkTime" value="12:45" checkedvalue="12:45" uncheckedvalue="unchecked_12:45" indeterminatevalue="indeterminate_12:45" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="13:00" checkedvalue="13:00" uncheckedvalue="unchecked_13:00" indeterminatevalue="indeterminate_13:00" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="13:15" checkedvalue="13:15" uncheckedvalue="unchecked_13:15" indeterminatevalue="indeterminate_13:15" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="checkTime" value="13:30" checkedvalue="13:30" uncheckedvalue="unchecked_13:30" indeterminatevalue="indeterminate_13:30" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="checkTime" value="13:45" checkedvalue="13:45" uncheckedvalue="unchecked_13:45" indeterminatevalue="indeterminate_13:45" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="checkTime" value="14:00" checkedvalue="14:00" uncheckedvalue="unchecked_14:00" indeterminatevalue="indeterminate_14:00" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="18:00" checkedvalue="18:00" uncheckedvalue="unchecked_18:00" indeterminatevalue="indeterminate_18:00" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="checkTime" value="18:15" checkedvalue="18:15" uncheckedvalue="unchecked_18:15" indeterminatevalue="indeterminate_18:15" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="18:30" checkedvalue="18:30" uncheckedvalue="unchecked_18:30" indeterminatevalue="indeterminate_18:30" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="checkTime" value="18:45" checkedvalue="18:45" uncheckedvalue="unchecked_18:45" indeterminatevalue="indeterminate_18:45" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="19:00" checkedvalue="19:00" uncheckedvalue="unchecked_19:00" indeterminatevalue="indeterminate_19:00" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="checkTime" value="19:15" checkedvalue="19:15" uncheckedvalue="unchecked_19:15" indeterminatevalue="indeterminate_19:15" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="19:30" checkedvalue="19:30" uncheckedvalue="unchecked_19:30" indeterminatevalue="indeterminate_19:30" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="checkTime" value="19:45" checkedvalue="19:45" uncheckedvalue="unchecked_19:45" indeterminatevalue="indeterminate_19:45" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="20:00" checkedvalue="20:00" uncheckedvalue="unchecked_20:00" indeterminatevalue="indeterminate_20:00" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="20:15" checkedvalue="20:15" uncheckedvalue="unchecked_20:15" indeterminatevalue="indeterminate_20:15" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="20:30" checkedvalue="20:30" uncheckedvalue="unchecked_20:30" indeterminatevalue="indeterminate_20:30" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
						<td>
							<input type="checkbox" class="tristate" name="checkTime" value="20:45" checkedvalue="20:45" uncheckedvalue="unchecked_20:45" indeterminatevalue="indeterminate_20:45" onmouseup="javascript: toggle(2, this, this.value)">
						</td>
                     <!--   <td>
							<input type="checkbox" class="tristate" name="checkTime" value="21:00" checkedvalue="21:00" uncheckedvalue="unchecked_21:00" indeterminatevalue="indeterminate_21:00" onmouseup="javascript: toggle(2, this, this.value)">
						</td>-->
					</th>
<?php
				$date_array = explode(",", $row['date']);
				$days = days_in_month ($row['month'], $row['year']);
				
				for ($i=1; $i<=$days; $i++) {
					if(in_array($i, $date_array)) continue;
					$query2 = "
						SELECT * FROM tijd
						WHERE jaar='" . $row['year'] . "'
						AND maand='" . $row['month'] . "'
						AND dag='" . $i . "'
					";
					$result2 = mysql_query($query2) or die(mysql_error());
					$row2 = mysql_fetch_assoc($result2);
					if(mysql_num_rows($result2) == 0) $checked = true;
?>
					<tr>
						<td width="50">
							<?=$i; ?> <input type="checkbox" class="tristate" name="all_<?=$i?>" onmouseup="javascript: toggle(1, this, <?=$i?>)" value="" checkedvalue="" uncheckedvalue="unchecked" indeterminatevalue="indeterminate" >
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1200" value="12:00" checkedvalue="12:00" uncheckedvalue="unchecked_12:00" indeterminatevalue="indeterminate_12:00"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "12:00") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "12:00") ? ' indeterminate="indeterminate"' : "") ?>> 12:00
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1215" value="12:15" checkedvalue="12:15" uncheckedvalue="unchecked_12:15" indeterminatevalue="indeterminate_12:15"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "12:15") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "12:15") ? ' indeterminate="indeterminate"' : "") ?>> 12:15
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1230" value="12:30" checkedvalue="12:30" uncheckedvalue="unchecked_12:30" indeterminatevalue="indeterminate_12:30"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "12:30") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "12:30") ? ' indeterminate="indeterminate"' : "") ?>> 12:30
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1245" value="12:45" checkedvalue="12:45" uncheckedvalue="unchecked_12:45" indeterminatevalue="indeterminate_12:45"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "12:45") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "12:45") ? ' indeterminate="indeterminate"' : "") ?>> 12:45
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1300" value="13:00" checkedvalue="13:00" uncheckedvalue="unchecked_13:00" indeterminatevalue="indeterminate_13:00"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "13:00") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "13:00") ? ' indeterminate="indeterminate"' : "") ?>> 13:00
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1315" value="13:15" checkedvalue="13:15" uncheckedvalue="unchecked_13:15" indeterminatevalue="indeterminate_13:15"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "13:15") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "13:15") ? ' indeterminate="indeterminate"' : "") ?>> 13:15
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1330" value="13:30" checkedvalue="13:30" uncheckedvalue="unchecked_13:30" indeterminatevalue="indeterminate_13:30"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "13:30") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "13:30") ? ' indeterminate="indeterminate"' : "") ?>> 13:30
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1345" value="13:45" checkedvalue="13:45" uncheckedvalue="unchecked_13:45" indeterminatevalue="indeterminate_13:45"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "13:45") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "13:45") ? ' indeterminate="indeterminate"' : "") ?>> 13:45
						</td>
                         <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1400" value="14:00" checkedvalue="14:00" uncheckedvalue="unchecked_14:00" indeterminatevalue="indeterminate_14:00"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "14:00") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "14:00") ? ' indeterminate="indeterminate"' : "") ?>> 14:00
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1800" value="18:00" checkedvalue="18:00" uncheckedvalue="unchecked_18:00" indeterminatevalue="indeterminate_18:00"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "18:00") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "18:00") ? ' indeterminate="indeterminate"' : "") ?>> 18:00
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1815" value="18:15" checkedvalue="18:15" uncheckedvalue="unchecked_18:15" indeterminatevalue="indeterminate_18:15"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "18:15") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "18:15") ? ' indeterminate="indeterminate"' : "") ?>> 18:15
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1830" value="18:30" checkedvalue="18:30" uncheckedvalue="unchecked_18:30" indeterminatevalue="indeterminate_18:30"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "18:30") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "18:30") ? ' indeterminate="indeterminate"' : "") ?>> 18:30
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1845" value="18:45" checkedvalue="18:45" uncheckedvalue="unchecked_18:45" indeterminatevalue="indeterminate_18:45"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "18:45") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "18:45") ? ' indeterminate="indeterminate"' : "") ?>> 18:45
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1900" value="19:00" checkedvalue="19:00" uncheckedvalue="unchecked_19:00" indeterminatevalue="indeterminate_19:00"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "19:00") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "19:00") ? ' indeterminate="indeterminate"' : "") ?>> 19:00
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1915" value="19:15" checkedvalue="19:15" uncheckedvalue="unchecked_19:15" indeterminatevalue="indeterminate_19:15"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "19:15") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "19:15") ? ' indeterminate="indeterminate"' : "") ?>> 19:15
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1930" value="19:30" checkedvalue="19:30" uncheckedvalue="unchecked_19:30" indeterminatevalue="indeterminate_19:30"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "19:30") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "19:30") ? ' indeterminate="indeterminate"' : "") ?>> 19:30
						</td>
                        <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_1945" value="19:45" checkedvalue="19:45" uncheckedvalue="unchecked_19:45" indeterminatevalue="indeterminate_19:45"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "19:45") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "19:45") ? ' indeterminate="indeterminate"' : "") ?>> 19:45
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_2000" value="20:00" checkedvalue="20:00" uncheckedvalue="unchecked_20:00" indeterminatevalue="indeterminate_20:00"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "20:00") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "20:00") ? ' indeterminate="indeterminate"' : "") ?>> 20:00
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_2015" value="20:15" checkedvalue="20:15" uncheckedvalue="unchecked_20:15" indeterminatevalue="indeterminate_20:15"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "20:15") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "20:15") ? ' indeterminate="indeterminate"' : "") ?>> 20:15
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_2030" value="20:30" checkedvalue="20:30" uncheckedvalue="unchecked_20:30" indeterminatevalue="indeterminate_20:30"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "20:30") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "20:30") ? ' indeterminate="indeterminate"' : "") ?>> 20:30
						</td>
						<td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_2045" value="20:45" checkedvalue="20:45" uncheckedvalue="unchecked_20:45" indeterminatevalue="indeterminate_20:45"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "20:45") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "20:45") ? ' indeterminate="indeterminate"' : "") ?>> 20:45
						</td>
                     <!--   <td>
							<input type="checkbox" class="tristate" name="tijd_<?=$i?>_2100" value="21:00" checkedvalue="21:00" uncheckedvalue="unchecked_21:00" indeterminatevalue="indeterminate_21:00"<?=($checked == true ? " checked" : (strstr($row2['tijden'], "21:00") ? " checked" : "")) ?><?=(strstr($row2['tijden_nietbeschikbaar'], "21:00") ? ' indeterminate="indeterminate"' : "") ?>> 21:00
						</td>-->
					</tr>
<?php
					
				}
?>
				</table>
				</td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#dddddd" width="100%" align="center" valign="top" class="tekst_normaal">
					<input type="button" name="verzenden" value="Wijzigingen Opslaan" onclick="saveForm()">
				</td>
			</tr>
		</table>
		</form>	
	<?	
	}
	echo '</div><br>';
}
?>