function externalLinks() {
	var hostname = window.location.hostname;
	hostname = hostname.replace("www.","").toLowerCase();
	this.check = function(obj){
		var href = obj.href.toLowerCase();
		return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false;				
	}
	this.set = function(obj){
		obj.target = "_blank";
		obj.className += " external";
		obj.title += ' (opent in een nieuw scherm)';
	}
	$('.content a').each(function () {
		if(check(this)) set(this);
	});		
}



function smoothAnchors() {
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
			var h = this.hash;
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 1000, function(){
					document.location.hash = h;
				});
				return false;
			}
		}
	});
}



$(document).ready(function() {
	externalLinks();
	smoothAnchors();
});
