//http://javascriptcompressor.com/
function initFrontpage(e) {
	var tabs = ['tabInhoud'];
	var stdValue = 'doorzoek alles (uitstapje, hotel, ...)';

	var e = document.getElementById('dqa');
	if (e != null) { stdValue = e.value; }

	initStdInput(['dqa'],[stdValue]);
	initStdInput(['dq','dqw'],['wat', 'waar']);
};

function initUitjeZoeken(e) {
	var hd = document.getElementById("dqa");

	if (hd != null) {
		this.hdData = new function() {
			var rsXML = {
					resultNode: "item", 
					fields: [
						{ key: 'soort' },
						{ key: 'titel' },
						{ key: 'url' }
					],
					metaNode: "resultset"
				};

			// first build a datasource
			var hdServer = "/ajax/dwsearch2.php";
			var hdDataSource = new YAHOO.util.XHRDataSource(hdServer);
			hdDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_XML;
			hdDataSource.responseSchema = rsXML;

			//this.autoComplete = new YAHOO.widget.AutoComplete("destination", "destinationList", hdDataSource);
			this.autoComplete = new YAHOO.widget.AutoComplete("dqa", "uitjeAC", hdDataSource);
			this.autoComplete.resultTypeList = false;
			this.autoComplete.prehighlightClassName = "yui-ac-prehighlight";
			this.autoComplete.typeAhead = false;
			this.autoComplete.queryDelay = 0.2;
			this.autoComplete.maxResultsDisplayed = 20;
			this.autoComplete.minQueryLength = 4;
			this.autoComplete.autoHighlight = true;
			this.autoComplete.useShadow = true;
			this.autoComplete.alwaysShowContainer = false;
			this.autoComplete.allowBrowserAutocomplete = false;

			var hdMarkup = "<div><span>Zoekresultaten</span>";
			this.autoComplete.setHeader(hdMarkup);

			var bdMarkup = "</div><span><div>";
			this.autoComplete.setBody(bdMarkup);

			var ftMarkup = "</div>";
			this.autoComplete.setFooter(ftMarkup);
			
			this.autoComplete.klasse = '';
			this.autoComplete.formatResult = function(oResultItem, sQuery, sResultMatch) {
				switch (oResultItem.soort) {
				case 'kalender':
					this.klasse = "aK";
					break;

				case 'artikel':
					this.klasse = "aA";
					break;

				case 'hotel':
					this.klasse = "aH";
					break;

				case 'uitstapje':
					this.klasse = "aU";
					break;

				case 'aU':
				case 'aH':
				case 'aK':
				case 'aA':
					this.klasse = "zoekKop";
					break;
				};

				var aMarkup = ["<div class=\""+this.klasse+"\">",
					"<span>",
					"<a href=\""+oResultItem.url+"\">",
					oResultItem.titel,
					"</a>",
					"</span>",
					"</div>"
					];

				return (aMarkup.join(""));
			}
		};
	}
}

// timer voor opties
YAHOO.util.Event.onAvailable('dqa', initUitjeZoeken, this);
YAHOO.util.Event.onAvailable('dqa', initFrontpage, this);
YAHOO.util.Event.onAvailable('navigatie', dwmenuinit, this);
//YAHOO.util.Event.addListener(window, 'load', initFrontpage);
//YAHOO.util.Event.addListener(window, 'load', initUitjeZoeken);

// Voor buttons voorpagina
// thissite.js oude functies

function PrintVersion(urll) { var pup=window.open(urll,"Print","toolbar=0,location=0,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=690,height=550,left=50,top=50"); pup.focus; };

