$(document).ready(function() 
{
	$('#navigatie.navigatieHome a, #navigatieOnder.navigatieHome a').hover(
		function() 
		{
			var i = $(this).attr('rel');
			var img = $('#collage div.' + i + ' img');
			var navigatieHoverTekstDiv = $('#navigatieHoverTekst');
			var imgOffset = img.offset();
			var imgTop = imgOffset.top;
			var imgLeft = imgOffset.left;
			
			img.animate({
				opacity: 0.2
			}, 500);
			
			navigatieHoverTekstDiv.find('h6').html(navigatieHoverTekst[i]);
			
			navigatieHoverTekstDiv.css({
				top: imgTop + 'px',
				left: imgLeft + 'px'
			}).show();
		},
		function() 
		{
			var i = $(this).attr('rel');
			var img = $('#collage div.' + i + ' img');
			var navigatieHoverTekstDiv = $('#navigatieHoverTekst');
			
			img.animate({
				opacity: 1
			}, 500);
			
			navigatieHoverTekstDiv.hide();	
			navigatieHoverTekstDiv.find('h6').html('');
		}
	);
	
	$('.addCaseStudy').click(function() 
	{
		$('.caseStudyAddForm').slideToggle(function() 
		{
			if ($('.caseStudyAddForm').css('display') == 'block') 
			{
				$('.addCaseStudy').text('- Add case study');
			}
			else 
			{
				$('.addCaseStudy').text('+ Add case study');
			}
		});
	});
	
	$('#caseStudyLijst li').hover(
		function() 
		{
			$(this).css({
				cursor: 'pointer',
				background: '#e1e1e1'
			});
		},
		function() 
		{
			$(this).css({
				cursor: 'default',
				background: '#f7f7f7'
			});
		}
	).click(function() 
	{
		var url = $(this).find('a').attr('href');
		window.location = url;
	});
	
	$('.caseStudyAddForm form').submit(function() 
	{
		if ($('#titel').length < 1) 
		{
			alert('Please fill in a title.');
			return false;
		}
		else if ($('#bestand').length < 1) 
		{
			alert('Please select a file.');
			return false;
		}
		else 
		{
			return true;
		}
	});
});

var navigatieHoverTekst = new Array();
navigatieHoverTekst[1] = 'Water has shaped cultures. Professionals can learn from the way that cultures around the world have adapted themselves to living with water in different environments.';
navigatieHoverTekst[2] = 'Water plays a central role in many cultural traditions, <span class="italic">religions</span> and beliefs. A better understanding of the way various cultures in different parts of the world perceive and manage water may lead to new concepts for sustainable water management. ';
navigatieHoverTekst[3] = 'Water can be a source of <span class="italic">power</span>, as in the case of hydropower. However, the power dimension of water also reflects political power. With regard to sustainable water management, water planners and policy makers need to take into account the power dimensions of water.';
navigatieHoverTekst[4] = 'Water can be a source of <span class="italic">conflict</span>, as well as a source of <span class="italic">cooperation</span>, as many river treaties show. How water can help to establish cooperation is a key question with regard to future developments, including climate change.';
navigatieHoverTekst[9] = '';
navigatieHoverTekst[10] = 'Decision-makers should not only understand the cultural context but also consider the cultural consequences of their decisions and allow people to participate in designing water projects and their future.';
navigatieHoverTekst[11] = 'Cultural aspects may hamper or foster sustainable water management. Successful <span class="italic">intercultural communication</span> requires cultural competence. It makes partnerships more effective. ';
navigatieHoverTekst[12] = 'To make international water projects more sustainable the cultural context must be recognised, understood and addressed appropriately.';
