$(document).ready(function() {
	
	
	
	
	
	$('#scroll-pane').jScrollPane({showArrows:true});
	
	
	$.post(
		webroot + 'getCoords',
		{  },
		function(response) {
			coords = response.split(',');
			if(coords != '')
				$('.block').css( { 'left': coords[0] + 'px', 'top': coords[1] + 'px'} ).show();
			else 
				$('.block').show();
			$('#scroll-pane').jScrollPane({showArrows:true});
		}
	)
	
	
	
	$('.block').draggable({
		handle: '#drag',
		stop: function(event, ui) {
			$.post(
				webroot + 'setCoords',
				{ x: $(this).css('left'), y: $(this).css('top') }
			)
		}
	});
	
	$('#header').fadeIn(2200);
	
	$('a[rel="external"]').click(function() {
		window.open($(this).attr('href'));
		return false;
	})
	

	$('#ReserveReserveForm input, #ReserveReserveForm textarea, #ContactContactForm input, #ContactContactForm textarea').focus(function() {
		if ($(this).val()==$(this).attr('id')) $(this).val('');
	});
	$('#ReserveReserveForm input, #ReserveReserveForm textarea, #ContactContactForm input, #ContactContactForm textarea').blur(function() {
		if ($(this).val()=='') $(this).val($(this).attr('id'));
	});
	$('.data td:first').width(600);
	
	$('#flashMessage').hide().fadeIn('normal').delay(3000).fadeOut('normal');
	
	
	
	$.each({'Naam':'', 'E-mailadres':'', 'Datum': '', 'Telefoonnummer' : '', 'Opmerkingen' : '', 'Telefoon':'', 'Onderwerp':'', 'Postcode':'', 'Plaats':'', 'Bericht':''}, function(index) {
		if($('#' + index).val() == '')
			$('#' + index).val($('#' + index).attr('id'));
	});
		
	$('#ContactContactForm, #ReserveReserveForm').submit(function() {
		
		$.each({'Naam':'', 'E-mailadres':'', 'Datum' : '', 'Telefoonnummer' : '', 'Opmerkingen' : '', 'Telefoon':'', 'Onderwerp':'', 'Postcode':'', 'Plaats':'', 'Bericht':''}, function(index) {
			if($('#' + index).val() == $('#' + index).attr('id')) {
				$('#' + index).val('');
			}
		});
		
		
		
		
		
		
	});
	
	
	
	
	
	
	
	
});
