var ua;

// Browser check
ua = navigator.userAgent;

var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isMSIE5 = isMSIE && (ua.indexOf('MSIE 5') != -1);
var isMSIE6_0 = isMSIE && (ua.indexOf('MSIE 6.0') != -1);
var isMSIE7 = isMSIE && (ua.indexOf('MSIE 7') != -1);
var isMSIE8 = isMSIE && (ua.indexOf('MSIE 8') != -1);
isMSIE6_0 = (isMSIE8 || isMSIE7) ? false : isMSIE6_0;
var isGecko = ua.indexOf('Gecko') != -1; // Will also be true on Safari
var isSafari = ua.indexOf('Safari') != -1;
var isOpera = window['opera'] && opera.buildNumber ? true : false;
var isMac = ua.indexOf('Mac') != -1;
var isNS7 = ua.indexOf('Netscape/7') != -1;
var isNS71 = ua.indexOf('Netscape/7.1') != -1;

function init()
{
	var fullsize = 0;
	if (document.getElementById('content_text'))
	{
		var divs=new Array(2)
		divs[0] = 'content_text';
		divs[1] = 'grey';
		
		var pads = new Array(2)
		pads[0] = 14;
		pads[1] = 0;
		
		var other = 0;
		var useheight = fullsize-other;
		
		for( i=0; i<divs.length; i++) {
			useheight = Math.max(useheight, document.getElementById(divs[i]).offsetHeight);
		}
	
		if (isMSIE6_0)
		{
			for( i=0; i<divs.length; i++) {
				document.getElementById(divs[i]).style.height = (useheight-pads[i]/2) + 'px';
			}
		} else
		{
			for( i=0; i<divs.length; i++) {
				document.getElementById(divs[i]).style.height = (useheight-pads[i]) + 'px';
			}
		}
	}
	// if (!isMSIE6_0) window.onresize = init();
	
	$('#slides').cycle({ fx: 'fade',
	    random: 1,
	    timeout: 5000,
	    delay:  -2000
	});
	initRollovers();
} 

function doSearch()
{
	if (document.getElementById('zoekquery').value.length > 2)
	{
		document.getElementById('zoekform').action = '/zoeken.php';
	 	document.getElementById('zoekform').submit();
	} else
	{
		alert('Zoekterm is te kort, minimaal 3 tekens nodig');
	}
}

function submitSearch()
{
	if (document.getElementById('zoekquery').value.length > 2)
	{
		document.getElementById('zoekform').action = '/zoeken.php';
	 	return true;
	} else
	{
		alert('Zoekterm is te kort, minimaal 3 tekens nodig');
		return false;
	}
}

function doSearch1()
{
	if (document.getElementById('zoekquery1').value.length > 2)
	{
		document.getElementById('zoekform1').action = '/zoeken.php';
	 	document.getElementById('zoekform1').submit();
	} else
	{
		alert('Zoekterm is te kort, minimaal 3 tekens nodig');
	}
}

function submitSearch1()
{
	if (document.getElementById('zoekquery1').value.length > 2)
	{
		document.getElementById('zoekform1').action = '/zoeken.php';
	 	return true;
	} else
	{
		alert('Zoekterm is te kort, minimaal 3 tekens nodig');
		return false;
	}
}
//


function initRollovers() {
    if (!document.getElementById) return

    var aPreLoad = new Array();
    var sTempSrc;
    var aImages = document.getElementsByTagName('img');

    for (var i = 0; i < aImages.length; i++) {

        if (aImages[i].className == 'tabimg') {

            var src = aImages[i].getAttribute('src');
            var hsrc = aImages[i].getAttribute('hsrc');

            aPreLoad[i] = new Image();
            aPreLoad[i].src = hsrc;

            aImages[i].onmouseover = function() {
                sTempSrc = this.getAttribute('src');
                this.setAttribute('src', this.getAttribute('hsrc'));
            }

            aImages[i].onmouseout = function() {
                if (!sTempSrc) sTempSrc = this.getAttribute('dsrc');
                this.setAttribute('src', sTempSrc);
            }

        }

    }
}
