$(document).ready(function(){

	// flash inladen
	// als een div aangemaakt wordt met als class "flash",
	// en als inhoud het absolute pad naar de flash en de variable
	// wordt deze automatisch ingeladen
	$('.flash').each(function(){
		slideshowvars = $(this).find('.flashlink').html();
		slideshowheight = $(this).css('height');
		slideshowwidth = $(this).css('width');
		$(this).html("");
		$(this).flash({
	    	src: slideshowvars,
	    	width: slideshowwidth,
	    	height: slideshowheight,
			wmode: 'transparent',
			allowfullscreen: 'true'
		});
	});

	// links in "_blank" i.p.v. via HTML i.v.m. valid XHTML
	$('.blankwindow').attr('target','_blank');

    $('.submitlink').click(function(){
        $(this).parents('form:first').trigger('submit');
		return false;
	});

    //## colorbox ##
	if (typeof $().colorbox == 'function')
	{

		/**
		 *	-- Gebruik --
		 *	Geef een anchor de class .colorbox en de href de locatie van de afbeelding
		 *	Voor een slideshow:
		 *	Geef meerdere anchor's met .colorbox dezelfde rel="" waarde
		 *	Voorbeeld slideshow:
		 *	<a class="colorbox" rel="testblaat" href="/public/img/video2.jpg">klik</a>
		 *	<a class="colorbox" rel="testblaat" href="/public/img/banner.jpg">klik</a>
		 */
		//set
		$('.colorbox').colorbox({
			transition:'elastic',
			speed:150,
			opacity:0.9
		})

		/**
		* Html tonen in colorbox:
		* <a class="htmlcolorbox" rel="idvanjehtmldiv">Klik</a>
		*/
		$('.htmlcolorbox').click(function(){
			var targetid = $(this).attr('rel');
			if (typeof targetid == 'undefined' || targetid == '') return ;

			$(this).colorbox({
				open: true,
				inline:true,
				transition:'none',
				href:"#" + targetid
			});
		});
	}

});
