// CUFON
Cufon.replace('.din', { fontFamily: 'DINPro-Regular' });
Cufon.replace('.post-entry h2', { fontFamily: 'DINPro-Regular' });
Cufon.replace('.post-entry h3', { fontFamily: 'DINPro-Regular' });
Cufon.replace('.post-entry h4', { fontFamily: 'DINPro-Regular' });
Cufon.replace('#nvl ul li a', { 
	fontFamily: 'DINPro-Regular',
	hover: true, 
	hover: {
		color: '#999'
	}
});
Cufon.replace('#snl ul li a', { 
	fontFamily: 'DINPro-Regular',
	hover: true, 
	hover: {
		color: '#666'
	}
});

// CHECK
function isiPhone(){
    return (
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPad") != -1) ||
        (navigator.platform.indexOf("iPod") != -1)
    );
}

function hideMelding() {
	$('.melding').hide();
}

// JQUERY
$(document).ready(function() 
{

	// HACK for profile
	$('table.form-table:eq(0)').hide();

	$('table.form-table:eq(3) tbody tr:eq(0)').hide();

	$('.editform').hide();
	
	
	// FANCYBOX
	$("a[rel=omgeving]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	// SLIDER
	var active	= false;
	var cs 		= 0;
	var ts 		= $('.slider li').length;
	function changeImageSlide(t) {
		// hide		
		$('.slider li').hide();
		$('.slide-img li').removeClass('current');
		// 
		$('.slider li:eq('+t+')').fadeIn("slow");
		$('.slide-img li:eq('+t+')').addClass('current');
	}
	function checkSlideParam() {
		if(cs<ts-1) {
			cs++;
		} else {
			cs=0;
		}
	}
	function killTimer() {
		if (active) {
			active = !active;
			$('.slider').stopTime('controlled');
		}
	}
	function startSlides() {
		if (!active) {
			active = !active;
			$('.slider').everyTime(5000, 'controlled', function() {
				checkSlideParam();
				changeImageSlide(cs);
			});
		}
	}
	changeImageSlide(0);
	startSlides();
	$('.slide-img li:eq(0)').click(function(){ killTimer(); changeImageSlide(0); });
	$('.slide-img li:eq(1)').click(function(){ killTimer(); changeImageSlide(1); });
	$('.slide-img li:eq(2)').click(function(){ killTimer(); changeImageSlide(2); });
	$('.slide-img li:eq(3)').click(function(){ killTimer(); changeImageSlide(3); });
	$('.slide-img li:eq(4)').click(function(){ killTimer(); changeImageSlide(4); });
	$('.slide-img li:eq(5)').click(function(){ killTimer(); changeImageSlide(5); });
});