// script functions for hotel search date fields
function calcCal(formNaam) {
	var currentDate = new Date(); var currentYear = 1900 + currentDate.getYear();
	var dailyMS = 24*60*60*1000;
	var currentHour = new Date(currentDate.getHours());
	var arrivalExtra = 0;
	var departureExtra = 1;
	if (currentHour > 18) {
		var arrivalExtra = 1;
		var departureExtra = 2;
	}
	var arrivalDate = new Date(currentDate.getTime() + arrivalExtra*dailyMS);
	var departureDate = new Date(currentDate.getTime() + departureExtra*dailyMS);
	var arrivalYear = 1900+arrivalDate.getYear(); var arrivalMonth = 1+arrivalDate.getMonth(); var arrivalDay = arrivalDate.getDate();
	var departureYear = 1900+departureDate.getYear(); var departureMonth = 1+departureDate.getMonth(); var departureDay = departureDate.getDate();
	var a=formNaam;
	if ((a.checkin_monthday.selectedIndex == 0) && (a.checkin_month.selectedIndex == 0) && (a.checkin_year.selectedIndex == 0) &&
		(a.checkout_monthday.selectedIndex == 0) && (a.checkout_month.selectedIndex == 0) && (a.checkout_year.selectedIndex == 0)){
		a.checkin_monthday.options[arrivalDay-1].selected = true;
		a.checkin_month.options[arrivalMonth-1].selected = true;
		a.checkin_year.options[arrivalYear-currentYear].selected = true;
		a.checkout_monthday.options[departureDay-1].selected = true;
		a.checkout_month.options[departureMonth-1].selected = true;
		a.checkout_year.options[departureYear-currentYear].selected = true;
	}
};

