// form-value
	jQuery.fn.toggleVal = function(focusClass) {
		this.each(function() {
			$(this).live('focus blur', function(event) {
				if (event.type == 'focus') {
					// clear value if current value is the default
					if($(this).val() == this.defaultValue) { $(this).val(""); }
				
					// if focusClass is set, add the class
					if(focusClass) { $(this).addClass(focusClass); }
				} else {
					// restore to the default value if current value is empty
					if($(this).val() == "") { $(this).val(this.defaultValue); }
				
					// if focusClass is set, remove class
					if(focusClass) { $(this).removeClass(focusClass); }
				}
			});
		});
	};
// external links
	function externalLinks() {
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
				anchor.target = "_blank";
		}
	};
	window.onload = externalLinks;



	$(document).ready(function(){
// png voor IE
		$('body').pngFix();
// enter does submit if IE
		if ($.browser.msie){
			$('input').keydown(function(e){
				if (e.keyCode == 13) {
					$(this).parents('form').submit();
					return false;
				}
			});
		}
		
$('#headerimage img').hover(function(){
				$(this).stop().animate({'opacity':.7}, 100);
				}, function(){
				$(this).stop().animate({'opacity':1}, 400, function() {
					if ($.browser.msie)
					this.style.removeAttribute('filter');
				});
			});
// dotted linkline
		$('a').focus(function() {this.blur();});
		$('a img').hover(function(){
			$(this).stop().animate({'opacity':.7}, 100);
		}, function(){
			$(this).stop().animate({'opacity':1}, 400);
		})
// als links niet in markup mogen ivm worst-in-blik.
		$('a.verborgen').each(function(){
			var hiddenLink = $(this).text(),
				splitLink = hiddenLink.split('$'),
				emailLink = splitLink[0]+'@'+splitLink[1]+''+splitLink[2]+'.'+splitLink[3];
			$(this).attr('href', 'mailto:'+emailLink);
			$(this).text(emailLink);
			$(this).removeClass('verborgen');
		});
// values van label in input
// form als t-shirt
		$('label.hidden').each(function(){
			var tekst = $(this).text();
			$(this).next('input').val(tekst);
			$(this).hide();
		});
// focus op input
		$('textarea, input[type="text"]').addClass("idleField");
		// textarea
		$('textarea').focus(function() {
			$(this).removeClass("idleField").addClass("focusField");
		});
		$('textarea').blur(function() {
			$(this).removeClass("focusField").addClass("idleField");
		});
		//input type=text
		$('input[type="text"], textarea').live('focus', function() {
			$(this).removeClass("idleField").addClass("focusField");
			var defVal = $(this).prev('label').text();
			if (this.value == this.defaultValue){ 
				this.value = '';
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		$('input[type="text"], textarea').live('blur', function() {
			$(this).removeClass("focusField").addClass("idleField");
			if ($.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
// printbutton
		$('#printwindow').click(function(){
			window.print();
			return false;
		});

// custom functions
		$("#members").fancybox({
				'width'				: '95%',
				'height'			: '90%',
				'margin'			: '0',
				'padding'			: '0',
				'autoScale'			: true,
				'transitionIn'		: 'fade',
				'transitionOut'		: 'fade',
				'type'				: 'iframe'
		});
	});
