$(document).ready( function() {
		
	/* hieronder alle code voor het hoofdmenu */
	$('#oplossingen, #scanner, #software, #klanten, #docspro, #contact').hover(function(){
		menu_open(this.id);
	},
	function(){
		menu_close(this.id);
	});
	
/* Hieronder alle code voor globale aanpassingen op de website. */
	// de focus en non focus op een tekst veld
	$(':text').focus(function(){
		clearText(this);						  
	});
	$(':text').blur(function(){
		clearText(this);						  
	});
	
	// de hover over de downloads
	$("table[id^='dlt']").hover(function(){
		$(this).removeClass('nohover').addClass('hover');
	}, function(){	
		$(this).removeClass('hover').addClass('nohover');
	});
	
	// click op hoofdmenu
	$(".button").live("click",function () {
		window.location = $(this).find("a").attr("href");
	})
	
	// click op de downloads
	$("table[id^='dlt']").live("click",function () {
		var id = parseInt(this.id.substr(3)); 
		window.location = $('#dlh' + id).attr("href");
	})

	// de buttons van producten en referenties
	$('#ref_button').click(function(){
		document.getElementById('referenties').className='dblock';
		document.getElementById('producten').className='dnone';
		document.getElementById('ref_button').className='tab_selected';
		document.getElementById('prod_button').className='tab_button';							
	});
	$('#prod_button').click(function(){
		document.getElementById('referenties').className='dnone';
		document.getElementById('producten').className='dblock';
		document.getElementById('ref_button').className='tab_button';
		document.getElementById('prod_button').className='tab_selected';							
	});
	
	$('.lees_button').hover(function(){
		$(this).removeClass('lees_button').addClass('lees_hover');								
	},function(){
		$(this).removeClass('lees_hover').addClass('lees_button');	
	});
	
});

function menu_open(button){
	$('#'+button).removeClass('item').addClass('hover');
	$('#'+button+'button').removeClass('item_button').addClass('hover_button');
	$('#'+button+'_dropdown').show();
}

function menu_close(button){
	$('#'+button).removeClass('hover').addClass('item');
	$('#'+button+'button').removeClass('hover_button').addClass('item_button');
	$('#'+button+'_dropdown').hide();
}

function clearText(field){
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}