jQuery(document).ready(function()
{
//nl
    $('body.nl a[target=_blank]').each(function()
    {
        var oldTitle = $(this).attr('title'); //link title
        var link = $(this).attr('href'); //link destination
        var boodschap = " (link opent in een nieuw venster)";
        var oldHtml = ($(this).html()); //link text
        var newHtml = oldHtml + " <img src='/Sites/main/templates/img/newWindow.jpg' alt='link opent in een nieuw venster' style='border:none; padding:0 !important;' class='windowImage' />";
        if (oldTitle == undefined)
        {
            oldTitle = "";
        }
        if (oldTitle.indexOf("nieuw venster") > -1)
        {
            boodschap = "";
        }
        if (link.indexOf("mailto") > -1)
        {
            boodschap = " (de link wordt geopend in uw mail programma)";
        }
        if (oldHtml.indexOf("<img src") > -1 || link.indexOf("mailto:") > -1)
        {
            newHtml = oldHtml;
        }
        $(this).attr('title', oldTitle + boodschap);
        $(this).html(newHtml);

    }).find('img').each(function()
    {
        var oldAlt = $(this).attr('alt'); //alt text
        var boodschap = " (link opens in new window)";
        if (oldAlt == undefined)
        {
            oldAlt = "";
        }
        if (oldAlt.indexOf("nieuw venster") > -1)
        {
            boodschap = "";
        }
        $(this).attr('alt', oldAlt + boodschap);
    });
    //en
    $('body.en a[target=_blank]').each(function()
    {
        var oldTitle = $(this).attr('title'); //link title
        var link = $(this).attr('href'); //link destination
        var boodschap = " (link opens in new window)";
        var oldHtml = ($(this).html()); //link text
        var newHtml = oldHtml + " <img src='/Sites/main/templates/img/newWindow.jpg' alt='link opens in new window' style='border:none; padding:0 !important;' class='windowImage' />";
        if (oldTitle == undefined)
        {
            oldTitle = "";
        }
        if (oldTitle.indexOf("new window") > -1)
        {
            boodschap = "";
        }
        if (link.indexOf("mailto") > -1)
        {
            boodschap = " (the link opens in your mail programm)";
        }
        if (oldHtml.indexOf("<img src") > -1 || link.indexOf("mailto:") > -1)
        {
            newHtml = oldHtml;
        }
        $(this).attr('title', oldTitle + boodschap);
        $(this).html(newHtml);

    }).find('img').each(function()
    {
        var oldAlt = $(this).attr('alt'); //alt text
        var boodschap = " (link opens in new window)";
        if (oldAlt == undefined)
        {
            oldAlt = "";
        }
        if (oldAlt.indexOf("new window") > -1)
        {
            boodschap = "";
        }
        $(this).attr('alt', oldAlt + boodschap);
    });
    if ($("#accordion"))
    {
        $("#accordion").accordion({
            collapsible: true,
            header: 'h1',
            autoHeight: false,
            active: false
        });
    }
    if (jQuery().colorbox)
    {
        $("a[href$=.gif], a[href$=.png], a[href$=.jpg],a[href$=.GIF], a[href$=.PNG], a[href$=.JPG]").colorbox({ title: false });
    }

});
