$(document).ready(function(){
	initSIFR();						   
});
function fixMenu(){
	var nHeight = $('ul.sub:visible').outerHeight(true);
	$('#left').css('padding-top',nHeight+'px');				 
}
function initSIFR(){
	sIFR.replace(sifr, {
		selector: 'h1.flash'
		,css: [
		  '.sIFR-root { padding: 0px; font-weight: bold; font-size: 19px; color: #0094d2; text-transform: uppercase; line-height: 19px; height: 19px; width: auto;}'
		],
		wmode: 'transparent'
	});
	sIFR.replace(sifr, {
		selector: 'h2.flash'
		,css: [
		  '.sIFR-root { padding: 0px; font-weight: bold; font-size: 15px; color: #fd7f10; text-transform: uppercase; line-height: 15px; height: 15px; width: auto;}'
		],
		wmode: 'transparent'
	});
	sIFR.replace(sifr, {
		selector: 'h3.flash'
		,css: [
		  '.sIFR-root { padding: 0px; font-weight: bold; font-size: 13px; color: #0094d2; text-transform: uppercase; line-height: 13px; height: 13px; width: auto;}'
		],
		wmode: 'transparent'
	});
}
function projectCycle() {
	var nTotal = $('#cycle img').size();
	$('#cycle')
		.cycle({
			fx:     'fade',
			timeout: 0,
			speed:	 300,
			next:   '#cycle_next', 
    		prev:   '#cycle_prev', 
			after: function(curr,next,opts) {
				var nCurrent = opts.currSlide + 1;
				$('span#total').text(nTotal);
				$('span#current').text(nCurrent);
			}
	});
}
function validateForm(p_sForm){
	$('#'+p_sForm).validate({
		errorPlacement: function(error, element) {
			var obj = element.parent().next('div.icon');
			error.insertAfter(obj);
			obj.attr('class','icon invalid');
		},
		errorElement: 'div',
		success: function(label) {
			label.prev('div.icon').attr('class','icon valid');
			label.remove();
		},
		submitHandler: function(form) {
			form.submit();
		}
	});	
}
function initialize() {
	var myLatlng = new google.maps.LatLng(51.851702,4.298406);
	var myOptions = {
	  zoom: 15,
	  center: myLatlng,
	  mapTypeId: google.maps.MapTypeId.ROADMAP,	  
	  mapTypeControl: false
	}
	var map = new google.maps.Map(document.getElementById('map'), myOptions);
	
	var image = new google.maps.MarkerImage('images/template/google.png',
		new google.maps.Size(94, 75),
		// 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(32, 68)
	);
	var marker = new google.maps.Marker({
		position: myLatlng, 
		map: map,
		icon: image
	});   
}
function projecten(){
	$('#filter a').click(function(){
		$('#filter a').removeClass('active');
		$(this).addClass('active');
		
		var sFilter = $(this).text();
		loadProjecten('filter=' + sFilter);
	});
}
function loadProjecten(p_sData){
	$.ajax({
		type: 'POST',
		url: 'inc/projecten.inc.php',
		data: p_sData,
		success: function(result){
			$('#ajax').html(result);
			projecten();
			initSIFR();
		}
	});		
}

function initGallery() {
	$('#photo').cycle({ 
		fx:     'fade',
		timeout: 4000,
		random: 1,
		speed: 500,
		min: 1
	});
}
