var icons = {};
function selectLink(link) {
   if ( link.length < 1 )
      return;
   var classes = link.attr('class').split(' ');
   for (i = 0; i < classes.length; ++i) {
      if (classes[i].substr(0, 8) == 'preview_') {
         var id = classes[i].substr(8);
         var html_code = 
            "<a href=\"" + link.attr('href') +
            "\" title=\"" + icons[id].title +
            "\"><img src=\"" + icons[id].image.src;
         if (icons[id].width != null) {
            html_code += "\" width=\"" + icons[id].width;
         }
         if (icons[id].height != null) {
            html_code += "\" height=\"" + icons[id].height;
         }
         html_code += "\"/></a>";
         link.parents('.preview_list').find('.preview-icon')
            .html(html_code);
         break;
      }
   }
}

$(function() {
   $('.preview_list .links a').mouseover(function() {
      selectLink($(this));
   });
   $('.preview_list div.cpnt-body div.links').each(
         function (index, domEle) {
            selectLink($('a:first',domEle));
         }
   );
});