function changeCheck(fieldNaam) {
	ad = new Date();

	// Vertrekdatum niet voor huidige datum.
	if ((
		document.getElementById('checkin_monthday').value < ad.getDate() &&
		document.getElementById('checkin_month').value <= (ad.getMonth()+1) &&
		document.getElementById('checkin_year').value <= ad.getFullYear()
		)
		||
		(
		document.getElementById('checkin_month').value < (ad.getMonth()+1) &&
		document.getElementById('checkin_year').value <= ad.getFullYear()
		)
		||
		(
		document.getElementById('checkout_monthday').value <= ad.getDate() &&
		document.getElementById('checkout_month').value <= (ad.getMonth()+1) &&
		document.getElementById('checkout_year').value <= ad.getFullYear()
		)
		||
		(
		document.getElementById('checkout_month').value < (ad.getMonth()+1) &&
		document.getElementById('checkout_year').value <= ad.getFullYear()
		)
		)
	{
		document.getElementById('checkin_monthday').value = (ad.getDate()<10 ? '0'+ad.getDate() : ad.getDate());
		document.getElementById('checkin_month').value = (ad.getMonth()<9 ? '0'+(ad.getMonth()+1) : ad.getMonth()+1);
		document.getElementById('checkin_year').value = ad.getFullYear();

		if (document.getElementById('checkin_month').value >= document.getElementById('checkout_month').value &&
			document.getElementById('checkin_year').value <= document.getElementById('checkout_year').value) {
			if ( getNumOfDays(ad.getFullYear(), ad.getDate()) <= ad.getDate() ) {
				document.getElementById('checkout_monthday').value = '01';
				if (ad.getMonth() < 11) {
					document.getElementById('checkout_month').value = (ad.getMonth()<8 ? '0'+(ad.getMonth()+2) : ad.getMonth()+2);
					document.getElementById('checkout_year').value = ad.getFullYear();
				} else {
					document.getElementById('checkout_month').value = '01';
					document.getElementById('checkout_year').value = ad.getFullYear()+1;
				}
			} else {
				document.getElementById('checkout_monthday').value = (ad.getDate()<9 ? '0'+(ad.getDate()+1) : ad.getDate()+1);
				document.getElementById('checkout_month').value = (ad.getMonth()<9 ? '0'+(ad.getMonth()+1) : ad.getMonth()+1);
				document.getElementById('checkout_year').value = ad.getFullYear();
			}
		}
	}

		if ((
			document.getElementById('checkin_monthday').value >= document.getElementById('checkout_monthday').value && 
			document.getElementById('checkin_month').value <= document.getElementById('checkout_month').value &&
			document.getElementById('checkin_year').value <= document.getElementById('checkout_year').value
			)
			||
			(
			document.getElementById('checkin_month').value > document.getElementById('checkout_month').value &&
			document.getElementById('checkin_year').value >= document.getElementById('checkout_year').value
			)
			||
			document.getElementById('checkin_year').value > document.getElementById('checkout_year').value
			
			)
		{
			if (document.getElementById('checkin_month').value >= document.getElementById('checkout_month').value
				&& document.getElementById('checkin_year').value >= document.getElementById('checkout_year').value
				||	
				document.getElementById('checkin_year').value > document.getElementById('checkout_year').value
				) {
				switch (fieldNaam) {
				case 'checkin_monthday':
				case 'checkin_month':
				case 'checkin_year':
					// pas check-in aan aan gewijzigde check-out.
					if (document.getElementById('checkout_monthday').value > 1) {
						if (document.getElementById('checkout_monthday').value > 10 ) {
							document.getElementById('checkin_monthday').value = Number(document.getElementById('checkout_monthday').value) - 1;
						} else {
							document.getElementById('checkin_monthday').value = '0'+(Number(document.getElementById('checkout_monthday').value) - 1);
						}
						document.getElementById('checkin_month').value = document.getElementById('checkout_month').value;
						document.getElementById('checkin_year').value = document.getElementById('checkout_year').value;
					} else {
						// niet voor huidige maand
						if ( Number(document.getElementById('checkin_month').value - 1) == (ad.getMonth()) &&
							document.getElementById('checkin_year').value == ad.getFullYear() )
						{
							document.getElementById('checkin_monthday').value = '01';
							document.getElementById('checkout_monthday').value = '02';
						} else
						{
							if (document.getElementById('checkout_month').value < 11) {
								document.getElementById('checkin_month').value = '0'+(Number(document.getElementById('checkout_month').value) - 1);
							} else {
								document.getElementById('checkin_month').value = ''+(Number(document.getElementById('checkout_month').value) - 1);
							}
							document.getElementById('checkin_monthday').value = getNumOfDays(Number(document.getElementById('checkin_year').value),
																				Number(document.getElementById('checkin_month').value) - 1)
						}
					}
					break;
				case 'checkout_monthday':
				case 'checkout_month':
				case 'checkout_year':
					// pas check-out aan aan gewijzigde check-in.
					if (document.getElementById('checkin_monthday').value >= getNumOfDays(Number(document.getElementById('checkin_year').value),
																				Number(document.getElementById('checkin_month').value) - 1)
						) {
						// maand wijzigen.
						if (document.getElementById('checkin_month').value == 12 ) {
							// jaar wijzigen
							document.getElementById('checkout_year').value = Number(document.getElementById('checkin_year').value) + 1;
							document.getElementById('checkout_month').value = '01';
						} else {
							if (document.getElementById('checkout_month').value < 9) {
								document.getElementById('checkout_month').value = '0'+(Number(document.getElementById('checkout_month').value) + 1);
							} else {
								document.getElementById('checkout_month').value = ''+(Number(document.getElementById('checkout_month').value) + 1);
							}
						}
						document.getElementById('checkout_monthday').value = '01';
					} else {
						if (document.getElementById('checkin_monthday').value < 9) {
							document.getElementById('checkout_monthday').value = '0'+(Number(document.getElementById('checkin_monthday').value)+1);
						} else {
							document.getElementById('checkout_monthday').value = Number(document.getElementById('checkin_monthday').value)+1;
						}
						document.getElementById('checkout_year').value = document.getElementById('checkin_year').value;
					}
					if (document.getElementById('checkin_month').value > document.getElementById('checkout_month').value &&
							document.getElementById('checkin_year').value >= document.getElementById('checkout_year').value)
					{
						document.getElementById('checkout_month').value = document.getElementById('checkin_month').value;
					}
					if (document.getElementById('checkin_year').value > document.getElementById('checkout_year').value) {
						document.getElementById('checkout_year').value = document.getElementById('checkin_year').value;
					}
						
					break;
				}
			}
		}
};

function getNumOfDays(year, month) { return 32 - new Date(year, month, 32).getDate(); };

