$(document).ready(function(){
	$('#nieuwsteaser').scrollable({
		vertical: true,
		interval: 4000,
		size: 1,
		speed: 750,
		loop: true,
		easing: 'swing',
		onBeforeSeek: function(){
			this.getItems().fadeTo(350, 0.2)
		},
		onSeek: function(){
			this.getItems().fadeTo(350, 1)
		}
	})

	$('#menu-links-0').superfish()
	$('#menu-rechts-0').superfish()
	
	$('.datum-veld').each(function(){
		$(this).datepicker({
			dateFormat: "dd-mm-yy"
		})
	})
	
	$('.style-over-gif').mouseover(function(){
		$(this).attr('src',$(this).attr('src').replace('.gif','-over.gif'))
	}).mouseout(function(){
		$(this).attr('src',$(this).attr('src').replace('-over.gif','.gif'))
	})
	$('.style-over-bg-gif').mouseover(function(){
		$(this).css('background-image',$(this).css('background-image').replace('.gif','-over.gif'))
	}).mouseout(function(){
		$(this).css('background-image',$(this).css('background-image').replace('-over.gif','.gif'))
	})
	
	$('.style-over-opacity').mouseover(function(){
		$(this).css('opacity','0.7')
	}).mouseout(function(){
		$(this).css('opacity','1')
	})
	
	if (typeof($('#speler').css('height')) != "undefined") {
		flowplayer("speler", "/static/swf/external.flowplayer.swf", {
			key: '#@41f9d80dd0eb1ad6469',
			play: {
				replayLabel: 'Speel opnieuw'
			},
			logo: {
				bottom: '0',
				right: '5',
				fullscreenOnly: false,
				fadeSpeed: '1000',
				zIndex: 1
			},
			canvas: {
				backgroundColor: "#3882b1"
			},
			plugins: {
				controls: {
					url: '/static/swf/external.flowplayer.controls.swf',
					progressColor: '#175a85',
					backgroundColor: '#004977',
					buttonOverColor: '#ffffff',
					buttonColor: '#08283c',
					bufferColor: '#b1b1b1',
					backgroundGradient: [0.6,0.3,0,0,0],
					bufferGradient: 'none',
					borderRadius: '0px',
					timeColor: '#ffffff',
					durationColor: '#ffffff',
					progressGradient: 'medium',
					sliderColor: '#4596c9',
					sliderGradient: 'none',
					opacity:1.0
				}
			}
		})
	}

	$('.bg-on-odd-row:odd').addClass('some-odd-row')
	
	$('#contact-formulier').submit(function(){
		var do_submit = true;
		$('.verplicht-veld').css('border','solid 1px #ccc')
		$('.verplicht-veld').each(function(){
			if ($(this).val() == '') {
				$(this).css('border','solid 1px red')
				do_submit = false
			}
		})
		if (do_submit != true) {
			$('#waarschuwing').html('<span style="color:red;">U heeft niet alle verplichte velden ingevuld</span>');
			return false
		}
		return true
	})
	
	$('#menu-rechts-0 li:first a:first').css('padding-right','7px')
	
	$('#splashscreen-wrapper').css({
		'bottom': $(window).height(),
		'right': $(window).width()
	})
	$('#doRemove').click(function(){
		$('#splashscreen-wrapper').remove()
	})
	var hoogte = $(window).height()
	var breedte = $('#splashscreen a:last img').width()
	hoogte = Math.round(hoogte - $('#splashscreen').height()) / 2 - 20
	$('#splashscreen').css({
		'margin': '0 auto',
		'width': breedte,
		'margin-top': hoogte
	})
	
	$('.chalet .foto').corner()
	
	$('.replace-tags').each(function(){
		var txt = $(this).text()
		$(this).html(txt.replace('Maasduinen','<span class="blauw">Maasduinen</span>'))
	})
	$('#lastminutes').css('min-height','385px')
	if (typeof(affiliate_id) != "undefined") {
		$('li a').each(function(){ 
			href = $(this).attr('href')
			if (href.match('taal=')) {
				$(this).attr('href',href.replace('taal=','affiliate_id='+affiliate_id+'&taal='))
			}
			if (href.match('u=') && !href.match('affiliate_id')) {
				$(this).attr('href',href.replace('u=','affiliate_id='+affiliate_id+'&u='))
			}
		})
	}
})

var parkimpressie = new Array();
parkimpressie[0] = ['/media/upload/fadeshows/parkimpressie/1.jpg','',''];
parkimpressie[1] = ['/media/upload/fadeshows/parkimpressie/2.jpg','',''];
parkimpressie[2] = ['/media/upload/fadeshows/parkimpressie/3.jpg','',''];
parkimpressie[3] = ['/media/upload/fadeshows/parkimpressie/4.jpg','',''];
parkimpressie[4] = ['/media/upload/fadeshows/parkimpressie/5.jpg','',''];