Cufon.replace('ul.dropdown li a.firstlevel, ul#usps, h3, h4, ul#tabindex, h2, div#headerimage span, h1');

$(document).ready(function(){
	Shadowbox.init({
		troubleElements: []
	});
});


/*jReject
=====================================*/
$(document).ready(function() {
	$.reject({
		reject: { }, // Reject all renderers for demo
		display: ['firefox','chrome','msie'], // Displays only firefox, chrome, and opera
		imagePath: serverpad + 'paques/www/websites/implementatie/paques/script/jreject/'
	});
	return false;
});

$(document).ready(function() {
	$('div#headerimage').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed: 1000,
		timeout: 6000
	});
});

$(function(){
	var	config = {
		sensitivity: 3, //	number = sensitivity threshold (must be	1 or higher)	
		interval: 0,  // number = milliseconds	for	onMouseOver	polling	interval	
		over: doOpen,	 //	function = onMouseOver callback	(REQUIRED)	  
		timeout: 200,	 //	number = milliseconds delay	before onMouseOut	 
		out: doClose	 //	function = onMouseOut callback (REQUIRED)	 
	};
	
	function doOpen() {
		$(this).addClass("hover");
		$('ul:first',this).css('visibility', 'visible');
	}
 
	function doClose() {
		$(this).removeClass("hover");
		$('ul:first',this).css('visibility', 'hidden');
	}

	$("ul.dropdown li").hoverIntent(config);
	
	$("ul.dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");
});

$(function(){
	var maxHeight = 0;
	
	$("div#footer div.column").each(function(){
		if($(this).height() > maxHeight) maxHeight = $(this).height();
	});

	$("div#footer div.column").height(maxHeight);

	/* Tabs */
	$("ul#tabindex li").click(function(){
		$("ul#tabindex li").removeClass("active");
		$("div.tabcontent").removeClass("active");
		$("div.tabcontent." + $(this).attr("class")).addClass("active");
		$(this).addClass("active").parent().removeClass().addClass($(this).attr("class"));
		Cufon.refresh();
	});

	/* Slider */
	if($("ul#slider").length > 0){
		$("ul#slider").jcarousel({
	
		});
		
		$("ul#slider li").each(function(){
			if($(this).find("a.solutionlink").length > 0){
				$(this).find("a").attr("href", $(this).find("a.solutionlink").attr("href"));
				$(this).find("p").remove();
			}
		});
	}

	$("a.cta").each(function(){
		$(this).after("<div class=\"clear\"></div>").prepend("<span></span>");
	});

	$("div#breadcrumbs a:last").css("color", "#bababa");

	$("div.showvideo a").toggle(function(){
		$("div.casevideo").show();
		return false;
	}, function () {
		$("div.casevideo").hide();
		return false;
	});

	$("div.casevideo").hide();
});

/*
 * NoSpam
 */

jQuery.fn.nospam = function(settings) {
	settings = jQuery.extend({
		replaceText: false, 	// optional, accepts true or false
		filterLevel: 'normal' 	// optional, accepts 'low' or 'normal'
	}, settings);
	
	return this.each(function(){
		e = null;
		if(settings.filterLevel == 'low') { // Can be a switch() if more levels added
			if($(this).is('a[rel]')) {
				e = $(this).attr('rel').replace('//', '@').replace(/\//g, '.');
			} else {
				e = $(this).text().replace('//', '@').replace(/\//g, '.');
			}
		} else { // 'normal'
			if($(this).is('a[rel]')) {
				e = $(this).attr('rel').split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			} else {
				e = $(this).text().split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			}
		}
		if(e) {
			if($(this).is('a[rel]')) {
				$(this).attr('href', 'mailto:' + e);
				if(settings.replaceText) {
					$(this).text(e);
				}
			} else {
				$(this).text(e);
			}
		}
	});
};

$('a.email').nospam({
  filterLevel: 'low'
});
