$j(document).ready(function() {

	jQuery('h1[title]').each(function() {
		jQuery(this).attr('title','<div>' + jQuery(this).attr('title') + '</div>');
		});	
	jQuery('h1[title]').tooltip();

	$j('a[href=#beschrijving]:not(#tab_beschrijving)').click(function() {
		var api = $j('ul.tabs').data('tabs');
		api.click('#beschrijving');	
	});

	$j('a[href=#extern]:not(#tab_adviseurs)').click(function() {
		var api = $j('ul.actueel-tabs').data('tabs');
		api.click('#extern');	
	});

	$j('a[href=#intern]:not(#tab_intern)').click(function() {
		var api = $j('ul.actueel-tabs').data('tabs');
		api.click('#intern');	
	});

	
	//$j('h1').tooltip();
	//handle tag clicks
	$j('.clickabletagcloud a').click(function() {
		var rel= $j(this).attr('rel');
		
		var tagnr = rel.split('|')[0].split(':')[1];
		var itemnr = rel.split('|')[1].split(':')[1];
		$j.get('/tagclick.aspx',{tag : tagnr,item : itemnr});
		});
	
	//check for reactions form
	if($j('#schrijf_reactie').length>0) {		
		var api = $j('ul.tabs').data('tabs');
		var tabs = api.getTabs();
		var index = 0;
		
		for(var t=0;t<tabs.length;t++) {
			if(tabs[t].id == 'reacties') {
				index = t;
				}
			}
		//debugger;	
		var pane = api.getPanes()[index];
		//$j(pane).find('div.col1 h3').prepend('<a id="commentbutton" href="#" style="float:left">Plaats reactie</a>');
		$j('<a id="commentbutton"  href="#" style="float:right">Plaats reactie</a>').prependTo($j(pane).find('div.col1 h3')).click(function(evt) {
			var api = $j('ul.tabs').data('tabs');
			var tabs = api.click(0);
			$j(this).attr('href','#schrijf_reactie');
			// evt.preventDefault();
				// return false;	
			});
			
	
		}
		
		
	


$j('.printpage').popupWindow({ 
height:700, 
width:720, 
top:50, 
left:50 
}); 

// thumbnail scrollable
	$j("#kunst_view").scrollable({size: 3, clickable: false}).find("img").each(function(index) {

		// thumbnail images trigger the overlay
		$j(this).overlay({

			effect: 'apple',
			target: '#box',
			mask: { maskId: 'mask' },

			// when box is opened, scroll to correct position (in 0 seconds)
			onLoad: function() {
				$j("#images").data("scrollable").seekTo(index, 0);
			}
		});
	});


// scrollable inside the box.
	$j("#images").scrollable();

	
	// enable tooltips for the images
	$j("#images img").tooltip({
		position: "bottom center",
		offset: [-75, -30],
		opacity: 0.8,
		effect: 'fade',

		// position tooltips relative to the parent scrollable
		relative: true
	});
});

<!-- make all links with the 'rel' attribute open overlays -->
/*
$j(function() {
	$j("#triggers img[rel]").overlay({effect: 'apple'});
});
*/

