// JavaScript Document

$(document).ready(function(){
	
	$(function() {
		$('a[rel="lightbox"]').lightBox();
		$('a[rel="colorbox"]').colorbox({innerWidth:771, innerHeight:740});
	});
	
	$(".archief_body").hide();
	$(".archief_head").click(function(){
		if ($(this).css ("background-image").match ('archief_pijl1.gif'))
			$(this).css ("background-image","url(/nl/images/archief_pijl2.gif)");
		else
			$(this).css ("background-image","url(/nl/images/archief_pijl1.gif)");
		$(this).next(".archief_body").toggle(300);
	});
	
	$(".scooter").mouseover(function(){
		$(this).attr ('src', '/nl/images/scooter2.gif')
	});
	
	$(".scooter").mouseout(function(){
		$(this).attr ('src', '/nl/images/scooter.gif')
	});
	
	$("#creabea").mouseover(function(){
		$(this).attr ('src', '/nl/images/creabea2.gif')
	});
	
	$("#creabea").mouseout(function(){
		$(this).attr ('src', '/nl/images/creabea1.gif')
	});
	
	$("#vlag_nl").mouseover(function(){
		$(this).attr ('src', '/nl/images/vlag_nl_on.gif');
	}).mouseout(function(){
		$(this).attr ('src', '/nl/images/vlag_nl_off.gif');
	});
	
	$("#vlag_de").mouseover(function(){
		$(this).attr ('src', '/nl/images/vlag_de_on.gif');
	}).mouseout(function(){
		$(this).attr ('src', '/nl/images/vlag_de_off.gif');
	});
	
	$("#vlag_en").mouseover(function(){
		$(this).attr ('src', '/nl/images/vlag_en_on.gif');
	}).mouseout(function(){
		$(this).attr ('src', '/nl/images/vlag_en_off.gif');
	});
	
	$("#vlag_dk").mouseover(function(){
		$(this).attr ('src', '/nl/images/vlag_dk_on.gif');
	}).mouseout(function(){
		$(this).attr ('src', '/nl/images/vlag_dk_off.gif');
	});
	
	$(".faq_body").hide();
	$(".faq_head_nl").click(function(){
		$(".faq_head_nl").css ("background-image","url(/nl/images/faq_bg_nl.gif)");
		$(".faq_head_nl").css ("color","#666");
		$(".faq_body").hide(300);
		if ($(this).css ("background-image").match ('faq_bg_nl.gif')) {
			$(this).css ("background-image","url(/nl/images/faq_bg2.gif)");
			$(this).css ("color","#fff");
			$(this).next(".faq_body").toggle(300);
		} else {
			$(this).css ("background-image","url(/nl/images/faq_bg_nl.gif)");
			$(this).css ("color","#666");
		}

	});
	$(".faq_head_en").click(function(){
		$(".faq_head_en").css ("background-image","url(/nl/images/faq_bg_en.gif)");
		$(".faq_head_en").css ("color","#666");
		$(".faq_body").hide(300);
		if ($(this).css ("background-image").match ('faq_bg_en.gif')) {
			$(this).css ("background-image","url(/nl/images/faq_bg2.gif)");
			$(this).css ("color","#fff");
			$(this).next(".faq_body").toggle(300);
		} else {
			$(this).css ("background-image","url(/nl/images/faq_bg_en.gif)");
			$(this).css ("color","#666");
		}

	});
	
});

function checkForm (value) {
	
	var error = "";
	var message = "";

	if (value == 'form_contact') {
		
		if (document.getElementById('naam_bedrijf').value == "")
			error += "- Naam bedrijf is verplicht.<br />";
			
		if (document.getElementById('contactpersoon').value == "")
			error += "- Contactpersoon is verplicht.<br />";
			
		if (document.getElementById('telefoon').value == "")
			error += "- Telefoon is verplicht.<br />";
			
		if (document.getElementById('email').value == "")
			error += "- E-mail is verplicht.<br />";
		
		if (error == "") {
			
			document.forms['form_contact'].submit();
			
			message += "Het formulier wordt nu verwerkt.<br />";
			document.getElementById('contact_error').innerHTML = "";
			document.getElementById('contact_message').innerHTML = message;
			
		} else {
			
			document.getElementById('contact_error').innerHTML = error;
			
		}
	}
	
	else if (value == 'form_callme') {
		
		if (document.getElementById('naam').value == "" || document.getElementById('bedrijf').value == "" || document.getElementById('telefoon').value == "")
			alert("Alle velden dienen te worden ingevuld!");
		else {			
			document.forms['form_callme'].submit();
			
		}
	}
}
