// form-value
	jQuery.fn.toggleVal = function(focusClass) {
		this.each(function() {
			jQuery(this).live('focus blur', function(event) {
				if (event.type == 'focus') {
					// clear value if current value is the default
					if(jQuery(this).val() == this.defaultValue) { jQuery(this).val(""); }
				
					// if focusClass is set, add the class
					if(focusClass) { jQuery(this).addClass(focusClass); }
				} else {
					// restore to the default value if current value is empty
					if(jQuery(this).val() == "") { jQuery(this).val(this.defaultValue); }
				
					// if focusClass is set, remove class
					if(focusClass) { jQuery(this).removeClass(focusClass); }
				}
			});
		});
	};

	jQuery(document).ready(function(){
// png voor IE
		jQuery('body').pngFix();
// enter does submit if IE
	if (jQuery.browser.msie){
		jQuery('input').keydown(function(e){
			if (e.keyCode == 13) {
				jQuery(this).parents('form').submit();
				return false;
			}
		});
	}
// dotted linkline
		jQuery('a').focus(function() {this.blur();});
// als links niet in markup mogen ivm worst-in-blik.
		jQuery('a.verborgen').each(function(){
			var hiddenLink = jQuery(this).text(),
				splitLink = hiddenLink.split('jQuery'),
				emailLink = splitLink[0]+'@'+splitLink[1]+''+splitLink[2]+'.'+splitLink[3];
			jQuery(this).attr('href', 'mailto:'+emailLink);
			jQuery(this).text(emailLink);
			jQuery(this).removeClass('verborgen');
		});
// values van label in input
// form als t-shirt
		jQuery('label.hidden').each(function(){
			var tekst = jQuery(this).text();
			jQuery(this).next('input').val(tekst);
			jQuery(this).hide();
		});
// focus op input
		jQuery('textarea, input[type="text"]').addClass("idleField");
		// textarea
		jQuery('textarea').focus(function() {
			jQuery(this).removeClass("idleField").addClass("focusField");
		});
		jQuery('textarea').blur(function() {
			jQuery(this).removeClass("focusField").addClass("idleField");
		});
		//input type=text
		jQuery('input[type="text"]').live('focus', function() {
			jQuery(this).removeClass("idleField").addClass("focusField");
			var defVal = jQuery(this).prev('label').text();
			if (this.value == this.defaultValue){ 
				this.value = '';
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		jQuery('input[type="text"]').live('blur', function() {
			jQuery(this).removeClass("focusField").addClass("idleField");
			if (jQuery.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
// printbutton
		jQuery('#printwindow').click(function(){
			window.print();
			return false;
		});
// gallery
		jQuery('#printwindow').click(function(){
		$('#myGallery').spacegallery({loadingClass: 'loading'});
	   });
// caption hover
		jQuery('.caption').hover(function(){
			jQuery(this).children('p').css('color','#000');
		}, function(){
			jQuery(this).children('p').css('color','#648ac7');
		});
// footer @ bottom of page
		var docH = jQuery(window).height(),
			headerH = jQuery('#header').height(),
			mainH = jQuery('#content').height(),
			footerH = jQuery('#footer').height();
		if((headerH+mainH+footerH) < docH){
			jQuery('#footer').css({
				'margin-top': (docH - (headerH+mainH+footerH))+1
			});
		} else {
			jQuery('#footer').css({
				'margin-top':0
			});
		}
	});
