var init = function() {	
	$(".definition_highlight").tooltip({ 
		track: true 
	,	delay: 0
	,	showURL: false
	,	opacity: 1
	,	fixPNG: true
	,	showBody: " - "
	,	extraClass: "tooltip" 
	,	top: -200
	,	left: -20
	,	bodyHandler: function() {
//			return 'Titel - Lichaam';
			return Definitions.get($(this).attr("word"));
    	}
	});
	
	$('img').filter(function() {
		return ($(this).attr("src").match(/media\//)) != null;
	}).each( function(index) {
		// make it into a fancybox to the image page
		
		el = $(this);
		src = el.attr('src');
		
		relLoc = src.substr(src.lastIndexOf("media/")+("media/".length));
		scriptLoc = window["base_url"]+"special/media?media_url="+relLoc;
		
//		alert("Image position: "+el.offset().left+";"+el.offset().top);
		
		newEl = $("<a href=\""+scriptLoc+"\"></a>");
		
		el.wrap(newEl).fancybox({
			"type" :		"ajax"
		,	"href" :		scriptLoc
		});
	});
};


// make sure the function is executed once the document is loaded
$(init);
