$(document).ready(function() {
    // If href is an external link, add target="_blank".
    $("a").each(function(){
        if ($(this).attr('rel') == 'external') {
            $(this).attr('target', '_blank');
        }
    });

    // Replace the original text to "Lees meer..."
    $(".readmore").html("Lees meer...");

    // Convert normal images to div's, in that way they get round corners!
    $('#content img, #banners img').each(function(){
	    //if ($(this).get(0).style.styleFloat == 'right || '$(this).attr('style') == 'float: right;') {
    	if ($(this).hasClass('skip')) {
			return;
		}
		$(this).replaceWith(function() {
			var imgDiv = document.createElement('div');

			// Set width, height and background.
			imgDiv.style.width = $(this).attr('width') + 'px';
			imgDiv.style.height = $(this).attr('height') + 'px';
			imgDiv.style.background = 'url("' + $(this).attr('src') + '") repeat scroll 0% 0% transparent';
			imgDiv.innerText = ' ';
			imgDiv.className = 'image';
			imgDiv.title = $(this).attr('alt');
			return imgDiv;
		});
    });
	/*$('#content img, #banners img').replaceWith(function() {
    	var imgDiv = document.createElement('div');
			// If a float:right is set, set it also on the background image.
			if ($(this).attr('style') == 'float: right;') {
				imgDiv.style.float = 'right';
				imgDiv.style.cssFloat = 'right';
				imgDiv.style.styleFloat = 'right';
			};

return $(this).text();
			// Set width, height and background.
    		imgDiv.style.width = $(this).attr('width') + 'px';
    		imgDiv.style.height = $(this).attr('height') + 'px';
    		imgDiv.style.background = 'url("' + $(this).attr('src') + '") repeat scroll 0% 0% transparent';
    		imgDiv.innerText = ' ';
    		imgDiv.className = 'image';
    		imgDiv.title = $(this).attr('alt');
    	return imgDiv;
	});
	*/

    /*
    // Prefilled input fields.
    $('input.prefilled, textarea.prefilled').each(function(){
		return function() {
			el = $(this);
			el.attr('prefilled', el.val());
			el.focus(function(){
				if (this.value == $(this).attr('prefilled')) {
					this.value = '';
				}
			});
			el.blur(function(){
				if (!this.value) {
					this.value = $(this).attr('prefilled');
				}
			});
		}
	}());
    */
});
