function initGoogleMaps() {
	var myLatlng = new google.maps.LatLng(51.812734,4.492013);
	var myCenter = new google.maps.LatLng(51.812734,4.492013);
	var myOptions = {
		zoom: 14,
		mapTypeControl: false,
		scaleControl: false,
		navigationControl: true,
		navigationControlOptions: {
			style: google.maps.NavigationControlStyle.SMALL,
			position: google.maps.ControlPosition.BOTTOM_LEFT
		},
		center: myCenter,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	var map = new google.maps.Map(document.getElementById("googlemaps"), myOptions);
	
	var image = new google.maps.MarkerImage('images/template/icon-bronij.png',
		new google.maps.Size(124,94),
		new google.maps.Point(0,0),
		new google.maps.Point(62,94)
	);
	var marker = new google.maps.Marker({
		position: myLatlng, 
		map: map,
		icon: image
	});  
}

function initCycle() {
	$('#load-slides').fadeOut(500);
	$('#slides').fadeIn(500);
	$('.slides').cycle({
		prev: '#prev',
		next: '#next',
		pager: '.items',
		pagerAnchorBuilder: function(idx, slide) { 
			return '.items .item:eq(' + idx + ')'; 
		} 
	});
	$('a[rel=lightbox]').lightBox();	
}

function initCycleDetail() {
	$('#load-slides').fadeOut(500);
	$('#slides').fadeIn(500);
	$('.slides').cycle({
		prev: '#prev',
		next: '#next'
	});
	$('a[rel=lightbox]').lightBox();	
}

function initSubmenu() {
	$('ul.first li').hover(function() {
		$(this).children('ul.second').show();
	}, function() {
		$(this).children('ul.second').hide();
	});
}

function lightboxHome() {
	$('.project').click(function() {
		var sId = $(this).attr('id');
		var sNewId = sId.replace('project', 'lightbox');
		$(sNewId).trigger('click');
	});
}

function initSelectboxes(){
	$('div.select select').selectbox();
	var zIndex = 9999;
	$('div.form div.entry').each(function(){
		$(this).css('z-index',zIndex);
		zIndex--;
	});
}

function validateForm(p_sForm) {
	var rules = {};
	rules[aFields[1]] = {
		required: true,
		nonumber: true,
		notags: true
	};
	rules[aFields[3]] = {
		required: true,
		nonumber: true,
		notags: true
	};
	rules[aFields[4]] = {
		telephone: true
	};
	rules[aFields[5]] = {
		required: true,
		email: true
	};
	rules[aFields[6]] = {
		notags: true
	};
	
	var messages = {};
	messages[aFields[1]] = {
		required: 'Vul uw organisatie in.',
		nonumber: 'Dit veld mag geen getallen bevatten.',
		notags: 'U mag geen tags invullen.'
	};
	messages[aFields[3]] = {
		required: 'Vul een contactpersoon in.',
		nonumber: 'Dit veld mag geen getallen bevatten.',
		notags: 'U mag geen tags invullen.'
	};
	messages[aFields[4]] = {
		telephone: 'Vul een geldig telefoonnummer in..'
	};
	messages[aFields[5]] = {
		required: 'Vul uw e-mailadres in.',
		email: 'Vul een geldig e-mailadres in.'
	};
	messages[aFields[6]] = {
		notags: 'U mag geen tags invullen.'
	};
	$('#'+p_sForm).validate({
		rules: rules,
		messages: messages,
		errorPlacement: function(error, element) {
			var obj = element.parent().next('div.icon');
			error.insertAfter(obj);
			obj.attr('class','icon invalid');
		},
		success: function(label) {
			label.prev('div.icon').attr('class','icon valid');
			label.remove();
		},
		submitHandler: function(form) {
			form.submit();
		}
	});	
}
