// form-value
	jQuery.fn.toggleVal = function(focusClass) {
		this.each(function() {
			$(this).focus(function() {
				// 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); }
			}).blur(function() {
				// 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); }
			});
		});
	}
// Pixastic for jQuery
	function saturate(img) {
		var img2 = Pixastic.process(img, "desaturate");
		img2.onmouseover = function() {
			Pixastic.revert(this);
		}
}

	$(document).ready(function(){
// png voor IE
		$('body').pngFix();
// dotted linkline
		$('a').focus(function() {this.blur();});

// a img hover
		$('#share a img, #icons a img').css({"opacity": .5});
		$('#share a img, #icons a img').hover(
			function(){
				$(this).stop().animate({"opacity": 1}, 150);
			}, function(){
				$(this).stop().animate({"opacity": .5}, 300);
		});

// a img hover
		$('.worklist img').hover(
			function(){
				$(this).stop().animate({"opacity": .6}, 150);
				$(this).parent().siblings('.arrow').stop().animate({'bottom':7}, 150, "jswing");
			}, function(){
				$(this).stop().animate({"opacity": 1}, 300);
				$(this).parent().siblings('.arrow').stop().animate({'bottom':-23}, 300, "jswing");
		});


// formval joe!
		$('#zoekterm, #inschrijvert, #we_subscribe_email__').toggleVal();
// als links niet in markup mogen ivm worst-in-blik.
		$('a.linkhider').each(function(){
			var wattes = $(this).text();
			var expl = wattes.split('§');
			var watResult = expl[0]+'@'+expl[1]+'.'+expl[2];
			$(this).attr('href', 'mailto:'+watResult);
			$(this).text(watResult);
		});

		$('#zoekbox, #nieuwsbrief').css('display','none');

		$('a#nieuwsbrief_btn').click(function(){
			$('#subnav a.active').removeClass('active');
			if($('#zoekbox').hasClass('open')){
				$('#zoekbox > form').css('display','none');
				$('#zoekbox').animate({'marginTop':'-25px'}, 100, function(){
					$(this).css('display','none')
						.removeClass('open');
				})
			}
			if($('#nieuwsbrief').hasClass('open')){
				$('#nieuwsbrief').animate({'marginTop':'-25px'}, 300, function(){
					$(this)
						.css('display','none')
						.removeClass('open');
					
				});
			} else {
				$('#nieuwsbrief > form').css('display','block');
				$('#nieuwsbrief')
					.css('display','block')
					.animate({'marginTop':'0'}, 300)
					.addClass('open');
				
				$('a#nieuwsbrief_btn').addClass('active');
			}
			return false;
		});

		$('a#zoekbox_btn').click(function(){
			$('#subnav a.active').removeClass('active');
			if($('#nieuwsbrief').hasClass('open')){
				$('#nieuwsbrief > form').css('display','none')
				$('#nieuwsbrief').animate({'marginTop':'-29px'}, 100, function(){
					$(this).css('display','none')
						.removeClass('open');
				})
			}
			if($('#zoekbox').hasClass('open')){
				$('#zoekbox').animate({'marginTop':'-29px'}, 300, function(){
					$(this)
						.css('display','none')
						.removeClass('open');
					
				});
			} else {
				$('#zoekbox > form').css('display','block');
				$('#zoekbox')
					.css('display','block')
					.animate({'marginTop':'0'}, 300)
					.addClass('open');
					
				$('a#zoekbox_btn').addClass('active');
			}
			return false;
		});
		
// footerding
		$('<div id="footerclose"><img src="/images/close.gif" alt="close" width="23" height="23" /></div>')
			.appendTo('#footer');
		
		var fHeight = $('#footer').height();
		$('#footerclose').click(
			function(){
				$('#footer')
					.wrap('<div id="footerwrap" style="height:'+fHeight+'px;" />')
					.animate({'bottom':'-'+fHeight+'px'}, '150',
						function(){
							$('<div id="footeropen"><img src="/images/up.gif" alt="close" width="23" height="12" /></div>')
								.appendTo('#footerwrap')
								.animate({'bottom':'10px'}, 'fast')
								.click(
									function(){
										$(this).animate({'bottom':'-12px'}, '150',
											function(){
												$(this).remove();
												$('#footer')
													.animate({'bottom':'0px'}, '150',
														function(){
															$('#footer').unwrap();
														}
													);
												}
											)
									}
								);
							}
						)
					}
				);
			return false;
	});

