function setMinHeight(){
	var nMinHeight = ($(window).height()) - 308;
	$('#content_left_content').css('min-height', nMinHeight);
}
function setMinHeightHome(){
	var nMinHeight = ($(window).height()) - 472;
	if(nMinHeight > 390){
		$('#content_left').css('min-height', nMinHeight);
	}
}
function setGeoLocation() {
	if (GBrowserIsCompatible()) {

		
		var map = new GMap(document.getElementById('maps'));
		map.setCenter(new GLatLng(iLatitude, iLongitude));
		map.setZoom(16); 

		//map.disableContinuousZoom();
		//map.disableDoubleClickZoom();
		
		var tinyIcon = new GIcon();
		tinyIcon.image = 'http://www.webkey6.nl/klant/kramer/images/template/maps-logo.png';
		tinyIcon.iconSize = new GSize(96, 81);
		tinyIcon.iconAnchor = new GPoint(30, 60);		
		
		function createMarker(point) {
			markerOptions = { 'icon':tinyIcon };	
          	
            var marker = new GMarker(point, markerOptions);
			
			
			return marker;
        }

		function markertoevoegen(lat, len) {
			geo = new GLatLng(lat,len);
			marker = createMarker(geo);
			map.addOverlay(marker);
		}
  
        markertoevoegen(iLatitude, iLongitude);
   	}
}

function clearInput() {
	$('.fade').focus(function() {
		$(this).select();
		$(this).prev().fadeTo(150, 0.25);
		$(this).keydown(function() {
			$(this).css('background-repeat', 'repeat');			 
		});
	});
	$('.fade').blur(function() {
		if ( $(this).val() == '' ) {
			$(this).css('background-repeat', 'no-repeat');
			$(this).prev().fadeTo(150, 1);
		}
	});
	$('.fade').each(function(){
		if ( $(this).val() != '') {
			$(this).css('background-repeat', 'repeat');
		};
	});
}

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 initCheckselect(){
	$('.multiselect').click(function(){
		$('.checkbox_wrapper').slideToggle('fast');
	});
	$('.okay').click(function(){
		$('.checkbox_wrapper').slideUp('fast');
	});
}

function initCheckbox(){
	$('.checkbox_wrapper a.fakecheck').click(function(){
		var sId = $(this).attr('id').replace('fake_','');
		var oThis = $(this);
		if(sId == 'alles'){
			if($(oThis).hasClass('checked')){
				$('input.checken').attr('checked','checked');
			} else {
				$('input.checken').removeAttr('checked');
			}
		} else {
			var oCheckbox = $('input#input_'+sId);
			if($(oThis).hasClass('checked')){
			   oCheckbox.attr('checked','checked');  
			} else {
			   oCheckbox.removeAttr('checked');
			}
		}
	});
}
function initFakeCheckbox(){
	$('a.fakecheck').click(function(){
		$(this).toggleClass('checked');
		if(!$(this).hasClass('checked')){
			$('a.alles').removeClass('checked');	
		}
	});
	$('a.alles').click(function(){
		if($(this).hasClass('checked')){
			$('a.fakecheck').addClass('checked');		
		} else {
			$('a.fakecheck').removeClass('checked');		
		}
	});
}

function initSorteer(){
	$('.sorteer').click(function(){
		$('.sorteer').toggleClass('aktief');
	});
}

function photoSlider(){
	$('#test').slideKey({ bKeyboard: true, sExtension: 'large', sExtensionThumb: 'thumbs' });
}

function validateForm(p_sForm) {
	var rules = {};
	rules[aFields[0]] = {
		required: true
	};
	rules[aFields[1]] = {
		notags: true,
		required: true,
		nonumber: true
	};
	rules[aFields[2]] = {
		notags: true,
		required: true,
		number: true,
		minlength: 6
	};
	rules[aFields[3]] = {
		notags: true,
		required: true,
		email: true
	};
	rules[aFields[4]] = {
		notags: true,
		required: true
	};
	rules[aFields[5]] = {
		notags: true,
		required: false
	};
	
	var messages = {};
	messages[aFields[0]] = {
		required: 'De code komt niet overeen.'
	};
	messages[aFields[1]] = {
		notags: 'Tags zijn niet toegestaan',
		required: 'Vul a.u.b. uw naam in.',
		nonumber: 'Vul a.u.b. een geldige naam in'
	};
	messages[aFields[2]] = {
		notags: 'Tags zijn niet toegestaan',
		required: 'Vul a.u.b. een telefoonnummer in',
		number: 'Voer a.u.b. een geldig telefoonnummer in.',
		minlenght: 'Voer a.u.b. een geldig telefoonnummer in.'
	};
	messages[aFields[3]] = {
		notags: 'Tags zijn niet toegestaan',
		required: 'Vul uw e-mailadres in.',
		email: 'Vul een geldig e-mailadres in.'
	};
	messages[aFields[4]] = {
		required: 'Vul a.u.b. betreft in',
		notags: 'Tags zijn niet toegestaan'
	};
	messages[aFields[5]] = {
		notags: 'Tags zijn niet toegestaan'
	};
	$('#'+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.trigger('submit');
		}
	});	
}
