$(document).ready(function(){

	$('.show').click(function(){
		$('.show').next('ul').hide();
		$(this).next('ul').show();
	});
	
	$('#left ul > li:nth-child(1) a:first').attr("id","bemonstering");
	$('#left ul > li:nth-child(2) a:first').attr("id","verpakking");
	$('#left ul > li:nth-child(3) a:first').attr("id","verzegeling");
	$('#left ul > li:nth-child(4) a:first').attr("id","bescherming");
	$('#left ul > li:nth-child(5) a:first').attr("id","diversen");	
	$('#left ul > li:nth-child(6) a:first').attr("id","sectoren");
	
	$('#left ul a').each(function(){if($(this).attr('href') == window.location.href ) $(this).addClass('current');});
	$('.nav a').each(function(){if($(this).attr('href') == window.location.href ) $(this).addClass('active');});
	$('#footer-navigation a').each(function(){if($(this).attr('href') == window.location.href ) $(this).addClass('active');});	
	$('#footer-navigation > ul').removeClass('nav');
	
	$('#home-banner').cycle({timeout:5000});

});


/* XMLHTTPRequest Enable 
---------------------------- */
function createObject() {
	var request_type;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
	request_type = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_type = new XMLHttpRequest();
	}
		return request_type;
}
var http = createObject();


/* SEARCH 
-------------------------- */
function autosuggest() {
q = document.getElementById('search-q').value;
// Set te random number to add to URL request
if(q.length >= 3)
{
nocache = Math.random();
http.open('get', 'search.cfm?q='+q.replace(/%/gi, "")+'&nocache = '+nocache);
http.onreadystatechange = autosuggestReply;
http.send(null);
}
else
{
		document.getElementById('results').style.display="none";
}
}
function autosuggestReply() {
if(http.readyState == 4){
	var response = http.responseText;
	if(response!=""){
		document.getElementById('results').innerHTML=response;
		document.getElementById('results').style.display="block";
	} else {
		document.getElementById('results').style.display="none";
	}
}
}
