/* JQUERY FUNCTIONS */
$(document).ready(function() {
	$("a[rel*=fader-gallery]").fancybox({
		fitToView 	: true,
		closeBtn	: false,
		helpers		: { 
			title	: { type : 'inside' },
			buttons	: {}
		}
	});
	$('#fader').bxSlider({
		auto: true,
		prevText: 'Vorige',
		nextText: 'Volgende',
		autoHover: true,
		mode: 'fade'
	});
	$('#tv-fader').bxSlider({
		auto: true,
		controls: false,
		mode: 'fade',
		speed: 1000,
		tickerSpeed: 12000
	});
    $('input.text').click(function() {
		if (this.value == this.defaultValue) {
			this.value = '';
		}
	});
	$('input.text').blur(function() {
		if (this.value == '') {
			this.value = this.defaultValue;
		}
	});
	$('.orderbtn input[type=text]').click(function() {
		this.select();
	});
	$('.orderbtn input[type=text]').keyup(function () { 
	    this.value = this.value.replace(/[^0-9\.]/g,'');
	});
	var $slaps;
	$slaps = 0;
    $('#zoeken button').mouseout(function() {
    	$slaps++;
    	if($slaps == 5)
    		$('#leeg').fadeTo("slow", 0.85);
    	if($slaps == 7)
    		$('#leeg').fadeTo("slow", 0.7);
    	if($slaps == 9)
    		$('#leeg').fadeTo("slow", 0.5);
    	if($slaps == 11)
    		$('#leeg').fadeTo("slow", 0.4);
    	if($slaps == 13)
    		$('#leeg').fadeTo("slow", 0.2);
    	if($slaps == 14) {
    		$('#leeg').fadeTo("slow", 0, function() {
    			$('#leeg').hide();
    	    });
    	}
    	$('#book').fadeTo('slow', 0.5, function() {});
    });
	$('#chkafleveradres').click(function() {
	    $("#afleveradres").toggle(this.checked);
	    $("#afleveradresmelding").toggle(!this.checked);
	});
	$('#chkbedrijf').click(function() {
	    $("#bedrijf").toggle(this.checked);
	});
	$('#footer-nieuwsbrief').submit(function() {
		var strEmail = $('#footer-email').val();
		var regValid = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
		if(!regValid.test(strEmail) || strEmail == 'e-mailadres@zwartecross.nl') {
			alert("Vul een geldig e-mailadres in a.u.b.");
			$('#footer-email').select();
			$('#footer-email').focus();
			return false;
		}
		return true;
	});
});
/* MEDIAPLAYER */
var playerWidth = 110;
if($(window).width() < 1400) {
	playerWidth = 90;
}
jwplayer("player").setup({
	flashplayer: "/public/mediaplayer-5.8/player.swf",
	file: "/public/mp3/zwarte-cross-lied-2011.mp3",
	height: 10,
	width: playerWidth,
	volume: 80,
	controlbar: "bottom",
	skin: '/public/mediaplayer-5.8/skins/zwartecross/zwartecross.zip'
});
/* GOOGLE ANALYTICS */
var _gaq = _gaq || [];
_gaq.push(
  ['_setAccount', 'UA-5018620-11'],
  ['_trackPageview'],
  ['b._setAccount', 'UA-8918453-18'],
  ['b._trackPageview']
);
(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
/* ADDTHIS */
var addthis_share = {
  templates: { twitter: 'check out {{title}} @ {{url}}' } 
}
var addthis_config = {
  data_ga_property: 'UA-5018620-11',
  data_track_clickback: true
};
