/**
 * Created by IOAN on 11/25/2015.
 */
$(document).ready(function(){

    var click_links = click_count_paths;
    $('.click-link').each(function(){
        var click_link_id = $(this).data('rel');
        var extra_class = $(this).data('extra_class');
        var rel = 'noopener';
        if($(this).data('nofollow') != undefined) {
            rel = rel + ' ' + $(this).data('nofollow');
        }
        var sub_content = '<a href="' + click_links[click_link_id] + '" rel="'+rel+'" class="' + extra_class + '" target="_blank">' + $(this).html() + '<\/a>';
        $(this).replaceWith(sub_content);
    });

    $('.adv_linkage').each(function(){
        var $lnk = $(this);
        $lnk.on('click', function(ev){
            ev.preventDefault();
            window.open($lnk.data('link'));
            return false;
        });
    });

    $('a.mailto').each(function(){
        var email = $(this).data('rel');
        email = email.replace('[ at ]', '@');
        $(this).attr('href', 'mailto:' + email);
        $(this).text(email);
    });

});