$(document).ready(function(){
	Cufon('.nav a.fl', { fontFamily: 'Myriad Pro', hover: { color: '#455560' }});
	Cufon('.nav ul ul a', { fontFamily: 'Myriad Pro', hover: { color: '#d2d2d2' }});
	Cufon('H2,H3', { fontFamily: 'Myriad Pro'});
	Cufon('#scroller', { fontFamily: 'Myriad Pro'});
	Cufon.replace('H1', { fontFamily: 'Trajan Pro' });
	Cufon.replace('.mslider a', { fontFamily: 'Trajan Pro' });
	Cufon.replace('.plist span', { fontFamily: 'Myriad Pro' });
	Shadowbox.init({players:["flv","html"]}); 
	jQuery('#mslider').jcarousel({
		scroll: 1,
		auto: 4, 
		//wrap: 'circular',
		animation: 2000,
		wrap: 'last'
	});

	jQuery('#photo-slider').jcarousel({
		scroll: 1,
		animation: 1000,
		initCallback: mycarousel_initCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null 
	});
	$('#aslide').cycle({ 
		fx:     'fade', 
		slideExpr: 'div.ambassadors',
		timeout: 0, 
		cleartype: true,
		cleartypeNoBg: true,
		next:   '#pleft', 
		prev:   '#pright'	
	});
	$('#banners').cycle({ 
		fx:     'fade', 
		slideExpr: 'div.it',
		timeout: 4000,
		speed: 1000
	});
	$(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'fast',slideshow:10000, hideflash: true});
	$("a[rel^='prettygroup']").prettyPhoto({animation_speed:'fast',slideshow:10000, hideflash: true});
	
	$('a.close').click(function() { 
		$('.over').hide(); 
		$('.overlay').hide();
		window.location = "http://www.emmers.eu/"
		return false;
	});
	//colsScroll();
	//bottomTotal();
});
$(window).load(function() { $('.overlay').height($('body').height()); });

$(window).scroll(function() {
	//colsScroll();
	//bottomTotal();
});

function bottomTotal() {
	var a1 = $(window).scrollTop() + $(window).height();
	var b1 = $('#list').offset().top + $('#list').height();
	var c1 = $('#wrap').offset().top + $('#wrap').height();
	var d1 = 0;
	if (c1 < a1) { d1 = a1 - b1 - (a1 - c1); }
	else { d1 = a1 - b1; }
	if (d1 > 315) { $('#total').css('margin-top', d1 - 315); }
	else { $('#total').css('margin-top', 10); }
}

function colsScroll() {
	if (($('.left-col').height() < $(window).height()) || ($('.right-col').height() < $(window).height())) { 
		var a1 = $(window).scrollTop() + $(window).height();
		var b1 = 0;
		if ($('.left-col').height() > $('.right-col').height()) { b1 = $('.left-col').height(); }
		else { b1 = $('.right-col').height(); }
		var c1 = $('#wrap').height();
		var d1 = 0;
		if (a1 > c1) { d1 = a1 - c1; }
		if (d1 <= 0) { 
			if ($(window).scrollTop() < $('.header').height()) { 
				$('.left-col').css('margin-top', 0);
				$('.right-col').css('margin-top', 0);
			}
			else { 
				$('.left-col').css('margin-top', $(window).scrollTop() - $('.header').height());
				$('.right-col').css('margin-top', $(window).scrollTop() - $('.header').height());
			}
		}
	}
	
}
function mycarousel_initCallback(carousel) {		
	jQuery('#photo-slider .slide-next').bind('click', function() {
		carousel.next();
		return false;
	});
	jQuery('#photo-slider .slide-prev').bind('click', function() {
		carousel.prev();
		return false;
	}); 
}

// begin input validatie (zie jquery[dot]validate[dot]js
jQuery(function(){
	
	                jQuery("#naam").validate({
	                    expression: "if (VAL) return true; else return false;",
	                    message: "* Dit veld is verplicht."
	                });

	
	                jQuery("#adres").validate({
	                    expression: "if (VAL) return true; else return false;",
	                    message: ""
	                });


	                jQuery("#huisnummer").validate({
	                    expression: "if (VAL) return true; else return false;",
	                    message: "* Dit veld is verplicht."
	                });

	
	                jQuery("#postcode").validate({
	                    expression: "if (VAL) return true; else return false;",
	                    message: "* Vul a.u.b. een geldige postcode in."
	                });

	
	                jQuery("#woonplaats").validate({
	                    expression: "if (VAL) return true; else return false;",
	                    message: "* Vul a.u.b. een geldige woonplaats in."
	                });

	                jQuery("#land").validate({
	                    expression: "if (VAL) return true; else return false;",
	                    message: "* Vul a.u.b. een geldig land in."
	                });


	                jQuery("#email").validate({
	                    expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_\\-]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;",
	                    message: "* Vul a.u.b. een geldig mailadres in."
	                });

	                jQuery("#telefoonnummer").validate({
	                    expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
	                    message: "* Dit veld mag alleen cijfers bevatten."
                	});


	                jQuery("#row1").validate({
	                    expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;",
	                    message: "Vul alstublieft een geldig emailadres in."
	                });

	                jQuery("#row2").validate({
	                    expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
	                    message: "Vul alstublieft een geldig telefoonnummer in"
                	});

				});
// einde input validatie

function go_to_categorie(){
	var objSel = document.getElementById("categorie_list");
	MyVal2=(objSel.options[objSel.selectedIndex].value);
	location.replace(MyVal2); 
}

