/* This javascript file is build for www.dejong-it.nl
 * @version 2.0 [07-08-2011]
 * @author Jeroen de Jong / deJong-IT
 * http://www.dejong-it.nl
 */

	// Add Google Analytics
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-2582109-5']);
	_gaq.push(['_trackPageview']);

	(function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();


jQuery(function($) {

	// turn caching on
	jQuery.ajaxSetup({ cache: true });


	// Check if we need to resize the pakketten
	if ($('#pakketten').length > 0) {
		$('.pakket h2').css({marginTop:'40px',height:'20px','line-height':'20px'});
		GrowPakket();
	}

	$('img.captionme').each(function(i) {
		var captiontext = $(this).attr('alt');
		$(this).wrap('<div class="imgpost"></div>');
		var style = $(this).attr('style');
		$(this).attr('style',null);
		$(this).parent().append('<div class="thecaption">' + captiontext + '</div>');
		$(this).parent().attr('style',style);
	});

});



function GrowPakket() {
	$("#pakket1 h2").animate({marginTop:'30px',height:'30px','line-height':'30px'}, 600);
	$("#pakket2 h2").animate({marginTop:'20px',height:'40px','line-height':'40px'}, 800);
	$("#pakket3 h2").animate({marginTop:'10px',height:'50px','line-height':'50px'}, 1000);
	$("#pakket4 h2").animate({marginTop:'0px',height:'60px','line-height':'60px'}, 1200);
}


// this is a fix for the jQuery slide effects
function slideToggle(el, bShow){
	var $el = $(el), height = $el.data("originalHeight"), visible = $el.is(":visible");

	// if the bShow isn't present, get the current visibility and reverse it
	if( arguments.length == 1 ) bShow = !visible;

	// if the current visiblilty is the same as the requested state, cancel
	if( bShow == visible ) return false;

	// get the original height
	if( !height ){
		// get original height
		height = $el.show().height();
		// update the height
		$el.data("originalHeight", height);
		// if the element was hidden, hide it again
		if( !visible ) $el.hide().css({height: 0});
	}

	// expand the knowledge (instead of slideDown/Up, use custom animation which applies fix)
	if( bShow ){
		$el.show().animate({height: height}, {duration: 250});
	} else {
		$el.animate({height: 0}, {duration: 250, complete:function (){
			$el.hide();
		}
		});
	}
}

