jQuery.noConflict();

(function ($){

if($.browser.msie && $.browser.version.substring(0,1) === '6'){ // IE... hate it
	jQuery('#navigation > li').hover(
		function(){jQuery(this).addClass('hover');}, 
		function(){jQuery(this).removeClass('hover');}
	)
}


var p = $(".photo"), pl = $(".photo ul > li, #wrapper-photo ul"),  l = $(".logo"), 
	ll = $(".logo ul > li, #wrapper-logo ul"), ff = $("#sName, #sEmail"), ml = $("form#mailinglist");


ml.submit(function(){
		var valid = true, form = jQuery(this);
		form.find('.required').each(function(){
			var r = new RegExp('^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$');
			if(this.value == '' || (this.id == 'sEmail' && !r.test(this.value)) || (this.value == this.defaultValue)){
				this.style.borderColor = 'red';
				valid = false;
			}else{
				this.style.borderColor = '1px solid #A2A2A2';
			}
		});
		if(!valid){
			ml.get(0).scrollIntoView(true);
		}
		return valid;
});



/* Leeg maak functie formulier */
if(ff.get(0)){
ff.focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = "";
	}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
}
	
/* Preventdefault voor scroll knoppen */	
$('ul#externalControl li a, ul#controls li a').click(function(event) {
	event.preventDefault();
});

/* Scrollers */
if(p.get(0)){
	pl.removeClass("hide");

	p.jCarouselLite({
		auto: 6000,
		speed: 500,
		btnGo:[".control1", ".control2",".control3"]
	});
}	
if(l.get(0)){
	ll.removeClass("hide");
	
	l.jCarousel({
		auto: 8000,
		speed: 500,
		btnNext: ".next",
		btnPrev: ".prev"
	});
}	
/* Cufon */
Cufon.replace('.replace, #contents h1, #contents h2, #footer h2, #right h2');
	

} (jQuery));
