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=/";
}
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;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function goSearch(f){ 
if (f.kAndEntire.value =='Zoek op trefwoord'){ 
	f.kAndEntire.value ='';
}
if (f.city.value =='Plaatsnaam'){ 
	f.city.value ='';
}
document.vaczoek.submit();
}
 
function submitenter(myfield,e) {
 
if (window.event.keyCode == 13)   {
   
    if (vaczoek.kAndEntire.value =='Zoek op trefwoord'){ 
	vaczoek.kAndEntire.value ='';
	}
	if (vaczoek.city.value =='Plaatsnaam'){ 
		vaczoek.city.value ='';
	}
   myfield.form.submit();
   return false;
   }
else {
   return true;
   }
}



$(document).ready(function() {
	// vacature zoekbox toggle 
	$(".contactform").colorbox({width:"580px", height:"550px", iframe:true});
	
	$('#vacaturebox').hide(); 
	$('#zoekswitch').click(function() {
		if ($('#vacaturebox').is(":hidden")){
			$('.vaczoekhead').switchClass('openimg', 'closedimg','0');
		} else {
			$('.vaczoekhead').switchClass('closedimg','openimg', '0');
			
		}
		$('#vacaturebox').slideToggle('fast');	
	});
	// contactformulier ( topnav )
	

});
function printIt() {
	window.print();  
}
function toggle(id,state) {
	var my_ids = id.split(",");
	for (i=0;i<my_ids.length;i++){
		el = document.getElementById(my_ids[i]);
		var display = '';
		if  (!el.style.display) {
			display = 'none';
		}
		el.style.display = display;
	}
	if (state=='close'){
		var my_closed = id.split(",");
		for (i=0;i<my_closed.length;i++){
			el = document.getElementById(my_closed[i]);
			el.style.display = 'none';
		}
	}
	if (state=='open'){
		var my_open = id.split(",");
		for (i=0;i<my_open.length;i++){
			el = document.getElementById(my_open[i]);
			el.style.display = '';
		}
	}
}

function clearSearchForm(f,v){
	if ((f.query.value=='functie, trefwoorden of bedrijfsnaam') && (v !='l') ){
		f.query.value='';
	}
	if ((f.location.value=='plaats of postcode') && (v !='q') ){
		f.location.value='';
	}
}
