

	// Force IE6 to cache background images
	try {
		document.execCommand("BackgroundImageCache", false, true);
	} catch(err) {}


	// only when not on a page where mootools is active to not conflict 
	if (!window.$)
	{

		// standalone onDomReady function
		window.onDomReady = function(fn){
			window.__ondom_functionArray.push(fn);
		};
		(function(){
			window.__ondom_functionArray = [];
			function _runFunctions(){
				for (var i in window.__ondom_functionArray){
					(window.__ondom_functionArray[i])();
				}
			};
			var _khtml = /(WebKit|khtml)/i.test(navigator.userAgent);
			if(document.addEventListener && !_khtml){
				document.addEventListener('DOMContentLoaded', _runFunctions, false);
			}else if(_khtml){
				var _timer = setInterval(function(){
					if(/loaded|complete/.test(document.readyState)){
						clearInterval(_timer);
						_runFunctions();
					}
				}, 10);
			}else{
				document.write('<script id=__ie_ondom defer src=javascript:void(0)><\/script>');
				var script = document.getElementById('__ie_ondom');
				script.onreadystatechange = function(){
					if(this.readyState == 'complete'){
						_runFunctions();
					}
				};
			}
		})();


		// on dom ready
		onDomReady(function(){

			// make the contact form inputs empty on click
			if ($lite('textContact')) FormValidator.initialize();

		});

	}
	else
	{

		// on dom ready
		window.addEvent('domready', function(){

			// make category rows hover
			if ($lite('textCategories'))
			{
				var row, rows = $lite('textCategories').getElementsByTagName('tr');

				for (var i = 0; row = rows[i]; i++)
				{
					row.onmouseover = function(){
						addClassName(this, 'hover');
					};
					row.onmouseout = function(){
						removeClassName(this, 'hover');
					};
				}
			}

		});

	}


	// on load
	window.onload = function(){

		// preload menu hover images
		var image = new Image();
		var imageUrls, imageUrls = [
			'images/menuItemHomeActive.jpg',
			'images/menuItemWebshopActive.jpg',
			'images/menuItemOverOnsActive.jpg',
			'images/menuItemContactActive.jpg',
			'images/menuItemLinksActive.jpg'
		];
       for (var i = 0; imageUrl = imageUrls[i]; i++) image.src = imageUrl;


		// make external links open in new window
		var link, links = document.getElementsByTagName('a');
		for (var i = 0; link = links[i]; i++)
		{
			if (link.className.indexOf('extern') != -1) link.target = '_blank';
		}

	};


	// very simple $ function
	function $lite(id)
	{
		return document.getElementById(id);
	}


	// adds a className to an element
	function addClassName(element, className)
	{
		removeClassName (element, className);
		element.className = (element.className + ' ' + className).replace(/^\s+|\s+$/g, '');
	}


	// removes a className from an element
	function removeClassName(element, className)
	{
		element.className = element.className.replace(className, '').replace(/^\s+|\s+$/g, '');
	}


	// create cookie function from http://www.quirksmode.org/js/cookies.html
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}


	// read cookie function from http://www.quirksmode.org/js/cookies.html
	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}


	// erase cookie function from http://www.quirksmode.org/js/cookies.html
	function eraseCookie(name) {
		createCookie(name,"",-1);
	}