function elementOpen(elmntId) {
	if (document.getElementById(elmntId) != null) {
		document.getElementById(elmntId).style.display = 'block';
	}
	return false;
};
function elementClose(elmntId) {
	if (document.getElementById(elmntId) != null) {
		document.getElementById(elmntId).style.display = 'none';
	}
	return false;
};
function elementSwitch(elmntId) {
	if (document.getElementById(elmntId) != null) {
		var elmnt = document.getElementById(elmntId).style.display;
		document.getElementById(elmntId).style.display = (elmnt == 'block' ? 'none' : 'block');
	}
	return false;
};
function elementCloseAll(elmntIds) {
	try {
		for (i=0; i < elmntIds.length; i++) {
			if (document.getElementById(elmntIds[i]) != null) {
				document.getElementById(elmntIds[i]).style.display = 'none';
			}
		}
	}
	catch (e) {
	}
	finally {
		return false;
	}
};

function getXElement(e) {
	var x = 0;
	while (e) {
		x += e.offsetLeft;
		e = e.offsetParent;
	}
	return x;
};
function getYElement(e) {
	var y = 0;
	while (e) {
		y += e.offsetTop;
		e = e.offsetParent;
	}
	return y;
};
function showPopup(elmntId, eId) {
	var x = getXElement(eId) + getXElement(elmntId);
	var y = getYElement(eId) + getYElement(elmntId);
	var x = getXElement(elmntId);
	var y = getYElement(elmntId);
	//alert(x+'.'+y)
	elmntId.style.left = x;
	elmntId.style.top = y;
	elmntId.style.display = 'block';
};
function hidePopup(elmntId) { document.getElementById(elmntId).style.display = "none"; };
function switchPopup(elmntId, eId) {
	eId = document.getElementById(eId);
	elmntId = document.getElementById(elmntId);
	if (elmntId.style.display == 'none') {
		showPopup(elmntId, eId);
	} else {
		hidePopup(elmntId);
	}
};
function trim(value) { return value.replace(/^\s+/,'').replace(/\s+$/,''); };
function stdFocus(targetId, stdText, stdColor) {
	var e = targetId;
	if (e.value == stdText) {
		e.value = '';
	}
	e.style.color = stdColor;
};
function stdLostFocus(targetId, stdText, stdColor) {
	var e = targetId;
	if (trim(e.value) == '' || trim(e.value) == stdText) {
		e.value = stdText;
		e.style.color = stdColor;
	}
};
function stdSubmit(targetIds, targetValues) {
	var e;
	var stdVal;
	for (i=0; i < targetIds.length; i++) {
		e = document.getElementById(targetIds[i]);
		stdVal = targetValues[i];
		if (trim(e.value) == stdVal || trim(e.value) == e.stdValue) {
			e.value = '';
		}
	}
};
function initStdInput(idArray, valArray) {
	for (var i = 0; i < idArray.length; i++) {
		e = document.getElementById(idArray[i]);	

		if (e != null) {
			e.stdValue = valArray[i];
			e.onfocus = function() { stdFocus(this, this.stdValue, '#000'); };
			e.onblur = function() { stdLostFocus(this, this.stdValue, 'Gray'); };
		}
	}
};

function initStdSubmit(idSubmit,valArray,stdArray) {
	e = document.getElementById(idSubmit);	
	if (e != null) {
		e.valArray = valArray;
		e.stdArray = stdArray;
		e.onsubmit = function() {
			stdSubmit(this.valArray,this.stdArray);
		};
	};
};

