$(function() {

	// prettyphoto:
	$("a[rel^='cm-fotoblad']").prettyPhoto({
		animationSpeed: 'fast', 		/* fast/slow/normal */
		opacity: 0.80, 					/* Value between 0 and 1 */
		showTitle: true, 				/* true/false */
		allowresize: true, 				/* true/false */
		counter_separator_label: '/', 	/* The separator for the gallery counter 1 "of" 2 */
		theme: 'light_square', 			/* light_rounded / dark_rounded / light_square / dark_square / facebook */
		hideflash: false, 				/* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		wmode: 'opaque', 				/* Set the flash wmode attribute */
		autoplay: true, 				/* Automatically start videos: True/False */
		modal: false
	});
		
	// hoofdmenu 
	$('div#menu > ul > li > a').bind('mouseenter', function() {
		$(this).addClass('selected');
		$(this).parent().siblings().children('a').removeClass('selected');
		$(this).parent().siblings().children('ul').hide();
		$(this).siblings('ul').show();
	});
	
	$('div#menu > ul > li').bind('mouseleave',function() {
		$(this).children('ul').hide();
		$(this).children('a').removeClass('selected');
	});
	
	//als class firstlink is dan hele blok als link door middel van 1 a tag
	$('.firstlink').each(function() {
		$(this).click(function() {
			document.location.href = $(this).find('a[href]').get(0).href;
		});
		$(this).bind('mouseenter',function() {
			$(this).find('a[href]').eq(0).addClass('hover');
			$(this).find('div.button_left').eq(0).addClass('button_left_hover');
			$(this).find('div.button_right').eq(0).addClass('button_right_hover');
		});
		$(this).bind('mouseleave',function() {
			$(this).find('a[href]').eq(0).removeClass('hover');
			$(this).find('div.button_left').eq(0).removeClass('button_left_hover');
			$(this).find('div.button_right').eq(0).removeClass('button_right_hover');
		});
	});
	//als class firstlink is dan hele blok als link door middel van 1 a tag
	$('.firstlinknews').each(function() {
		$(this).click(function() {
			document.location.href = $(this).find('a[href]').get(0).href;
		});
		$(this).bind('mouseenter',function() {
			$(this).find('a[href]').eq(0).addClass('nieuws_link_hover');
		});
		$(this).bind('mouseleave',function() {
			$(this).find('a[href]').eq(0).removeClass('nieuws_link_hover');
		});
	});
	
	$('.username').each( function() {
		value = $(this).val();		
		$(this).focus( function() {
			if($(this).val() == value) {
				$(this).attr("value","");
			}
		});
		$(this).blur( function() {
			if($(this).val() == "") {
				$(this).attr("value",value);
			}
		});
	});
	
	$('#login').each( function() {
		
		parent_element = this;
		
		$(parent_element).find("input[name='wachtwoord']").hide();
		
		$(parent_element).find("input[name='login_wachtwoord_tekst']").focus( function() {
			if($(this).val() == 'wachtwoord') {
				$(this).hide();
				$(parent_element).find("input[name='wachtwoord']").show();
				$(parent_element).find("input[name='wachtwoord']").focus();
			}		
			if($(this).val() == 'mot de passe') {
				$(this).hide();
				$(parent_element).find("input[name='wachtwoord']").show();
				$(parent_element).find("input[name='wachtwoord']").focus();
			}		
		});
		
		$(parent_element).find("input[name='wachtwoord']").blur( function() {					
			if($(this).val() == '') {					
				$(this).hide();
				$(parent_element).find("input[name='login_wachtwoord_tekst']").show();
			}
		});
	});	
    
});
