// JavaScript Document

function check_Form(formulier, fields, description) {

	d = document.forms [formulier];
	var errors = "";
	
	for (i=0;i<fields.length;i++){ 
		data_field = fields[i];
		if(d [data_field].length && d [data_field].type!="select-one") { // radio or checkbox and no select?
			array_errors = true;
			for (y=0;y<d [data_field].length;y++) { // get options
				if(d [data_field][y].checked == true) {
					array_errors = false;
				}
			}
			if(array_errors != false){
				errors += "- "+description[i]+"\n";
			}
		}		
		else if(d [data_field].type=="checkbox"){
			if(d [data_field].checked == false){
				errors += "- "+description[i]+"\n";
			}
		}
		else {
			if(d [data_field].value == "") {
				errors += "- "+description[i]+"\n";
			}
		}
	}
	if(errors) {
		alert("De volgende veld(en) zijn nog niet ingevuld:\n"+errors);
		return false;
	}
	else {
		return true;
	}
}

function changePhoto( photo ){
//	document.getElementById("fotoToon").innerHTML = "<img src=\""+ photo +"\" />";
	window.open(photo,'jevensternaam', 'width=550,height=405,scrollbars=no,toolbar=no,location=no');
}

function closeAllLinks() {
	//document.getElementById("art").innerHTML="";
	document.getElementById("wonen").style.display="none";
	document.getElementById("overheid").style.display="none";
	document.getElementById("algemeen").style.display="none";	
}
function openOneLink( layer ) {
	closeAllLinks();

	document.getElementById( layer ).style.display="block";
}

jQuery(function($) {
	//$('a img').each(function(i, el) {
	//	var a = $(el).parent();
	//	if(a.attr('href').indexOf('.jpg') != -1 || a.attr('href').indexOf('.png') != -1) a.addClass('lightboz');
	//});

	//$('.lightboz').attr('rel', 'za-grup').lightBox();
	
	if(jQuery('.mid-z').length && jQuery('#midtop').length) {

		setTimeout(function() {
			var h = jQuery('#left_sidebar').height() + 232;
			var h2 = jQuery('#midtop').height() + 250;
			var h3 = 0;
			
			h = Math.max(h, h2, h3);
			jQuery('#container').height(h);
		}, 500);
		
		
	}
	
	setInterval(function() {
			if(jQuery('.woningen').length || !jQuery('#midtop').length) {
				jQuery('#mid').css('height', '100%');
			}
		}, 1000);
	
});








