$(document).ready(function() {

// bestelform
$("#box0").css("display","none");
$("#check0").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box0").show("fast");
	} else {
		$("#box0").hide("fast");
	}
});

$("#box1").css("display","none");
$("#check1").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box1").show("fast");
	} else {
		$("#box1").hide("fast");
	}
});


$("#box2").css("display","none");
$("#check2").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box2").show("fast");
	} else {
		$("#box2").hide("fast");
	}
});

$("#box3").css("display","none");
$("#check3").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box3").show("fast");
	} else {
		$("#box3").hide("fast");
	}
});

$("#box4").css("display","none");
$("#check4").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box4").show("fast");
	} else {
		$("#box4").hide("fast");
	}
});

$("#box5").css("display","none");
$("#check5").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box5").show("fast");
	} else {
		$("#box5").hide("fast");
	}
});

$("#box6").css("display","none");
$("#check6").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box6").show("fast");
	} else {
		$("#box6").hide("fast");
	}
});


$("#box7").css("display","none");
$("#check7").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box7").show("fast");
	} else {
		$("#box7").hide("fast");
	}
});


$("#box8").css("display","none");
$("#check8").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box8").show("fast");
	} else {
		$("#box8").hide("fast");
	}
});


$("#box9").css("display","none");
$("#check9").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box9").show("fast");
	} else {
		$("#box9").hide("fast");
	}
});


$("#box10").css("display","none");
$("#check10").click(function(){
	// If checked
	if ($(this).is(":checked")) {
		$("#box10").show("fast");
	} else {s
		$("#box10").hide("fast");
	}
});



$("#postcodeForm").hide();
$("#closePostcodeForm").click(function(){
	$("#postcodeForm").hide();
	return false;
});

$("#showPostcodeForm").click(function(){
	$("#postcodeForm").slideDown();
	return false;
});



// begin aanvraag installatie.
$(document).ready(function(){
	//check/hide dinges
	$(".box").css("display","none");
	$(".input").click(function(){
		if ($(this).is(":checked")) {
			$(this).next().next().next().show("fast");
		} else {
			$(this).next().next().next().hide("fast");
			}
		}
	);
	// ssst, ik heb "vaatwasser" gehard-code...
	// bepaal de prijs
	// verberg alle goedkope
	$('.price2').hide();
	var gecheckt = 0;
	$(".input").click(function(){
		// als er een nieuwe checkbox wordt geklikt.
		if ($(this).is(":checked")) {		
			// als er een checkbox bij komt. 
			// tenzij vaatwasser...
			if($(this).attr("name")!="Vaatwasser"){
				gecheckt++;
				if(gecheckt == 1){
					$(this).next('.price1').addClass("blocked");	
					$(this).next().next('.price2').addClass("blocked");
				}
			}
		} else {
		if($(this).attr("name")!="Vaatwasser"){
			// als er een checkbox weggaat...
			gecheckt = gecheckt-1;
			if($(this).next('.price1').hasClass("blocked")){
				$(this).next('.price1').removeClass("blocked");	
				$(this).next().next('.price2').removeClass("blocked");
				// als je een blocked uncheckt moet een ander duur worden. Hoe doen we dat?
				// vind 1 checkbox die gecheckd is. Wissel daar de waarden om. 
				var count = 0;
				$('.input').each(function() {
    				if(count == 0){
    					if($(this).is(":checked")){
    						$(this).next('.price1').addClass("blocked");	
							$(this).next().next('.price2').addClass("blocked");
							$(this).next('.price1').show();	
							$(this).next().next('.price2').hide();
    						count++;
    					}
    				}	
    			});
			}
		}
		}	
		// show prices if there is more than 1 checkbox checked.
		if(gecheckt > 0){
			$('.price1').not(".blocked").hide();
			$('.price2').not(".blocked").show();
		} else {
			$('.price2').not(".blocked").hide();
			$('.price1').not(".blocked").show();
		}
		// bepaald de totaalprijs
		var total = 0;
		$('.input').each(function() {
    		if($(this).is(":checked")){
    			if($(this).next('.price1').css('display') == "inline")
    				total += parseInt($(this).next('.price1').text());
    			if($(this).next().next('.price2').css('display') == "inline")
    				total += parseInt($(this).next().next('.price2').text());
    		};
    		$("#totaalBedrag").html("&euro; "+total);
    	});
    	$('.sub-input').each(function() {
    		if($(this).is(":checked")){
    			if($(this).next('.price1').css('display') == "inline")
    				total += parseInt($(this).next('.price1').text());
    			if($(this).next().next('.price2').css('display') == "inline")
    				total += parseInt($(this).next().next('.price2').text());
    		};
    		$("#totaalBedrag").html("&euro; "+total);
    	});
   	});
   	$(".sub-input").click(function(){
		// bepaald de totaalprijs
		var total = 0;
		$('.input').each(function() {
    		if($(this).is(":checked")){
    			if($(this).next('.price1').css('display') == "inline")
    				total += parseInt($(this).next('.price1').text());
    			if($(this).next().next('.price2').css('display') == "inline")
    				total += parseInt($(this).next().next('.price2').text());
    		};
    		$("#totaalBedrag").html("&euro; "+total);
    	});
    	$('.sub-input').each(function() {
    		if($(this).is(":checked")){
    			if($(this).next('.price1').css('display') == "inline")
    				total += parseInt($(this).next('.price1').text());
    			if($(this).next().next('.price2').css('display') == "inline")
    				total += parseInt($(this).next().next('.price2').text());
    		};
    		$("#totaalBedrag").html("&euro; "+total);
    	});
   	});
});

// einde aanvraag installatie




// einde jquery
});

function beginContact()
{
	// Als hier lege enters in staan voegt Wordpress p tags toe :S
	// hou gelijk op als niet compatibel met google maps
	if ( !GBrowserIsCompatible() )
		return;
	// Initialiseer map etc.
	map = new GMap2( document.getElementById("googleMapsCanvasContact") );
	map.setUIToDefault();
	var point = new GLatLng(51.97987,4.447435);
	map.addOverlay( new GMarker( point ) );
	map.setCenter( point, 13 );
}

// anwb route planner in contact formulier.
      var anwb_tool="adresnv";
      var anwb_tool_type="normal";
      var anwb_tool_tekst="AJTec";
      var anwb_tool_postcode="2652XL";
      var anwb_tool_nr="24";