// customize YAHOO.widget.Calendar
function customizeCalendar(calId) {
	if (calId != null) {
		calId.cfg.setProperty("DATE_FIELD_DELIMITER", ".");  

		calId.cfg.setProperty("MDY_DAY_POSITION", 1);  
		calId.cfg.setProperty("MDY_MONTH_POSITION", 2);  
		calId.cfg.setProperty("MDY_YEAR_POSITION", 3);  

		calId.cfg.setProperty("MD_DAY_POSITION", 1);  
		calId.cfg.setProperty("MD_MONTH_POSITION", 2);  

		calId.cfg.setProperty("MONTHS_SHORT",   ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"]);  
		calId.cfg.setProperty("MONTHS_LONG",	["Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"]);  
		calId.cfg.setProperty("WEEKDAYS_1CHAR", ["Z", "M", "D", "W", "D", "V", "Z"]);  
		calId.cfg.setProperty("WEEKDAYS_SHORT", ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"]);  
		calId.cfg.setProperty("WEEKDAYS_MEDIUM",["Zon", "Maa", "Din", "Woe", "Don", "Vri", "Zat"]);  
		calId.cfg.setProperty("WEEKDAYS_LONG",  ["Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"]);  

		// enable CalendarNavigation
		//calId.cfg.setProperty("navigator", true); voor later order
	}

	return;
};

// maak een YAHOO.widget.Calendar
function maakKalender(calField, dagid, maandid, jaarid) {
	var oCal = new YAHOO.widget.Overlay("cal"+calField, { visible: false} );
	
	var oButton = new YAHOO.widget.Button({ type: "menu",
											id: "cal"+calField+"picker",
											label: "",
											menu: oCal,
											container: calField } );
	
	oButton.on("appendTo", function() {
		oCal.setBody("&#32"); // empty element to reserve space to render the Calender instance into
		oCal.body.id = "cal"+calField+"container";
		oCal.render(this.get("container")); // render Button into the container element
	});
	
	function onButtonClick() {
		var oCalendar = new YAHOO.widget.Calendar("button"+calField+"calendar", oCal.body.id);
		customizeCalendar(oCalendar);
		oCalendar.render();
	
		oCalendar.changePageEvent.subscribe(function() {
			window.setTimeout(function() {
					oCal.show();
				}, 0);
		});
	
		oCalendar.selectEvent.subscribe(function(p_sType, p_aArgs) {
			var aDate;
			if (p_aArgs) {
				aDate = p_aArgs[0][0];
				YAHOO.util.Dom.get(dagid).value = aDate[2];
				YAHOO.util.Dom.get(maandid).value = aDate[1];
				YAHOO.util.Dom.get(jaarid).value = aDate[0];
			}
			oCal.hide();
		});
	
		this.unsubscribe("click", onButtonClick); // unsubscribe, this code has to be executed once.
	}

	oButton.on("click", onButtonClick);
};

// maak tooltips reeks voor een pagina
function maakTooltips(callFields, calToolTipTexts) {
	for (var i = 0; i < callFields.length; i++) {
		var e = document.getElementById(callFields[i]);
		if (e != null) {
			e.callFields = callFields;
			e.callPanel = new YAHOO.widget.Dialog(callFields[i]+'Panel', {
				context: [callFields[i], 'bl', 'tr'],
				y: 10,
				underlay: "shadow",
				close: true,
				visible: false,
				draggable: true,
				iframe: true,
				zIndex: 100
				/*effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}*/
				} );

			e.callPanel.setHeader("Toelichting op "+callFields[i]);
			e.callPanel.setBody(calToolTipTexts[i]);

			e.callPanel.render(document.body);

			e.onfocus = function() {
				for (var i = 0; i < this.callFields.length; i++) {
					var f = document.getElementById(this.callFields[i]);
					if (f != null && f!=this) {
						f.callPanel.cfg.setProperty("visible", false);
					} else {
						this.callPanel.cfg.setProperty("visible", true);
					}
				}
			};
		}
	}
};

function initTabUI(tabs, bgcolor1, bgcolor2, bgcolor3) {
	var tmp;
	var e;

	// init tabbladen filter
	// onmouseover werkt alleen als de gebruiker nog niet geklikt heeft in zijn sessie
	//YAHOO.util.Cookie.remove("if", { path: "/", domain: ".uitstappen.be" } );

	if (bgcolor1 == null) { bgcolor1 = '#5fc35d'; }
	if (bgcolor2 == null) { bgcolor2 = '#fff'; }
	if (bgcolor3 == null) { bgcolor3 = '#000'; }

	for (var j = 0; j < tabs.length; j++) {
		e = document.getElementById(tabs[j]);	
		if (e != null) {
			e.tabs = tabs;
	
			e.onmouseover = function () {
				var initFilter = YAHOO.util.Cookie.get("if");
				if (initFilter == null) {
					for (var j = 0; j < this.tabs.length; j++) {
						e = document.getElementById(this.tabs[j]);	
						if (e != null) {
							e.style.backgroundColor = bgcolor2;
							e.style.color = bgcolor3;
							e.style.textDecoration = 'none';
							
							f = document.getElementById(e.id+'C');	
							f.style.display = 'none';
						};
					}
	
					this.style.backgroundColor = bgcolor1;
					this.style.color = bgcolor2;
					this.style.textDecoration = 'underline';
	
					e = document.getElementById(this.id+'C');	
					if (e != null) {
						YAHOO.util.Cookie.set("if", this.id, { path: "/", domain: ".uitstappen.be" } );
						e.style.display = 'block';
					}
				} else {
					for (var j = 0; j < this.tabs.length; j++) {
						e = document.getElementById(this.tabs[j]);	
						if (e != null) {
							e.style.textDecoration = 'none';
						}
					};
					if (this.style.backgroundColor != bgcolor1) {
						this.style.textDecoration = 'underline';
					}
				}
			};
			
			e.onmouseout = function() {
				this.style.textDecoration = 'none';
			};
	
			e.onclick = function () {
				YAHOO.util.Cookie.set("if", this.id, { path: "/", domain: ".uitstappen.be" } );
	
				for (var j = 0; j < this.tabs.length; j++) {
					e = document.getElementById(this.tabs[j]);	
					if (e != null) {
						e.style.backgroundColor = bgcolor2;
						e.style.color = bgcolor1;
						e.style.textDecoration = 'none';
	
						f = document.getElementById(e.id+'C');	
						f.style.display = 'none';
					}
				}
	
				this.style.backgroundColor = bgcolor1;
				this.style.color = bgcolor2;
				this.style.textDecoration = 'none';
	
				e = document.getElementById(this.id+'C');	
				if (e != null) {
					e.style.display = 'block';
				}
			};
		}
	}
};

function initTabContentUI(container, tabs, bgcolor1, bgcolor2, bgcolor3) {
	if (bgcolor1 == '') { bgcolor1 = '#27bdee'; }
	if (bgcolor2 == '') { bgcolor2 = '#fff'; }
	if (bgcolor3 == '') { bgcolor2 = '#000'; }

	e = document.getElementById(container);	
	if (e != null) {
		e.tabs = tabs;
	
		e.onmouseout = function() {
			var initFilter = YAHOO.util.Cookie.get("if");
			if (initFilter == null) {
				for (var j = 0; j < this.tabs.length; j++) {
					e = document.getElementById(this.tabs[j]);	
					if (e != null) {
						e.style.backgroundColor = bgcolor2;
						e.style.color = bgcolor3;
	
						f = document.getElementById(e.id+'C');	
						f.style.display = 'none';
					}
				}
			}
		};
	
		var initFilter = YAHOO.util.Cookie.get("if");
		e2 = document.getElementById(initFilter);
		if (e2 != null) {
			e2.style.backgroundColor = bgcolor1;
			e2.style.color = bgcolor2;
			e2.style.textDecoration = 'none';
	
			f = document.getElementById(e2.id+'C');	
			f.style.display = 'block';
		} else {
			YAHOO.util.Cookie.remove("if", { path: "/", domain: ".uitstappen.be" } );
		}
	}
};

function fnVerrasme(e) {
	document.location = '/verrasme';
};

function dwinit() {
	var el = new YAHOO.util.Element('verrasme');
	el.on('click', fnVerrasme);
};

// advert functions
function placeAdsSemilo() {
	aanroep = this.data[0];
	plekid = this.data[1];
	orgid = this.data[2];
	document.getElementById(plekid).innerHTML = document.getElementById(orgid).innerHTML;
};

function dwMenuMOver(e) {
	if (window.menuTimeOut == e.menuItem) { 
		for(row=0; row < e.menuItems.length; row++) { 
			el1 = new YAHOO.util.Element(e.navItems[row]);
			if (e.navItems[row] != e.navItem) {
				el1l = new YAHOO.util.Element(e.leftItems[row]);
				if (el1l != null) { el1l.setStyle('background-image', 'url(http://www.uitstappen.be/ontwerp/tab_left_unselected.png)'); }
				el1r = new YAHOO.util.Element(e.rightItems[row]);
				if (el1r != null) { el1r.setStyle('background-image', 'url(http://www.uitstappen.be/ontwerp/tab_right_unselected.png)'); }
				elementClose(e.menuItems[row]);
				el1.setStyle('border-left', '0px solid #388327');
				el1.setStyle('border-right', '0px solid #388327');
				el1.setStyle('border-top', '0px solid #388327');
				el1.setStyle('color', '#723b77');
				el1.setStyle('background-image', 'url(http://www.uitstappen.be/ontwerp/tab_middle_unselected.png)');
			}
		}
		elementOpen(e.menuItem);
		el2l = new YAHOO.util.Element(e.leftItem);
		if (el2l != null) { el2l.setStyle('background-image', 'url(http://www.uitstappen.be/ontwerp/tab_left_selected.png)'); }
		el2r = new YAHOO.util.Element(e.rightItem);
		if (el2r != null) { el2r.setStyle('background-image', 'url(http://www.uitstappen.be/ontwerp/tab_right_selected.png)'); }
		el2 = new YAHOO.util.Element(e.navItem);
		el2.setStyle('background-image', 'url(http://www.uitstappen.be/ontwerp/tab_middle_selected.png)');
		el2.setStyle('color', '#FFF');
		el2.setStyle('border-left', '0px solid #72D46D');
		el2.setStyle('border-right', '0px solid #72D46D');
		el2.setStyle('border-top', '0px solid #72D46D');
	}
};
function dwMenuMOverTO(e, mi) {
	//if (window.menuTimeOut != null) { window.clearTimeOut(window.menuTimeOut); window.menuTimeOut = null; }
	window.menuTimeOut = mi.menuItem;
	window.setTimeout(function(){dwMenuMOver(mi)}, 220);
};
function dwMenuMLeaveTO(e, mi) {
	window.menuTimeOut = '';
};

function dwmenuinit() {
	var el = '';
	var row = 0;
	var menuItems = ['menuHome', 'menuDagjeUit', 'menuAgenda', 'menuVakantie', 'menuExtra'];
	var navItems = ['navHome', 'navDagjeUit', 'navAgenda', 'navVakantie', 'navExtra'];
	var leftItems = ['leftHome', 'leftDagjeUit', 'leftAgenda', 'leftVakantie', 'leftExtra'];
	var rightItems = ['rightHome', 'rightDagjeUit', 'rightAgenda', 'rightVakantie', 'rightExtra'];

	for(row=0; row < menuItems.length; row++) {
		el = new YAHOO.util.Element(menuItems[row]);
		if (el != null) {
			el.menuItem = menuItems[row];
			el.navItem = navItems[row];
			el.leftItem = leftItems[row];
			el.rightItem = rightItems[row];
			el.on('mouseleave', function(e) {
				window.menuTimeOut = '';
				if (e.relatedTarget.className != 'categorie' && e.relatedTarget.className != 'catnav') {
					elementClose(this.menuItem);
				}
			}
			);
		}
	}


	for(row=0; row < navItems.length; row++) {
		el = new YAHOO.util.Element(navItems[row]);
		if (el != null) {
			el.menuItems = menuItems;
			el.navItems = navItems;
			el.leftItems = leftItems;
			el.rightItems = rightItems;
			el.menuItem = menuItems[row];
			el.navItem = navItems[row];
			el.leftItem = leftItems[row];
			el.rightItem = rightItems[row];
			el.on('mouseover', dwMenuMOverTO, el, this);
			el.on('mouseleave', dwMenuMLeaveTO, el, this);
		}
	}

	el = new YAHOO.util.Element('navigatie');
	el.menuItems = menuItems;
	el.navItems = navItems;
	el.on('mouseleave', function(e) {
			if (e.relatedTarget.className != 'navigatie' && e.relatedTarget.className != 'navigatieB') {
				for(row=0; row < this.menuItems.length; row++) {
					elementClose(this.menuItems[row]);
				}
			}
		}
	);
};
function initFaceBook() {
    window.fbAsyncInit = function() {
        FB.init({
        appId  : '169929529733718',
        status : false,
        cookie : true,
        xfbml  : true,
        channelUrl  : 'http://www.uitstappen.be/channel.html'
        });
    };

    (function() {
        var e = document.createElement('script');
        e.async = true;
        e.src = document.location.protocol + '//connect.facebook.net/nl_NL/all.js';
        document.getElementById('fb-root').appendChild(e);
    }());
};
YAHOO.util.Event.addListener(window,'load',initFaceBook);

