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

    var click_links = filter_click_count_paths;
    $('.click-link').each(function(){
        var click_link_id = $(this).data('rel');
        var extra_class = $(this).data('extra_class');
        var sub_content = '<a href="' + click_links[click_link_id] + '" 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();
            var w_name = ($lnk.text()).replace(/\W+/g, '_').toLowerCase();
            window.open($lnk.data('link'), w_name);
            return false;
        });
    });

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

});