function getObj(objID)
{
    if (document.getElementById) {return document.getElementById(objID);}
    else if (document.all) {return document.all[objID];}
    else if (document.layers) {return document.layers[objID];}
}

function checkClick(e) {
	e?evt=e:evt=event;
	CSE=evt.target?evt.target:evt.srcElement;
	if (getObj('dateChooserPopupPanel'))
		if (!isChild(CSE,getObj('dateChooserPopupPanel')))
			getObj('dateChooserPopupPanel').style.display='none';
}

function isChild(s,d) {
	while(s) {
		if (s==d) 
			return true;
		s=s.parentNode;
	}
	return false;
}

function Left(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function Top(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

var buidCalander = "";
buidCalander = '<div id="dateChooserPopupPanel" style="position:absolute; display:none;" onMouseOver="document.getElementById(\'dateChooserPopupPanel\').style.display=\'block\'; document.getElementById(\'iFrameOverlay\').style.display=\'block\';" onMouseOut="document.getElementById(\'dateChooserPopupPanel\').style.display=\'none\'; document.getElementById(\'iFrameOverlay\').style.display=\'none\';">';
buidCalander += '	<div class="dateChooserCalanderBackground">';
buidCalander += '		<table class="dateChooserMainTable" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse; border-color: #ABABAB;">';
buidCalander += '			<tr class="dateChooserHeaderRow">';
buidCalander += '				<td id="previousMonth" align="center" class="dateChooserPreviousMonth" style="cursor:pointer" onclick="csubm()">&lt;&lt;</td>';
buidCalander += '				<td class="dateChooserPresentMonth" colspan="5" id="mns" align="center"></td>';
buidCalander += '				<td id="nextMonth" align="center" class="dateChooserNextMonth" style="cursor:pointer" onclick="caddm()">&gt;&gt;</td>';
buidCalander += '			</tr>';
buidCalander += '			<tr>';
buidCalander += '			<tr class="dateChooserDayRow">';
buidCalander += '				<td class="dateChooserDayCell" align="center">Z</td>';
buidCalander += '				<td class="dateChooserDayCell" align="center">M</td>';
buidCalander += '				<td class="dateChooserDayCell" align="center">D</td>';
buidCalander += '				<td class="dateChooserDayCell" align="center">W</td>';
buidCalander += '				<td class="dateChooserDayCell" align="center">D</td>';
buidCalander += '				<td class="dateChooserDayCell" align="center">V</td>';
buidCalander += '				<td class="dateChooserDayCell" align="center">Z</td>';
buidCalander += '			</tr>';
for(var kk=1;kk<=6;kk++) {
	buidCalander += '			<tr>';
	for(var tt=1;tt<=7;tt++) {
		num=7 * (kk-1) - (-tt);
		buidCalander += '				<td class="day" id="v' + num + '" style="text-align: center;">&nbsp;</td>';
	}
	buidCalander += '			</tr>';
}
buidCalander += '			<tr>';
buidCalander += '			<tr>';
buidCalander += '				<td colspan="7" class=""></td>';
buidCalander += '			</tr>';
buidCalander += '		</table>';
buidCalander += '	</div>';
buidCalander += '</div>';
buidCalander += '<iframe id="iFrameOverlay" style="DISPLAY: none;" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>';


document.all?document.attachEvent('onclick',checkClick):document.addEventListener('click',checkClick,false);


// Calendar script
var now = new Date;
var sccm=now.getMonth();
var sccy=now.getFullYear();
var ccm=now.getMonth();
var ccy=now.getFullYear();

var updobj;
var leftStart;
var topStart;
function lcs(ielem) {
	updobj		= ielem;
	leftStart	= Left(ielem);
	topStart	= Top(ielem)+ielem.offsetHeight;
	
	document.getElementById('dateChooserPopupPanel').style.display = '';
	document.getElementById('dateChooserPopupPanel').style.top = topStart+'px';
	document.getElementById('dateChooserPopupPanel').style.left = leftStart+'px';
	document.getElementById('dateChooserPopupPanel').style.zIndex = '10';

	document.getElementById('iFrameOverlay').style.display = '';
	document.getElementById('iFrameOverlay').style.top = topStart+'px';
	document.getElementById('iFrameOverlay').style.left = leftStart+'px';
	document.getElementById('iFrameOverlay').style.position = 'absolute';
	document.getElementById('iFrameOverlay').style.zIndex = '5';
	document.getElementById('iFrameOverlay').style.filter = 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
	
	
	// First check date is valid
	curdt=ielem.value;
	curdtarr=curdt.split('-');
	isdt=true;
	for(var k=0;k<curdtarr.length;k++) {
		if (isNaN(curdtarr[k]))
			isdt=false;
	}
	if (isdt&(curdtarr.length==3)) {
		ccm=curdtarr[1]-1;
		ccy=curdtarr[2];
		//alert(curdtarr[2]);
		prepcalendar(curdtarr[0],curdtarr[1]-1,curdtarr[2]); //dag, maand, jaar
	}
	
}

function evtTgt(e)
{
	var el;
	if(e.target)el=e.target;
	else if(e.srcElement)el=e.srcElement;
	if(el.nodeType==3)el=el.parentNode; // defeat Safari bug
	return el;
}
function EvtObj(e)
{
	if(!e)
		e=window.event;return e;
}
function cs_over(e) {
	evtTgt(EvtObj(e)).style.background='#6B284C';
	evtTgt(EvtObj(e)).style.color='#FFFFFF';
	evtTgt(EvtObj(e)).style.textAlign='center';
}
function cs_out(e) {
	evtTgt(EvtObj(e)).style.background='#FFFFFF';
	evtTgt(EvtObj(e)).style.color='';
	evtTgt(EvtObj(e)).style.textAlign='center';
}
function cs_click(e) {
	updobj.value=calvalarr[evtTgt(EvtObj(e)).id.substring(1,evtTgt(EvtObj(e)).id.length)];
	getObj('dateChooserPopupPanel').style.display='none';
	document.getElementById('iFrameOverlay').style.display = 'none';
	
}

var mn=new Array('Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December');
var mnn=new Array('31','28','31','30','31','30','31','31','30','31','30','31');
var mnl=new Array('31','29','31','30','31','30','31','31','30','31','30','31');
var calvalarr=new Array(42);

function f_cps(obj) {
//	obj.style.background='#C4D3EA';
//	obj.style.font='10px Arial';
//	obj.style.color='#333333';
//	obj.style.textAlign='center';
//	obj.style.textDecoration='none';
//	obj.style.border='1px solid #6487AE';
	obj.style.cursor='pointer';
	obj.style.color='';
}

function f_cpps(obj) {
//	obj.style.background='#C4D3EA';
//	obj.style.font='10px Arial';
//	obj.style.color='#e0e0e0';
//	obj.style.textAlign='center';
//	obj.style.textDecoration='line-through';
//	obj.style.border='1px solid #6487AE';
	obj.style.color='#cccccc';
	obj.style.cursor='default';
}

function f_hds(obj) {
//	obj.style.background='#FFF799';
//	obj.style.fontWeight='bold';
//	obj.style.color='#333333';
//	obj.style.textAlign='center';
//	obj.style.border='1px solid #6487AE';
	obj.style.color='#6B284C';
	obj.style.cursor='pointer';
}

// day selected
function prepcalendar(hd,cm,cy) 
{
	now=new Date();
	sd=now.getDate();
	td=new Date();
	td.setDate(1);
	td.setFullYear(cy);
	td.setMonth(cm);
	cd=td.getDay();
	getObj('mns').innerHTML=mn[cm]+ ' ' + cy;
	marr=((cy%4)==0)?mnl:mnn;
	
	for(var d=1;d<=42;d++) {
		f_cps(getObj('v'+parseInt(d)));
		if ((d >= (cd -(-1))) && (d<=cd-(-marr[cm]))) 
		{
			dip=((d-cd < sd)&&(cm==sccm)&&(cy==sccy));
			htd=((hd!='')&&(d-cd==hd));
			
			if (dip)
				f_cpps(getObj('v'+parseInt(d)));
			else if (htd)
				f_hds(getObj('v'+parseInt(d)));
			else
				f_cps(getObj('v'+parseInt(d)));

			getObj('v'+parseInt(d)).onmouseover=(dip)?null:cs_over;
			getObj('v'+parseInt(d)).onmouseout=(dip)?null:cs_out;
			getObj('v'+parseInt(d)).onclick=(dip)?null:cs_click;
			
			getObj('v'+parseInt(d)).innerHTML=d-cd;	
			
			dateDay = (d-cd);
			dateMonth = (cm-(-1));
			
			if(dateDay < 10)
			{
				dateDay = "0" + dateDay
			}
			
			if(dateMonth < 10)
			{
				dateMonth = "0" + dateMonth
			}
			
			calvalarr[d]=''+dateDay+'-'+dateMonth+'-'+cy;
		}
		else 
		{
			getObj('v'+d).innerHTML='&nbsp;';
			getObj('v'+parseInt(d)).onmouseover=null;
			getObj('v'+parseInt(d)).onmouseout=null;
			getObj('v'+parseInt(d)).style.cursor='default';
		}
	}
}

function caddm() {
	marr=((ccy%4)==0)?mnl:mnn;
	
	ccm+=1;
	if (ccm>=12) {
		ccm=0;
		ccy++;
	}
	cdayf();
	prepcalendar('',ccm,ccy);
}

function csubm() {
	marr=((ccy%4)==0)?mnl:mnn;
	
	ccm-=1;
	if (ccm<0) {
		ccm=11;
		ccy--;
	}
	cdayf();
	prepcalendar('',ccm,ccy);
}

function cdayf() {
if ((ccy>sccy)|((ccy==sccy)&&(ccm>=sccm)))
	{
	document.getElementById('previousMonth').style.visibility='visible';
	return;
	}
else {
	ccy=sccy;
	ccm=sccm;
	//cfd=scfd;
	document.getElementById('previousMonth').style.visibility='hidden';
	}
}

function validateForm()
{
	//return false;
	if((document.frm_search.apwiz_datum.value == "") || (document.frm_search.apwiz_datum.value == "dd-mm-jjjj"))
	{
		alert("Je hebt geen datum opgegeven.");
		document.frm_search.apwiz_datum.focus();
		return false;
	}
	if(document.frm_search.apwiz_aantalpersonen.value == "")
	{
		alert("Je hebt niet de aantal personen opgegeven.");
		document.frm_search.apwiz_aantalpersonen.focus();
		return false;
	}
	if(document.frm_search.apwiz_dagdeel.selectedIndex == "0")
	{
		alert("Geef een dagdeel op.");
		document.frm_search.apwiz_dagdeel.focus();
		return false;
	}
	if(document.frm_search.apwiz_opstelling.selectedIndex == "0")
	{
		alert("Geef een opstelling op.");
		document.frm_search.apwiz_opstelling.focus();
		return false;
	}
	else
	{
		return true;
	}
}



document.write('<style>');
document.write('.seats2MeetWizardContainer, .seats2MeetWizardContainer h3, .seats2MeetWizardContainer input, .seats2MeetWizardContainer select, .seats2MeetWizardContainer .dateChooserCalanderBackground { border: 1px solid #4B7E17; }');
document.write('.seats2MeetWizardContainer .divRow, .seats2MeetWizardContainer .buttonContainer, .seats2MeetWizardContainer .poweredByS2M { text-align: left }');

document.write('.seats2MeetWizardContainer { margin-bottom: 12px; font-size: 12px; color: #4B7E17; padding: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; background: #fafafa url(http://www.seats2meet.com/widget/images/servicePaginaS2MWatermerk.gif) no-repeat center center; }');
document.write('.seats2MeetWizardContainer h3 { margin: 0px -10px  10px  -10px; padding: 0 10px 5px 10px; font-size: 15px; border-top: 0px; border-left: 0px; border-right: 0px; }');


document.write('.seats2MeetWizardContainer .seats2MeetWizardWizardInhoud { position: relative; }');
document.write('.seats2MeetWizardContainer .divRow { float: left; clear: left; margin-bottom: 15px; width: 100%; }');
document.write('.seats2MeetWizardContainer .opstellingContainer { margin-bottom: 25px; }');
document.write('.seats2MeetWizardContainer .formLabel { float: left; width: 110px; margin-top: 3px; font-weight: bold; }');
document.write('.seats2MeetWizardContainer input, .seats2MeetWizardContainer select { float: left; padding: 0 0 0 5px; width: 165px; height: 18px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }');
document.write('.seats2MeetWizardContainer select { padding-left: 2px; width: 171px; height: 20px; } ');
document.write('.seats2MeetWizardContainer input.btn_zoek{ cursor: pointer; position: static; width: auto; font-size: 14px; color: #ffffff; height: 30px; padding: 1px 8px 2px 8px; -moz-border-radius: 5px; -webkit-border-radius: 5px; background: #64a81f }');
document.write('.seats2MeetWizardContainer .buttonContainer { float: left; }');
document.write('.seats2MeetWizardContainer .poweredByS2M { float: left; clear: left; margin-top: 15px; text-align: center; }');

document.write('.seats2MeetWizardContainer #dateChooserPopupPanel { position: absolute; top: 0px !important; left: 50% !important; margin-left: -106px; padding: 10px; width: 188px; border: 2px solid #ffffff; background: #eefddc; }');
document.write('.seats2MeetWizardContainer .dateChooserCalanderBackground { padding: 10px; background: #fff; }');
document.write('.seats2MeetWizardContainer .dateChooserMainTable { width: 100%; }');
document.write('.seats2MeetWizardContainer .dateChooserMainTable { width: 100%; }');
document.write('.seats2MeetWizardContainer .dateChooserPresentMonth { width: 130px; text-align: center; font-weight: bold; }');
document.write('.seats2MeetWizardContainer .dateChooserPreviousMonth, .seats2MeetWizardContainer .dateChooserNextMonth { width: 18px; }');
document.write('.seats2MeetWizardContainer .dateChooserDayRow { font-weight: bold; color: #fff; background: #4B7E17; }');
document.write('.seats2MeetWizardContainer .day { padding: 2px; }');
document.write('.seats2MeetWizardContainer #iFrameOverlay { visibility: hidden; }');
document.write('</style>');

document.write('<div class="seats2MeetWizardContainer">');
document.write('	<h3 class="subHeaderItem">Boek de Bloei!</h3>');
document.write('	<div class="seats2MeetWizardWizardInhoud">');
document.write('		<div class="seats2MeetWizardWizardWatermertkBackground">');
document.write('			<div class="divRow seats2MeetWizardIntro">U reserveert <strong>vergaderstoelen</strong> in plaats van zalen via internet. Hoe eerder u boekt, hoe groter uw voordeel!</div>');
document.write('			<form name="frm_search" action="http://bloei.seats2meet.com/default.asp?action=pagina&pagina=1349" method="post" target="_blank" onsubmit="return validateForm();">');
document.write('				<input name="sub_res_stap" value="" type="hidden" />');
document.write('				<input name="res_stap" value="2" type="hidden" />');
document.write('				<input name="check_form_1" value="1" type="hidden" />');
document.write('				<div class="divRow datumContainer">');
document.write('					<span class="formLabel datumLabel">Datum</span>');
document.write('					<input READONLY type="text" name="apwiz_datum" value="dd-mm-jjjj" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)" />');								
document.write('				</div>');
document.write('				<div class="divRow personenContainer">');
document.write('					<span class="formLabel personenLabel">Aantal personen</span>');
document.write('					<input type="text" name="apwiz_aantalpersonen" id="apwiz_aantalpersonen" value="" />');
document.write('				</div>');
document.write('				<div class="divRow dagdeelContainer">');
document.write('					<span class="formLabel dagdeelLabel">Dagdeel</span>'); 
document.write('					<select name="apwiz_dagdeel">');
document.write('						<option value="Maak een keuze">Maak een keuze</option>');
document.write('						<option title="Ochtend (09:00 - 13:00)" value="89">Ochtend (09:00 - 13:00)</option>');
document.write('						<option title="Middag (13:00 - 17:00)" value="90">Middag (13:00 - 17:00)</option>');
document.write('						<option title="Avond (17:00 - 21:00)" value="91">Avond (17:00 - 21:00)</option>');
document.write('						<option title="Ochtend &amp; middag (09:00 - 17:00)" value="92">Ochtend &amp; middag (09:00 - 17:00)</option>');
document.write('						<option title="Middag &amp; avond (13:00 - 21:00)" value="93">Middag &amp; avond (13:00 - 21:00)</option>');
document.write('						<option title="Ochtend, middag &amp; avond (09:00 - 21:00)" value="94">Ochtend, middag &amp; avond (09:00 - 21:00)</option>');
document.write('					</select>');
document.write('				</div>');
document.write('				<div class="divRow opstellingContainer">');
document.write('					<span class="formLabel opstellingLabel">Opstelling</span>'); 
document.write('					<select name="apwiz_opstelling">');
document.write('						<option value="Maak een keuze">Maak een keuze</option>');
document.write('						<option value="20">Congres</option>');
document.write('						<option value="22">Creatieve sessie</option>');
document.write('						<option value="23">Flexwerken</option>');
document.write('						<option value="19">Kennisoverdracht</option>');
document.write('						<option value="18">Vergadering</option>');
document.write('						<option value="21">Workshop</option>');
document.write('					</select>');
document.write('				</div>');
document.write('				<div class="buttonContainer">');
document.write('					<input type="submit" name="submit" value="Check beschikbaarheid" class="btn_zoek" /><br/>');
document.write('				</div>');
document.write('				<div class="poweredByS2M">');
document.write('					<a href="http://www.seats2meet.com" target="_blank" class="S2Mlogo"><img src="http://www.seats2meet.com/widget/images/poweredByS2M_logo.gif" border="0" alt="powered by Seats2Meet.com" title="Powered by Seats2Meet.com" /></a>');
document.write('				</div>');
document.write('				<div class="divBlank" style="clear: left;"> </div>');
document.write('			</form>');

document.write('		</div>');

					document.write( buidCalander );

					prepcalendar('',ccm,ccy);
document.write('	</div>');
document.write('</div>');

