// JavaScript Document


$("document").ready(function(){
    callDefaultFunctions();
})

//Default functions which need to be loaded with a normal and ajax load.
function callDefaultFunctions()
{   
    $('.content IMG:not(.image-left,.image-no-popup,.image-video-oud,.image-video-nieuw)').each(function () {
        alt = $(this).attr('alt');
        src = $(this).attr("src");
        src_ = src.split('_').pop();
        srcExt = src.split('.').pop();
        srcLarge = src.substr(0, (src.length - (src_.length + 1))) + '.' + srcExt;
                
        $(this).replaceWith(
            '<a id="example4" rel="gallery" href="' + srcLarge + '" title="' + alt + '" href="' + srcLarge + '">' +
                '<img src="' + $(this).attr("src") + '" width="135" height="90" border="0" alt="' + alt + '" />' +
            '</a>');
    });

    /* every image with class 'masked' is restyled (can only applied on images of 278 x 182 pixels) */
    $('.content IMG.image-video-oud').each(function () {
        align = $(this).attr('align');
        alt = $(this).attr('alt');
        $(this).replaceWith(
			    '<a id="video-oud" href="#oud" title="Video hoe het er vroeger aan toe ging">' +
				    '<img src="' + $(this).attr("src") + '" width="135" height="90" border="0" alt="' + alt + '" />' +
			    '</a>');
    });

	/* every image with class 'masked' is restyled (can only applied on images of 278 x 182 pixels) */
    $('.content IMG.image-video-nieuw').each(function () {
		align = $(this).attr('align');
		alt = $(this).attr('alt');
		$(this).replaceWith(
			'<a id="video-nieuw" href="#nieuw" title="Video hoe het er tegenwoordig aan toe gaat">' +
				'<img src="' + $(this).attr("src") + '" width="135" height="90" border="0" alt="' + alt + '" />' +
			'</a>');
	});
}
