	// Show page in top frame.
	if (top != self) {
		window.top.location.href=location;
	}

	// Browser detection.
	var szBrowser = navigator.appName
	var iVersion = navigator.userAgent.indexOf('MSIE');
	iVersion = parseFloat(navigator.userAgent.substr(iVersion + 5));
	// Deny IE6, not compatible.
	if (szBrowser == "Microsoft Internet Explorer" && iVersion <= 6) {
		szMessage = "Helaas,\nJe heb een te oude browser: Microsoft Internet Explorer " + iVersion + ".\nDeze browser is niet geschikt om de website weer te kunnen geven.\n\n";
		szLink = "Download de nieuwste versie op http://www.microsoft.nl/ie.\nOf gebruik Mozilla Firefox als browser, te downloaden op http://www.mozilla-europe.org/nl\n\n";
		szMail = "Voor vragen stuur een mail naar chil@geysie.nl";
		alert(szMessage + szLink + szMail);
	}
	
	// Counter for textarea.
	function TextCounter(szField, iCountField, iMaxLimit)
	{
		if (szField.value.length > iMaxLimit) {
			szField.value = szField.value.substring(0, iMaxLimit);
		} else {
			iCountField.value = iMaxLimit - szField.value.length;
		}
	}
	
	//	Insert text in a textarea at the cursors position.
	function FormInsertAtCursor(szTextArea, szElement)
	{

		if (document.selection) {
			// IE support.
			szTextArea.focus();
			sel = document.selection.createRange();
			sel.text = szElement;
		} else if (szTextArea.selectionStart || szTextArea.selectionStart == '0') {
			// Mozilla support.
			var startPos = szTextArea.selectionStart;
			var endPos = szTextArea.selectionEnd;
			var scrollTop = szTextArea.scrollTop;
			szTextArea.value = szTextArea.value.substring(0, startPos) + szElement + szTextArea.value.substring(endPos, szTextArea.value.length);
			szTextArea.focus();
			szTextArea.selectionStart = startPos + szElement.length;
			szTextArea.selectionEnd = startPos + szElement.length;
			szTextArea.scrollTop = scrollTop;
		} else {
			szTextArea.value += szElement;
			szTextArea.focus();
		}
	}
	
	// Textarea toolbar.
	function FormToolbar(szTextArea, szInsertElement)
	{
		// Inserts selected element into the textarea.
		FormInsertAtCursor(document.forms[0].elements[szTextArea], szInsertElement);
	}
	
	// Sidebar search function
	function Search()
	{
		var url = "";
		
		if(document.search.engine[0].checked == true) {
			url = "http://www.google.com/search?hl=nl&q=" + document.search.SearchString.value + "+site:www.geysie.nl";
		} else {
			url = "http://www.google.com/search?hl=nl&q=" + document.search.SearchString.value;
		}
		
		window.open(url);
	}
	
	// Display an email address.
	function Mailto(szElement, szName, szDomain, szSuffix)
	{
		szElement.href = "mailto:" + szName + "@" + szDomain + "." + szSuffix;
	}
	
	// Google maps.
	function InitializeGoogleMaps(iLatitude, iLongitude, iZoom, szMapType, szText)
	{
		if (GBrowserIsCompatible())
		{
			var map = new GMap2(document.getElementById("map_canvas"));
			map.setCenter(new GLatLng(iLatitude,iLongitude), iZoom);
			map.setMapType(szMapType);
			if (szText != "FALSE") {
				map.openInfoWindow(map.getCenter(), document.createTextNode(szText));
			}
			map.setUIToDefault();
		}
	}

