function setGeolocation() {
	var myLatlng = new google.maps.LatLng(iLatitude,iLongitude);
	var myCenter = new google.maps.LatLng(iLatitude,iLongitude);
	var myOptions = {
	  zoom: 14,
	  center: myCenter,
	  mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	var map = new google.maps.Map(document.getElementById("maps_load"), myOptions);
	
	var image = new google.maps.MarkerImage('http://www.webkey6.nl/klant/alphen/images/template/marker_logo.png',
		// This marker is 65 pixels wide by 61 pixels tall.
		new google.maps.Size(75,62),
		// The origin for this image is 0,0.
		new google.maps.Point(0,0),
		// The anchor for this image is the base of the flagpole at 0,32.
		new google.maps.Point(23,62)
	);
	var marker = new google.maps.Marker({
		position: myLatlng, 
		map: map,
		icon: image
	});  
}

function initSlideshow() {
	$('#photo_slider').cycle({
		fx:     'fade',
		timeout: 0,
		speed:	 500,
		next:   '#next', 
		prev:   '#prev',
		after: onAfter
	});
}
function onAfter(curr,next,opts) {
    $('.foto').html(opts.currSlide +1);
}

function showFilter(){
	$('#showslider').click(function(){
		$('#slider').show();
		$('#bg_left_laag').css('height','303px');
		$('#bg_left_laag').css('width','30%');
	});
	$('#inklappen').click(function(){
		$('#slider').hide();
		$('#bg_left_laag').css('height','63px');
		$('#bg_left_laag').css('width','49%');
	});
}
function customSelect(){
	$("select").each(function(){
		   $(this).wrap("<div class='selector'></div>");
		   // Store the value of title in the variable spanText
		   var spanText = $(this).attr('title');
		   // Use the variable span text as the default for the select field
		   var span = "<span class='select'>" + spanText + "</span>";
		   $(this).before(span)
		   .fadeTo(1, 0)
		   .focus(function(){
				   $(this).parents(".selector").addClass("focus");
		   })
		   .change(function(){
				   $(this).siblings("span").text($(this).children(":selected").text());
		   }).click ( function (){
				   $(this).siblings("span").text($(this).children(":selected").text());   
		   }) 
		   .blur(function(){
				   $(this).parents(".selector").removeClass("focus");
		   });     
	});
	$('select').trigger("change");
}
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 iconOK = {
		'background-position' : '0px -32px'
	}
	var iconError = {
		'background-position' : '0px 0px'
	}
	
	var rules = {};
	rules[aFields[0]] = {
		required: true
	};
	rules[aFields[1]] = {
		nonumber: true,
		required: true
	};
	rules[aFields[2]] = {
		number: true,
		required: true
	};
	rules[aFields[3]] = {
		required: true,
		email: true
	};
	rules[aFields[4]] = {
		required: true
	};
	rules[aFields[5]] = {
		required: true
	};
	
	var messages = {};
	messages[aFields[1]] = {
		nonumber: 'Uw naam mag geen nummers bevatten.',
		required: 'Vul uw naam in.'
	};
	messages[aFields[2]] = {
		number: 'Vul a.u.b. alleen nummers in.',
		required: 'Vul a.u.b. uw telefoonnummer in.'
	};
	messages[aFields[3]] = {
		email: 'Vul a.u.b. uw e-mailadres in.',
		required: 'Vul a.u.b. uw e-mailadres in.'
	};
	messages[aFields[4]] = {
		required: 'Vul a.u.b. een onderwerp in.'
	};
	messages[aFields[5]] = {
		required: 'Vul a.u.b. een vraag/opmerking in.'
	};
	$('#'+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();
		}
	});	
}
